1 // Copyright (C) 2007-2012 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.
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 __INTERPOLATIONOPTIONS_HXX__
21 #define __INTERPOLATIONOPTIONS_HXX__
23 #include "INTERPKERNELDefines.hxx"
27 namespace INTERP_KERNEL
29 typedef enum { Triangulation, Convex, Geometric2D, PointLocator } IntersectionType;
30 /// Type describing the different ways in which the hexahedron can be split into tetrahedra.
31 /// The PLANAR_* policies persume that each face is to be considered planar, while the general
32 /// policies make no such hypothesis. The integer at the end gives the number of tetrahedra
33 /// that result from the split.
34 typedef enum { PLANAR_FACE_5 = 5, PLANAR_FACE_6 = 6, GENERAL_24 = 24, GENERAL_48 = 48 } SplittingPolicy;
37 * \class InterpolationOptions
38 * Class defining the options for all interpolation algorithms.
40 * List of options, possible values and default values can be found on this page:
41 * \ref InterpKerIntersectors
43 class INTERPKERNEL_EXPORT InterpolationOptions
47 IntersectionType _intersection_type;
49 double _median_plane ;
51 //! this measure is relative to the caracteristic dimension
52 double _bounding_box_adjustment ;
53 //! this measure is absolute \b not relative to the cell size
54 double _bounding_box_adjustment_abs ;
55 double _max_distance_for_3Dsurf_intersect;
58 SplittingPolicy _splitting_policy ;
59 bool _P1P0_bary_method; // issue 0020440
62 InterpolationOptions() { init(); }
63 int getPrintLevel() const { return _print_level; }
64 void setPrintLevel(int pl) { _print_level=pl; }
66 IntersectionType getIntersectionType() const { return _intersection_type; }
67 void setIntersectionType(IntersectionType it) { _intersection_type=it; }
68 std::string getIntersectionTypeRepr() const;
70 double getPrecision() const { return _precision; }
71 void setPrecision(double p) { _precision=p; }
73 double getMedianPlane() const { return _median_plane; }
74 void setMedianPlane(double mp) { _median_plane=mp; }
76 bool getDoRotate() const { return _do_rotate; }
77 void setDoRotate( bool dr) { _do_rotate = dr; }
79 double getBoundingBoxAdjustment() const { return _bounding_box_adjustment; }
80 void setBoundingBoxAdjustment(double bba) { _bounding_box_adjustment=bba; }
82 double getBoundingBoxAdjustmentAbs() const { return _bounding_box_adjustment_abs; }
83 void setBoundingBoxAdjustmentAbs(double bba) { _bounding_box_adjustment_abs=bba; }
85 double getMaxDistance3DSurfIntersect() const { return _max_distance_for_3Dsurf_intersect; }
86 void setMaxDistance3DSurfIntersect(double bba) { _max_distance_for_3Dsurf_intersect=bba; }
88 int getOrientation() const { return _orientation; }
89 void setOrientation(int o) { _orientation=o; }
91 bool getMeasureAbsStatus() const { return _measure_abs; }
92 void setMeasureAbsStatus(bool newStatus) { _measure_abs=newStatus; }
94 SplittingPolicy getSplittingPolicy() const { return _splitting_policy; }
95 void setSplittingPolicy(SplittingPolicy sp) { _splitting_policy=sp; }
96 std::string getSplittingPolicyRepr() const;
98 void setP1P0BaryMethod(bool isP1P0) { _P1P0_bary_method=isP1P0; }
99 bool getP1P0BaryMethod() const { return _P1P0_bary_method; }
101 std::string filterInterpolationMethod(const std::string& meth) const;
106 _intersection_type=Triangulation;
108 _median_plane=DFT_MEDIAN_PLANE;
110 _bounding_box_adjustment=DFT_SURF3D_ADJ_EPS;
111 _bounding_box_adjustment_abs=0.;
112 _max_distance_for_3Dsurf_intersect=DFT_MAX_DIST_3DSURF_INTERSECT;
115 _splitting_policy=GENERAL_48;
116 _P1P0_bary_method=false;
118 bool setInterpolationOptions(long print_level,
119 std::string intersection_type,
123 double bounding_box_adjustment,
124 double bounding_box_adjustment_abs,
125 double max_distance_for_3Dsurf_intersect,
128 std::string splitting_policy,
129 bool P1P0_bary_method );
130 void copyOptions(const InterpolationOptions & other) { *this = other; }
131 bool setOptionDouble(const std::string& key, double value);
132 bool setOptionInt(const std::string& key, int value);
133 bool setOptionString(const std::string& key, const std::string& value);
134 std::string printOptions() const;
136 static const double DFT_MEDIAN_PLANE;
137 static const double DFT_SURF3D_ADJ_EPS;
138 static const double DFT_MAX_DIST_3DSURF_INTERSECT;
140 static const char PRECISION_STR[];
141 static const char MEDIANE_PLANE_STR[];
142 static const char BOUNDING_BOX_ADJ_STR[];
143 static const char BOUNDING_BOX_ADJ_ABS_STR[];
144 static const char MAX_DISTANCE_3DSURF_INSECT_STR[];
145 static const char PRINT_LEV_STR[];
146 static const char DO_ROTATE_STR[];
147 static const char ORIENTATION_STR[];
148 static const char MEASURE_ABS_STR[];
149 static const char INTERSEC_TYPE_STR[];
150 static const char SPLITTING_POLICY_STR[];
151 static const char TRIANGULATION_INTERSECT2D_STR[];
152 static const char CONVEX_INTERSECT2D_STR[];
153 static const char GEOMETRIC_INTERSECT2D_STR[];
154 static const char POINTLOCATOR_INTERSECT_STR[];
155 static const char PLANAR_SPLIT_FACE_5_STR[];
156 static const char PLANAR_SPLIT_FACE_6_STR[];
157 static const char GENERAL_SPLIT_24_STR[];
158 static const char GENERAL_SPLIT_48_STR[];