${InterpKernelTest_SOURCES}
InterpolationOptionsTest.cxx
MEDMeshMaker.cxx
- PointLocatorTest.cxx
)
SET(PerfTest_SOURCES
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}")
//
#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
//#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
{
}
-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
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))
}
// 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))
#define ERR_TOL 1.0e-8
-using MEDMEM::Interpolation3D;
-class MEDMEM::MESH;
-
/// \brief OBSOLETE - renamed Interpolation3DTestSuite
class Interpolation3DTest : public CppUnit::TestFixture
{
// 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()
*/
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();
}
}
#include "InterpKernelTestExport.hxx"
#include "InterpolationOptions.hxx"
-#include "MEDMEM_Field.hxx"
namespace INTERP_TEST
{
// 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();
}
// 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);
UNUSED_FILES = \
Interpolation3DTest.cxx \
Interpolation3DTest.hxx \
- MultiElement3DSurfTests.hxx \
- TestingUtils.hxx
+ MultiElement3DSurfTests.hxx
EXTRA_DIST += \
perf_test.sh \
}
-namespace MEDMEM {
- class MESH;
+namespace ParaMEDMEM
+{
+ class MEDCouplingUMesh;
}
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;
//
#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>
#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
* @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);
}
/**
* @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))
}
// 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))
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;
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;
}
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)
{
}
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);
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);
}
#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.
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");
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))
{
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;
#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 );
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
#define _TESTING_UTILS_HXX_
#include "Interpolation3D.hxx"
-#include "MEDMEM_Mesh.hxx"
+#include "MEDFileMesh.hxx"
+#include "MEDCouplingUMesh.hxx"
#include <iostream>
#include <map>
// 5 - misc
#include "Log.hxx"
-using namespace MEDMEM;
+using namespace ParaMEDMEM;
using namespace INTERP_KERNEL;
-using namespace MED_EN;
double sumVolume(const IntersectionMatrix& m)
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");
}
// 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)
// 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;
// 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;