]> SALOME platform Git repositories - plugins/blsurfplugin.git/blob - src/BLSURFPlugin/BLSURFPlugin_Hypothesis.hxx
Salome HOME
60df46564cb962ceb5115515e09d7011bdf862d2
[plugins/blsurfplugin.git] / src / BLSURFPlugin / BLSURFPlugin_Hypothesis.hxx
1 //  Copyright (C) 2007-2010  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 // ---
21 // File    : BLSURFPlugin_Hypothesis.hxx
22 // Authors : Francis KLOSS (OCC) & Patrick LAUG (INRIA) & Lioka RAZAFINDRAZAKA (CEA)
23 //           & Aurelien ALLEAUME (DISTENE)
24 //           Size maps developement: Nicolas GEIMER (OCC) & Gilles DAVID (EURIWARE)
25 // ---
26 //
27 #ifndef _BLSURFPlugin_Hypothesis_HXX_
28 #define _BLSURFPlugin_Hypothesis_HXX_
29
30 #include "SMESH_Hypothesis.hxx"
31 #include <vector>
32 #include <map>
33 #include <set>
34 #include <stdexcept>
35 #include <string>
36
37 //  Parameters for work of BLSURF
38
39 class BLSURFPlugin_Hypothesis: public SMESH_Hypothesis
40 {
41 public:
42   BLSURFPlugin_Hypothesis(int hypId, int studyId, SMESH_Gen * gen);
43
44   enum Topology {
45     FromCAD,
46     Process,
47     Process2
48   };
49
50   enum PhysicalMesh {
51     DefaultSize,
52     PhysicalUserDefined
53   };
54
55   enum GeometricMesh {
56     DefaultGeom,
57     UserDefined
58   };
59
60   void SetTopology(Topology theTopology);
61   Topology GetTopology() const { return _topology; }
62
63   void SetPhysicalMesh(PhysicalMesh thePhysicalMesh);
64   PhysicalMesh GetPhysicalMesh() const { return _physicalMesh; }
65
66   void SetPhySize(double thePhySize);
67   double GetPhySize() const { return _phySize; }
68
69   void SetPhyMin(double theMinSize);
70   double GetPhyMin() const { return _phyMin; }
71
72   void SetPhyMax(double theMaxSize);
73   double GetPhyMax() const { return _phyMax; }
74
75   void SetGeometricMesh(GeometricMesh theGeometricMesh);
76   GeometricMesh GetGeometricMesh() const { return _geometricMesh; }
77
78   void SetAngleMeshS(double theAngle);
79   double GetAngleMeshS() const { return _angleMeshS; }
80
81   void SetAngleMeshC(double theAngle);
82   double GetAngleMeshC() const { return _angleMeshC; }
83
84   void SetGeoMin(double theMinSize);
85   double GetGeoMin() const { return _hgeoMin; }
86
87   void SetGeoMax(double theMaxSize);
88   double GetGeoMax() const { return _hgeoMax; }
89
90   void SetGradation(double theGradation);
91   double GetGradation() const { return _gradation; }
92
93   void SetQuadAllowed(bool theVal);
94   bool GetQuadAllowed() const { return _quadAllowed; }
95
96   void SetDecimesh(bool theVal);
97   bool GetDecimesh() const { return _decimesh; }
98
99   void SetVerbosity(int theVal);
100   int GetVerbosity() const { return _verb; }
101   
102   void ClearEntry(const std::string& entry);
103   void ClearSizeMaps();
104
105   typedef std::map<std::string,std::string> TSizeMap;
106
107   void SetSizeMapEntry(const std::string& entry,const std::string& sizeMap );
108   std::string  GetSizeMapEntry(const std::string& entry);
109   const TSizeMap& _GetSizeMapEntries() const { return _sizeMap; }
110   /*!
111    * \brief Return the size maps
112    */
113   static TSizeMap GetSizeMapEntries(const BLSURFPlugin_Hypothesis* hyp);
114
115
116   void SetAttractorEntry(const std::string& entry,const std::string& attractor );
117   std::string GetAttractorEntry(const std::string& entry);
118   const TSizeMap& _GetAttractorEntries() const { return _attractors; };
119   /*!
120    * \brief Return the attractors
121    */
122   static TSizeMap GetAttractorEntries(const BLSURFPlugin_Hypothesis* hyp);
123
124
125 /*
126   void SetCustomSizeMapEntry(const std::string& entry,const std::string& sizeMap );
127   std::string  GetCustomSizeMapEntry(const std::string& entry);
128   void UnsetCustomSizeMap(const std::string& entry);
129   const TSizeMap& GetCustomSizeMapEntries() const { return _customSizeMap; }
130  */
131
132   /*!
133    * To set/get/unset an enforced vertex
134    */
135   typedef std::vector<double> TEnforcedVertex;
136   typedef std::set< TEnforcedVertex > TEnforcedVertexList;
137   typedef std::map< std::string, TEnforcedVertexList > TEnforcedVertexMap;
138   
139   void SetEnforcedVertex(const std::string& entry, double x, double y, double z);
140 //   void SetEnforcedVertexList(const std::string& entry, const TEnforcedVertexList vertexList);
141   TEnforcedVertexList GetEnforcedVertices(const std::string& entry) throw (std::invalid_argument);
142   void ClearEnforcedVertex(const std::string& entry, double x, double y, double z) throw (std::invalid_argument);
143 //   void ClearEnforcedVertexList(const std::string& entry, TEnforcedVertexList vertexList) throw (std::invalid_argument);
144   void ClearEnforcedVertices(const std::string& entry) throw (std::invalid_argument);
145
146   void ClearAllEnforcedVertices();
147   const TEnforcedVertexMap _GetAllEnforcedVertices() const { return _enforcedVertices; }
148
149   /*!
150    * \brief Return the enforced vertices
151    */
152   static TEnforcedVertexMap GetAllEnforcedVertices(const BLSURFPlugin_Hypothesis* hyp);
153
154
155   static Topology        GetDefaultTopology();
156   static PhysicalMesh    GetDefaultPhysicalMesh();
157   static double          GetDefaultPhySize();
158   static double          GetDefaultMaxSize();
159   static double          GetDefaultMinSize();
160   static GeometricMesh   GetDefaultGeometricMesh();
161   static double          GetDefaultAngleMeshS();
162   static double          GetDefaultAngleMeshC() { return GetDefaultAngleMeshS(); }
163   static double          GetDefaultGradation();
164   static bool            GetDefaultQuadAllowed();
165   static bool            GetDefaultDecimesh();
166   static int             GetDefaultVerbosity() { return 10; }
167   static TSizeMap        GetDefaultSizeMap() { return TSizeMap();}
168   static TEnforcedVertexMap GetDefaultEnforcedVertexMap() { return TEnforcedVertexMap(); }
169
170   static double undefinedDouble() { return -1.0; }
171
172   typedef std::map< std::string, std::string > TOptionValues;
173   typedef std::set< std::string >              TOptionNames;
174
175   void SetOptionValue(const std::string& optionName,
176                       const std::string& optionValue) throw (std::invalid_argument);
177   std::string GetOptionValue(const std::string& optionName) throw (std::invalid_argument);
178   void ClearOption(const std::string& optionName);
179   const TOptionValues& GetOptionValues() const { return _option2value; }
180
181   // Persistence
182   virtual std::ostream & SaveTo(std::ostream & save);
183   virtual std::istream & LoadFrom(std::istream & load);
184   friend std::ostream & operator <<(std::ostream & save, BLSURFPlugin_Hypothesis & hyp);
185   friend std::istream & operator >>(std::istream & load, BLSURFPlugin_Hypothesis & hyp);
186
187   /*!
188    * \brief Does nothing
189    * \param theMesh - the built mesh
190    * \param theShape - the geometry of interest
191    * \retval bool - always false
192    */
193   virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
194
195   /*!
196    * \brief Initialize my parameter values by default parameters.
197    *  \retval bool - true if parameter values have been successfully defined
198    */
199   virtual bool SetParametersByDefaults(const TDefaults& dflts, const SMESH_Mesh* theMesh=0);
200
201 private:
202   Topology        _topology;
203   PhysicalMesh    _physicalMesh;
204   double          _phySize, _phyMin, _phyMax;
205   GeometricMesh   _geometricMesh;
206   double          _angleMeshS, _angleMeshC, _hgeoMin, _hgeoMax;
207   double          _gradation;
208   bool            _quadAllowed;
209   bool            _decimesh;
210   int             _verb;
211   TOptionValues   _option2value;
212   TOptionNames    _doubleOptions, _charOptions;
213   TSizeMap        _sizeMap;
214   TSizeMap        _attractors;
215   TEnforcedVertexMap _enforcedVertices;
216 /*
217   TSizeMap      _customSizeMap;
218 */
219 };
220
221 #endif