Salome HOME
The big test of different synchronizations.
[modules/med.git] / src / MEDCoupling / Test / MEDCouplingBasicsTest1.cxx
index 5d2b0c0f99e2567e291b805fe7c4005f6ffb5b53..0792f92198c6ce8b64e9bbf7b750b5bac39f3745 100644 (file)
@@ -1,9 +1,9 @@
-// Copyright (C) 2007-2013  CEA/DEN, EDF R&D
+// Copyright (C) 2007-2014  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
 // License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
 //
 // This library is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -145,7 +145,7 @@ void MEDCouplingBasicsTest1::testMesh()
   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(not MEDCouplingMesh::IsStaticGeometricType(INTERP_KERNEL::NORM_POLYGON));
+  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"));
@@ -591,11 +591,11 @@ void MEDCouplingBasicsTest1::testBuildPartOfMySelf()
   MEDCouplingUMesh *subMesh=dynamic_cast<MEDCouplingUMesh *>(subMeshSimple);
   CPPUNIT_ASSERT(subMesh);
   std::string name(subMesh->getName());
-  CPPUNIT_ASSERT_EQUAL(2,(int)mesh->getAllTypes().size());
-  CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_TRI3,*mesh->getAllTypes().begin());
-  CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_QUAD4,*(++(mesh->getAllTypes().begin())));
-  CPPUNIT_ASSERT_EQUAL(1,(int)subMesh->getAllTypes().size());
-  CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_QUAD4,*subMesh->getAllTypes().begin());
+  CPPUNIT_ASSERT_EQUAL(2,(int)mesh->getAllGeoTypes().size());
+  CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_TRI3,*mesh->getAllGeoTypes().begin());
+  CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_QUAD4,*(++(mesh->getAllGeoTypes().begin())));
+  CPPUNIT_ASSERT_EQUAL(1,(int)subMesh->getAllGeoTypes().size());
+  CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_QUAD4,*subMesh->getAllGeoTypes().begin());
   CPPUNIT_ASSERT(name=="Toto");
   CPPUNIT_ASSERT(mesh->getCoords()==subMesh->getCoords());
   CPPUNIT_ASSERT_EQUAL(2,subMesh->getNumberOfCells());
@@ -611,9 +611,9 @@ void MEDCouplingBasicsTest1::testBuildPartOfMySelf()
   subMesh=dynamic_cast<MEDCouplingUMesh *>(subMeshSimple);
   CPPUNIT_ASSERT(subMesh);
   name=subMesh->getName();
-  CPPUNIT_ASSERT_EQUAL(2,(int)subMesh->getAllTypes().size());
-  CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_TRI3,*subMesh->getAllTypes().begin());
-  CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_QUAD4,*(++(subMesh->getAllTypes().begin())));
+  CPPUNIT_ASSERT_EQUAL(2,(int)subMesh->getAllGeoTypes().size());
+  CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_TRI3,*subMesh->getAllGeoTypes().begin());
+  CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_QUAD4,*(++(subMesh->getAllGeoTypes().begin())));
   CPPUNIT_ASSERT(name=="Toto");
   CPPUNIT_ASSERT(mesh->getCoords()==subMesh->getCoords());
   CPPUNIT_ASSERT_EQUAL(3,subMesh->getNumberOfCells());
@@ -640,8 +640,8 @@ void MEDCouplingBasicsTest1::testBuildPartOfMySelfNode()
   MEDCouplingPointSet *subMeshSimple=mesh->buildPartOfMySelfNode(tab1,tab1+4,true);
   MEDCouplingUMesh *subMesh=dynamic_cast<MEDCouplingUMesh *>(subMeshSimple);
   CPPUNIT_ASSERT(subMesh);
-  CPPUNIT_ASSERT_EQUAL(1,(int)subMesh->getAllTypes().size());
-  CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_QUAD4,*subMesh->getAllTypes().begin());
+  CPPUNIT_ASSERT_EQUAL(1,(int)subMesh->getAllGeoTypes().size());
+  CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_QUAD4,*subMesh->getAllGeoTypes().begin());
   CPPUNIT_ASSERT_EQUAL(1,subMesh->getNumberOfCells());
   CPPUNIT_ASSERT_EQUAL((std::size_t)5,subMesh->getNodalConnectivity()->getNbOfElems());
   CPPUNIT_ASSERT_EQUAL((std::size_t)2,subMesh->getNodalConnectivityIndex()->getNbOfElems());
