Back to index

salome-med  6.5.0
MeshTestToolkit.hxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D
00002 //
00003 // This library is free software; you can redistribute it and/or
00004 // modify it under the terms of the GNU Lesser General Public
00005 // License as published by the Free Software Foundation; either
00006 // version 2.1 of the License.
00007 //
00008 // This library is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011 // Lesser General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU Lesser General Public
00014 // License along with this library; if not, write to the Free Software
00015 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00016 //
00017 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00018 //
00019 
00020 #ifndef __TU_MESH_TEST_TOOLKIT_HXX__
00021 #define __TU_MESH_TEST_TOOLKIT_HXX__
00022 
00023 #include "Interpolation3D.hxx"
00024 #include "Interpolation3D.txx"
00025 #include "InterpolationPlanar.hxx"
00026 
00027 #include <vector>
00028 #include <map>
00029 
00030 #define ERR_TOL 1.0e-8
00031 
00032 typedef std::vector<std::map<int,double> > IntersectionMatrix;
00033 
00034 namespace INTERP_KERNEL
00035 {
00036   class Interpolation3D;
00037 }
00038 
00039 
00040 namespace MEDMEM {
00041   class MESH;
00042 }
00043 
00044 namespace INTERP_TEST
00045 {
00050   template<int SPACEDIM, int MESHDIM>
00051   class MeshTestToolkit
00052   {
00053 
00054   public:
00055     double _precision;
00056     INTERP_KERNEL::IntersectionType _intersectionType;//Used only in the case MESHDIM==2 (planar intersections)
00057 
00058     MeshTestToolkit():_precision(1.e-6),_intersectionType(INTERP_KERNEL::Triangulation)  {}
00059   
00060     ~MeshTestToolkit() {}
00061 
00062     void intersectMeshes(const char* mesh1, const char* mesh2, const double correctVol, const double prec = 1.0e-5, bool doubleTest = true) const;
00063 
00064     // 1.0e-5 here is due to limited precision of "correct" volumes calculated in Salome
00065     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;
00066   
00067     void dumpIntersectionMatrix(const IntersectionMatrix& m) const;
00068 
00069     double sumRow(const IntersectionMatrix& m, int i) const;
00070 
00071     double sumCol(const IntersectionMatrix& m, int i) const;
00072 
00073     void getVolumes( MEDMEM::MESH& mesh, double* tab) const;
00074 
00075     bool testVolumes(const IntersectionMatrix& m,  MEDMEM::MESH& sMesh,  MEDMEM::MESH& tMesh) const;
00076 
00077     double sumVolume(const IntersectionMatrix& m) const;
00078 
00079     bool areCompatitable( const IntersectionMatrix& m1,  const IntersectionMatrix& m2) const;
00080 
00081     bool testTranspose(const IntersectionMatrix& m1, const IntersectionMatrix& m2) const;
00082 
00083     bool testDiagonal(const IntersectionMatrix& m) const;
00084   
00085     void calcIntersectionMatrix(const char* mesh1path, const char* mesh1, const char* mesh2path, const char* mesh2, IntersectionMatrix& m) const;
00086   
00087   };
00088 }
00089 #endif