1 // Copyright (C) 2007-2019 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, or (at your option) any later version.
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
21 // File : HexoticPlugin_Hypothesis.hxx
22 // Author : Lioka RAZAFINDRAZAKA (CEA)
25 #ifndef _HexoticPlugin_Hypothesis_HXX_
26 #define _HexoticPlugin_Hypothesis_HXX_
28 #include "HexoticPlugin_Defs.hxx"
30 #include "SMESH_Hypothesis.hxx"
31 #include "Utils_SALOME_Exception.hxx"
36 // class HexoticSizeMap
39 // SizeMap(const TopoDS_Shape& theShape, double theSize)
44 // TopoDS_Shape shape;
47 // Parameters for work of MG-Hexa
50 class HEXOTICPLUGIN_EXPORT HexoticPlugin_Hypothesis: public SMESH_Hypothesis
54 HexoticPlugin_Hypothesis(int hypId, SMESH_Gen* gen);
56 static const char* GetHypType() { return "MG-Hexa Parameters"; }
58 void SetHexesMinLevel(int theVal);
59 int GetHexesMinLevel() const { return _hexesMinLevel; }
61 void SetHexesMaxLevel(int theVal);
62 int GetHexesMaxLevel() const { return _hexesMaxLevel; }
64 void SetMinSize(double theVal);
65 double GetMinSize() const { return _minSize; }
67 void SetMaxSize(double theVal);
68 double GetMaxSize() const { return _maxSize; }
70 void SetHexoticIgnoreRidges(bool theVal);
71 bool GetHexoticIgnoreRidges() const { return _hexoticIgnoreRidges; }
73 void SetHexoticInvalidElements(bool theVal);
74 bool GetHexoticInvalidElements() const { return _hexoticInvalidElements; }
76 void SetHexoticSharpAngleThreshold(double theVal);
77 double GetHexoticSharpAngleThreshold() const { return _hexoticSharpAngleThreshold; }
79 void SetHexoticNbProc(int theVal);
80 int GetHexoticNbProc() const { return _hexoticNbProc; }
82 void SetHexoticWorkingDirectory(const std::string& path);
83 std::string GetHexoticWorkingDirectory() const { return _hexoticWorkingDirectory; }
85 void SetHexoticSdMode(int theVal);
86 int GetHexoticSdMode() const { return _hexoticSdMode; }
88 void SetHexoticVerbosity(int theVal);
89 int GetHexoticVerbosity() const { return _hexoticVerbosity; }
91 void SetHexoticMaxMemory(int theVal);
92 int GetHexoticMaxMemory() const { return _hexoticMaxMemory; }
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; }
100 typedef std::map<std::string,double> THexoticSizeMaps;
102 // For the GUI HexoticPluginGUI_HypothesisCreator::storeParamToHypo
103 const THexoticSizeMaps& GetSizeMaps() const { return _sizeMaps; }
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);
109 void SetNbLayers(int theVal);
110 int GetNbLayers() const { return _nbLayers; }
112 void SetFirstLayerSize(double theVal);
113 double GetFirstLayerSize() const { return _firstLayerSize; }
115 void SetDirection(bool theVal);
116 bool GetDirection() const { return _direction; }
118 void SetGrowth(double theVal);
119 double GetGrowth() const { return _growth; }
121 bool SetFacesWithLayers(const std::vector<int>& theVal);
122 const std::vector<int>& GetFacesWithLayers() const { return _facesWithLayers; }
124 bool SetImprintedFaces(const std::vector<int>& theVal);
125 const std::vector<int>& GetImprintedFaces() const { return _imprintedFaces; }
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();
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);
156 * \brief Does nothing
157 * \param theMesh - the built mesh
158 * \param theShape - the geometry of interest
159 * \retval bool - always false
161 virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
164 * \brief Initialize my parameter values by default parameters.
165 * \retval bool - true if parameter values have been successfully defined
167 virtual bool SetParametersByDefaults(const TDefaults& dflts, const SMESH_Mesh* theMesh=0);
174 bool _hexoticIgnoreRidges;
175 bool _hexoticInvalidElements;
176 double _hexoticSharpAngleThreshold;
179 int _hexoticVerbosity;
180 int _hexoticMaxMemory;
181 std::string _textOptions;
182 THexoticSizeMaps _sizeMaps;
183 std::string _hexoticWorkingDirectory;
185 double _firstLayerSize;
188 std::vector<int> _facesWithLayers;
189 std::vector<int> _imprintedFaces;