]> SALOME platform Git repositories - modules/med.git/commitdiff
Salome HOME
Bug fix - are2DCellsCorrectlyOriented - added C++ tests as well (valgrind 0) abn/fix_orient
authorAdrien Bruneton <adrien.bruneton@cea.fr>
Tue, 18 Feb 2014 10:33:22 +0000 (11:33 +0100)
committerAdrien Bruneton <adrien.bruneton@cea.fr>
Tue, 18 Feb 2014 10:33:22 +0000 (11:33 +0100)
src/MEDCoupling/Test/MEDCouplingBasicsTest2.cxx
src/MEDCoupling/Test/MEDCouplingBasicsTest2.hxx

index 79b232f4a5c71ceacbb2a695ac94f3d06edec272..365cea85a79f34da9a192de56da14c5baaee8498 100644 (file)
@@ -261,6 +261,38 @@ void MEDCouplingBasicsTest2::testCellOrientation2()
   m2->decrRef();
 }
 
+void MEDCouplingBasicsTest2::testCellOrientation3()
+{
+  MEDCouplingUMesh *m = MEDCouplingUMesh::New("circle", 2);
+
+  double coords[8]={ 0.,0.,  0.,0.,  0.,0., 0.,0.};
+  coords[0] = cos(-M_PI/4.0); coords[1] = sin(-M_PI/4.0);
+  coords[2] = cos(3*M_PI/4.0); coords[3] = sin(3*M_PI/4.0);
+  coords[4] = cos(5*M_PI/4.0); coords[5] = sin(5*M_PI/4.0);
+  coords[6] = cos(M_PI/4.0); coords[7] = sin(M_PI/4.0);
+
+  int conn[4]= { 0,1,2,3 };
+  double vec[3]={0.,0.,-1.};
+  m->allocateCells(1);
+  m->insertNextCell(INTERP_KERNEL::NORM_QPOLYG,4,conn);
+  m->finishInsertingCells();
+  DataArrayDouble *myCoords=DataArrayDouble::New();
+  myCoords->alloc(4,2);
+  std::copy(coords,coords+8,myCoords->getPointer());
+  m->setCoords(myCoords);
+  myCoords->decrRef();
+  m->changeSpaceDimension(3);
+
+  std::vector<int> res1;
+  m->are2DCellsNotCorrectlyOriented(vec,false,res1);
+  CPPUNIT_ASSERT(res1.empty());
+  vec[2] = 1.0;
+  res1.clear();
+  m->are2DCellsNotCorrectlyOriented(vec,false,res1);
+  CPPUNIT_ASSERT_EQUAL(1,(int)res1.size());
+  m->decrRef();
+}
+
 /*!
  * This test check polyhedron true barycenter computation. 
  */
index 2ca46e68817ce9e13d51cad703d4cc81ffd68db7..5247e3c6b4d38762ca16fe8ca154b103c8214ad2 100644 (file)
@@ -40,6 +40,7 @@ namespace ParaMEDMEM
     CPPUNIT_TEST( testGaussPointNEField1 );
     CPPUNIT_TEST( testCellOrientation1 );
     CPPUNIT_TEST( testCellOrientation2 );
+    CPPUNIT_TEST( testCellOrientation3 );
     CPPUNIT_TEST( testPolyhedronBarycenter );
     CPPUNIT_TEST( testNormL12Integ1D );
     CPPUNIT_TEST( testAreaBary2D );
@@ -83,6 +84,7 @@ namespace ParaMEDMEM
     void testGaussPointNEField1();
     void testCellOrientation1();
     void testCellOrientation2();
+    void testCellOrientation3();
     void testPolyhedronBarycenter();
     void testNormL12Integ1D();
     void testAreaBary2D();