Salome HOME
Merge from BR_V5_DEV 17Feb09
[plugins/blsurfplugin.git] / src / BLSURFPlugin / BLSURFPlugin_Hypothesis.hxx
1 //  Copyright (C) 2007-2008  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 // ---
20 // File    : BLSURFPlugin_Hypothesis.hxx
21 // Authors : Francis KLOSS (OCC) & Patrick LAUG (INRIA) & Lioka RAZAFINDRAZAKA (CEA)
22 //           & Aurelien ALLEAUME (DISTENE)
23 // ---
24 //
25 #ifndef _BLSURFPlugin_Hypothesis_HXX_
26 #define _BLSURFPlugin_Hypothesis_HXX_
27
28 #include "SMESH_Hypothesis.hxx"
29 #include <map>
30 #include <set>
31 #include <stdexcept>
32 #include <string>
33
34 //  Parameters for work of BLSURF
35
36 class BLSURFPlugin_Hypothesis: public SMESH_Hypothesis
37 {
38 public:
39   BLSURFPlugin_Hypothesis(int hypId, int studyId, SMESH_Gen * gen);
40
41   enum Topology {
42     FromCAD,
43     Process,
44     Process2
45   };
46
47   enum PhysicalMesh {
48     DefaultSize,
49     PhysicalUserDefined
50   };
51
52   enum GeometricMesh {
53     DefaultGeom,
54     UserDefined
55   };
56
57   void SetTopology(Topology theTopology);
58   Topology GetTopology() const { return _topology; }
59
60   void SetPhysicalMesh(PhysicalMesh thePhysicalMesh);
61   PhysicalMesh GetPhysicalMesh() const { return _physicalMesh; }
62
63   void SetPhySize(double thePhySize);
64   double GetPhySize() const { return _phySize; }
65
66   void SetPhyMin(double theMinSize);
67   double GetPhyMin() const { return _phyMin; }
68
69   void SetPhyMax(double theMaxSize);
70   double GetPhyMax() const { return _phyMax; }
71
72   void SetGeometricMesh(GeometricMesh theGeometricMesh);
73   GeometricMesh GetGeometricMesh() const { return _geometricMesh; }
74
75   void SetAngleMeshS(double theAngle);
76   double GetAngleMeshS() const { return _angleMeshS; }
77
78   void SetAngleMeshC(double theAngle);
79   double GetAngleMeshC() const { return _angleMeshC; }
80
81   void SetGeoMin(double theMinSize);
82   double GetGeoMin() const { return _hgeoMin; }
83
84   void SetGeoMax(double theMaxSize);
85   double GetGeoMax() const { return _hgeoMax; }
86
87   void SetGradation(double theGradation);
88   double GetGradation() const { return _gradation; }
89
90   void SetQuadAllowed(bool theVal);
91   bool GetQuadAllowed() const { return _quadAllowed; }
92
93   void SetDecimesh(bool theVal);
94   bool GetDecimesh() const { return _decimesh; }
95
96   void SetVerbosity(int theVal);
97   int GetVerbosity() const { return _verb; }
98
99   static Topology      GetDefaultTopology();
100   static PhysicalMesh  GetDefaultPhysicalMesh();
101   static double        GetDefaultPhySize();
102   static double        GetDefaultMaxSize();
103   static double        GetDefaultMinSize();
104   static GeometricMesh GetDefaultGeometricMesh();
105   static double        GetDefaultAngleMeshS();
106   static double        GetDefaultAngleMeshC() { return GetDefaultAngleMeshS(); }
107   static double        GetDefaultGradation();
108   static bool          GetDefaultQuadAllowed();
109   static bool          GetDefaultDecimesh();
110   static int           GetDefaultVerbosity() { return 10; }
111
112   static double undefinedDouble() { return -1.0; }
113
114   typedef std::map< std::string, std::string > TOptionValues;
115   typedef std::set< std::string >              TOptionNames;
116
117   void SetOptionValue(const std::string& optionName,
118                       const std::string& optionValue) throw (std::invalid_argument);
119   std::string GetOptionValue(const std::string& optionName) throw (std::invalid_argument);
120   void ClearOption(const std::string& optionName);
121   const TOptionValues& GetOptionValues() const { return _option2value; }
122
123   // Persistence
124   virtual std::ostream & SaveTo(std::ostream & save);
125   virtual std::istream & LoadFrom(std::istream & load);
126   friend std::ostream & operator <<(std::ostream & save, BLSURFPlugin_Hypothesis & hyp);
127   friend std::istream & operator >>(std::istream & load, BLSURFPlugin_Hypothesis & hyp);
128
129   /*!
130    * \brief Does nothing
131    * \param theMesh - the built mesh
132    * \param theShape - the geometry of interest
133    * \retval bool - always false
134    */
135   virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
136
137   /*!
138    * \brief Initialize my parameter values by default parameters.
139    *  \retval bool - true if parameter values have been successfully defined
140    */
141   virtual bool SetParametersByDefaults(const TDefaults& dflts, const SMESH_Mesh* theMesh=0);
142
143 private:
144   Topology      _topology;
145   PhysicalMesh  _physicalMesh;
146   double        _phySize, _phyMin, _phyMax;
147   GeometricMesh _geometricMesh;
148   double        _angleMeshS, _angleMeshC, _hgeoMin, _hgeoMax;
149   double        _gradation;
150   bool          _quadAllowed;
151   bool          _decimesh;
152   int           _verb;
153   TOptionValues _option2value;
154   TOptionNames  _doubleOptions, _charOptions;
155 };
156
157 #endif