]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
one InterpolationOptions by coupling
authorsecher <secher>
Fri, 12 Feb 2010 10:48:28 +0000 (10:48 +0000)
committersecher <secher>
Fri, 12 Feb 2010 10:48:28 +0000 (10:48 +0000)
src/INTERP_KERNEL/InterpolationOptions.cxx
src/INTERP_KERNEL/InterpolationOptions.hxx

index 68325eecfd971b133cd29b54b147e699e9a46fb1..5b65d63426cba72b8f87100f8553cafabb1cebf3 100644 (file)
@@ -180,8 +180,8 @@ std::string INTERP_KERNEL::InterpolationOptions::filterInterpolationMethod(const
   return meth;
 }
 
-void INTERP_KERNEL::InterpolationOptions::setInterpolationOptions(long print_level,
-                                                                  const char * intersection_type,
+bool INTERP_KERNEL::InterpolationOptions::setInterpolationOptions(long print_level,
+                                                                  std::string intersection_type,
                                                                   double precision,
                                                                   double median_plane,
                                                                   bool do_rotate,
@@ -190,22 +190,13 @@ void INTERP_KERNEL::InterpolationOptions::setInterpolationOptions(long print_lev
                                                                   double max_distance_for_3Dsurf_intersect,
                                                                   long orientation,
                                                                   bool measure_abs,
-                                                                  const char * splitting_policy,
+                                                                  std::string splitting_policy,
                                                                   bool P1P0_bary_method )
 {
-  std::string interType = intersection_type;
-  std::string splitPolicy = splitting_policy;
+  bool ret=true;
 
-  _setInterpolationOptions=true;
   _print_level=print_level;
-  if( interType.find("Triangulation") != std::string::npos )
-    _intersection_type=INTERP_KERNEL::Triangulation;
-  else if( interType.find("Convex") != std::string::npos )
-    _intersection_type=INTERP_KERNEL::Convex;
-  else if( interType.find("Geometric2D") != std::string::npos )
-    _intersection_type=INTERP_KERNEL::Geometric2D;
-  else if( interType.find("PointLocator") != std::string::npos )
-    _intersection_type=INTERP_KERNEL::PointLocator;
+  ret = setOptionString(INTERSEC_TYPE_STR,intersection_type);
   _precision=precision;
   _median_plane=median_plane;
   _do_rotate=do_rotate;
@@ -214,14 +205,9 @@ void INTERP_KERNEL::InterpolationOptions::setInterpolationOptions(long print_lev
   _max_distance_for_3Dsurf_intersect=max_distance_for_3Dsurf_intersect;
   _orientation=orientation;
   _measure_abs=measure_abs;
-  if( splitPolicy.find("PLANAR_FACE_5") != std::string::npos )
-    _splitting_policy=INTERP_KERNEL::PLANAR_FACE_5;
-  else if( splitPolicy.find("PLANAR_FACE_6") != std::string::npos )
-    _splitting_policy=INTERP_KERNEL::PLANAR_FACE_6;
-  else if( splitPolicy.find("GENERAL_24") != std::string::npos )
-    _splitting_policy=INTERP_KERNEL::GENERAL_24;
-  else if( splitPolicy.find("GENERAL_48") != std::string::npos )
-    _splitting_policy=INTERP_KERNEL::GENERAL_48;
+  ret = setOptionString(SPLITTING_POLICY_STR,splitting_policy);
   _P1P0_bary_method=P1P0_bary_method;
+
+  return ret;
 }
 
index 3446c4f9b75fea84c2a6995b7e0b0a43fcb6df34..1701a99e8336d3dc4d00935fd855ca80de6e1c0a 100644 (file)
@@ -34,7 +34,7 @@ namespace INTERP_KERNEL
   
   class INTERPKERNEL_EXPORT InterpolationOptions
   {
-  protected:
+  private:
     int _print_level ;
     IntersectionType _intersection_type;
     double _precision;
@@ -50,7 +50,6 @@ namespace INTERP_KERNEL
     SplittingPolicy _splitting_policy ;
     bool _P1P0_bary_method; // issue 0020440
 
-    bool _setInterpolationOptions;
   public:
     InterpolationOptions() { init(); }
     int getPrintLevel() const { return _print_level; }
@@ -105,13 +104,9 @@ namespace INTERP_KERNEL
       _measure_abs=true;
       _splitting_policy=GENERAL_48;
       _P1P0_bary_method=false;
-      _setInterpolationOptions=false;
     }
-    bool setOptionDouble(const std::string& key, double value);
-    bool setOptionInt(const std::string& key, int value);
-    bool setOptionString(const std::string& key, std::string& value);
-    void setInterpolationOptions(long print_level,
-                                 const char * intersection_type,
+    bool setInterpolationOptions(long print_level,
+                                 std::string intersection_type,
                                  double precision,
                                  double median_plane,
                                  bool do_rotate,
@@ -120,8 +115,12 @@ namespace INTERP_KERNEL
                                  double max_distance_for_3Dsurf_intersect,
                                  long orientation,
                                  bool measure_abs,
-                                 const char * splitting_policy,
+                                 std::string splitting_policy,
                                  bool P1P0_bary_method );
+    void copyOptions(InterpolationOptions & other) { *this = other; }
+    bool setOptionDouble(const std::string& key, double value);
+    bool setOptionInt(const std::string& key, int value);
+    bool setOptionString(const std::string& key, std::string& value);
   private:
     static const double DFT_MEDIAN_PLANE;
     static const double DFT_SURF3D_ADJ_EPS;