]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
Little cleanup.
authorageay <ageay>
Thu, 1 Mar 2012 08:12:52 +0000 (08:12 +0000)
committerageay <ageay>
Thu, 1 Mar 2012 08:12:52 +0000 (08:12 +0000)
src/ParaMEDMEMTest/ParaMEDMEMTest.hxx
src/ParaMEDMEMTest/ParaMEDMEMTest_MEDLoader.cxx

index a9d616c030bb35e72ea1567ae465590681b97625..e65e67429039980b5bcd7283da214ec71b6f3f07 100644 (file)
@@ -77,8 +77,6 @@ class ParaMEDMEMTest : public CppUnit::TestFixture
   CPPUNIT_TEST(testMEDLoaderRead1);
   CPPUNIT_TEST(testMEDLoaderPolygonRead);
   CPPUNIT_TEST(testMEDLoaderPolyhedronRead);
-  //CPPUNIT_TEST(testMEDLoaderWrite1);
-  //CPPUNIT_TEST(testMEDLoaderPolygonWrite);
   CPPUNIT_TEST_SUITE_END();
   
 
index ab04e68fad6fc7e5002a1f87ab524a0b5f0c8ab9..ec3893402a0dedf06bf2afe1fe471d89dedcfbd5 100644 (file)
 //
 
 #include "ParaMEDMEMTest.hxx"
-#include <cppunit/TestAssert.h>
 #include "MEDLoader.hxx"
 #include "MEDCouplingUMesh.hxx"
 #include "MEDCouplingFieldDouble.hxx"
 
+#include <cppunit/TestAssert.h>
+
 #include <algorithm>
 #include <numeric>
 #include <iostream>
@@ -396,73 +397,3 @@ void ParaMEDMEMTest::testMEDLoaderPolyhedronRead()
   CPPUNIT_ASSERT_EQUAL(0,(int)mesh->getAllTypes().size());
   mesh->decrRef();
 }
-
-void ParaMEDMEMTest::testMEDLoaderWrite1()
-{
-  const char meshName[]="MEDLoaderWrite1";
-  string outFileName=makeTmpFile("toto22137.med");
-  double targetCoords[18]={-0.3,-0.3, 0.2,-0.3, 0.7,-0.3, -0.3,0.2, 0.2,0.2, 0.7,0.2, -0.3,0.7, 0.2,0.7, 0.7,0.7 };
-  int targetConn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4};
-  MEDCouplingUMesh *mesh=MEDCouplingUMesh::New();
-  mesh->setMeshDimension(2);
-  mesh->allocateCells(5);
-  mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,targetConn);
-  mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,targetConn+4);
-  mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,targetConn+7);
-  mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,targetConn+10);
-  mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,targetConn+14);
-  mesh->finishInsertingCells();
-  DataArrayDouble *myCoords=DataArrayDouble::New();
-  myCoords->alloc(9,2);
-  std::copy(targetCoords,targetCoords+18,myCoords->getPointer());
-  mesh->setCoords(myCoords);
-  myCoords->decrRef();
-  mesh->checkCoherency();
-  CPPUNIT_ASSERT_EQUAL(2,mesh->getSpaceDimension());
-  CPPUNIT_ASSERT_EQUAL(2,mesh->getMeshDimension());
-  CPPUNIT_ASSERT_EQUAL(5,mesh->getNumberOfCells());
-  CPPUNIT_ASSERT_EQUAL(9,mesh->getNumberOfNodes());
-  bool normalThrow=false;
-  try
-    {
-      MEDLoader::WriteUMesh(outFileName.c_str(),mesh,true);
-    }
-  catch(INTERP_KERNEL::Exception& e)
-    {
-      normalThrow=true;
-    }
-  CPPUNIT_ASSERT(normalThrow);
-  mesh->setName(meshName);
-  MEDLoader::WriteUMesh(outFileName.c_str(),mesh,true);
-  mesh->decrRef();
-  //
-  mesh=MEDLoader::ReadUMeshFromFile(outFileName.c_str(),meshName,0);
-  CPPUNIT_ASSERT_EQUAL(2,mesh->getSpaceDimension());
-  CPPUNIT_ASSERT_EQUAL(2,mesh->getMeshDimension());
-  CPPUNIT_ASSERT_EQUAL(5,mesh->getNumberOfCells());
-  CPPUNIT_ASSERT_EQUAL(9,mesh->getNumberOfNodes());
-  CPPUNIT_ASSERT_EQUAL(2,(int)mesh->getAllTypes().size());
-  for(int i=0;i<2;i++)
-    CPPUNIT_ASSERT_EQUAL(NORM_TRI3,mesh->getTypeOfCell(i));
-  for(int i=2;i<5;i++)
-    CPPUNIT_ASSERT_EQUAL(NORM_QUAD4,mesh->getTypeOfCell(i));
-  CPPUNIT_ASSERT_DOUBLES_EQUAL(3.6,std::accumulate(mesh->getCoords()->getPointer(),mesh->getCoords()->getPointer()+18,0.),1.e-12);
-  mesh->decrRef();
-}
-
-void ParaMEDMEMTest::testMEDLoaderPolygonWrite()
-{
-  string fileName=getResourceFile("polygones.med");
-  vector<string> meshNames=MEDLoader::GetMeshNames(fileName.c_str());
-  CPPUNIT_ASSERT_EQUAL(1,(int)meshNames.size());
-  CPPUNIT_ASSERT(meshNames[0]=="Bord");
-  MEDCouplingUMesh *mesh=MEDLoader::ReadUMeshFromFile(fileName.c_str(),meshNames[0].c_str(),0);
-  mesh->checkCoherency();
-  string outFileName=makeTmpFile("toto22138.med");
-  MEDLoader::WriteUMesh(outFileName.c_str(),mesh,true);
-  //
-  MEDCouplingUMesh *mesh2=MEDLoader::ReadUMeshFromFile(outFileName.c_str(),meshNames[0].c_str(),0);
-  //
-  mesh2->decrRef();
-  mesh->decrRef();
-}