X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FMEDCoupling%2FTest%2FMEDCouplingBasicsTest4.cxx;h=8170b70853f8991e257ca0ef80508a0b814dd4c3;hb=ffe6d640bbaae9d66ac15d1015761d047a495ede;hp=c867a699adb7653206cf8228af2e63fd593f0980;hpb=10f37bf6f33a762626d7f1093b2f5450c1688667;p=tools%2Fmedcoupling.git diff --git a/src/MEDCoupling/Test/MEDCouplingBasicsTest4.cxx b/src/MEDCoupling/Test/MEDCouplingBasicsTest4.cxx index c867a699a..8170b7085 100644 --- a/src/MEDCoupling/Test/MEDCouplingBasicsTest4.cxx +++ b/src/MEDCoupling/Test/MEDCouplingBasicsTest4.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2012 CEA/DEN, EDF R&D +// Copyright (C) 2007-2013 CEA/DEN, EDF R&D // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -16,6 +16,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// Author : Anthony Geay (CEA/DEN) #include "MEDCouplingBasicsTest4.hxx" #include "MEDCouplingUMesh.hxx" @@ -397,11 +398,16 @@ void MEDCouplingBasicsTest4::testApplyFuncThree1() void MEDCouplingBasicsTest4::testFillFromAnalyticTwo1() { MEDCouplingUMesh *m1=build3DSurfTargetMesh_1(); + m1->setTime(3.4,5,6); m1->setTimeUnit("us"); + int a,b; CPPUNIT_ASSERT_THROW(m1->fillFromAnalytic2(ON_NODES,1,"y+z"),INTERP_KERNEL::Exception); m1->getCoords()->setInfoOnComponent(0,"x [m]"); m1->getCoords()->setInfoOnComponent(1,"y"); m1->getCoords()->setInfoOnComponent(2,"z"); MEDCouplingFieldDouble *f1=m1->fillFromAnalytic2(ON_NODES,1,"y+z"); + CPPUNIT_ASSERT_DOUBLES_EQUAL(3.4,f1->getTime(a,b),1.e-14); + CPPUNIT_ASSERT_EQUAL(5,a); CPPUNIT_ASSERT_EQUAL(6,b); + CPPUNIT_ASSERT_EQUAL(std::string(f1->getTimeUnit()),std::string("us")); CPPUNIT_ASSERT_EQUAL(1,f1->getNumberOfComponents()); CPPUNIT_ASSERT_EQUAL(9,f1->getNumberOfTuples()); const double expected1[9]={0.2, 0.7, 1.2, 0.7, 1.2, 1.7, 1.2, 1.7, 2.2}; @@ -414,11 +420,16 @@ void MEDCouplingBasicsTest4::testFillFromAnalyticTwo1() void MEDCouplingBasicsTest4::testFillFromAnalyticThree1() { MEDCouplingUMesh *m1=build3DSurfTargetMesh_1(); + m1->setTime(3.4,5,6); m1->setTimeUnit("us"); + int a,b; std::vector vs(3); vs[0]="x"; vs[1]="Y"; vs[2]="z"; CPPUNIT_ASSERT_THROW(m1->fillFromAnalytic3(ON_NODES,1,vs,"y+z"),INTERP_KERNEL::Exception); vs[1]="y"; MEDCouplingFieldDouble *f1=m1->fillFromAnalytic3(ON_NODES,1,vs,"y+z"); + CPPUNIT_ASSERT_DOUBLES_EQUAL(3.4,f1->getTime(a,b),1.e-14); + CPPUNIT_ASSERT_EQUAL(5,a); CPPUNIT_ASSERT_EQUAL(6,b); + CPPUNIT_ASSERT_EQUAL(std::string(f1->getTimeUnit()),std::string("us")); CPPUNIT_ASSERT_EQUAL(1,f1->getNumberOfComponents()); CPPUNIT_ASSERT_EQUAL(9,f1->getNumberOfTuples()); const double expected1[9]={0.2, 0.7, 1.2, 0.7, 1.2, 1.7, 1.2, 1.7, 2.2}; @@ -1518,10 +1529,10 @@ void MEDCouplingBasicsTest4::testGetDistributionOfTypes1() CPPUNIT_ASSERT_EQUAL(6,(int)code.size()); CPPUNIT_ASSERT_EQUAL(3,code[0]); CPPUNIT_ASSERT_EQUAL(2,code[1]); - CPPUNIT_ASSERT_EQUAL(0,code[2]); + CPPUNIT_ASSERT_EQUAL(-1,code[2]); CPPUNIT_ASSERT_EQUAL(4,code[3]); CPPUNIT_ASSERT_EQUAL(3,code[4]); - CPPUNIT_ASSERT_EQUAL(0,code[5]); + CPPUNIT_ASSERT_EQUAL(-1,code[5]); m->decrRef(); } @@ -1588,11 +1599,11 @@ void MEDCouplingBasicsTest4::testFindAndCorrectBadOriented3DExtrudedCells1() m->insertNextCell(INTERP_KERNEL::NORM_HEXA8,8,conn+48); m->finishInsertingCells(); // - std::vector v; - m->findAndCorrectBadOriented3DExtrudedCells(v); - CPPUNIT_ASSERT_EQUAL(4,(int)v.size()); - CPPUNIT_ASSERT(std::equal(v.begin(),v.end(),invalidCells)); + DataArrayInt *v=m->findAndCorrectBadOriented3DExtrudedCells(); + CPPUNIT_ASSERT_EQUAL(4,v->getNumberOfTuples()); + CPPUNIT_ASSERT(std::equal(v->begin(),v->end(),invalidCells)); CPPUNIT_ASSERT(std::equal(connExp,connExp+64,m->getNodalConnectivity()->getConstPointer())); + v->decrRef(); // m->decrRef(); } @@ -1621,20 +1632,18 @@ void MEDCouplingBasicsTest4::testConvertExtrudedPolyhedra1() m->convertExtrudedPolyhedra(); DataArrayInt *da=m->getNodalConnectivity(); DataArrayInt *dai=m->getNodalConnectivityIndex(); - CPPUNIT_ASSERT_EQUAL(10,dai->getNbOfElems()); - CPPUNIT_ASSERT_EQUAL(159,da->getNbOfElems()); - // - const int expected1[159]={14, 1, 2, 3, 4, - 18, 5, 6, 7, 8, 9, 10, 11, 12, - 14, 13, 14, 15, 16, - 31, 17, 18, 19, -1, 20, 22, 21, -1, 17, 18, 21, 20, -1, 18, 19, 22, 21, -1, 19, 17, 20, - 22, - 16, 23, 24, 25, 26, 27, 28, - 31, 29, 30, 31, 32, 33, -1, 34, 38, 37, 36, 35, -1, 29, 30, 35, 34, -1, 30, 31, 36, 35, -1, 31, 32, 37, 36, -1, 32, 33, 38, 37, - -1, 33, 29, 34, 38, - 18, 39, 40, 41, 42, 43, 44, 45, 46, - 22, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, - 31, 59, 60, 61, 62, 63, 64, 65, -1, 66, 72, 71, 70, 69, 68, 67, -1, 59, 60, 67, 66, -1, 60, 61, 68, 67, -1, 61, 62, 69, 68, -1, 62, 63, 70, 69, -1, 63, 64, 71, 70, -1, 64, 65, 72, 71, -1, 65, 59, 66, 72}; + CPPUNIT_ASSERT_EQUAL((std::size_t)10,dai->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL((std::size_t)159,da->getNbOfElems()); + // + const int expected1[159]={14,1,2,3,4, + 18,5,6,7,8,9,10,11,12, + 14,13,14,15,16, + 31,17,18,19,-1,20,22,21,-1,17,20,21,18,-1,18,21,22,19,-1,19,22,20,17, + 16,23,24,25,26,27,28, + 31,29,30,31,32,33,-1,34,38,37,36,35,-1,29,34,35,30,-1,30,35,36,31,-1,31,36,37,32,-1,32,37,38,33,-1,33,38,34,29, + 18,39,40,41,42,43,44,45,46, + 22,47,48,49,50,51,52,53,54,55,56,57,58, + 31,59,60,61,62,63,64,65,-1,66,72,71,70,69,68,67,-1,59,66,67,60,-1,60,67,68,61,-1,61,68,69,62,-1,62,69,70,63,-1,63,70,71,64,-1,64,71,72,65,-1,65,72,66,59}; const int expected2[10]={0,5,14,19,42,49,86,95,108,159}; CPPUNIT_ASSERT(std::equal(expected1,expected1+159,da->getConstPointer())); CPPUNIT_ASSERT(std::equal(expected2,expected2+10,dai->getConstPointer())); @@ -1649,9 +1658,9 @@ void MEDCouplingBasicsTest4::testNonRegressionCopyTinyStrings() MEDCouplingFieldDouble *f1=m->getMeasureField(true); f1->getArray()->setInfoOnComponent(0,"P [N/m^2]"); DataArrayDouble *bary=m->getBarycenterAndOwner(); - MEDCouplingFieldDouble *f2=f1->buildNewTimeReprFromThis(ONE_TIME,false); + MEDCouplingFieldDouble *f2=f1->buildNewTimeReprFromThis(NO_TIME,false); f2->setArray(bary); - CPPUNIT_ASSERT_THROW(f2->copyTinyAttrFrom(f1),INTERP_KERNEL::Exception); + CPPUNIT_ASSERT_THROW(f1->copyTinyAttrFrom(f2),INTERP_KERNEL::Exception); m->decrRef(); f1->decrRef(); bary->decrRef(); @@ -1705,7 +1714,7 @@ void MEDCouplingBasicsTest4::testUMeshMergeMeshesCVW1() MEDCouplingUMesh *m=build3DSurfTargetMesh_1(); MEDCouplingUMesh *m2=MEDCouplingUMesh::New("toto",2); MEDCouplingUMesh *m3=MEDCouplingUMesh::MergeUMeshes(m,m2); - m3->setName(m->getName()); + m3->setName(m->getName().c_str()); CPPUNIT_ASSERT(m->isEqual(m3,1e-12)); m3->decrRef(); m->decrRef(); @@ -1760,8 +1769,8 @@ void MEDCouplingBasicsTest4::testDADFindCommonTuples1() da->findCommonTuples(1e-2,-1,c,cI); const int expected1[3]={0,3,4}; const int expected2[2]={0,3}; - CPPUNIT_ASSERT_EQUAL(3,c->getNbOfElems()); - CPPUNIT_ASSERT_EQUAL(2,cI->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL((std::size_t)3,c->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL((std::size_t)2,cI->getNbOfElems()); CPPUNIT_ASSERT(std::equal(expected1,expected1+3,c->getConstPointer())); CPPUNIT_ASSERT(std::equal(expected2,expected2+2,cI->getConstPointer())); c->decrRef(); @@ -1770,8 +1779,8 @@ void MEDCouplingBasicsTest4::testDADFindCommonTuples1() da->findCommonTuples(2e-1,-1,c,cI); const int expected3[5]={0,3,4,1,2}; const int expected4[3]={0,3,5}; - CPPUNIT_ASSERT_EQUAL(5,c->getNbOfElems()); - CPPUNIT_ASSERT_EQUAL(3,cI->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL((std::size_t)5,c->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL((std::size_t)3,cI->getNbOfElems()); CPPUNIT_ASSERT(std::equal(expected3,expected3+5,c->getConstPointer())); CPPUNIT_ASSERT(std::equal(expected4,expected4+3,cI->getConstPointer())); c->decrRef(); @@ -1781,16 +1790,16 @@ void MEDCouplingBasicsTest4::testDADFindCommonTuples1() const double array2[12]={2.3,2.3,1.2,1.2,1.3,1.3,2.3,2.3,2.301,2.301,0.8,0.8}; std::copy(array2,array2+12,da->getPointer()); da->findCommonTuples(1e-2,-1,c,cI); - CPPUNIT_ASSERT_EQUAL(3,c->getNbOfElems()); - CPPUNIT_ASSERT_EQUAL(2,cI->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL((std::size_t)3,c->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL((std::size_t)2,cI->getNbOfElems()); CPPUNIT_ASSERT(std::equal(expected1,expected1+3,c->getConstPointer())); CPPUNIT_ASSERT(std::equal(expected2,expected2+2,cI->getConstPointer())); c->decrRef(); cI->decrRef(); // da->findCommonTuples(2e-1,-1,c,cI); - CPPUNIT_ASSERT_EQUAL(5,c->getNbOfElems()); - CPPUNIT_ASSERT_EQUAL(3,cI->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL((std::size_t)5,c->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL((std::size_t)3,cI->getNbOfElems()); CPPUNIT_ASSERT(std::equal(expected3,expected3+5,c->getConstPointer())); CPPUNIT_ASSERT(std::equal(expected4,expected4+3,cI->getConstPointer())); c->decrRef(); @@ -1800,16 +1809,16 @@ void MEDCouplingBasicsTest4::testDADFindCommonTuples1() const double array3[18]={2.3,2.3,2.3,1.2,1.2,1.2,1.3,1.3,1.3,2.3,2.3,2.3,2.301,2.301,2.301,0.8,0.8,0.8}; std::copy(array3,array3+18,da->getPointer()); da->findCommonTuples(1e-2,-1,c,cI); - CPPUNIT_ASSERT_EQUAL(3,c->getNbOfElems()); - CPPUNIT_ASSERT_EQUAL(2,cI->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL((std::size_t)3,c->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL((std::size_t)2,cI->getNbOfElems()); CPPUNIT_ASSERT(std::equal(expected1,expected1+3,c->getConstPointer())); CPPUNIT_ASSERT(std::equal(expected2,expected2+2,cI->getConstPointer())); c->decrRef(); cI->decrRef(); // da->findCommonTuples(2e-1,-1,c,cI); - CPPUNIT_ASSERT_EQUAL(5,c->getNbOfElems()); - CPPUNIT_ASSERT_EQUAL(3,cI->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL((std::size_t)5,c->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL((std::size_t)3,cI->getNbOfElems()); CPPUNIT_ASSERT(std::equal(expected3,expected3+5,c->getConstPointer())); CPPUNIT_ASSERT(std::equal(expected4,expected4+3,cI->getConstPointer())); c->decrRef(); @@ -1820,8 +1829,8 @@ void MEDCouplingBasicsTest4::testDADFindCommonTuples1() std::copy(array11,array11+6,da->getPointer()); // nbOftuples=1, no common groups da->findCommonTuples(1e-2,-1,c,cI); - CPPUNIT_ASSERT_EQUAL(0,c->getNbOfElems()); - CPPUNIT_ASSERT_EQUAL(1,cI->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL((std::size_t)0,c->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL((std::size_t)1,cI->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(0,cI->getIJ(0,0)); da->alloc(6,4); //bad NumberOfComponents @@ -1866,14 +1875,14 @@ void MEDCouplingBasicsTest4::testDADGetDifferentValues1() // const double expected1[4]={2.301,1.2,1.3,0.8}; DataArrayDouble *dv=da->getDifferentValues(1e-2); - CPPUNIT_ASSERT_EQUAL(4,dv->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL((std::size_t)4,dv->getNbOfElems()); for(int i=0;i<4;i++) CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],dv->getIJ(i,0),1e-14); dv->decrRef(); // dv=da->getDifferentValues(2e-1); const double expected2[3]={2.301,1.3,0.8}; - CPPUNIT_ASSERT_EQUAL(3,dv->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL((std::size_t)3,dv->getNbOfElems()); for(int i=0;i<3;i++) CPPUNIT_ASSERT_DOUBLES_EQUAL(expected2[i],dv->getIJ(i,0),1e-14); dv->decrRef(); @@ -1891,12 +1900,13 @@ void MEDCouplingBasicsTest4::testDAIBuildOld2NewArrayFromSurjectiveFormat2() b->alloc(3,1); std::copy(arrI,arrI+3,b->getPointer()); int newNbTuple=-1; - DataArrayInt *ret=DataArrayInt::BuildOld2NewArrayFromSurjectiveFormat2(10,a,b,newNbTuple); + DataArrayInt *ret=DataArrayInt::BuildOld2NewArrayFromSurjectiveFormat2(10,a->begin(),b->begin(),b->end(),newNbTuple); const int expected[10]={0,1,2,0,3,4,5,4,6,4}; - CPPUNIT_ASSERT_EQUAL(10,ret->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL((std::size_t)10,ret->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(7,newNbTuple); CPPUNIT_ASSERT_EQUAL(1,ret->getNumberOfComponents()); CPPUNIT_ASSERT(std::equal(expected,expected+10,ret->getConstPointer())); + CPPUNIT_ASSERT_THROW(DataArrayInt::BuildOld2NewArrayFromSurjectiveFormat2(9,a->begin(),b->begin(),b->end(),newNbTuple),INTERP_KERNEL::Exception); ret->decrRef(); b->decrRef(); a->decrRef(); @@ -1944,10 +1954,10 @@ void MEDCouplingBasicsTest4::testGetNodeIdsInUse1() DataArrayInt *arr=m1->getNodeIdsInUse(newNbOfNodes); const int expected[9]={-1,0,1,-1,2,3,-1,-1,-1}; CPPUNIT_ASSERT_EQUAL(4,newNbOfNodes); - CPPUNIT_ASSERT_EQUAL(9,arr->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL((std::size_t)9,arr->getNbOfElems()); CPPUNIT_ASSERT(std::equal(expected,expected+9,arr->getConstPointer())); DataArrayInt *arr2=arr->invertArrayO2N2N2O(newNbOfNodes); - CPPUNIT_ASSERT_EQUAL(4,arr2->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL((std::size_t)4,arr2->getNbOfElems()); const int expected2[4]={1,2,4,5}; CPPUNIT_ASSERT(std::equal(expected2,expected2+4,arr2->getConstPointer())); arr2->decrRef(); @@ -1968,10 +1978,10 @@ void MEDCouplingBasicsTest4::testBuildDescendingConnec2() mesh2->checkCoherency(); CPPUNIT_ASSERT_EQUAL(1,mesh2->getMeshDimension()); CPPUNIT_ASSERT_EQUAL(13,mesh2->getNumberOfCells()); - CPPUNIT_ASSERT_EQUAL(14,revDescIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(14,revDescIndx->getNumberOfTuples()); - CPPUNIT_ASSERT_EQUAL(6,descIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(6,descIndx->getNumberOfTuples()); - CPPUNIT_ASSERT_EQUAL(18,desc->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(18,desc->getNumberOfTuples()); - CPPUNIT_ASSERT_EQUAL(18,revDesc->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(18,revDesc->getNumberOfTuples()); + CPPUNIT_ASSERT_EQUAL((std::size_t)14,revDescIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(14,revDescIndx->getNumberOfTuples()); + CPPUNIT_ASSERT_EQUAL((std::size_t)6,descIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(6,descIndx->getNumberOfTuples()); + CPPUNIT_ASSERT_EQUAL((std::size_t)18,desc->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(18,desc->getNumberOfTuples()); + CPPUNIT_ASSERT_EQUAL((std::size_t)18,revDesc->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(18,revDesc->getNumberOfTuples()); const int expected1[18]={1,2,3,4,-3,5,6, 7,8,-5,9,10,-2,11, 12,13,-7,-10}; CPPUNIT_ASSERT(std::equal(expected1,expected1+18,desc->getConstPointer())); const int expected2[6]={0,4,7,10,14,18}; @@ -2019,22 +2029,22 @@ void MEDCouplingBasicsTest4::testIntersect2DMeshesTmp1() // End of construction of input meshes m1bis and m2 -> start of specific part of the test DataArrayInt *d1=0,*d2=0; MEDCouplingUMesh *m3=MEDCouplingUMesh::Intersect2DMeshes(m1bis,m2,1e-10,d1,d2); - const int expected1[5]={0,1,1,2,2}; - const int expected2[5]={0,0,1,1,2}; - CPPUNIT_ASSERT_EQUAL(5,d1->getNumberOfTuples()); - CPPUNIT_ASSERT_EQUAL(5,d2->getNumberOfTuples()); - CPPUNIT_ASSERT_EQUAL(5,m3->getNumberOfCells()); + const int expected1[8]={0,0,1,1,1,2,2,2}; + const int expected2[8]={0,-1,0,1,-1,1,2,-1}; + CPPUNIT_ASSERT_EQUAL(8,d1->getNumberOfTuples()); + CPPUNIT_ASSERT_EQUAL(8,d2->getNumberOfTuples()); + CPPUNIT_ASSERT_EQUAL(8,m3->getNumberOfCells()); CPPUNIT_ASSERT_EQUAL(22,m3->getNumberOfNodes()); CPPUNIT_ASSERT_EQUAL(2,m3->getSpaceDimension()); - CPPUNIT_ASSERT(std::equal(expected1,expected1+5,d1->getConstPointer())); - CPPUNIT_ASSERT(std::equal(expected2,expected2+5,d2->getConstPointer())); - const int expected3[25]={5,17,1,16,12,5,18,1,17,13,5,19,2,18,13,5,20,2,19,14,5,21,3,20,14}; - const int expected4[6]={0,5,10,15,20,25}; + CPPUNIT_ASSERT(std::equal(expected1,expected1+8,d1->getConstPointer())); + CPPUNIT_ASSERT(std::equal(expected2,expected2+8,d2->getConstPointer())); + const int expected3[44]={5,17,1,16,12,5,16,0,4,5,17,12,5,18,1,17,13,5,19,2,18,13,5,17,5,6,19,13,5,20,2,19,14,5,21,3,20,14,5,19,6,7,21,14}; + const int expected4[9]={0,5,12,17,22,28,33,38,44}; const double expected5[44]={-1.0,2.0,1.0,2.0,2.0,2.0,4.0,2.0,-1.0,4.0,1.0,4.0,2.0,4.0,4.0,4.0,-0.5,-1.5,1.5,-1.5,2.5,-1.5,4.5,-1.5,-0.5,2.5,1.5,2.5,2.5,2.5,4.5,2.5,-0.5,2.0,1.0,2.5,1.5,2.0,2.0,2.5,2.5,2.0,4.0,2.5}; - CPPUNIT_ASSERT_EQUAL(25,m3->getNodalConnectivity()->getNumberOfTuples()); - CPPUNIT_ASSERT_EQUAL(6,m3->getNodalConnectivityIndex()->getNumberOfTuples()); - CPPUNIT_ASSERT(std::equal(expected3,expected3+25,m3->getNodalConnectivity()->getConstPointer())); - CPPUNIT_ASSERT(std::equal(expected4,expected4+6,m3->getNodalConnectivityIndex()->getConstPointer())); + CPPUNIT_ASSERT_EQUAL(44,m3->getNodalConnectivity()->getNumberOfTuples()); + CPPUNIT_ASSERT_EQUAL(9,m3->getNodalConnectivityIndex()->getNumberOfTuples()); + CPPUNIT_ASSERT(std::equal(expected3,expected3+44,m3->getNodalConnectivity()->getConstPointer())); + CPPUNIT_ASSERT(std::equal(expected4,expected4+9,m3->getNodalConnectivityIndex()->getConstPointer())); for(int i=0;i<44;i++) CPPUNIT_ASSERT_DOUBLES_EQUAL(expected5[i],m3->getCoords()->getIJ(0,i),1e-12); d1->decrRef(); @@ -2186,23 +2196,23 @@ void MEDCouplingBasicsTest4::testIntersect2DMeshesTmp3() DataArrayInt *d1=0,*d2=0; MEDCouplingUMesh *m3=MEDCouplingUMesh::Intersect2DMeshes(m1,m2,1e-10,d1,d2); m3->unPolyze(); - const int expected1[12]={0,1,1,2,3,3,4,5,5,6,7,7}; - const int expected2[12]={0,0,1,2,2,3,4,4,5,6,6,7}; - CPPUNIT_ASSERT_EQUAL(12,d1->getNumberOfTuples()); - CPPUNIT_ASSERT_EQUAL(12,d2->getNumberOfTuples()); - CPPUNIT_ASSERT_EQUAL(12,m3->getNumberOfCells()); - CPPUNIT_ASSERT_EQUAL(88,m3->getNumberOfNodes()); + const int expected1[16]={0,1,1,1,2,3,3,3,4,5,5,5,6,7,7,7}; + const int expected2[16]={0,0,1,-1,2,2,3,-1,4,4,5,-1,6,6,7,-1}; + CPPUNIT_ASSERT_EQUAL(16,d1->getNumberOfTuples()); + CPPUNIT_ASSERT_EQUAL(16,d2->getNumberOfTuples()); + CPPUNIT_ASSERT_EQUAL(16,m3->getNumberOfCells()); + CPPUNIT_ASSERT_EQUAL(104,m3->getNumberOfNodes()); CPPUNIT_ASSERT_EQUAL(2,m3->getSpaceDimension()); - CPPUNIT_ASSERT(std::equal(expected1,expected1+12,d1->getConstPointer())); - CPPUNIT_ASSERT(std::equal(expected2,expected2+12,d2->getConstPointer())); - const int expected3[100]={6,28,1,25,44,45,46,8,26,1,28,27,47,48,49,50,8,40,2,26,27,51,52,53,54,6,28,25,5,55,56,57,8,28,5,32,31,58,59,60,61,8,32,6,41,31,62,63,64,65,6,25,37,5,66,67,68,8,32,5,37,36,69,70,71,72,8,42,6,32,36,73,74,75,76,6,1,37,25,77,78,79,8,37,1,26,38,80,81,82,83,8,26,2,43,38,84,85,86,87}; - const int expected4[13]={0,7,16,25,32,41,50,57,66,75,82,91,100}; - const double expected5[176]={0.,0.,1.,0.,1.5,0.,0.,1.,0.,1.5,-1.,0.,-1.5,0.,0.,-1.,0.,-1.5,0.5,0.,1.25,0.,0.7071067811865476,0.7071067811865476,1.0606601717798214,1.0606601717798214,0.,0.5,0.,1.25,-0.7071067811865476,0.7071067811865476,-1.0606601717798214,1.0606601717798214,-0.5,0.,-1.25,0.,-0.7071067811865476,-0.7071067811865476,-1.0606601717798214,-1.0606601717798214,0.,-0.5,0.,-1.25,0.7071067811865476,-0.7071067811865476,1.0606601717798214,-1.0606601717798214,0.,0.,1.1,0.,1.1,1.,0.,1.,1.7,0.,1.7,1.,-1.1,1.,-1.1,0.,-1.7,0.,-1.7,1.,-1.7,-1.,-1.1,-1.,0.,-1.,1.1,-1.,1.7,-1.,1.118033988749895,1.,-1.118033988749895,1.,-1.118033988749895,-1.,1.118033988749895,-1.,0.7071067811865477,0.7071067811865476,0.5,0.,0.,0.5,1.05,0.,0.7071067811865475,0.7071067811865477,0.55,1.,1.1,0.5,1.4012585384440737,0.535233134659635,1.3,0.,1.1,0.5,1.1090169943749475,1.,0.,0.5,-0.5,0.,-0.7071067811865477,0.7071067811865476,-0.7071067811865475,0.7071067811865477,-1.05,0.,-1.1,0.5,-0.55,1.,-1.3,0.,-1.4012585384440737,0.5352331346596344,-1.1090169943749475,1.,-1.1,0.5,0.,-0.5,-0.7071067811865475,-0.7071067811865477,-0.5,0.,-1.05,0.,-0.7071067811865478,-0.7071067811865475,-0.55,-1.,-1.1,-0.5,-1.4012585384440732,-0.5352331346596354,-1.3,0.,-1.1,-0.5,-1.1090169943749475,-1.,0.7071067811865475,-0.7071067811865477,0.,-0.5,0.5,0.,0.7071067811865477,-0.7071067811865475,1.05,0.,1.1,-0.5,0.55,-1.,1.3,0.,1.4012585384440737,-0.535233134659635,1.1090169943749475,-1.,1.1,-0.5}; - CPPUNIT_ASSERT_EQUAL(100,m3->getNodalConnectivity()->getNumberOfTuples()); - CPPUNIT_ASSERT_EQUAL(13,m3->getNodalConnectivityIndex()->getNumberOfTuples()); - CPPUNIT_ASSERT(std::equal(expected3,expected3+100,m3->getNodalConnectivity()->getConstPointer())); - CPPUNIT_ASSERT(std::equal(expected4,expected4+13,m3->getNodalConnectivityIndex()->getConstPointer())); - for(int i=0;i<176;i++) + CPPUNIT_ASSERT(std::equal(expected1,expected1+16,d1->getConstPointer())); + CPPUNIT_ASSERT(std::equal(expected2,expected2+16,d2->getConstPointer())); + const int expected3[136]={6,28,1,25,44,45,46,8,26,1,28,27,47,48,49,50,8,40,2,26,27,51,52,53,54,8,28,4,40,27,55,56,57,58,6,28,25,5,59,60,61,8,28,5,32,31,62,63,64,65,8,32,6,41,31,66,67,68,69,8,41,4,28,31,70,71,72,73,6,25,37,5,74,75,76,8,32,5,37,36,77,78,79,80,8,42,6,32,36,81,82,83,84,8,37,8,42,36,85,86,87,88,6,1,37,25,89,90,91,8,37,1,26,38,92,93,94,95,8,26,2,43,38,96,97,98,99,8,43,8,37,38,100,101,102,103}; + const int expected4[17]={0,7,16,25,34,41,50,59,68,75,84,93,102,109,118,127,136}; + const double expected5[208]={0.,0.,1.,0.,1.5,0.,0.,1.,0.,1.5,-1.,0.,-1.5,0.,0.,-1.,0.,-1.5,0.5,0.,1.25,0.,0.7071067811865476,0.7071067811865476,1.0606601717798214,1.0606601717798214,0.,0.5,0.,1.25,-0.7071067811865476,0.7071067811865476,-1.0606601717798214,1.0606601717798214,-0.5,0.,-1.25,0.,-0.7071067811865476,-0.7071067811865476,-1.0606601717798214,-1.0606601717798214,0.,-0.5,0.,-1.25,0.7071067811865476,-0.7071067811865476,1.0606601717798214,-1.0606601717798214,0.,0.,1.1,0.,1.1,1.,0.,1.,1.7,0.,1.7,1.,-1.1,1.,-1.1,0.,-1.7,0.,-1.7,1.,-1.7,-1.,-1.1,-1.,0.,-1.,1.1,-1.,1.7,-1.,1.118033988749895,1.,-1.118033988749895,1.,-1.118033988749895,-1.,1.118033988749895,-1.,0.7071067811865477,0.7071067811865476,0.5,0.,0.,0.5,1.05,0.,0.7071067811865475,0.7071067811865477,0.55,1.,1.1,0.5,1.4012585384440737,0.535233134659635,1.3,0.,1.1,0.5,1.1090169943749475,1.,0.,1.25,0.6123724356957946,1.369306393762915,1.1090169943749475,1.,0.55,1.,0.,0.5,-0.5,0.,-0.7071067811865477,0.7071067811865476,-0.7071067811865475,0.7071067811865477,-1.05,0.,-1.1,0.5,-0.55,1.,-1.3,0.,-1.4012585384440737,0.5352331346596344,-1.1090169943749475,1.,-1.1,0.5,-0.6123724356957941,1.3693063937629155,0.,1.25,-0.55,1.,-1.1090169943749475,1.,0.,-0.5,-0.7071067811865475,-0.7071067811865477,-0.5,0.,-1.05,0.,-0.7071067811865478,-0.7071067811865475,-0.55,-1.,-1.1,-0.5,-1.4012585384440734,-0.5352331346596354,-1.3,0.,-1.1,-0.5,-1.1090169943749475,-1.,0.,-1.25,-0.6123724356957945,-1.369306393762915,-1.1090169943749475,-1.,-0.55,-1.,0.7071067811865475,-0.7071067811865477,0.,-0.5,0.5,0.,0.7071067811865477,-0.7071067811865475,1.05,0.,1.1,-0.5,0.55,-1.,1.3,0.,1.4012585384440737,-0.535233134659635,1.1090169943749475,-1.,1.1,-0.5,0.6123724356957946,-1.369306393762915,0.,-1.25,0.55,-1.,1.1090169943749475,-1.0}; + CPPUNIT_ASSERT_EQUAL(136,m3->getNodalConnectivity()->getNumberOfTuples()); + CPPUNIT_ASSERT_EQUAL(17,m3->getNodalConnectivityIndex()->getNumberOfTuples()); + CPPUNIT_ASSERT(std::equal(expected3,expected3+136,m3->getNodalConnectivity()->getConstPointer())); + CPPUNIT_ASSERT(std::equal(expected4,expected4+17,m3->getNodalConnectivityIndex()->getConstPointer())); + for(int i=0;i<208;i++) CPPUNIT_ASSERT_DOUBLES_EQUAL(expected5[i],m3->getCoords()->getIJ(0,i),1e-12); d1->decrRef(); d2->decrRef();