]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
*** empty log message ***
authorageay <ageay>
Wed, 15 Dec 2010 08:35:59 +0000 (08:35 +0000)
committerageay <ageay>
Wed, 15 Dec 2010 08:35:59 +0000 (08:35 +0000)
src/MEDCoupling/Test/MEDCouplingBasicsTest.hxx
src/MEDCoupling/Test/MEDCouplingBasicsTest2.cxx

index 88de848a4dbcc246264fb59a465c841f55979fa0..5e434fef23929cb950b4ccf3e204b2cb63d3d4b1 100644 (file)
@@ -171,6 +171,7 @@ namespace ParaMEDMEM
     CPPUNIT_TEST( testDaDoubleSelectByTupleIdSafe1 );
     CPPUNIT_TEST( testAreCellsIncludedIn1 );
     CPPUNIT_TEST( testDAIBuildSubstraction1 );
+    CPPUNIT_TEST( testBuildOrthogonalField2 );
     //MEDCouplingBasicsTestInterp.cxx
     CPPUNIT_TEST( test2DInterpP0P0_1 );
     CPPUNIT_TEST( test2DInterpP0P0PL_1 );
@@ -370,6 +371,7 @@ namespace ParaMEDMEM
     void testDaDoubleSelectByTupleIdSafe1();
     void testAreCellsIncludedIn1();
     void testDAIBuildSubstraction1();
+    void testBuildOrthogonalField2();
     //MEDCouplingBasicsTestInterp.cxx
     void test2DInterpP0P0_1();
     void test2DInterpP0P0PL_1();
index 6029b80be6803788f0310faaaad2a8714c7f8359..e9df36e6741c3bd18f43444d0d6801a73410e8c4 100644 (file)
@@ -3981,3 +3981,30 @@ void MEDCouplingBasicsTest::testDAIBuildSubstraction1()
   b->decrRef();
   a->decrRef();
 }
+
+void MEDCouplingBasicsTest::testBuildOrthogonalField2()
+{
+  MEDCouplingUMesh *m=build2DTargetMesh_1();
+  DataArrayInt *d1=DataArrayInt::New();
+  DataArrayInt *d2=DataArrayInt::New();
+  DataArrayInt *d3=DataArrayInt::New();
+  DataArrayInt *d4=DataArrayInt::New();
+  MEDCouplingUMesh *m1=m->buildDescendingConnectivity(d1,d2,d3,d4);
+  //
+  MEDCouplingFieldDouble *f1=m1->buildOrthogonalField();
+  DataArrayDouble *da1=f1->getArray();
+  CPPUNIT_ASSERT_EQUAL(2,da1->getNumberOfComponents());
+  CPPUNIT_ASSERT_EQUAL(13,da1->getNumberOfTuples());
+  //
+  const double expected1[26]={-1.,0.,0.,1.,1.,0.,0.,-1.,0.707106781186548,0.707106781186548,0.,-1.,0.,1.,1.,0.,0.,1.,1.,0.,-1.,0.,0.,1.,1.,0.};
+  for(int i=0;i<26;i++)
+    CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],da1->getIJ(0,i),1e-14);
+  //
+  f1->decrRef();
+  m1->decrRef();
+  d1->decrRef();
+  d2->decrRef();
+  d3->decrRef();
+  d4->decrRef();
+  m->decrRef();
+}