Salome HOME
Copyright update 2020
[tools/medcoupling.git] / src / INTERP_KERNEL / InterpolationOptions.hxx
1 // Copyright (C) 2007-2020  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 __INTERPOLATIONOPTIONS_HXX__
22 #define __INTERPOLATIONOPTIONS_HXX__
23
24 #include "INTERPKERNELDefines.hxx"
25 #include "NormalizedUnstructuredMesh.hxx"
26
27 #include <string>
28
29 namespace INTERP_KERNEL
30 {
31   typedef enum { Triangulation, Convex, Geometric2D, PointLocator, Barycentric, BarycentricGeo2D, MappedBarycentric } IntersectionType;
32   
33   /*!
34    * Class defining the options for all interpolation algorithms used in the \ref remapper "remapper" and
35    * in some of the \ref para-dec "DECs".
36    * 
37    * List of options, possible values and default values can be found on this page:
38    * \ref InterpKerIntersectors
39    */
40   class INTERPKERNEL_EXPORT InterpolationOptions
41   {
42   private:
43     int _print_level ;
44     IntersectionType _intersection_type;
45     double _precision;
46     double _median_plane ;
47     bool _do_rotate ;
48     //! this measure is relative to the caracteristic dimension
49     double _bounding_box_adjustment ;
50     //! this measure is absolute \b not relative to the cell size
51     double _bounding_box_adjustment_abs ;
52     double _max_distance_for_3Dsurf_intersect;
53     double _min_dot_btw_3Dsurf_intersect;
54     int _orientation ;
55     bool _measure_abs;
56     SplittingPolicy _splitting_policy ;
57   public:
58     InterpolationOptions() { init(); }
59     int getPrintLevel() const { return _print_level; }
60     void setPrintLevel(int pl) { _print_level=pl; }
61
62     IntersectionType getIntersectionType() const { return _intersection_type; }
63     void setIntersectionType(IntersectionType it) { _intersection_type=it; }
64     std::string getIntersectionTypeRepr() const;
65
66     double getPrecision() const { return _precision; }
67     void setPrecision(double p) { _precision=p; }
68
69     double getMedianPlane() const { return _median_plane; }
70     void setMedianPlane(double mp) { _median_plane=mp; }
71     
72     bool getDoRotate() const { return _do_rotate; }
73     void setDoRotate( bool dr) { _do_rotate = dr; }
74     
75     double getBoundingBoxAdjustment() const { return _bounding_box_adjustment; }
76     void setBoundingBoxAdjustment(double bba) { _bounding_box_adjustment=bba; }
77
78     double getBoundingBoxAdjustmentAbs() const { return _bounding_box_adjustment_abs; }
79     void setBoundingBoxAdjustmentAbs(double bba) { _bounding_box_adjustment_abs=bba; }
80     
81     double getMaxDistance3DSurfIntersect() const { return _max_distance_for_3Dsurf_intersect; }
82     void setMaxDistance3DSurfIntersect(double bba) { _max_distance_for_3Dsurf_intersect=bba; }
83
84     double getMinDotBtwPlane3DSurfIntersect() const { return _min_dot_btw_3Dsurf_intersect; }
85     void setMinDotBtwPlane3DSurfIntersect(double v) { _min_dot_btw_3Dsurf_intersect=v; }
86
87     int getOrientation() const { return _orientation; }
88     void setOrientation(int o) { _orientation=o; }
89
90     bool getMeasureAbsStatus() const { return _measure_abs; }
91     void setMeasureAbsStatus(bool newStatus) { _measure_abs=newStatus; }
92     
93     SplittingPolicy getSplittingPolicy() const { return _splitting_policy; }
94     void setSplittingPolicy(SplittingPolicy sp) { _splitting_policy=sp; }
95     std::string getSplittingPolicyRepr() const;
96
97     std::string filterInterpolationMethod(const std::string& meth) const;
98
99     void init();
100     
101     bool setInterpolationOptions(int print_level,
102                                  std::string intersection_type,
103                                  double precision,
104                                  double median_plane,
105                                  bool do_rotate,
106                                  double bounding_box_adjustment,
107                                  double bounding_box_adjustment_abs,
108                                  double max_distance_for_3Dsurf_intersect,
109                                  int orientation,
110                                  bool measure_abs,
111                                  std::string splitting_policy);
112     void copyOptions(const InterpolationOptions & other) { *this = other; }
113     bool setOptionDouble(const std::string& key, double value);
114     bool setOptionInt(const std::string& key, int value);
115     bool setOptionString(const std::string& key, const std::string& value);
116     std::string printOptions() const;
117   public:
118     static void CheckAndSplitInterpolationMethod(const std::string& method, std::string& srcMeth, std::string& trgMeth);
119   private:
120     static const double DFT_MEDIAN_PLANE;
121     static const double DFT_SURF3D_ADJ_EPS;
122     static const double DFT_MAX_DIST_3DSURF_INTERSECT;
123     static const double DFT_MIN_DOT_BTW_3DSURF_INTERSECT;
124   public:
125     static const char PRECISION_STR[];
126     static const char MEDIANE_PLANE_STR[];
127     static const char BOUNDING_BOX_ADJ_STR[];
128     static const char BOUNDING_BOX_ADJ_ABS_STR[];
129     static const char MAX_DISTANCE_3DSURF_INSECT_STR[];
130     static const char MIN_DOT_BTW_3DSURF_INSECT_STR[];
131     static const char PRINT_LEV_STR[];
132     static const char DO_ROTATE_STR[];
133     static const char ORIENTATION_STR[];
134     static const char MEASURE_ABS_STR[];
135     static const char INTERSEC_TYPE_STR[];
136     static const char SPLITTING_POLICY_STR[];
137     static const char TRIANGULATION_INTERSECT2D_STR[];
138     static const char CONVEX_INTERSECT2D_STR[];
139     static const char GEOMETRIC_INTERSECT2D_STR[];
140     static const char POINTLOCATOR_INTERSECT_STR[];
141     static const char BARYCENTRIC_INTERSECT_STR[];
142     static const char BARYCENTRICGEO2D_INTERSECT_STR[];
143     static const char PLANAR_SPLIT_FACE_5_STR[];
144     static const char PLANAR_SPLIT_FACE_6_STR[];
145     static const char GENERAL_SPLIT_24_STR[];
146     static const char GENERAL_SPLIT_48_STR[];
147   };
148
149 }
150 #endif