Salome HOME
API modification (simplification) : MEDFileMesh::getGenMeshAtLevel -> MEDFileMesh...
[tools/medcoupling.git] / src / MEDLoader / Test / SauvLoaderTest.cxx
index df15700080148f7af9dc20d63b80682902622136..4fda6a2464aea2596ca99041441f55218a6df43c 100644 (file)
 #include "MEDFileData.hxx"
 #include "MEDCouplingFieldDouble.hxx"
 #include "MEDCouplingMemArray.hxx"
+#include "TestInterpKernelUtils.hxx"  // getResourceFile()
 
 #ifdef WIN32
-# include <windows.h>
+#include <windows.h>
 #else
 # include <unistd.h>
 #endif
@@ -39,7 +40,7 @@ using namespace ParaMEDMEM;
 void SauvLoaderTest::testSauv2Med()
 {
   // read a file containing all types of readable piles
-  std::string file = getResourceFile("allPillesTest.sauv");
+  std::string file = INTERP_TEST::getResourceFile("allPillesTest.sauv", 3);
   MEDCouplingAutoRefCountObjectPtr<SauvReader> sr=SauvReader::New(file.c_str());
   MEDCouplingAutoRefCountObjectPtr<MEDFileData> d2=sr->loadInMEDFileDS();
   // write MED
@@ -124,7 +125,7 @@ void SauvLoaderTest::testMed2SauvOnAMeshWithVoidFamily()
 void SauvLoaderTest::testSauv2MedOnA3SubsField()
 {
   // read SAUV
-  std::string sauvFile = getResourceFile("portico_3subs.sauv");
+  std::string sauvFile = INTERP_TEST::getResourceFile("portico_3subs.sauv", 3);
   MEDCouplingAutoRefCountObjectPtr<SauvReader> sr=SauvReader::New(sauvFile.c_str());
   MEDCouplingAutoRefCountObjectPtr<MEDFileData> d2=sr->loadInMEDFileDS();
   // check mesh
@@ -168,7 +169,7 @@ void SauvLoaderTest::testSauv2MedOnA3SubsField()
 void SauvLoaderTest::testMed2Sauv()
 {
   // read pointe.med
-  std::string file = getResourceFile("pointe.med");
+  std::string file = INTERP_TEST::getResourceFile("pointe.med", 3);
   MEDCouplingAutoRefCountObjectPtr<MEDFileData> pointeMed=MEDFileData::New(file.c_str());
 
   // add 3 faces to pointeMed
@@ -249,14 +250,14 @@ void SauvLoaderTest::testMed2Sauv()
   CPPUNIT_ASSERT( std::find(groups.begin(),groups.end(),"groupe5") != groups.end() );
   CPPUNIT_ASSERT( std::find(groups.begin(),groups.end(),"maa1") != groups.end() );
   CPPUNIT_ASSERT_EQUAL(16,m->getSizeAtLevel(0));
-  MEDCouplingAutoRefCountObjectPtr<MEDCouplingMesh> um0 = m->getGenMeshAtLevel(0);
+  MEDCouplingAutoRefCountObjectPtr<MEDCouplingMesh> um0 = m->getMeshAtLevel(0);
   CPPUNIT_ASSERT_EQUAL(12, um0->getNumberOfCellsWithType( INTERP_KERNEL::NORM_TETRA4 ));
   CPPUNIT_ASSERT_EQUAL(2,  um0->getNumberOfCellsWithType( INTERP_KERNEL::NORM_PYRA5 ));
   CPPUNIT_ASSERT_EQUAL(2,  um0->getNumberOfCellsWithType( INTERP_KERNEL::NORM_HEXA8 ));
-  MEDCouplingAutoRefCountObjectPtr<MEDCouplingMesh> um1 = m->getGenMeshAtLevel(-1);
+  MEDCouplingAutoRefCountObjectPtr<MEDCouplingMesh> um1 = m->getMeshAtLevel(-1);
   CPPUNIT_ASSERT_EQUAL(2, um1->getNumberOfCellsWithType( INTERP_KERNEL::NORM_TRI3 ));
   MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> pointeUM0 =
-    static_cast<MEDCouplingUMesh*>( pointeMedMesh->getGenMeshAtLevel(0));
+    static_cast<MEDCouplingUMesh*>( pointeMedMesh->getMeshAtLevel(0));
   DataArrayDouble *coo = m->getCoords();
   DataArrayDouble *pointeCoo = pointeMedMesh->getCoords();
   CPPUNIT_ASSERT(coo->isEqualWithoutConsideringStr(*pointeCoo,1e-12));
@@ -327,28 +328,3 @@ void SauvLoaderTest::tearDown()
       remove(fileToRemove[i]);
   }
 }
-
-std::string SauvLoaderTest::getResourceFile( const std::string& filename )
-{
-  std::string resourceFile = "";
-
-  if ( getenv("MEDTOOL_ROOT_DIR") ) {
-    // use MEDTOOL_ROOT_DIR env.var
-    resourceFile = getenv("MEDTOOL_ROOT_DIR");
-    resourceFile += "/share/resources/med/";
-  }
-  else {
-    resourceFile = get_current_dir_name();
-    resourceFile += "/../../../resources/";
-  }
-
-  resourceFile += filename;
-#ifdef WIN32
-  std::string fixedpath = resourceFile;
-  for ( int i=0; i < fixedpath.length(); ++i )
-    if (fixedpath[i] == '/')
-      fixedpath[i] = '\\';
-  return fixedpath;
-#endif
-  return resourceFile;
-}