Salome HOME
23586: [EDF] HYDRO: Copy mesh to new geometry
[plugins/hexoticplugin.git] / src / HexoticPlugin / HexoticPlugin_Hypothesis.hxx
1 // Copyright (C) 2007-2016  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, or (at your option) any later version.
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   : HexoticPlugin_Hypothesis.hxx
22 // Author : Lioka RAZAFINDRAZAKA (CEA)
23 // ---
24 //
25 #ifndef _HexoticPlugin_Hypothesis_HXX_
26 #define _HexoticPlugin_Hypothesis_HXX_
27
28 #include "HexoticPlugin_Defs.hxx"
29
30 #include "SMESH_Hypothesis.hxx"
31 #include "Utils_SALOME_Exception.hxx"
32
33 #include <map>
34 #include <vector>
35
36 // class HexoticSizeMap
37 // {
38 // public:
39 //   SizeMap(const TopoDS_Shape& theShape, double theSize)
40 //   {
41 //     shape=theShape;
42 //     size=theSize;
43 //   };
44 //   TopoDS_Shape shape;
45 //   double size;
46 // }
47 //  Parameters for work of MG-Hexa
48 //
49
50 class HEXOTICPLUGIN_EXPORT HexoticPlugin_Hypothesis: public SMESH_Hypothesis
51 {
52 public:
53
54   HexoticPlugin_Hypothesis(int hypId, SMESH_Gen* gen);
55
56   static const char* GetHypType() { return "MG-Hexa Parameters"; }
57
58   void SetHexesMinLevel(int theVal);
59   int GetHexesMinLevel() const { return _hexesMinLevel; }
60
61   void SetHexesMaxLevel(int theVal);
62   int GetHexesMaxLevel() const { return _hexesMaxLevel; }
63
64   void SetMinSize(double theVal);
65   double GetMinSize() const { return _minSize; }
66
67   void SetMaxSize(double theVal);
68   double GetMaxSize() const { return _maxSize; }
69
70   void SetHexoticIgnoreRidges(bool theVal);
71   bool GetHexoticIgnoreRidges() const { return _hexoticIgnoreRidges; }
72
73   void SetHexoticInvalidElements(bool theVal);
74   bool GetHexoticInvalidElements() const { return _hexoticInvalidElements; }
75    
76   void SetHexoticSharpAngleThreshold(double theVal);
77   double GetHexoticSharpAngleThreshold() const { return _hexoticSharpAngleThreshold; }
78    
79   void SetHexoticNbProc(int theVal);
80   int GetHexoticNbProc() const { return _hexoticNbProc; }
81   
82   void SetHexoticWorkingDirectory(const std::string& path);
83   std::string GetHexoticWorkingDirectory() const { return _hexoticWorkingDirectory; }
84
85   void SetHexoticSdMode(int theVal);
86   int GetHexoticSdMode() const { return _hexoticSdMode; }
87
88   void SetHexoticVerbosity(int theVal);
89   int GetHexoticVerbosity() const { return _hexoticVerbosity; }
90
91   void SetHexoticMaxMemory(int theVal);
92   int GetHexoticMaxMemory() const { return _hexoticMaxMemory; }
93   
94   void SetAdvancedOption(const std::string& theOptions);
95   std::string GetAdvancedOption() const { return _textOptions; }
96   void SetTextOptions(const std::string& theOptions); // obsolete
97   std::string GetTextOptions() const { return _textOptions; }
98
99   // Size Maps
100   typedef std::map<std::string,double> THexoticSizeMaps;
101   
102   // For the GUI HexoticPluginGUI_HypothesisCreator::storeParamToHypo
103   const THexoticSizeMaps& GetSizeMaps() const { return _sizeMaps; }
104
105   // Add one size map to the collection of size maps (user interface)
106   bool AddSizeMap(std::string theEntry, double theSize);
107   bool UnsetSizeMap(std::string theEntry);
108
109   void SetNbLayers(int theVal);
110   int GetNbLayers() const { return _nbLayers; }
111
112   void SetFirstLayerSize(double theVal);
113   double GetFirstLayerSize() const { return _firstLayerSize; }
114
115   void SetDirection(bool theVal);
116   bool GetDirection() const { return _direction; }
117
118   void SetGrowth(double theVal);
119   double GetGrowth() const { return _growth; }
120
121   bool SetFacesWithLayers(const std::vector<int>& theVal);
122   const std::vector<int>& GetFacesWithLayers() const { return _facesWithLayers; }
123
124   bool SetImprintedFaces(const std::vector<int>& theVal);
125   const std::vector<int>& GetImprintedFaces() const { return _imprintedFaces; }
126
127   // the parameters default values 
128   static int GetDefaultHexesMinLevel();
129   static int GetDefaultHexesMaxLevel();
130   static double GetDefaultMinSize();
131   static double GetDefaultMaxSize();
132   static bool GetDefaultHexoticIgnoreRidges();
133   static bool GetDefaultHexoticInvalidElements();
134   static double GetDefaultHexoticSharpAngleThreshold();
135   static int GetDefaultHexoticNbProc();
136   static std::string GetDefaultHexoticWorkingDirectory();
137   static int GetDefaultHexoticSdMode();
138   static int GetDefaultHexoticVerbosity();
139   static int GetDefaultHexoticMaxMemory();
140   static std::string GetDefaultTextOptions();
141   static THexoticSizeMaps GetDefaultHexoticSizeMaps();
142   static int GetDefaultNbLayers();
143   static double GetDefaultFirstLayerSize();
144   static bool GetDefaultDirection();
145   static double GetDefaultGrowth();
146   static std::vector<int> GetDefaultFacesWithLayers();
147   static std::vector<int> GetDefaultImprintedFaces();
148
149   // Persistence
150   virtual std::ostream& SaveTo(std::ostream& save);
151   virtual std::istream& LoadFrom(std::istream& load);
152   friend  std::ostream& operator <<(std::ostream& save, HexoticPlugin_Hypothesis& hyp);
153   friend  std::istream& operator >>(std::istream& load, HexoticPlugin_Hypothesis& hyp);
154
155   /*!
156    * \brief Does nothing
157    * \param theMesh - the built mesh
158    * \param theShape - the geometry of interest
159    * \retval bool - always false
160    */
161   virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
162
163   /*!
164    * \brief Initialize my parameter values by default parameters.
165    *  \retval bool - true if parameter values have been successfully defined
166    */
167   virtual bool SetParametersByDefaults(const TDefaults& dflts, const SMESH_Mesh* theMesh=0);
168
169 private:
170   int    _hexesMinLevel;
171   int    _hexesMaxLevel;
172   double _minSize;
173   double _maxSize;
174   bool   _hexoticIgnoreRidges;
175   bool   _hexoticInvalidElements;
176   double _hexoticSharpAngleThreshold;
177   int    _hexoticNbProc;
178   int    _hexoticSdMode;
179   int    _hexoticVerbosity;
180   int    _hexoticMaxMemory;
181   std::string _textOptions;
182   THexoticSizeMaps _sizeMaps;
183   std::string _hexoticWorkingDirectory;
184   int    _nbLayers;
185   double _firstLayerSize;
186   bool   _direction;
187   double _growth;
188   std::vector<int> _facesWithLayers;
189   std::vector<int> _imprintedFaces;
190 };
191
192 #endif