1 // Copyright (C) 2007-2015 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #ifndef __TU_MESH_TEST_TOOLKIT_HXX__
21 #define __TU_MESH_TEST_TOOLKIT_HXX__
23 #include "Interpolation3D.hxx"
24 #include "Interpolation3D.txx"
25 #include "InterpolationPlanar.hxx"
30 #define ERR_TOL 1.0e-8
32 typedef std::vector<std::map<int,double> > IntersectionMatrix;
34 namespace INTERP_KERNEL
36 class Interpolation3D;
42 class MEDCouplingUMesh;
48 * \brief Class providing services for mesh intersection tests.
51 template<int SPACEDIM, int MESHDIM>
57 INTERP_KERNEL::IntersectionType _intersectionType;//Used only in the case MESHDIM==2 (planar intersections)
59 MeshTestToolkit():_precision(1.e-6),_intersectionType(INTERP_KERNEL::Triangulation) {}
63 void intersectMeshes(const char* mesh1, const char* mesh2, const double correctVol, const double prec = 1.0e-5, bool doubleTest = true) const;
65 // 1.0e-5 here is due to limited precision of "correct" volumes calculated in Salome
66 void intersectMeshes(const char* mesh1path, const char* mesh1, const char* mesh2path, const char* mesh2, const double correctVol, const double prec = 1.0e-5, bool doubleTest = true) const;
68 void dumpIntersectionMatrix(const IntersectionMatrix& m) const;
70 double sumRow(const IntersectionMatrix& m, int i) const;
72 double sumCol(const IntersectionMatrix& m, int i) const;
74 void getVolumes(ParaMEDMEM::MEDCouplingUMesh& mesh, double* tab) const;
76 bool testVolumes(const IntersectionMatrix& m, ParaMEDMEM::MEDCouplingUMesh& sMesh, ParaMEDMEM::MEDCouplingUMesh& tMesh) const;
78 double sumVolume(const IntersectionMatrix& m) const;
80 bool areCompatitable( const IntersectionMatrix& m1, const IntersectionMatrix& m2) const;
82 bool testTranspose(const IntersectionMatrix& m1, const IntersectionMatrix& m2) const;
84 bool testDiagonal(const IntersectionMatrix& m) const;
86 void calcIntersectionMatrix(const char* mesh1path, const char* mesh1, const char* mesh2path, const char* mesh2, IntersectionMatrix& m) const;