Salome HOME
MEDMEM suppression
authorageay <ageay>
Thu, 4 Apr 2013 13:47:52 +0000 (13:47 +0000)
committerageay <ageay>
Thu, 4 Apr 2013 13:47:52 +0000 (13:47 +0000)
14 files changed:
src/INTERP_KERNELTest/CMakeLists.txt
src/INTERP_KERNELTest/Interpolation3DTest.cxx
src/INTERP_KERNELTest/Interpolation3DTest.hxx
src/INTERP_KERNELTest/InterpolationOptionsTest.cxx
src/INTERP_KERNELTest/InterpolationOptionsTest.hxx
src/INTERP_KERNELTest/MEDMeshMaker.cxx
src/INTERP_KERNELTest/MEDMeshMaker.hxx
src/INTERP_KERNELTest/Makefile.am
src/INTERP_KERNELTest/MeshTestToolkit.hxx
src/INTERP_KERNELTest/MeshTestToolkit.txx
src/INTERP_KERNELTest/PerfTest.cxx
src/INTERP_KERNELTest/TestInterpKernel.cxx
src/INTERP_KERNELTest/TestingUtils.hxx
src/RENUMBER/renumbering.cxx

index 6011adb3119d4d4175422e108a8514b62541dd7a..f843aa0e1c7658d5e21abf63a5b4b6ab4710703d 100644 (file)
@@ -62,7 +62,6 @@ IF(NOT MED_ENABLE_MICROMED)
     ${InterpKernelTest_SOURCES}
     InterpolationOptionsTest.cxx
     MEDMeshMaker.cxx
-    PointLocatorTest.cxx
     )
   
   SET(PerfTest_SOURCES
@@ -76,7 +75,7 @@ ENDIF(NOT MED_ENABLE_MICROMED)
 
 ADD_LIBRARY(InterpKernelTest SHARED ${InterpKernelTest_SOURCES})
 SET_TARGET_PROPERTIES(InterpKernelTest PROPERTIES COMPILE_FLAGS "${HDF5_DEFINITIONS} ${MED3_DEFINITIONS} ${XDR_DEFINITIONS} ${CPPUNIT_DEFINITIONS} ${PLATFORM_DEFINITIONS}")
-TARGET_LINK_LIBRARIES(InterpKernelTest medmem interpkernel ${CPPUNIT_LIBS})
+TARGET_LINK_LIBRARIES(InterpKernelTest medloader medcoupling interpkernel ${CPPUNIT_LIBS})
 
 ADD_EXECUTABLE(TestINTERP_KERNEL ${TestINTERP_KERNEL_SOURCES})
 SET_TARGET_PROPERTIES(TestINTERP_KERNEL PROPERTIES COMPILE_FLAGS "${HDF5_DEFINITIONS} ${MED3_DEFINITIONS} ${XDR_DEFINITIONS} ${CPPUNIT_DEFINITIONS} ${PLATFORM_DEFINITIONS}")
index 44e600c08988f25debeaa222c03fe31e217c61b1..ae0069c13349ec35d29303a1820dee2ffdbc39b9 100644 (file)
 //
 
 #include "Interpolation3DTest.hxx"
-#include "MEDMEM_Mesh.hxx"
 
-#include <iostream>
+#include "MEDFileMesh.hxx"
+#include "MEDCouplingUMesh.hxx"
+#include "MEDCouplingFieldDouble.hxx"
+
 #include <map>
-#include <vector>
 #include <cmath>
+#include <vector>
+#include <iostream>
 #include <algorithm>
 
 #include "VectorUtils.hxx"
 
-#include "MEDMEM_Field.hxx"
-#include "MEDMEM_Support.hxx"
-
 // levels : 
 // 1 - titles and volume results
 // 2 - symmetry / diagonal results and intersection matrix output
@@ -42,9 +42,8 @@
 
 //#define VOL_PREC 1.0e-6
 
-using namespace MEDMEM;
+using namespace ParaMEDMEM;
 using namespace INTERP_KERNEL;
-using namespace MED_EN;
 
 double Interpolation3DTest::sumRow(const IntersectionMatrix& m, int i) const
 {
@@ -72,13 +71,10 @@ double Interpolation3DTest::sumCol(const IntersectionMatrix& m, int i) const
 }
 
 
-void Interpolation3DTest::getVolumes(MESH& mesh, double* tab) const
+void Interpolation3DTest::getVolumes(ParaMEDMEM::MEDCouplingUMesh& mesh, double *tab) const
 {
-  SUPPORT *sup=new SUPPORT(&mesh,"dummy",MED_CELL);
-  FIELD<double>* f=mesh.getVolume(sup);
-  const double *tabS=f->getValue();
-  std::copy(tabS,tabS+mesh.getNumberOfElements(MED_CELL,MED_ALL_ELEMENTS),tab)
-    delete sup;
+  MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> vol=mesh->getMeasureField(true);
+  std::copy(vol->getArray()->begin(),vol->getArray()->end(),tab);
 }
 
 double Interpolation3DTest::sumVolume(const IntersectionMatrix& m) const
@@ -102,15 +98,15 @@ double Interpolation3DTest::sumVolume(const IntersectionMatrix& m) const
   return vol;
 }
 
