Salome HOME
ae9a853740db0cc27e504886cbb6f2c78abb00a1
[modules/med.git] / src / INTERP_KERNEL / PlanarIntersector.hxx
1 // Copyright (C) 2007-2013  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.
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     //! \addtogroup InterpKerGrpIntPlan @{
45     PlanarIntersector(const MyMeshType& meshT, const MyMeshType& meshS, double dimCaracteristic, double precision, double md3DSurf, double medianPlane, bool doRotate, int orientation, int printLevel);
46     //! @}
47     virtual ~PlanarIntersector();
48     void createBoundingBoxes(const MyMeshType& mesh, std::vector<double>& bbox);
49     void adjustBoundingBoxes(std::vector<double>& bbox, double surf3DAdjustmentEps, double surf3DAdjustmentEpsAbs);
50     inline void getElemBB(double* bb, const MyMeshType& mesh, ConnType iP, ConnType nb_nodes);
51     static int projection(double *Coords_A, double *Coords_B,
52                           int nb_NodesA, int nb_NodesB, double epsilon, double md3DSurf, double median_plane, bool do_rotate);
53     virtual const DuplicateFacesType* getIntersectFaces() const
54     {
55       return NULL;
56     }
57   protected :
58     int projectionThis(double *Coords_A, double *Coords_B, int nb_NodesA, int nb_NodesB);
59     void getRealTargetCoordinates(ConnType icellT, std::vector<double>& coordsT);
60     void getRealSourceCoordinates(ConnType icellS, std::vector<double>& coordsS);
61     void getRealTargetCoordinatesPermute(ConnType icellT, int offset, std::vector<double>& coordsT);
62     void getRealSourceCoordinatesPermute(ConnType icellS, int offset, std::vector<double>& coordsS);
63     void getRealCoordinates(ConnType icellT, ConnType icellS, ConnType nbNodesT, ConnType nbNodesS, std::vector<double>& coordsT, std::vector<double>& coordsS, int& orientation);
64     double getValueRegardingOption(double val) const;
65     static void rotate3DTriangle( double* PP1, double*PP2, double*PP3,
66                                   TranslationRotationMatrix& rotation_matrix);
67   protected:
68     const ConnType *_connectT;
69     const ConnType *_connectS;
70     const double *_coordsT;
71     const double *_coordsS;
72     const ConnType *_connIndexT;
73     const ConnType *_connIndexS;
74     const MyMeshType& _meshT;
75     const MyMeshType& _meshS;
76     double _dim_caracteristic;
77     double _max_distance_3Dsurf_intersect;
78     double _precision;
79     double _median_plane;
80     bool _do_rotate;
81     int _orientation;
82     int _print_level;
83   };
84 }
85
86 #endif