@@ -655,9 +655,9 @@ void MEDCouplingBasicsTest1::testBuildPartOfMySelfNode()
   subMeshSimple=mesh->buildPartOfMySelfNode(tab1,tab1+2,false);
   subMesh=dynamic_cast<MEDCouplingUMesh *>(subMeshSimple);
   CPPUNIT_ASSERT(subMesh);
-  CPPUNIT_ASSERT_EQUAL(2,(int)subMesh->getAllTypes().size());
-  CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_TRI3,*subMesh->getAllTypes().begin());
-  CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_QUAD4,*(++subMesh->getAllTypes().begin()));
+  CPPUNIT_ASSERT_EQUAL(2,(int)subMesh->getAllGeoTypes().size());
+  CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_TRI3,*subMesh->getAllGeoTypes().begin());
+  CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_QUAD4,*(++subMesh->getAllGeoTypes().begin()));
   CPPUNIT_ASSERT_EQUAL(3,subMesh->getNumberOfCells());
   CPPUNIT_ASSERT_EQUAL((std::size_t)14,subMesh->getNodalConnectivity()->getNbOfElems());
   CPPUNIT_ASSERT_EQUAL((std::size_t)4,subMesh->getNodalConnectivityIndex()->getNbOfElems());
@@ -672,9 +672,9 @@ void MEDCouplingBasicsTest1::testBuildPartOfMySelfNode()
   subMeshSimple=mesh->buildPartOfMySelfNode(tab2,tab2+7,true);
   subMesh=dynamic_cast<MEDCouplingUMesh *>(subMeshSimple);
   CPPUNIT_ASSERT(subMesh);
-  CPPUNIT_ASSERT_EQUAL(2,(int)subMesh->getAllTypes().size());
-  CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_TRI3,*subMesh->getAllTypes().begin());
-  CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_QUAD4,*(++subMesh->getAllTypes().begin()));
+  CPPUNIT_ASSERT_EQUAL(2,(int)subMesh->getAllGeoTypes().size());
+  CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_TRI3,*subMesh->getAllGeoTypes().begin());
+  CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_QUAD4,*(++subMesh->getAllGeoTypes().begin()));
   CPPUNIT_ASSERT_EQUAL(3,subMesh->getNumberOfCells());
   subMeshSimple->decrRef();
   //
@@ -684,7 +684,7 @@ void MEDCouplingBasicsTest1::testBuildPartOfMySelfNode()
 void MEDCouplingBasicsTest1::testZipCoords()
 {
   MEDCouplingUMesh *mesh=build2DTargetMesh_1();
-  CPPUNIT_ASSERT_EQUAL(2,(int)mesh->getAllTypes().size());
+  CPPUNIT_ASSERT_EQUAL(2,(int)mesh->getAllGeoTypes().size());
   CPPUNIT_ASSERT_EQUAL(2,mesh->getSpaceDimension());
   CPPUNIT_ASSERT_EQUAL(9,mesh->getNumberOfNodes());
   CPPUNIT_ASSERT_EQUAL(5,mesh->getNumberOfCells());
@@ -695,7 +695,7 @@ void MEDCouplingBasicsTest1::testZipCoords()
   DataArrayDouble *oldCoords=mesh->getCoords();
   oldCoords->incrRef();
   mesh->zipCoords();
-  CPPUNIT_ASSERT_EQUAL(2,(int)mesh->getAllTypes().size());
+  CPPUNIT_ASSERT_EQUAL(2,(int)mesh->getAllGeoTypes().size());
   CPPUNIT_ASSERT_EQUAL(2,mesh->getSpaceDimension());
   CPPUNIT_ASSERT_EQUAL(9,mesh->getNumberOfNodes());
   CPPUNIT_ASSERT_EQUAL(5,mesh->getNumberOfCells());
@@ -713,7 +713,7 @@ void MEDCouplingBasicsTest1::testZipCoords()
   const int expectedTraducer[9]={0,1,-1,2,3,4,-1,5,6};
   CPPUNIT_ASSERT(std::equal(expectedTraducer,expectedTraducer+9,traducer->getPointer()));
   traducer->decrRef();
-  CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_QUAD4,*subMesh->getAllTypes().begin());
+  CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_QUAD4,*subMesh->getAllGeoTypes().begin());
   CPPUNIT_ASSERT_EQUAL(2,subMesh->getNumberOfCells());
   const int subConn[10]={4,0,2,3,1,4,5,6,4,3};
   const int subConnIndex[3]={0,5,10};
