From: ageay Date: Thu, 4 Apr 2013 13:47:52 +0000 (+0000) Subject: MEDMEM suppression X-Git-Tag: V7_3_1b1~451 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=aaa6cbecf0dc3e3f8858cd6e2be59844a2037417;p=tools%2Fmedcoupling.git MEDMEM suppression --- diff --git a/src/INTERP_KERNELTest/CMakeLists.txt b/src/INTERP_KERNELTest/CMakeLists.txt index 6011adb31..f843aa0e1 100644 --- a/src/INTERP_KERNELTest/CMakeLists.txt +++ b/src/INTERP_KERNELTest/CMakeLists.txt @@ -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}") diff --git a/src/INTERP_KERNELTest/Interpolation3DTest.cxx b/src/INTERP_KERNELTest/Interpolation3DTest.cxx index 44e600c08..ae0069c13 100644 --- a/src/INTERP_KERNELTest/Interpolation3DTest.cxx +++ b/src/INTERP_KERNELTest/Interpolation3DTest.cxx @@ -18,19 +18,19 @@ // #include "Interpolation3DTest.hxx" -#include "MEDMEM_Mesh.hxx" -#include +#include "MEDFileMesh.hxx" +#include "MEDCouplingUMesh.hxx" +#include "MEDCouplingFieldDouble.hxx" + #include -#include #include +#include +#include #include #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* f=mesh.getVolume(sup); - const double *tabS=f->getValue(); - std::copy(tabS,tabS+mesh.getNumberOfElements(MED_CELL,MED_ALL_ELEMENTS),tab) - delete sup; + MEDCouplingAutoRefCountObjectPtr 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)) diff --git a/src/INTERP_KERNELTest/Interpolation3DTest.hxx b/src/INTERP_KERNELTest/Interpolation3DTest.hxx index 4b3a8bb0c..e2a1c5823 100644 --- a/src/INTERP_KERNELTest/Interpolation3DTest.hxx +++ b/src/INTERP_KERNELTest/Interpolation3DTest.hxx @@ -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 { diff --git a/src/INTERP_KERNELTest/InterpolationOptionsTest.cxx b/src/INTERP_KERNELTest/InterpolationOptionsTest.cxx index cc79d6341..fc6c438d1 100644 --- a/src/INTERP_KERNELTest/InterpolationOptionsTest.cxx +++ b/src/INTERP_KERNELTest/InterpolationOptionsTest.cxx @@ -17,13 +17,19 @@ // 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 #include +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 *source_field=new FIELD(source_support,1); - double* value=const_cast(source_field->getValue()); - for (int i=0; igetNumberOfElements(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; igetNumberOfCells(); i++) value[i]=1.0; - const MEDMEM::SUPPORT *target_support=target_mesh->getSupportOnAll(MED_EN::MED_CELL); - MEDMEM::FIELD *target_field=new FIELD(target_support,1); - double* targetvalue=const_cast(target_field->getValue()); - for (int i=0; igetNumberOfElements(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; igetNumberOfCells(); 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(); } } diff --git a/src/INTERP_KERNELTest/InterpolationOptionsTest.hxx b/src/INTERP_KERNELTest/InterpolationOptionsTest.hxx index 27ca2be4b..d9cf333eb 100644 --- a/src/INTERP_KERNELTest/InterpolationOptionsTest.hxx +++ b/src/INTERP_KERNELTest/InterpolationOptionsTest.hxx @@ -24,7 +24,6 @@ #include "InterpKernelTestExport.hxx" #include "InterpolationOptions.hxx" -#include "MEDMEM_Field.hxx" namespace INTERP_TEST { diff --git a/src/INTERP_KERNELTest/MEDMeshMaker.cxx b/src/INTERP_KERNELTest/MEDMeshMaker.cxx index 83efbb661..1e3341b24 100644 --- a/src/INTERP_KERNELTest/MEDMeshMaker.cxx +++ b/src/INTERP_KERNELTest/MEDMeshMaker.cxx @@ -17,85 +17,32 @@ // 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 c=MEDCouplingCMesh::New(); + MEDCouplingAutoRefCountObjectPtr 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; iysetCoordinates(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; ixsetCoords(arr,arr); + break; } - if (dim==3) + case 3: { - for (int ix=0; ixsetCoords(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(); } diff --git a/src/INTERP_KERNELTest/MEDMeshMaker.hxx b/src/INTERP_KERNELTest/MEDMeshMaker.hxx index 744587041..7d188ce3f 100644 --- a/src/INTERP_KERNELTest/MEDMeshMaker.hxx +++ b/src/INTERP_KERNELTest/MEDMeshMaker.hxx @@ -17,10 +17,6 @@ // 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); diff --git a/src/INTERP_KERNELTest/Makefile.am b/src/INTERP_KERNELTest/Makefile.am index a0848ec52..4e50f6efb 100644 --- a/src/INTERP_KERNELTest/Makefile.am +++ b/src/INTERP_KERNELTest/Makefile.am @@ -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 \ diff --git a/src/INTERP_KERNELTest/MeshTestToolkit.hxx b/src/INTERP_KERNELTest/MeshTestToolkit.hxx index 6d703e78b..a5fb47ba9 100644 --- a/src/INTERP_KERNELTest/MeshTestToolkit.hxx +++ b/src/INTERP_KERNELTest/MeshTestToolkit.hxx @@ -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; diff --git a/src/INTERP_KERNELTest/MeshTestToolkit.txx b/src/INTERP_KERNELTest/MeshTestToolkit.txx index 6121329e7..28ce7bde9 100644 --- a/src/INTERP_KERNELTest/MeshTestToolkit.txx +++ b/src/INTERP_KERNELTest/MeshTestToolkit.txx @@ -18,22 +18,23 @@ // #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 #include -#include #include +#include +#include +#include #include @@ -48,9 +49,7 @@ #include //#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 - void MeshTestToolkit::getVolumes(MEDMEM::MESH& mesh, double* tab) const + void MeshTestToolkit::getVolumes(ParaMEDMEM::MEDCouplingUMesh& mesh, double *tab) const { - const SUPPORT *sup=mesh.getSupportOnAll( MED_CELL ); - FIELD* 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 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 - bool MeshTestToolkit::testVolumes(const IntersectionMatrix& m, MEDMEM::MESH& sMesh, MEDMEM::MESH& tMesh) const + bool MeshTestToolkit::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::const_iterator iter2 = iter->begin() ; iter2 != iter->end() ; ++iter2) + for(std::map::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::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::const_iterator iter2 = iter->begin() ; iter2 != iter->end() ; ++iter2) + for(std::map::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 sMeshML=MEDFileUMesh::New(INTERP_TEST::getResourceFile(mesh1path).c_str(),mesh1); + MEDCouplingAutoRefCountObjectPtr sMesh=sMeshML->getMeshAtLevel(0); LOG(5, "Loading " << mesh2 << " from " << mesh2path); - MESH tMesh(MED_DRIVER, INTERP_TEST::getResourceFile(mesh2path), mesh2); + MEDCouplingAutoRefCountObjectPtr tMeshML=MEDFileUMesh::New(INTERP_TEST::getResourceFile(mesh2path).c_str(),mesh2); + MEDCouplingAutoRefCountObjectPtr tMesh=tMeshML->getMeshAtLevel(0); - MEDNormalizedUnstructuredMesh sMesh_wrapper(&sMesh); - MEDNormalizedUnstructuredMesh tMesh_wrapper(&tMesh); + MEDCouplingNormalizedUnstructuredMesh sMesh_wrapper(sMesh); + MEDCouplingNormalizedUnstructuredMesh 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 void MeshTestToolkit::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); } diff --git a/src/INTERP_KERNELTest/PerfTest.cxx b/src/INTERP_KERNELTest/PerfTest.cxx index bd8fff56b..a32aad802 100644 --- a/src/INTERP_KERNELTest/PerfTest.cxx +++ b/src/INTERP_KERNELTest/PerfTest.cxx @@ -24,15 +24,11 @@ #include "VectorUtils.hxx" #include "TestInterpKernelUtils.hxx" -#include "MEDMEM_Mesh.hxx" -#include "MEDNormalizedUnstructuredMesh.hxx" +#include "MEDCouplingNormalizedUnstructuredMesh.hxx" #include #include -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 sMeshML=MEDFileUMesh::New(INTERP_TEST::getResourceFile(mesh1path).c_str(),mesh1); + MEDCouplingAutoRefCountObjectPtr sMesh=sMeshML->getMeshAtLevel(0); LOG(5, "Loading " << mesh2 << " from " << mesh2path); - const MESH tMesh(MED_DRIVER, INTERP_TEST::getResourceFile(mesh2path), mesh2); + MEDCouplingAutoRefCountObjectPtr tMeshML=MEDFileUMesh::New(INTERP_TEST::getResourceFile(mesh2path).c_str(),mesh2); + MEDCouplingAutoRefCountObjectPtr 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::const_iterator iter2 = iter->begin() ; iter2 != iter->end() ; ++iter2) + for(std::map::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; diff --git a/src/INTERP_KERNELTest/TestInterpKernel.cxx b/src/INTERP_KERNELTest/TestInterpKernel.cxx index 0e1d7de5d..cb6c907be 100644 --- a/src/INTERP_KERNELTest/TestInterpKernel.cxx +++ b/src/INTERP_KERNELTest/TestInterpKernel.cxx @@ -27,20 +27,17 @@ #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 diff --git a/src/INTERP_KERNELTest/TestingUtils.hxx b/src/INTERP_KERNELTest/TestingUtils.hxx index 76ab59274..d46818678 100644 --- a/src/INTERP_KERNELTest/TestingUtils.hxx +++ b/src/INTERP_KERNELTest/TestingUtils.hxx @@ -21,7 +21,8 @@ #define _TESTING_UTILS_HXX_ #include "Interpolation3D.hxx" -#include "MEDMEM_Mesh.hxx" +#include "MEDFileMesh.hxx" +#include "MEDCouplingUMesh.hxx" #include #include @@ -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 sMeshML=MEDFileUMesh::New((dataDir+mesh1path).c_str(),mesh1); + MEDCouplingAutoRefCountObjectPtr 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 tMeshML=MEDFileUMesh::New((dataDir+mesh2path).c_str(),mesh2); + MEDCouplingAutoRefCountObjectPtr tMesh=tMeshML->getMeshAtLevel(0); + const int numTargetElems = tMesh->getNumberOfCells(); LOG(1, "Target mesh has " << numTargetElems << " elements"); diff --git a/src/RENUMBER/renumbering.cxx b/src/RENUMBER/renumbering.cxx index 765fb7f8f..d429b2cff 100644 --- a/src/RENUMBER/renumbering.cxx +++ b/src/RENUMBER/renumbering.cxx @@ -57,7 +57,7 @@ int main(int argc, char** argv) } // Reading file structure cout << "Reading : " << flush; - MEDCouplingAutoRefCountObjectPtr fd=MEDFileData::New(filename_in); + MEDCouplingAutoRefCountObjectPtr fd=MEDFileData::New(filename_in.c_str()); MEDFileMesh *m=fd->getMeshes()->getMeshWithName(meshname.c_str()); MEDFileUMesh *mc=dynamic_cast(m); if(!mc) @@ -79,7 +79,7 @@ int main(int argc, char** argv) // Compute permutation iperm->new2old perm->old2new vector 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 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;