From 8d5d15f6dc8490d1d903ce49ec2469e275ac6bda Mon Sep 17 00:00:00 2001 From: ageay Date: Wed, 15 Dec 2010 08:35:59 +0000 Subject: [PATCH] *** empty log message *** --- .../Test/MEDCouplingBasicsTest.hxx | 2 ++ .../Test/MEDCouplingBasicsTest2.cxx | 27 +++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/src/MEDCoupling/Test/MEDCouplingBasicsTest.hxx b/src/MEDCoupling/Test/MEDCouplingBasicsTest.hxx index 88de848a4..5e434fef2 100644 --- a/src/MEDCoupling/Test/MEDCouplingBasicsTest.hxx +++ b/src/MEDCoupling/Test/MEDCouplingBasicsTest.hxx @@ -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(); diff --git a/src/MEDCoupling/Test/MEDCouplingBasicsTest2.cxx b/src/MEDCoupling/Test/MEDCouplingBasicsTest2.cxx index 6029b80be..e9df36e67 100644 --- a/src/MEDCoupling/Test/MEDCouplingBasicsTest2.cxx +++ b/src/MEDCoupling/Test/MEDCouplingBasicsTest2.cxx @@ -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(); +} -- 2.39.2