-bool Interpolation3DTest::testVolumes(const IntersectionMatrix& m,  MESH& sMesh,  MESH& tMesh) const
+bool Interpolation3DTest::testVolumes(const IntersectionMatrix& m,  MEDCouplingUMesh& sMesh,  MEDCouplingUMesh& tMesh) const
 {
   bool ok = true;
 
   // source elements
-  double* sVol = new double[sMesh.getNumberOfElements(MED_CELL,MED_ALL_ELEMENTS)];
+  double* sVol = new double[sMesh.getNumberOfCells()];
   getVolumes(sMesh, sVol);
 
-  for(int i = 0; i < sMesh.getNumberOfElements(MED_CELL,MED_ALL_ELEMENTS); ++i)
+  for(int i = 0; i < sMesh.getNumberOfCells(); ++i)
     {
       const double sum_row = sumRow(m, i+1);
       if(!epsilonEqualRelative(sum_row, sVol[i], VOL_PREC))
@@ -122,9 +118,9 @@ bool Interpolation3DTest::testVolumes(const IntersectionMatrix& m,  MESH& sMesh,
     }
 
   // target elements
-  double* tVol = new double[tMesh.getNumberOfElements(MED_CELL,MED_ALL_ELEMENTS)];
+  double* tVol = new double[tMesh.getNumberOfCells()];
   getVolumes(tMesh, tVol);
-  for(int i = 0; i < tMesh.getNumberOfElements(MED_CELL,MED_ALL_ELEMENTS); ++i)
+  for(int i = 0; i < tMesh.getNumberOfCells(); ++i)
     {
       const double sum_col = sumCol(m, i);
       if(!epsilonEqualRelative(sum_col, tVol[i], VOL_PREC))
index 4b3a8bb0c37831357d1e9ff6a47823632eeac9fa..e2a1c582308ab4f5577d8a30d259e1988afc8c95 100644 (file)
@@ -25,9 +25,6 @@
 
 #define ERR_TOL 1.0e-8
 
-using MEDMEM::Interpolation3D;
-class MEDMEM::MESH;
-
 /// \brief OBSOLETE - renamed Interpolation3DTestSuite
 class Interpolation3DTest : public CppUnit::TestFixture
 {
index cc79d63413ceae45c3b703ec3ce1480490133745..fc6c438d186874bc37f630d417beda92a31b0c59 100644 (file)
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
+#include "MEDFileMesh.hxx"
+#include "MEDCouplingFieldDouble.hxx"
+
 #include "InterpolationOptionsTest.hxx"
-#include "MEDNormalizedUnstructuredMesh.txx"
+#include "MEDCouplingNormalizedUnstructuredMesh.txx"
 #include "Interpolation2D.txx"
 #include "TestInterpKernelUtils.hxx"
+
 #include <iostream>
 #include <vector>
 
+using namespace ParaMEDMEM;
+
 namespace INTERP_TEST
 {
   void InterpolationOptionsTest::setUp()
@@ -45,34 +51,40 @@ namespace INTERP_TEST
    */
   void InterpolationOptionsTest::test_InterpolationOptions() 
   {
-    string sourcename=INTERP_TEST::getResourceFile("square1.med");
-    MEDMEM::MESH *source_mesh=new MEDMEM::MESH(MED_DRIVER,sourcename,"Mesh_2");
+    std::string sourcename=INTERP_TEST::getResourceFile("square1.med");
+    MEDFileUMesh *source_mesh=MEDFileUMesh::New(sourcename.c_str(),"Mesh_2");
 
-    string targetname=INTERP_TEST::getResourceFile("square2.med");
-    MEDMEM::MESH *target_mesh=new MEDMEM::MESH(MED_DRIVER,targetname,"Mesh_3");
+    std::string targetname=INTERP_TEST::getResourceFile("square2.med");
+    MEDFileUMesh *target_mesh=MEDFileUMesh::New(targetname.c_str(),"Mesh_3");
 
-    const MEDMEM::SUPPORT *source_support=source_mesh->getSupportOnAll(MED_EN::MED_CELL);
-    MEDMEM::FIELD<double> *source_field=new FIELD<double>(source_support,1);
-    double* value=const_cast<double*>(source_field->getValue());
-    for (int i=0; i<source_support->getNumberOfElements(MED_EN::MED_ALL_ELEMENTS); i++)
+    MEDCouplingUMesh *source_mesh_mc=source_mesh->getMeshAtLevel(0);
+    MEDCouplingFieldDouble *source_field=MEDCouplingFieldDouble::New(ON_CELLS);
+    source_field->setMesh(source_mesh_mc); source_mesh_mc->decrRef();
+    DataArrayDouble *arr=DataArrayDouble::New(); arr->alloc(source_mesh_mc->getNumberOfCells(),1);
+    source_field->setArray(arr); arr->decrRef();
+    double *value=arr->getPointer();
+    for(int i=0; i<source_mesh_mc->getNumberOfCells(); i++)
       value[i]=1.0;
-    const MEDMEM::SUPPORT *target_support=target_mesh->getSupportOnAll(MED_EN::MED_CELL);
-    MEDMEM::FIELD<double> *target_field=new FIELD<double>(target_support,1);
-    double* targetvalue=const_cast<double*>(target_field->getValue());
-    for (int i=0; i<target_support->getNumberOfElements(MED_EN::MED_ALL_ELEMENTS); i++)
+    MEDCouplingUMesh *target_mesh_mc=target_mesh->getMeshAtLevel(0);
+    MEDCouplingFieldDouble *target_field=MEDCouplingFieldDouble::New(ON_CELLS);
+    target_field->setMesh(target_mesh_mc); target_mesh_mc->decrRef();
+    arr=DataArrayDouble::New(); arr->alloc(target_mesh_mc->getNumberOfCells(),1);
+    target_field->setArray(arr); arr->decrRef();
+    double* targetvalue=arr->getPointer();
+    for(int i=0; i<target_mesh_mc->getNumberOfCells(); i++)
       targetvalue[i]=0.0;
     // Ok at this point we have our mesh in MED-Memory format.
     // Go to wrap med_source_mesh and med_target_mesh.
-    MEDNormalizedUnstructuredMesh<2,2> wrap_source_mesh(source_mesh);
-    MEDNormalizedUnstructuredMesh<2,2> wrap_target_mesh(target_mesh);
+    MEDCouplingNormalizedUnstructuredMesh<2,2> wrap_source_mesh(source_mesh_mc);
+    MEDCouplingNormalizedUnstructuredMesh<2,2> wrap_target_mesh(target_mesh_mc);
     // Go for interpolation...
     INTERP_KERNEL::Interpolation2D myInterpolator;
     //optionnal call to parametrize your interpolation. First precision, tracelevel, intersector wanted.
     myInterpolator.setPrecision(1e-7);
     myInterpolator.setPrintLevel(1);
-    source_mesh->removeReference();
-    source_field->removeReference();
-    target_field->removeReference();
-    target_mesh->removeReference();
+    source_mesh->decrRef();
+    source_field->decrRef();
+    target_field->decrRef();
+    target_mesh->decrRef();
   }
 }
index 27ca2be4b94f07624cad92237075c6362db1dae4..d9cf333eb8316151723e7d239ddf08e9f869b69e 100644 (file)
@@ -24,7 +24,6 @@
 
 #include "InterpKernelTestExport.hxx"
 #include "InterpolationOptions.hxx"
-#include "MEDMEM_Field.hxx"
 
 namespace INTERP_TEST
 {
index 83efbb6616bbed9f7d86c28b9190253471b2b215..1e3341b24d9fc2a4a8b84dc7a423df0063e1c33b 100644 (file)
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
+#include "MEDCouplingAutoRefCountObjectPtr.hxx"
+#include "MEDCouplingCMesh.hxx"
+
 #include "MEDMeshMaker.hxx"
 
-#include "MEDMEM_Mesh.hxx"
-#include "MEDMEM_Meshing.hxx"
+using namespace ParaMEDMEM;
 
-MEDMEM::MESH* MEDMeshMaker(int dim, int nbedge, MED_EN::medGeometryElement type)
+ParaMEDMEM::MEDCouplingUMesh *MEDMeshMaker(int dim, int nbedge)
 {
-  MEDMEM::MESHING* mesh=new MEDMEM::MESHING();
-  int nbnodes;
-  int nbelems;
-  switch (dim)
-    {
-    case 2: 
-      nbnodes=(nbedge+1)*(nbedge+1);
-      if(type==MED_EN::MED_QUAD4)
-        nbelems=(nbedge*nbedge);
-      else
-        throw MEDMEM::MEDEXCEPTION("MEDMeshMaker: type not impletmented");
-      break;
-    case 3:
-      nbnodes=(nbedge+1)*(nbedge+1)*(nbedge+1);
-      if (type==MED_EN::MED_HEXA8)
-        nbelems= nbedge*nbedge*nbedge;
-      else
-        throw MEDMEM::MEDEXCEPTION("MEDMeshMaker: type not impletmented");
-      break;
-    }
-  double* coords = new double[dim*nbnodes];
-  int nz;
-  if (dim==2) nz =1; else nz=nbedge+1;
+  MEDCouplingAutoRefCountObjectPtr<MEDCouplingCMesh> c=MEDCouplingCMesh::New();
+  MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::New();
+  arr->alloc(nbedge+1,1); arr->iota(0.); arr->applyLin(1./double(nbedge),0.);
+  switch(dim)
   {
-    for (int ix=0; ix < nbedge+1; ix++)
-      for (int iy=0; iy<nbedge+1; iy++)
-        for (int iz=0; iz<nz;iz++)
-          {
-            int inode=(ix*(nbedge+1)*nz+iy*nz+iz);
-            coords[inode*dim]=double(ix)/double(nbedge);
-            coords[inode*dim+1]=double(iy)/double(nbedge);
-            if (dim==3)
-              coords[inode*dim+2]=double(iz)/double(nbedge);
-          }
-  }
-  mesh->setCoordinates(dim, nbnodes,coords,"CARTESIAN",MED_EN::MED_FULL_INTERLACE);
-  delete [] coords;
-  mesh->setNumberOfTypes(1,MED_EN::MED_CELL);
-  mesh->setTypes(&type,MED_EN::MED_CELL);
-  mesh->setNumberOfElements(&nbelems,MED_EN::MED_CELL);
-  
-  int* conn = new int [nbelems*(type%100)];
-  if (dim==2)
+  case 2:
     {
-      for (int ix=0; ix<nbedge; ix++)
-        for (int iy=0; iy<nbedge; iy++)
-          {
-            int ielem=(ix*nbedge+iy);
-            conn [ielem*4]=ix*(nbedge+1)+iy+1;
-            conn [ielem*4+1]=ix*(nbedge+1)+iy+1+1;
-            conn [ielem*4+2]=(ix+1)*(nbedge+1)+iy+1+1;
-            conn [ielem*4+3]=(ix+1)*(nbedge+1)+iy+1;                               
-          }
+      c->setCoords(arr,arr);
+      break;
     }
-  if (dim==3)
+  case 3:
     {
-      for (int ix=0; ix<nbedge; ix++)
-        for (int iy=0; iy<nbedge; iy++)
-          for (int iz=0; iz<nbedge; iz++)
-            {
-              int ielem=(ix*nbedge*nbedge+iy*nbedge+iz);
-              conn [ielem*8]=ix*(nbedge+1)*(nbedge+1)+iy*(nbedge+1)+iz+1;
-              conn [ielem*8+1]=(ix+1)*(nbedge+1)*(nbedge+1)+iy*(nbedge+1)+iz+1;
-              conn [ielem*8+2]=(ix+1)*(nbedge+1)*(nbedge+1)+(iy+1)*(nbedge+1)+iz+1;
-              conn [ielem*8+3]=ix*(nbedge+1)*(nbedge+1)+(iy+1)*(nbedge+1)+iz+1;
-              conn [ielem*8+4]=ix*(nbedge+1)*(nbedge+1)+iy*(nbedge+1)+iz+1+1;
-              conn [ielem*8+5]=(ix+1)*(nbedge+1)*(nbedge+1)+iy*(nbedge+1)+iz+1+1;
-              conn [ielem*8+6]=(ix+1)*(nbedge+1)*(nbedge+1)+(iy+1)*(nbedge+1)+iz+1+1;
-              conn [ielem*8+7]=ix*(nbedge+1)*(nbedge+1)+(iy+1)*(nbedge+1)+iz+1+1;
-            }
+      c->setCoords(arr,arr,arr);
+      break;
     }
-  mesh->setConnectivity(MED_EN::MED_CELL,type,conn);
-  delete [] conn;
-  return mesh;
+  default:
+    throw INTERP_KERNEL::Exception("MEDMeshMaker : only dim 2 or 3 supported !");
+  }
+  return c->buildUnstructured();
 }
index 744587041729f436bad12c145822df85148a7f9a..7d188ce3f6a26a20863d625da402d0073c45ee6e 100644 (file)
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
-#include "MEDMEM_define.hxx"
-namespace MEDMEM
-{
-  class MESH;
-}
+#include "MEDCouplingUMesh.hxx"
 
-MEDMEM::MESH* MEDMeshMaker(int dim, int nbedge, MED_EN::medGeometryElement type);
+ParaMEDMEM::MEDCouplingUMesh *MEDMeshMaker(int dim, int nbedge);
index a0848ec5297441d75a263e870c1032b3a55f84a5..4e50f6efb623d0e6d78332f39ad9b5ffef7add82 100644 (file)
@@ -25,8 +25,7 @@ lib_LTLIBRARIES = libInterpKernelTest.la
 UNUSED_FILES =                               \
        Interpolation3DTest.cxx              \
        Interpolation3DTest.hxx              \
-       MultiElement3DSurfTests.hxx          \
-       TestingUtils.hxx
+       MultiElement3DSurfTests.hxx
 
 EXTRA_DIST +=                                \
        perf_test.sh                         \
index 6d703e78b546907e95c4ac851d0a4610b55fff82..a5fb47ba90046dcf67e9d1108ae9a826b1cbaa14 100644 (file)
@@ -37,8 +37,9 @@ namespace INTERP_KERNEL
 }
 
 
-namespace MEDMEM {
-  class MESH;
+namespace ParaMEDMEM
+{
+  class MEDCouplingUMesh;
 }
 
 namespace INTERP_TEST
@@ -70,9 +71,9 @@ namespace INTERP_TEST
 
     double sumCol(const IntersectionMatrix& m, int i) const;
 
-    void getVolumes( MEDMEM::MESH& mesh, double* tab) const;
+    void getVolumes(ParaMEDMEM::MEDCouplingUMesh& mesh, double* tab) const;
 
-    bool testVolumes(const IntersectionMatrix& m,  MEDMEM::MESH& sMesh,  MEDMEM::MESH& tMesh) const;
+    bool testVolumes(const IntersectionMatrix& m,  ParaMEDMEM::MEDCouplingUMesh& sMesh,  ParaMEDMEM::MEDCouplingUMesh& tMesh) const;
 
     double sumVolume(const IntersectionMatrix& m) const;
 
index 6121329e7f65b04f7caf63917a4bcd047f8e05f0..28ce7bde9511e07b6af5200b85121fd385ed2dd0 100644 (file)
 //
 #include "TestInterpKernelUtils.hxx"
 
-#include "MEDNormalizedUnstructuredMesh.hxx"
-#include "MEDNormalizedUnstructuredMesh.txx"
-
 #include "MeshTestToolkit.hxx"
-#include "MEDMEM_Mesh.hxx"
-#include "MEDMEM_Field.hxx"
-#include "MEDMEM_Support.hxx"
+
+#include "MEDFileMesh.hxx"
+
+#include "MEDCouplingNormalizedUnstructuredMesh.hxx"
+#include "MEDCouplingNormalizedUnstructuredMesh.txx"
+#include "MEDCouplingFieldDouble.hxx"
 
 #include "Interpolation3DSurf.hxx"
 #include "Interpolation2D.txx"
 #include "Interpolation3D.txx"
 
-#include <iostream>
 #include <map>
-#include <vector>
 #include <cmath>
+#include <vector>
+#include <cstring>
+#include <iostream>
 #include <algorithm>
 
 
@@ -48,9 +49,7 @@
 #include <cppunit/extensions/HelperMacros.h>
 
 //#define VOL_PREC 1.0e-6
-
-using namespace MEDMEM;
-using namespace MED_EN;
+using namespace ParaMEDMEM;
 using namespace INTERP_KERNEL;
 
 namespace INTERP_TEST
@@ -105,22 +104,10 @@ namespace INTERP_TEST
    * @param tab    pointer to double[no. elements of mesh] array in which to store the volumes
    */
   template <int SPACEDIM, int MESHDIM>
-  void MeshTestToolkit<SPACEDIM,MESHDIM>::getVolumes(MEDMEM::MESH& mesh, double* tab) const
+  void MeshTestToolkit<SPACEDIM,MESHDIM>::getVolumes(ParaMEDMEM::MEDCouplingUMesh& mesh, double *tab) const
   {
-    const SUPPORT *sup=mesh.getSupportOnAll( MED_CELL );
-    FIELD<double>* f;
-    switch (MESHDIM)
-      {
-      case 2:
-        f=mesh.getArea(sup);
-        break;
-      case 3:
-        f=mesh.getVolume(sup);
-        break;
-      }
-    const double *tabS = f->getValue();
-    std::copy(tabS,tabS+mesh.getNumberOfElements(MED_CELL,MED_ALL_ELEMENTS),tab);
-    f->removeReference();
+    MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> vol=mesh.getMeasureField(true);
+    std::copy(vol->getArray()->begin(),vol->getArray()->end(),tab);
   }
 
   /**
@@ -163,15 +150,15 @@ namespace INTERP_TEST
    * @return true if the condition is verified, false if not.
    */
   template <int SPACEDIM, int MESHDIM>
-  bool MeshTestToolkit<SPACEDIM,MESHDIM>::testVolumes(const IntersectionMatrix& m,  MEDMEM::MESH& sMesh,  MEDMEM::MESH& tMesh) const
+  bool MeshTestToolkit<SPACEDIM,MESHDIM>::testVolumes(const IntersectionMatrix& m,  ParaMEDMEM::MEDCouplingUMesh& sMesh,  ParaMEDMEM::MEDCouplingUMesh& tMesh) const
   {
     bool ok = true;
 
     // source elements
-    double* sVol = new double[sMesh.getNumberOfElements(MED_CELL,MED_ALL_ELEMENTS)];
+    double* sVol = new double[sMesh.getNumberOfCells()];
     getVolumes(sMesh, sVol);
 
-    for(int i = 0; i < sMesh.getNumberOfElements(MED_CELL,MED_ALL_ELEMENTS); ++i)
+    for(int i = 0; i < sMesh.getNumberOfCells(); ++i)
       {
         const double sum_row = sumRow(m, i+1);
         if(!epsilonEqualRelative(sum_row, fabs(sVol[i]), _precision))
@@ -183,9 +170,9 @@ namespace INTERP_TEST
       }
 
     // target elements
-    double* tVol = new double[tMesh.getNumberOfElements(MED_CELL,MED_ALL_ELEMENTS)];
+    double* tVol = new double[tMesh.getNumberOfCells()];
     getVolumes(tMesh, tVol);
-    for(int i = 0; i < tMesh.getNumberOfElements(MED_CELL,MED_ALL_ELEMENTS); ++i)
+    for(int i = 0; i < tMesh.getNumberOfCells(); ++i)
       {
         const double sum_col = sumCol(m, i);
         if(!epsilonEqualRelative(sum_col,fabs(tVol[i]), _precision))
@@ -300,7 +287,7 @@ namespace INTERP_TEST
     bool isDiagonal = true;
     for(IntersectionMatrix::const_iterator iter = m.begin() ; iter != m.end() ; ++iter)
       {
-        for(map<int, double>::const_iterator iter2 = iter->begin() ; iter2 != iter->end() ; ++iter2)
+        for(std::map<int, double>::const_iterator iter2 = iter->begin() ; iter2 != iter->end() ; ++iter2)
           {
             int j = iter2->first;
             const double vol = iter2->second;
@@ -332,12 +319,12 @@ namespace INTERP_TEST
   void MeshTestToolkit<SPACEDIM,MESHDIM>::dumpIntersectionMatrix(const IntersectionMatrix& m) const
   {
     int i = 0;
-    std::cout << "Intersection matrix is " << endl;
+    std::cout << "Intersection matrix is " << std::endl;
     for(IntersectionMatrix::const_iterator iter = m.begin() ; iter != m.end() ; ++iter)
       {
-        for(map<int, double>::const_iterator iter2 = iter->begin() ; iter2 != iter->end() ; ++iter2)
+        for(std::map<int, double>::const_iterator iter2 = iter->begin() ; iter2 != iter->end() ; ++iter2)
           {
-            std::cout << "V(" << i << ", " << iter2->first << ") = " << iter2->second << endl;
+            std::cout << "V(" << i << ", " << iter2->first << ") = " << iter2->second << std::endl;
           }
         ++i;
       }
@@ -360,13 +347,15 @@ namespace INTERP_TEST
     LOG(1, std::endl << "=== -> intersecting src = " << mesh1path << ", target = " << mesh2path );
 
     LOG(5, "Loading " << mesh1 << " from " << mesh1path);
-    MESH sMesh(MED_DRIVER, INTERP_TEST::getResourceFile(mesh1path), mesh1);
+    MEDCouplingAutoRefCountObjectPtr<MEDFileUMesh> sMeshML=MEDFileUMesh::New(INTERP_TEST::getResourceFile(mesh1path).c_str(),mesh1);
+    MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> sMesh=sMeshML->getMeshAtLevel(0);
 
     LOG(5, "Loading " << mesh2 << " from " << mesh2path);
-    MESH tMesh(MED_DRIVER, INTERP_TEST::getResourceFile(mesh2path), mesh2);
+    MEDCouplingAutoRefCountObjectPtr<MEDFileUMesh> tMeshML=MEDFileUMesh::New(INTERP_TEST::getResourceFile(mesh2path).c_str(),mesh2);
+    MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> tMesh=tMeshML->getMeshAtLevel(0);
 
-    MEDNormalizedUnstructuredMesh<SPACEDIM,MESHDIM> sMesh_wrapper(&sMesh);
-    MEDNormalizedUnstructuredMesh<SPACEDIM,MESHDIM> tMesh_wrapper(&tMesh);
+    MEDCouplingNormalizedUnstructuredMesh<SPACEDIM,MESHDIM> sMesh_wrapper(sMesh);
+    MEDCouplingNormalizedUnstructuredMesh<SPACEDIM,MESHDIM> tMesh_wrapper(tMesh);
 
     if (SPACEDIM==2 && MESHDIM==2)
       {
@@ -387,12 +376,12 @@ namespace INTERP_TEST
       }
     else
       {
-        throw MEDEXCEPTION("Wrong dimensions");
+        throw INTERP_KERNEL::Exception("Wrong dimensions");
       }
     // if reflexive, check volumes
     if(strcmp(mesh1path,mesh2path) == 0)
       {
-        const bool row_and_col_sums_ok = testVolumes(m, sMesh, tMesh);
+        const bool row_and_col_sums_ok = testVolumes(m, *sMesh, *tMesh);
         CPPUNIT_ASSERT_EQUAL_MESSAGE("Row or column sums incorrect", true, row_and_col_sums_ok);
         const bool is_diagonal =testDiagonal(m);
         CPPUNIT_ASSERT_EQUAL_MESSAGE("Self intersection matrix is not diagonal", true, is_diagonal);
@@ -485,9 +474,9 @@ namespace INTERP_TEST
   template <int SPACEDIM, int MESHDIM>
   void MeshTestToolkit<SPACEDIM,MESHDIM>::intersectMeshes(const char* mesh1, const char* mesh2, const double correctVol, const double prec, bool doubleTest) const
   {
-    const string path1 = string(mesh1) + string(".med");
+    const std::string path1 = std::string(mesh1) + std::string(".med");
     std::cout << "here :" << path1 << std::endl;
-    const string path2 = string(mesh2) + string(".med");
+    const std::string path2 = std::string(mesh2) + std::string(".med");
 
     intersectMeshes(path1.c_str(), mesh1, path2.c_str(), mesh2, correctVol, prec, doubleTest);
   }
index bd8fff56b274cd8d497f191b009bd2de64393f38..a32aad8023df24ae1146ff752cf094640928d8ae 100644 (file)
 #include "VectorUtils.hxx"
 #include "TestInterpKernelUtils.hxx"
 
-#include "MEDMEM_Mesh.hxx"
-#include "MEDNormalizedUnstructuredMesh.hxx"
+#include "MEDCouplingNormalizedUnstructuredMesh.hxx"
 
 #include <cassert>
 #include <string>
 
-using namespace MEDMEM;
-using namespace MED_EN;
-
 /**
  * \file PerfTest.cxx
  * Test program which takes two meshes and calculates their intersection matrix. 
@@ -71,14 +67,16 @@ namespace INTERP_TEST
       LOG(1, std::endl << "=== -> intersecting src = " << mesh1 << ", target = " << mesh2 );
       
       LOG(5, "Loading " << mesh1 << " from " << mesh1path);
-      const MESH sMesh(MED_DRIVER, INTERP_TEST::getResourceFile(mesh1path), mesh1);
+      MEDCouplingAutoRefCountObjectPtr<MEDFileUMesh> sMeshML=MEDFileUMesh::New(INTERP_TEST::getResourceFile(mesh1path).c_str(),mesh1);
+      MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> sMesh=sMeshML->getMeshAtLevel(0);
     
     
       LOG(5, "Loading " << mesh2 << " from " << mesh2path);
-      const MESH tMesh(MED_DRIVER, INTERP_TEST::getResourceFile(mesh2path), mesh2);
+      MEDCouplingAutoRefCountObjectPtr<MEDFileUMesh> tMeshML=MEDFileUMesh::New(INTERP_TEST::getResourceFile(mesh2path).c_str(),mesh2);
+    MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> tMesh=tMeshML->getMeshAtLevel(0);
       
-      MEDNormalizedUnstructuredMesh<3,3> sMesh_wrapper(&sMesh);
-      MEDNormalizedUnstructuredMesh<3,3> tMesh_wrapper(&tMesh);
+      MEDCouplingNormalizedUnstructuredMesh<3,3> sMesh_wrapper(sMesh);
+      MEDCouplingNormalizedUnstructuredMesh<3,3> tMesh_wrapper(tMesh);
       
       Interpolation3D interpolator;
       interpolator.interpolateMeshes(sMesh_wrapper, tMesh_wrapper,m,"P0P0");
@@ -108,7 +106,7 @@ namespace INTERP_TEST
       for(IntersectionMatrix::const_iterator iter = m.begin() ; iter != m.end() ; ++iter)
         {
           numElems += iter->size();
-          for(map<int, double>::const_iterator iter2 = iter->begin() ; iter2 != iter->end() ; ++iter2)
+          for(std::map<int, double>::const_iterator iter2 = iter->begin() ; iter2 != iter->end() ; ++iter2)
             {
               if(!INTERP_KERNEL::epsilonEqual(iter2->second, 0.0, VOL_PREC))
                 {
@@ -137,11 +135,11 @@ int main(int argc, char** argv)
   assert(argc == 3);
   
   // load meshes
-  const string mesh1 = argv[1];
-  const string mesh2 = argv[2];
+  const std::string mesh1 = argv[1];
+  const std::string mesh2 = argv[2];
 
-  const string mesh1path = mesh1 + ".med";
-  const string mesh2path = mesh2 + ".med";
+  const std::string mesh1path = mesh1 + ".med";
+  const std::string mesh2path = mesh2 + ".med";
 
   IntersectionMatrix m;
 
index 0e1d7de5dd6626f779cdf21a8702a072557393e8..cb6c907be11b1ea0d269a9b048602487a4ba3d6e 100644 (file)
 #include "UnitTetraIntersectionBaryTest.hxx"
 #include "UnitTetra3D2DIntersectionTest.hxx"
 
-#ifdef DISABLE_MICROMED
 #include "HexaTests.hxx"
 #include "InterpolationOptionsTest.hxx"
 #include "MultiElement2DTests.hxx"
 #include "MultiElementTetraTests.hxx"
-#include "PointLocatorTest.hxx"
 #include "SingleElementTetraTests.hxx"
-#endif
 
 using namespace INTERP_TEST;
 
 //--- Registers the fixture into the 'registry'
 
-CPPUNIT_TEST_SUITE_REGISTRATION( BBTreeTest);
+CPPUNIT_TEST_SUITE_REGISTRATION( BBTreeTest );
 CPPUNIT_TEST_SUITE_REGISTRATION( ExprEvalInterpTest );
 CPPUNIT_TEST_SUITE_REGISTRATION( QuadraticPlanarInterpTest );
 CPPUNIT_TEST_SUITE_REGISTRATION( SingleElementPlanarTests );
@@ -49,14 +46,11 @@ CPPUNIT_TEST_SUITE_REGISTRATION( TransformedTriangleTest );
 CPPUNIT_TEST_SUITE_REGISTRATION( UnitTetraIntersectionBaryTest );
 CPPUNIT_TEST_SUITE_REGISTRATION( UnitTetra3D2DIntersectionTest );
 
-#ifdef DISABLE_MICROMED
-CPPUNIT_TEST_SUITE_REGISTRATION( HexaTests );
 CPPUNIT_TEST_SUITE_REGISTRATION( InterpolationOptionsTest );
+CPPUNIT_TEST_SUITE_REGISTRATION( HexaTests );
 CPPUNIT_TEST_SUITE_REGISTRATION( MultiElement2DTests );
 CPPUNIT_TEST_SUITE_REGISTRATION( MultiElementTetraTests );
-CPPUNIT_TEST_SUITE_REGISTRATION( PointLocatorTest);
 CPPUNIT_TEST_SUITE_REGISTRATION( SingleElementTetraTests );
-#endif
 
 // --- generic Main program from KERNEL_SRC/src/Basics/Test
 
index 76ab592741699bdbe94fc04f8561e7093cedbd5a..d468186789c49e3204e566e05a3971fc66c55c1e 100644 (file)
@@ -21,7 +21,8 @@
 #define _TESTING_UTILS_HXX_
 
 #include "Interpolation3D.hxx"
-#include "MEDMEM_Mesh.hxx"
+#include "MEDFileMesh.hxx"
+#include "MEDCouplingUMesh.hxx"
 
 #include <iostream>
 #include <map>
@@ -39,9 +40,8 @@
 // 5 - misc
 #include "Log.hxx"
 
-using namespace MEDMEM;
+using namespace ParaMEDMEM;
 using namespace INTERP_KERNEL;
-using namespace MED_EN;
 
 
 double sumVolume(const IntersectionMatrix& m) 
@@ -212,14 +212,17 @@ void calcIntersectionMatrix(const char* mesh1path, const char* mesh1, const char
   LOG(1, std::endl << "=== -> intersecting src = " << mesh1 << ", target = " << mesh2 );
 
   LOG(5, "Loading " << mesh1 << " from " << mesh1path);
-  const MESH sMesh(MED_DRIVER, dataDir+mesh1path, mesh1);
-  const int numSrcElems = sMesh.getNumberOfElements(MED_CELL, MED_ALL_ELEMENTS);
+  MEDCouplingAutoRefCountObjectPtr<MEDFileUMesh> sMeshML=MEDFileUMesh::New((dataDir+mesh1path).c_str(),mesh1);
+  MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> sMesh=sMeshML->getMeshAtLevel(0);
+
+  const int numSrcElems = sMesh->getNumberOfCells();
   LOG(1, "Source mesh has " << numSrcElems << " elements");
 
 
   LOG(5, "Loading " << mesh2 << " from " << mesh2path);
-  const MESH tMesh(MED_DRIVER, dataDir+mesh2path, mesh2);
-  const int numTargetElems = tMesh.getNumberOfElements(MED_CELL, MED_ALL_ELEMENTS);
+  MEDCouplingAutoRefCountObjectPtr<MEDFileUMesh> tMeshML=MEDFileUMesh::New((dataDir+mesh2path).c_str(),mesh2);
+  MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> tMesh=tMeshML->getMeshAtLevel(0);
+  const int numTargetElems = tMesh->getNumberOfCells();
 
   LOG(1, "Target mesh has " << numTargetElems << " elements");
 
index 765fb7f8f87622d67b28440eab04651edba2e7b7..d429b2cffd310e030c4234fa1b2967c01bbcd330 100644 (file)
@@ -57,7 +57,7 @@ int main(int argc, char** argv)
     }
   // Reading file structure
   cout << "Reading : " << flush;
-  MEDCouplingAutoRefCountObjectPtr<MEDFileData> fd=MEDFileData::New(filename_in);
+  MEDCouplingAutoRefCountObjectPtr<MEDFileData> fd=MEDFileData::New(filename_in.c_str());
   MEDFileMesh *m=fd->getMeshes()->getMeshWithName(meshname.c_str());
   MEDFileUMesh *mc=dynamic_cast<MEDFileUMesh *>(m);
   if(!mc)
@@ -79,7 +79,7 @@ int main(int argc, char** argv)
   // Compute permutation iperm->new2old perm->old2new
   vector<int> iperm,perm;
   Renumbering *renumb=RenumberingFactory(type_renum);
-  renumb->renumber(graph,graph_index,nb_cell,iperm,perm);
+  renumb->renumber(graph,graph_index,workMesh->getNumberOfCells(),iperm,perm);
   delete renumb;
   t_compute_graph=clock();
   cout << " : " << (t_compute_graph-t_read_st)/(double) CLOCKS_PER_SEC << "s" << endl;
@@ -100,8 +100,10 @@ int main(int argc, char** argv)
   // Fields
   cout << "Reordering fields and writing : " << flush;
   MEDFileFields *fs=fd->getFields();
-  fs->renumberEntitiesLyingOnMesh(meshname.c_str(),code,code,&perm[0]);
-  fs->write();
+  MEDCouplingAutoRefCountObjectPtr<DataArrayInt> o2n=DataArrayInt::New();
+  o2n->useArray(&perm[0],false,CPP_DEALLOC,perm.size(),1);
+  fs->renumberEntitiesLyingOnMesh(meshname.c_str(),code,code,o2n);
+  fs->write(filename_out.c_str(),0);
   t_field=clock();
   cout << " : " << (t_field-t_family)/(double) CLOCKS_PER_SEC << "s" << endl << flush;
   return 0;