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
19 // Author : Anthony Geay (CEA/DEN)
21 #ifndef __INTERPOLATIONOPTIONS_HXX__
22 #define __INTERPOLATIONOPTIONS_HXX__
24 #include "INTERPKERNELDefines.hxx"
28 namespace INTERP_KERNEL
30 typedef enum { Triangulation, Convex, Geometric2D, PointLocator } IntersectionType;
31 /// Type describing the different ways in which the hexahedron can be split into tetrahedra.
32 /// The PLANAR_* policies persume that each face is to be considered planar, while the general
33 /// policies make no such hypothesis. The integer at the end gives the number of tetrahedra
34 /// that result from the split.
35 typedef enum { PLANAR_FACE_5 = 5, PLANAR_FACE_6 = 6, GENERAL_24 = 24, GENERAL_48 = 48 } SplittingPolicy;
38 * \class InterpolationOptions
39 * Class defining the options for all interpolation algorithms.
41 * List of options, possible values and default values can be found on this page:
42 * \ref InterpKerIntersectors
44 class INTERPKERNEL_EXPORT InterpolationOptions
48 IntersectionType _intersection_type;
50 double _median_plane ;
52 //! this measure is relative to the caracteristic dimension
53 double _bounding_box_adjustment ;
54 //! this measure is absolute \b not relative to the cell size
55 double _bounding_box_adjustment_abs ;
56 double _max_distance_for_3Dsurf_intersect;
59 SplittingPolicy _splitting_policy ;
60 bool _P1P0_bary_method; // issue 0020440
63 InterpolationOptions() { init(); }
64 int getPrintLevel() const { return _print_level; }
65 void setPrintLevel(int pl) { _print_level=pl; }
67 IntersectionType getIntersectionType() const { return _intersection_type; }
68 void setIntersectionType(IntersectionType it) { _intersection_type=it; }
69 std::string getIntersectionTypeRepr() const;
71 double getPrecision() const { return _precision; }
72 void setPrecision(double p) { _precision=p; }
74 double getMedianPlane() const { return _median_plane; }
75 void setMedianPlane(double mp) { _median_plane=mp; }
77 bool getDoRotate() const { return _do_rotate; }
78 void setDoRotate( bool dr) { _do_rotate = dr; }
80 double getBoundingBoxAdjustment() const { return _bounding_box_adjustment; }
81 void setBoundingBoxAdjustment(double bba) { _bounding_box_adjustment=bba; }
83 double getBoundingBoxAdjustmentAbs() const { return _bounding_box_adjustment_abs; }
84 void setBoundingBoxAdjustmentAbs(double bba) { _bounding_box_adjustment_abs=bba; }
86 double getMaxDistance3DSurfIntersect() const { return _max_distance_for_3Dsurf_intersect; }
87 void setMaxDistance3DSurfIntersect(double bba) { _max_distance_for_3Dsurf_intersect=bba; }
89 int getOrientation() const { return _orientation; }
90 void setOrientation(int o) { _orientation=o; }
92 bool getMeasureAbsStatus() const { return _measure_abs; }
93 void setMeasureAbsStatus(bool newStatus) { _measure_abs=newStatus; }
95 SplittingPolicy getSplittingPolicy() const { return _splitting_policy; }
96 void setSplittingPolicy(SplittingPolicy sp) { _splitting_policy=sp; }
97 std::string getSplittingPolicyRepr() const;
99 void setP1P0BaryMethod(bool isP1P0) { _P1P0_bary_method=isP1P0; }
100 bool getP1P0BaryMethod() const { return _P1P0_bary_method; }
102 std::string filterInterpolationMethod(const std::string& meth) const;
107 _intersection_type=Triangulation;
109 _median_plane=DFT_MEDIAN_PLANE;
111 _bounding_box_adjustment=DFT_SURF3D_ADJ_EPS;
112 _bounding_box_adjustment_abs=0.;
113 _max_distance_for_3Dsurf_intersect=DFT_MAX_DIST_3DSURF_INTERSECT;
116 _splitting_policy=GENERAL_48;
117 _P1P0_bary_method=false;
119 bool setInterpolationOptions(long print_level,
120 std::string intersection_type,
124 double bounding_box_adjustment,
125 double bounding_box_adjustment_abs,
126 double max_distance_for_3Dsurf_intersect,
129 std::string splitting_policy,
130 bool P1P0_bary_method );
131 void copyOptions(const InterpolationOptions & other) { *this = other; }
132 bool setOptionDouble(const std::string& key, double value);
133 bool setOptionInt(const std::string& key, int value);
134 bool setOptionString(const std::string& key, const std::string& value);
135 std::string printOptions() const;
137 static const double DFT_MEDIAN_PLANE;
138 static const double DFT_SURF3D_ADJ_EPS;
139 static const double DFT_MAX_DIST_3DSURF_INTERSECT;
141 static const char PRECISION_STR[];
142 static const char MEDIANE_PLANE_STR[];
143 static const char BOUNDING_BOX_ADJ_STR[];
144 static const char BOUNDING_BOX_ADJ_ABS_STR[];
145 static const char MAX_DISTANCE_3DSURF_INSECT_STR[];
146 static const char PRINT_LEV_STR[];
147 static const char DO_ROTATE_STR[];
148 static const char ORIENTATION_STR[];
149 static const char MEASURE_ABS_STR[];
150 static const char INTERSEC_TYPE_STR[];
151 static const char SPLITTING_POLICY_STR[];
152 static const char TRIANGULATION_INTERSECT2D_STR[];
153 static const char CONVEX_INTERSECT2D_STR[];
154 static const char GEOMETRIC_INTERSECT2D_STR[];
155 static const char POINTLOCATOR_INTERSECT_STR[];
156 static const char PLANAR_SPLIT_FACE_5_STR[];
157 static const char PLANAR_SPLIT_FACE_6_STR[];
158 static const char GENERAL_SPLIT_24_STR[];
159 static const char GENERAL_SPLIT_48_STR[];