X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FINTERP_KERNELTest%2FMeshTestToolkit.txx;h=aa8c192553a998500b7be01e0323c2e235d90073;hb=214cb0a3e23e084616ebf247642bfbc43811e26d;hp=4ba4f7698b6939fb00a3887ec63d3a81574f70ed;hpb=fb512e2b77325290aaa2b4c9fd8f22d5949b6369;p=tools%2Fmedcoupling.git diff --git a/src/INTERP_KERNELTest/MeshTestToolkit.txx b/src/INTERP_KERNELTest/MeshTestToolkit.txx index 4ba4f7698..aa8c19255 100644 --- a/src/INTERP_KERNELTest/MeshTestToolkit.txx +++ b/src/INTERP_KERNELTest/MeshTestToolkit.txx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2014 CEA/DEN, EDF R&D +// Copyright (C) 2007-2023 CEA/DEN, EDF R&D // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -38,7 +38,7 @@ #include -// levels : +// levels : // 1 - titles and volume results // 2 - symmetry / diagonal results and intersection matrix output // 3 - empty @@ -49,7 +49,7 @@ #include //#define VOL_PREC 1.0e-6 -using namespace ParaMEDMEM; +using namespace MEDCoupling; using namespace INTERP_KERNEL; namespace INTERP_TEST @@ -70,7 +70,7 @@ namespace INTERP_TEST { if(iter->count(i) != 0.0) { - std::map::const_iterator iter2 = iter->find(i); + std::map::const_iterator iter2 = iter->find(i); vol += fabs(iter2->second); } } @@ -89,8 +89,8 @@ namespace INTERP_TEST double MeshTestToolkit::sumCol(const IntersectionMatrix& m, int i) const { double vol = 0.0; - const std::map& col = m[i]; - for(std::map::const_iterator iter = col.begin() ; iter != col.end() ; ++iter) + const std::map& col = m[i]; + for(std::map::const_iterator iter = col.begin() ; iter != col.end() ; ++iter) { vol += fabs(iter->second); } @@ -104,9 +104,9 @@ namespace INTERP_TEST * @param tab pointer to double[no. elements of mesh] array in which to store the volumes */ template - void MeshTestToolkit::getVolumes(ParaMEDMEM::MEDCouplingUMesh& mesh, double *tab) const + void MeshTestToolkit::getVolumes(MEDCoupling::MEDCouplingUMesh& mesh, double *tab) const { - MEDCouplingAutoRefCountObjectPtr vol=mesh.getMeasureField(true); + MCAuto vol=mesh.getMeasureField(true); std::copy(vol->getArray()->begin(),vol->getArray()->end(),tab); } @@ -123,7 +123,7 @@ namespace INTERP_TEST std::vector volumes; for(IntersectionMatrix::const_iterator iter = m.begin() ; iter != m.end() ; ++iter) { - for(std::map::const_iterator iter2 = iter->begin() ; iter2 != iter->end() ; ++iter2) + for(std::map::const_iterator iter2 = iter->begin() ; iter2 != iter->end() ; ++iter2) { volumes.push_back(fabs(iter2->second)); } @@ -138,7 +138,7 @@ namespace INTERP_TEST } /** - * Verifies if for a given intersection matrix the sum of each row is equal to the volumes + * Verifies if for a given intersection matrix the sum of each row is equal to the volumes * of the corresponding source elements and the sum of each column is equal to the volumes * of the corresponding target elements. This will be true as long as the meshes correspond * to the same geometry. The equalities are in the "epsilon-sense", making sure the relative @@ -150,7 +150,7 @@ namespace INTERP_TEST * @return true if the condition is verified, false if not. */ template - bool MeshTestToolkit::testVolumes(const IntersectionMatrix& m, ParaMEDMEM::MEDCouplingUMesh& sMesh, ParaMEDMEM::MEDCouplingUMesh& tMesh) const + bool MeshTestToolkit::testVolumes(const IntersectionMatrix& m, MEDCoupling::MEDCouplingUMesh& sMesh, MEDCoupling::MEDCouplingUMesh& tMesh) const { bool ok = true; @@ -203,9 +203,9 @@ namespace INTERP_TEST int i = 0; for(IntersectionMatrix::const_iterator iter = m1.begin() ; iter != m1.end() ; ++iter) { - for(std::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; + mcIdType j = iter2->first; if(m2.at(j).count(i) == 0) { if(!epsilonEqual(iter2->second, 0.0, _precision)) @@ -245,14 +245,14 @@ namespace INTERP_TEST for(IntersectionMatrix::const_iterator iter = m1.begin() ; iter != m1.end() ; ++iter) { - for(std::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; + mcIdType j = iter2->first; const double v1 = fabs(iter2->second); //if(m2[j - 1].count(i+1) > 0) // { - std::map theMap = m2.at(j); - const double v2 = fabs(theMap[i]); + std::map theMap = m2.at(j); + const double v2 = fabs(theMap[i]); if(v1 != v2) { LOG(2, "V1( " << i << ", " << j << ") = " << v1 << " which is different from V2( " << j << ", " << i << ") = " << v2 << " | diff = " << v1 - v2 ); @@ -267,7 +267,7 @@ namespace INTERP_TEST } if(!isSymmetric) { - LOG(1, "*** matrices are not symmetric"); + LOG(1, "*** matrices are not symmetric"); } return isSymmetric; } @@ -287,9 +287,9 @@ namespace INTERP_TEST bool isDiagonal = true; for(IntersectionMatrix::const_iterator iter = m.begin() ; iter != m.end() ; ++iter) { - for(std::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; + mcIdType j = iter2->first; const double vol = iter2->second; if(vol != 0.0 && (i != j)) { @@ -322,7 +322,7 @@ namespace INTERP_TEST std::cout << "Intersection matrix is " << std::endl; for(IntersectionMatrix::const_iterator iter = m.begin() ; iter != m.end() ; ++iter) { - for(std::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 << std::endl; } @@ -335,9 +335,9 @@ namespace INTERP_TEST * Calculates the intersection matrix for two meshes. * If the source and target meshes are the same, a CppUnit assertion raised if testVolumes() returns false. * - * @param mesh1path the path to the file containing the source mesh, relative to {$MED_ROOT_DIR}/share/salome/resources/med/ + * @param mesh1path the path to the file containing the source mesh, relative to {$MEDCOUPLING_ROOT_DIR}/share/resources/med/ * @param mesh1 the name of the source mesh - * @param mesh2path the path to the file containing the target mesh, relative to {$MED_ROOT_DIR}/share/salome/resources/med/ + * @param mesh2path the path to the file containing the target mesh, relative to {$MEDCOUPLING_ROOT_DIR}/share/resources/med/ * @param mesh2 the name of the target mesh * @param m intersection matrix in which to store the result of the intersection */ @@ -347,12 +347,12 @@ namespace INTERP_TEST LOG(1, std::endl << "=== -> intersecting src = " << mesh1path << ", target = " << mesh2path ); LOG(5, "Loading " << mesh1 << " from " << mesh1path); - MEDCouplingAutoRefCountObjectPtr sMeshML=MEDFileUMesh::New(INTERP_TEST::getResourceFile(mesh1path).c_str(),mesh1); - MEDCouplingAutoRefCountObjectPtr sMesh=sMeshML->getMeshAtLevel(0); + MCAuto sMeshML=MEDFileUMesh::New(INTERP_TEST::getResourceFile(mesh1path).c_str(),mesh1); + MCAuto sMesh=sMeshML->getMeshAtLevel(0); LOG(5, "Loading " << mesh2 << " from " << mesh2path); - MEDCouplingAutoRefCountObjectPtr tMeshML=MEDFileUMesh::New(INTERP_TEST::getResourceFile(mesh2path).c_str(),mesh2); - MEDCouplingAutoRefCountObjectPtr tMesh=tMeshML->getMeshAtLevel(0); + MCAuto tMeshML=MEDFileUMesh::New(INTERP_TEST::getResourceFile(mesh2path).c_str(),mesh2); + MCAuto tMesh=tMeshML->getMeshAtLevel(0); MEDCouplingNormalizedUnstructuredMesh sMesh_wrapper(sMesh); MEDCouplingNormalizedUnstructuredMesh tMesh_wrapper(tMesh); @@ -397,12 +397,12 @@ namespace INTERP_TEST * it will be confirmed that the intersection matrix is diagonal, otherwise the intersection matrices will be * calculated once which each mesh as source mesh, and it will be verified that the they are each others' transpose. * - * @param mesh1path the path to the file containing the source mesh, relative to {$MED_ROOT_DIR}/share/salome/resources/med/ + * @param mesh1path the path to the file containing the source mesh, relative to {$MEDCOUPLING_ROOT_DIR}/share/resources/med/ * @param mesh1 the name of the source mesh - * @param mesh2path the path to the file containing the target mesh, relative to {$MED_ROOT_DIR}/share/salome/resources/med/ + * @param mesh2path the path to the file containing the target mesh, relative to {$MEDCOUPLING_ROOT_DIR}/share/resources/med/ * @param mesh2 the name of the target mesh * @param correctVol the total volume of the intersection of the two meshes - * @param prec maximum relative error to be tolerated in volume comparisions + * @param prec maximum relative error to be tolerated in volume comparisons * @param doubleTest if false, only the test with mesh 1 as the source mesh and mesh 2 as the target mesh will be performed * */ @@ -420,7 +420,7 @@ namespace INTERP_TEST IntersectionMatrix matrix1; calcIntersectionMatrix(mesh1path, mesh1, mesh2path, mesh2, matrix1); -#if LOG_LEVEL >= 2 +#if LOG_LEVEL >= 2 dumpIntersectionMatrix(matrix1); #endif @@ -441,7 +441,7 @@ namespace INTERP_TEST else { IntersectionMatrix matrix2; - calcIntersectionMatrix(mesh2path, mesh2, mesh1path, mesh1, matrix2); + calcIntersectionMatrix(mesh2path, mesh2, mesh1path, mesh1, matrix2); #if LOG_LEVEL >= 2 dumpIntersectionMatrix(matrix2); @@ -460,14 +460,14 @@ namespace INTERP_TEST /** * Utility method used to facilitate the call to intersect meshes. - * It calls intersectMeshes, using "mesh1.med" as file name for the mesh with name "mesh1" and + * It calls intersectMeshes, using "mesh1.med" as file name for the mesh with name "mesh1" and * "mesh2.med" as file name for the mesh with name "mesh2". The rest of the arguments are passed * along as they are. * * @param mesh1 the name of the source mesh * @param mesh2 the name of the target mesh * @param correctVol the total volume of the intersection of the two meshes - * @param prec maximum relative error to be tolerated in volume comparisions + * @param prec maximum relative error to be tolerated in volume comparisons * @param doubleTest if false, only the test with mesh 1 as the source mesh and mesh 2 as the target mesh will be performed * */