Salome HOME
Get relevant changes from V7_dev branch (copyright update, adm files etc)
[tools/medcoupling.git] / src / INTERP_KERNEL / PlanarIntersector.hxx
1 // Copyright (C) 2007-2016  CEA/DEN, EDF R&D
2 //
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.
7 //
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.
12 //
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
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 // Author : Anthony Geay (CEA/DEN)
20
21 #ifndef __PLANARINTERSECTOR_HXX__
22 #define __PLANARINTERSECTOR_HXX__
23
24 #include "TargetIntersector.hxx"
25 #include "NormalizedUnstructuredMesh.hxx"
26
27 #include <map>
28 #include <set>
29
30 namespace INTERP_KERNEL
31 {
32   class TranslationRotationMatrix;
33   
34   template<class MyMeshType, class MyMatrix>
35   class PlanarIntersector : public TargetIntersector<MyMeshType,MyMatrix>
36   {
37   public:
38     static const int SPACEDIM=MyMeshType::MY_SPACEDIM;
39     static const int MESHDIM=MyMeshType::MY_MESHDIM;
40     typedef typename MyMeshType::MyConnType ConnType;
41     static const NumberingPolicy numPol=MyMeshType::My_numPol;
42     typedef typename std::map<int,std::set<int> > DuplicateFacesType;
43   public:
44     PlanarIntersector(const MyMeshType& meshT, const MyMeshType& meshS, double dimCaracteristic, double precision, double md3DSurf, double minDot3DSurf, double medianPlane, bool doRotate, int orientation, int printLevel);
45     virtual ~PlanarIntersector();
46     void createBoundingBoxes(const MyMeshType& mesh, std::vector<double>& bbox);
47     void adjustBoundingBoxes(std::vector<double>& bbox, double surf3DAdjustmentEps, double surf3DAdjustmentEpsAbs);
48     inline void getElemBB(double* bb, const MyMeshType& mesh, ConnType iP, ConnType nb_nodes);
49     static int Projection(double *Coords_A, double *Coords_B,
50                           int nb_NodesA, int nb_NodesB, double epsilon, double md3DSurf, double minDot3DSurf, double median_plane, bool do_rotate);
51     virtual const DuplicateFacesType* getIntersectFaces() const
52     {
53       return NULL;
54     }
55   protected :
56     int projectionThis(double *Coords_A, double *Coords_B, int nb_NodesA, int nb_NodesB);
57     void getRealTargetCoordinates(ConnType icellT, std::vector<double>& coordsT);
58     void getRealSourceCoordinates(ConnType icellS, std::vector<double>& coordsS);
59     void getRealTargetCoordinatesPermute(ConnType icellT, int offset, std::vector<double>& coordsT);
60     void getRealSourceCoordinatesPermute(ConnType icellS, int offset, std::vector<double>& coordsS);
61     void getRealCoordinates(ConnType icellT, ConnType icellS, ConnType nbNodesT, ConnType nbNodesS, std::vector<double>& coordsT, std::vector<double>& coordsS, int& orientation);
62     double getValueRegardingOption(double val) const;
63     static void rotate3DTriangle( double* PP1, double*PP2, double*PP3,
64                                   TranslationRotationMatrix& rotation_matrix);
65   protected:
66     const ConnType *_connectT;
67     const ConnType *_connectS;
68     const double *_coordsT;
69     const double *_coordsS;
70     const ConnType *_connIndexT;
71     const ConnType *_connIndexS;
72     const MyMeshType& _meshT;
73     const MyMeshType& _meshS;
74     double _dim_caracteristic;
75     double _max_distance_3Dsurf_intersect;
76     double _min_dot_btw_3Dsurf_intersect;
77     double _precision;
78     double _median_plane;
79     bool _do_rotate;
80     int _orientation;
81     int _print_level;
82   };
83 }
84
85 #endif