From: ageay Date: Mon, 16 Apr 2012 13:26:09 +0000 (+0000) Subject: imp umesh with mdim=1 getValueOnMulti X-Git-Tag: TRIPOLI_323~65 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=9e7aa087a239da1e4e1547959956fc6468267e5d;p=tools%2Fmedcoupling.git imp umesh with mdim=1 getValueOnMulti --- diff --git a/src/MEDCoupling/Test/MEDCouplingBasicsTest5.cxx b/src/MEDCoupling/Test/MEDCouplingBasicsTest5.cxx index a018ea2d6..9c92eebb3 100644 --- a/src/MEDCoupling/Test/MEDCouplingBasicsTest5.cxx +++ b/src/MEDCoupling/Test/MEDCouplingBasicsTest5.cxx @@ -590,3 +590,39 @@ void MEDCouplingBasicsTest5::testDataArrayAbs1() d2->decrRef(); d1->decrRef(); } + +void MEDCouplingBasicsTest5::testGetValueOn3() +{ + const double v[4]={0.,1.,1.5,2.}; + const double v2[5]={0.7,1.25,0.,2.,1.5}; + const double disp[12]={5.,50.,500.,6.,60.,600.,7.,70.,700.,8.,80.,800.}; + MEDCouplingUMesh *m=MEDCouplingUMesh::New("myMesh",1); + const int nbNodes=4; + const int nbCells=nbNodes-1; + m->allocateCells(nbCells); + DataArrayDouble *coords=DataArrayDouble::New(); + coords->alloc(nbNodes,1); + std::copy(v,v+nbNodes,coords->getPointer()); + m->setCoords(coords); + coords->decrRef(); + const int conn[6]={0,1,2,1,2,3}; + m->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,conn); + m->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,conn+2); + m->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,conn+4); + m->finishInsertingCells(); + MEDCouplingFieldDouble *f=MEDCouplingFieldDouble::New(ON_NODES); + f->setMesh(m); + DataArrayDouble *array=DataArrayDouble::New(); + array->alloc(m->getNumberOfNodes(),3); + std::copy(disp,disp+12,array->getPointer()); + f->setArray(array); + array->decrRef(); + DataArrayDouble *arr1=f->getValueOnMulti(v2,5); + CPPUNIT_ASSERT_EQUAL(5,arr1->getNumberOfTuples()); + CPPUNIT_ASSERT_EQUAL(3,arr1->getNumberOfComponents()); + const double expected1[15]={5.7,57.,570.,6.5,65.,650.,5.,50.,500.,8.,80.,800.,7.,70.,700.}; + for(int i=0;i<15;i++) + CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],arr1->getIJ(0,i),1e-14); + f->decrRef(); + m->decrRef(); +} diff --git a/src/MEDCoupling/Test/MEDCouplingBasicsTest5.hxx b/src/MEDCoupling/Test/MEDCouplingBasicsTest5.hxx index 46aa74d84..28b5e4918 100644 --- a/src/MEDCoupling/Test/MEDCouplingBasicsTest5.hxx +++ b/src/MEDCoupling/Test/MEDCouplingBasicsTest5.hxx @@ -57,6 +57,7 @@ namespace ParaMEDMEM void testBuildDescendingConnec2Of3DMesh1(); void testAre2DCellsNotCorrectlyOriented1(); void testDataArrayAbs1(); + void testGetValueOn3(); }; }