X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FMEDCoupling%2FTest%2FMEDCouplingBasicsTest1.cxx;h=9808e0205d113042f28bc8745a07d098741c4fc9;hb=ffe6d640bbaae9d66ac15d1015761d047a495ede;hp=2832db0c02644c6edd4ef5aeebfea151cb5d96d9;hpb=f1a947b32a36d8dc8e3079b25305bb50e8cb59a0;p=tools%2Fmedcoupling.git diff --git a/src/MEDCoupling/Test/MEDCouplingBasicsTest1.cxx b/src/MEDCoupling/Test/MEDCouplingBasicsTest1.cxx index 2832db0c0..9808e0205 100644 --- a/src/MEDCoupling/Test/MEDCouplingBasicsTest1.cxx +++ b/src/MEDCoupling/Test/MEDCouplingBasicsTest1.cxx @@ -139,7 +139,21 @@ void MEDCouplingBasicsTest1::testMesh() int tab4[4*nbOfCells]={ 1, 2, 8, 7, 2, 3, 9, 8, 3, 4, 10, 9, 4, 5, 11, 10, 5, 0, 6, 11, 0, 1, 7, 6, }; - + CPPUNIT_ASSERT_EQUAL(MEDCouplingMesh::GetNumberOfNodesOfGeometricType(INTERP_KERNEL::NORM_TRI3),3); + CPPUNIT_ASSERT(MEDCouplingMesh::IsStaticGeometricType(INTERP_KERNEL::NORM_TRI3)); + CPPUNIT_ASSERT(MEDCouplingMesh::IsLinearGeometricType(INTERP_KERNEL::NORM_TRI3)); + CPPUNIT_ASSERT_EQUAL(MEDCouplingMesh::GetDimensionOfGeometricType(INTERP_KERNEL::NORM_TRI3),2); + CPPUNIT_ASSERT_EQUAL(std::string(MEDCouplingMesh::GetReprOfGeometricType(INTERP_KERNEL::NORM_TRI3)),std::string("NORM_TRI3")); + CPPUNIT_ASSERT_THROW(MEDCouplingMesh::GetNumberOfNodesOfGeometricType(INTERP_KERNEL::NORM_POLYGON),INTERP_KERNEL::Exception); + CPPUNIT_ASSERT(!MEDCouplingMesh::IsStaticGeometricType(INTERP_KERNEL::NORM_POLYGON)); + CPPUNIT_ASSERT(MEDCouplingMesh::IsLinearGeometricType(INTERP_KERNEL::NORM_POLYGON)); + CPPUNIT_ASSERT_EQUAL(MEDCouplingMesh::GetDimensionOfGeometricType(INTERP_KERNEL::NORM_POLYGON),2); + CPPUNIT_ASSERT_EQUAL(std::string(MEDCouplingMesh::GetReprOfGeometricType(INTERP_KERNEL::NORM_POLYGON)),std::string("NORM_POLYGON")); + CPPUNIT_ASSERT_EQUAL(MEDCouplingMesh::GetNumberOfNodesOfGeometricType(INTERP_KERNEL::NORM_TRI6),6); + CPPUNIT_ASSERT(MEDCouplingMesh::IsStaticGeometricType(INTERP_KERNEL::NORM_TRI6)); + CPPUNIT_ASSERT(!MEDCouplingMesh::IsLinearGeometricType(INTERP_KERNEL::NORM_TRI6)); + CPPUNIT_ASSERT_EQUAL(MEDCouplingMesh::GetDimensionOfGeometricType(INTERP_KERNEL::NORM_TRI6),2); + CPPUNIT_ASSERT_EQUAL(std::string(MEDCouplingMesh::GetReprOfGeometricType(INTERP_KERNEL::NORM_TRI6)),std::string("NORM_TRI6")); MEDCouplingUMesh *mesh=MEDCouplingUMesh::New(); mesh->setMeshDimension(2); mesh->allocateCells(8); @@ -1332,15 +1346,15 @@ void MEDCouplingBasicsTest1::testMergeMeshOnSameCoords1() CPPUNIT_ASSERT_EQUAL(15,m4->getNumberOfCells()); const int cells1[5]={0,1,2,3,4}; MEDCouplingPointSet *m1_1=m4->buildPartOfMySelf(cells1,cells1+5,true); - m1_1->setName(m1->getName()); + m1_1->setName(m1->getName().c_str()); CPPUNIT_ASSERT(m1->isEqual(m1_1,1e-12)); const int cells2[5]={5,6,7,8,9}; MEDCouplingPointSet *m2_1=m4->buildPartOfMySelf(cells2,cells2+5,true); - m2_1->setName(m2->getName()); + m2_1->setName(m2->getName().c_str()); CPPUNIT_ASSERT(m2->isEqual(m2_1,1e-12)); const int cells3[5]={10,11,12,13,14}; MEDCouplingPointSet *m3_1=m4->buildPartOfMySelf(cells3,cells3+5,true); - m3_1->setName(m3->getName()); + m3_1->setName(m3->getName().c_str()); CPPUNIT_ASSERT(m3->isEqual(m3_1,1e-12)); m1_1->decrRef(); m2_1->decrRef(); m3_1->decrRef(); // @@ -1998,7 +2012,7 @@ void MEDCouplingBasicsTest1::testSplitByType() CPPUNIT_ASSERT_EQUAL(3,(int)v.size()); std::vector v2(v.begin(),v.end()); MEDCouplingUMesh *m2=MEDCouplingUMesh::MergeUMeshesOnSameCoords(v2); - m2->setName(m1->getName()); + m2->setName(m1->getName().c_str()); CPPUNIT_ASSERT(m1->isEqual(m2,1.e-12)); for(std::vector::const_iterator iter=v.begin();iter!=v.end();iter++) (*iter)->decrRef(); @@ -2444,11 +2458,9 @@ void MEDCouplingBasicsTest1::testCMesh2() CPPUNIT_ASSERT_EQUAL(3,(int) dis.size()); CPPUNIT_ASSERT_EQUAL((int) INTERP_KERNEL::NORM_HEXA8,dis[0]); CPPUNIT_ASSERT_EQUAL(27,dis[1]); - CPPUNIT_ASSERT_EQUAL(0,dis[2]); + CPPUNIT_ASSERT_EQUAL(-1,dis[2]); std::vector idsPerType; - CPPUNIT_ASSERT_THROW(mesh1->checkTypeConsistencyAndContig(dis, idsPerType),INTERP_KERNEL::Exception); - dis[2]=-1; CPPUNIT_ASSERT(!(mesh1->checkTypeConsistencyAndContig(dis, idsPerType))); dis[0]=(int) INTERP_KERNEL::NORM_QUAD4; CPPUNIT_ASSERT_THROW(mesh1->checkTypeConsistencyAndContig(dis, idsPerType),INTERP_KERNEL::Exception); @@ -2457,7 +2469,7 @@ void MEDCouplingBasicsTest1::testCMesh2() dis[2]=0; DataArrayInt *ids=DataArrayInt::New(); ids->alloc(10,1); - ids->fillWithValue(111); + ids->fillWithValue(23); idsPerType.push_back(ids); DataArrayInt* check=mesh1->checkTypeConsistencyAndContig(dis, idsPerType); CPPUNIT_ASSERT(check); @@ -2469,11 +2481,13 @@ void MEDCouplingBasicsTest1::testCMesh2() mesh1->splitProfilePerType(ids,code,idsInPflPerType,pfls); CPPUNIT_ASSERT_EQUAL(3,(int)code.size()); CPPUNIT_ASSERT_EQUAL((int) INTERP_KERNEL::NORM_HEXA8,code[0]); - CPPUNIT_ASSERT_EQUAL(27,code[1]); + CPPUNIT_ASSERT_EQUAL(10,code[1]); CPPUNIT_ASSERT_EQUAL(0,code[2]); CPPUNIT_ASSERT_EQUAL(1,(int)idsInPflPerType.size()); CPPUNIT_ASSERT_EQUAL(1,(int)pfls.size()); - CPPUNIT_ASSERT(idsInPflPerType[0]->isEqual(*ids)); + DataArrayInt *exp=DataArrayInt::New(); exp->alloc(10,1); exp->iota(0); + CPPUNIT_ASSERT(idsInPflPerType[0]->isEqual(*exp)); + exp->decrRef(); CPPUNIT_ASSERT(pfls[0]->isEqual(*ids)); idsInPflPerType[0]->decrRef(); pfls[0]->decrRef(); @@ -2490,8 +2504,8 @@ void MEDCouplingBasicsTest1::testCMesh2() int cells2[2]={25,26}; DataArrayInt* arr1; - MEDCouplingUMesh *partMesh2= - dynamic_cast(mesh1->buildPartAndReduceNodes(cells2,cells2+2,arr1)); + MEDCouplingCMesh *partMesh2= + dynamic_cast(mesh1->buildPartAndReduceNodes(cells2,cells2+2,arr1)); CPPUNIT_ASSERT(partMesh2); CPPUNIT_ASSERT_EQUAL(2,partMesh2->getNumberOfCellsWithType(INTERP_KERNEL::NORM_HEXA8)); CPPUNIT_ASSERT_EQUAL(12,partMesh2->getNumberOfNodes()); @@ -2652,7 +2666,7 @@ void MEDCouplingBasicsTest1::testChangeSpaceDimension() CPPUNIT_ASSERT_EQUAL(3,m1->getSpaceDimension()); m1->changeSpaceDimension(2); CPPUNIT_ASSERT_EQUAL(2,m1->getSpaceDimension()); - m1->setName(m2->getName()); + m1->setName(m2->getName().c_str()); CPPUNIT_ASSERT(m1->isEqual(m2,1e-12)); m1->changeSpaceDimension(3); CPPUNIT_ASSERT_EQUAL(3,m1->getSpaceDimension());