}
}
+bool QuadraticPolygon::isButterflyAbs()
+{
+ INTERP_KERNEL::Bounds b;
+ double xBary,yBary;
+ b.prepareForAggregation();
+ fillBounds(b);
+ double dimChar=b.getCaracteristicDim();
+ b.getBarycenter(xBary,yBary);
+ applyGlobalSimilarity(xBary,yBary,dimChar);
+ //
+ return isButterfly();
+}
+
bool QuadraticPolygon::isButterfly() const
{
for(std::list<ElementaryEdge *>::const_iterator it=_sub_edges.begin();it!=_sub_edges.end();it++)
~QuadraticPolygon();
void closeMe() const;
void circularPermute();
+ bool isButterflyAbs();
bool isButterfly() const;
void dumpInXfigFile(const char *fileName) const;
void dumpInXfigFileWithOther(const ComposedEdge& other, const char *fileName) const;
d2->decrRef();
m->decrRef();
}
+
+void MEDCouplingBasicsTest5::testCheckButterflyCellsBug1()
+{
+ double mesh2DCoords[10]={323.85,120.983748908684,317.5,131.982271536747,336.55,120.983748908686,330.2,131.982271536751,323.85,142.98079416481};
+ int mesh2DConn[5]={4,1,0,2,3};
+ MEDCouplingUMesh *mesh2D=MEDCouplingUMesh::New("mesh",2);
+ mesh2D->allocateCells(1);
+ mesh2D->insertNextCell(INTERP_KERNEL::NORM_POLYGON,5,mesh2DConn);
+ mesh2D->finishInsertingCells();
+ DataArrayDouble *myCoords=DataArrayDouble::New();
+ myCoords->alloc(5,2);
+ std::copy(mesh2DCoords,mesh2DCoords+10,myCoords->getPointer());
+ mesh2D->setCoords(myCoords);
+ myCoords->decrRef();
+ mesh2D->checkCoherency();
+ //
+ mesh2D->writeVTK("pupu.vtu");
+ std::vector<int> v;
+ mesh2D->checkButterflyCells(v);
+ CPPUNIT_ASSERT_EQUAL(0,(int)v.size());
+ //
+ mesh2D->decrRef();
+}
CPPUNIT_TEST( testGetNodeIdsOfCell2 );
CPPUNIT_TEST( testRenumberNodesInConn1 );
CPPUNIT_TEST( testComputeNeighborsOfCells1 );
+ CPPUNIT_TEST( testCheckButterflyCellsBug1 );
CPPUNIT_TEST_SUITE_END();
public:
void testUMeshTessellate2D1();
void testGetNodeIdsOfCell2();
void testRenumberNodesInConn1();
void testComputeNeighborsOfCells1();
+ void testCheckButterflyCellsBug1();
};
}
PyList_SetItem(res,2,SWIG_From_int(ret2));
return res;
}
- PyObject *checkButterflyCells() throw(INTERP_KERNEL::Exception)
+ PyObject *checkButterflyCells(double eps=1e-12) throw(INTERP_KERNEL::Exception)
{
std::vector<int> cells;
- self->checkButterflyCells(cells);
+ self->checkButterflyCells(cells,eps);
DataArrayInt *ret=DataArrayInt::New();
ret->alloc((int)cells.size(),1);
std::copy(cells.begin(),cells.end(),ret->getPointer());
self.assertEqual(expected2,d1.getValues());
pass
+ def testCheckButterflyCellsBug1(self):
+ mesh2DCoords=[323.85,120.983748908684,317.5,131.982271536747,336.55,120.983748908686,330.2,131.982271536751,323.85,142.98079416481]
+ mesh2DConn=[4,1,0,2,3]
+ mesh2D=MEDCouplingUMesh.New("mesh",2);
+ mesh2D.allocateCells(1);
+ mesh2D.insertNextCell(NORM_POLYGON,5,mesh2DConn[0:5])
+ mesh2D.finishInsertingCells();
+ myCoords=DataArrayDouble.New(mesh2DCoords,5,2);
+ mesh2D.setCoords(myCoords);
+ mesh2D.checkCoherency();
+ #
+ v=mesh2D.checkButterflyCells();
+ self.assertTrue(v.empty());
+ pass
+
def setUp(self):
pass
pass