@@ -727,7 +727,7 @@ void MEDCouplingBasicsTest1::testZipCoords()
   subMeshPtSet=mesh->buildPartOfMySelf(tab1,tab1+2,false);
   subMesh=dynamic_cast<MEDCouplingUMesh *>(subMeshPtSet);
   CPPUNIT_ASSERT(subMesh);
-  CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_QUAD4,*subMesh->getAllTypes().begin());
+  CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_QUAD4,*subMesh->getAllGeoTypes().begin());
   CPPUNIT_ASSERT_EQUAL(2,subMesh->getNumberOfCells());
   CPPUNIT_ASSERT_EQUAL(7,subMesh->getNumberOfNodes());
   CPPUNIT_ASSERT_EQUAL((std::size_t)10,subMesh->getNodalConnectivity()->getNbOfElems());
@@ -1346,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();
   //
@@ -2012,7 +2012,7 @@ void MEDCouplingBasicsTest1::testSplitByType()
   CPPUNIT_ASSERT_EQUAL(3,(int)v.size());
   std::vector<const MEDCouplingUMesh *> 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<MEDCouplingUMesh *>::const_iterator iter=v.begin();iter!=v.end();iter++)
     (*iter)->decrRef();
@@ -2162,25 +2162,24 @@ void MEDCouplingBasicsTest1::testGetCellsContainingPoint()
 {
   MEDCouplingUMesh *targetMesh=build2DTargetMesh_1();
   double pos[12]={0.,0.,0.4,0.4,0.,0.4,0.1,0.1,0.25,0.,0.65,0.};
-  std::vector<int> t1,t2;
+  MEDCouplingAutoRefCountObjectPtr<DataArrayInt> t1,t2;
   //2D basic
   targetMesh->getCellsContainingPoints(pos,6,1e-12,t1,t2);
-  CPPUNIT_ASSERT_EQUAL(6,(int)t1.size());
-  CPPUNIT_ASSERT_EQUAL(7,(int)t2.size());
+  CPPUNIT_ASSERT_EQUAL(6,(int)t1->getNbOfElems());
+  CPPUNIT_ASSERT_EQUAL(7,(int)t2->getNbOfElems());
   const int expectedValues1[6]={0,4,3,0,1,2};
   const int expectedValues2[7]={0,1,2,3,4,5,6};
-  CPPUNIT_ASSERT(std::equal(t1.begin(),t1.end(),expectedValues1));
-  CPPUNIT_ASSERT(std::equal(t2.begin(),t2.end(),expectedValues2));
+  CPPUNIT_ASSERT(std::equal(t1->begin(),t1->end(),expectedValues1));
+  CPPUNIT_ASSERT(std::equal(t2->begin(),t2->end(),expectedValues2));
   //2D with no help of bounding box.
   double center[2]={0.2,0.2};
   MEDCouplingPointSet::Rotate2DAlg(center,0.78539816339744830962,6,pos);
   targetMesh->rotate(center,0,0.78539816339744830962);
-  t1.clear(); t2.clear();
   targetMesh->getCellsContainingPoints(pos,6,1e-12,t1,t2);
-  CPPUNIT_ASSERT_EQUAL(6,(int)t1.size());
-  CPPUNIT_ASSERT_EQUAL(7,(int)t2.size());
-  CPPUNIT_ASSERT(std::equal(t1.begin(),t1.end(),expectedValues1));
-  CPPUNIT_ASSERT(std::equal(t2.begin(),t2.end(),expectedValues2));
+  CPPUNIT_ASSERT_EQUAL(6,(int)t1->getNbOfElems());
+  CPPUNIT_ASSERT_EQUAL(7,(int)t2->getNbOfElems());
+  CPPUNIT_ASSERT(std::equal(t1->begin(),t1->end(),expectedValues1));
+  CPPUNIT_ASSERT(std::equal(t2->begin(),t2->end(),expectedValues2));
   //2D outside
   const double pos1bis[2]={-0.3303300858899107,-0.11819805153394641};
   CPPUNIT_ASSERT_EQUAL(-1,targetMesh->getCellContainingPoint(pos1bis,1e-12));
@@ -2188,17 +2187,18 @@ void MEDCouplingBasicsTest1::testGetCellsContainingPoint()
   //test limits 2D
   targetMesh=build2DTargetMesh_1();
   const double pos2[2]={0.2,-0.05};
-  t1.clear();
-  targetMesh->getCellsContainingPoint(pos2,1e-12,t1);
-  CPPUNIT_ASSERT_EQUAL(2,(int)t1.size());
+  std::vector<int> t11;
+  t11.clear();
+  targetMesh->getCellsContainingPoint(pos2,1e-12,t11);
+  CPPUNIT_ASSERT_EQUAL(2,(int)t11.size());
   const int expectedValues3[2]={0,1};
-  CPPUNIT_ASSERT(std::equal(t1.begin(),t1.end(),expectedValues3));
+  CPPUNIT_ASSERT(std::equal(t11.begin(),t11.end(),expectedValues3));
   const double pos3[2]={0.2,0.2};
-  t1.clear();
-  targetMesh->getCellsContainingPoint(pos3,1e-12,t1);
-  CPPUNIT_ASSERT_EQUAL(5,(int)t1.size());
+  t11.clear();
+  targetMesh->getCellsContainingPoint(pos3,1e-12,t11);
+  CPPUNIT_ASSERT_EQUAL(5,(int)t11.size());
   const int expectedValues4[5]={0,1,2,3,4};
-  CPPUNIT_ASSERT(std::equal(t1.begin(),t1.end(),expectedValues4));
+  CPPUNIT_ASSERT(std::equal(t11.begin(),t11.end(),expectedValues4));
   CPPUNIT_ASSERT_EQUAL(0,targetMesh->getCellContainingPoint(pos3,1e-12));
   targetMesh->decrRef();
   //3D
@@ -2206,17 +2206,17 @@ void MEDCouplingBasicsTest1::testGetCellsContainingPoint()
   const double pos4[3]={25.,25.,25.};
   CPPUNIT_ASSERT_EQUAL(0,targetMesh->getCellContainingPoint(pos4,1e-12));
   const double pos5[3]={50.,50.,50.};
-  t1.clear();
-  targetMesh->getCellsContainingPoint(pos5,1e-12,t1);
-  CPPUNIT_ASSERT_EQUAL(8,(int)t1.size());
+  t11.clear();
+  targetMesh->getCellsContainingPoint(pos5,1e-12,t11);
+  CPPUNIT_ASSERT_EQUAL(8,(int)t11.size());
   const int expectedValues5[8]={0,1,2,3,4,5,6,7};
-  CPPUNIT_ASSERT(std::equal(t1.begin(),t1.end(),expectedValues5));
+  CPPUNIT_ASSERT(std::equal(t11.begin(),t11.end(),expectedValues5));
   const double pos6[3]={0., 50., 0.};
-  t1.clear();
-  targetMesh->getCellsContainingPoint(pos6,1e-12,t1);
-  CPPUNIT_ASSERT_EQUAL(2,(int)t1.size());
+  t11.clear();
+  targetMesh->getCellsContainingPoint(pos6,1e-12,t11);
+  CPPUNIT_ASSERT_EQUAL(2,(int)t11.size());
   const int expectedValues6[2]={0,2};
-  CPPUNIT_ASSERT(std::equal(t1.begin(),t1.end(),expectedValues6));
+  CPPUNIT_ASSERT(std::equal(t11.begin(),t11.end(),expectedValues6));
   //3D outside
   const double pos7[3]={-1.0,-1.0,0.};
   CPPUNIT_ASSERT_EQUAL(-1,targetMesh->getCellContainingPoint(pos7,1e-12));
@@ -2458,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<const DataArrayInt *> 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);
@@ -2471,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);
@@ -2483,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();
@@ -2504,8 +2504,8 @@ void MEDCouplingBasicsTest1::testCMesh2()
   
   int cells2[2]={25,26};
   DataArrayInt* arr1;
-  MEDCouplingUMesh *partMesh2=
-    dynamic_cast<MEDCouplingUMesh *>(mesh1->buildPartAndReduceNodes(cells2,cells2+2,arr1));
+  MEDCouplingCMesh *partMesh2=
+    dynamic_cast<MEDCouplingCMesh *>(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());
@@ -2666,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());