1 // Copyright (C) 2007-2015 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, int studyId, 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 SetTextOptions(const std::string& theOptions);
95 std::string GetTextOptions() const { return _textOptions; }
98 typedef std::map<std::string,double> THexoticSizeMaps;
100 // For the GUI HexoticPluginGUI_HypothesisCreator::storeParamToHypo
101 THexoticSizeMaps GetSizeMaps() const { return _sizeMaps; };
103 // Add one size map to the collection of size maps (user interface)
104 bool AddSizeMap(std::string theEntry, double theSize);
105 bool UnsetSizeMap(std::string theEntry);
107 void SetNbLayers(int theVal);
108 int GetNbLayers() const { return _nbLayers; }
110 void SetFirstLayerSize(double theVal);
111 double GetFirstLayerSize() const { return _firstLayerSize; }
113 void SetDirection(bool theVal);
114 bool GetDirection() const { return _direction; }
116 void SetGrowth(double theVal);
117 double GetGrowth() const { return _growth; }
119 bool SetFacesWithLayers(const std::vector<int>& theVal);
120 std::vector<int> GetFacesWithLayers() const { return _facesWithLayers; }
122 bool SetImprintedFaces(const std::vector<int>& theVal);
123 std::vector<int> GetImprintedFaces() const { return _imprintedFaces; }
125 // the parameters default values
126 static int GetDefaultHexesMinLevel();
127 static int GetDefaultHexesMaxLevel();
128 static double GetDefaultMinSize();
129 static double GetDefaultMaxSize();
130 static bool GetDefaultHexoticIgnoreRidges();
131 static bool GetDefaultHexoticInvalidElements();
132 static double GetDefaultHexoticSharpAngleThreshold();
133 static int GetDefaultHexoticNbProc();
134 static std::string GetDefaultHexoticWorkingDirectory();
135 static int GetDefaultHexoticSdMode();
136 static int GetDefaultHexoticVerbosity();
137 static int GetDefaultHexoticMaxMemory();
138 static std::string GetDefaultTextOptions();
139 static THexoticSizeMaps GetDefaultHexoticSizeMaps();
140 static int GetDefaultNbLayers();
141 static double GetDefaultFirstLayerSize();
142 static bool GetDefaultDirection();
143 static double GetDefaultGrowth();
144 static std::vector<int> GetDefaultFacesWithLayers();
145 static std::vector<int> GetDefaultImprintedFaces();
148 virtual std::ostream& SaveTo(std::ostream& save);
149 virtual std::istream& LoadFrom(std::istream& load);
150 friend std::ostream& operator <<(std::ostream& save, HexoticPlugin_Hypothesis& hyp);
151 friend std::istream& operator >>(std::istream& load, HexoticPlugin_Hypothesis& hyp);
154 * \brief Does nothing
155 * \param theMesh - the built mesh
156 * \param theShape - the geometry of interest
157 * \retval bool - always false
159 virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
162 * \brief Initialize my parameter values by default parameters.
163 * \retval bool - true if parameter values have been successfully defined
165 virtual bool SetParametersByDefaults(const TDefaults& dflts, const SMESH_Mesh* theMesh=0);
172 bool _hexoticIgnoreRidges;
173 bool _hexoticInvalidElements;
174 double _hexoticSharpAngleThreshold;
177 int _hexoticVerbosity;
178 int _hexoticMaxMemory;
179 std::string _textOptions;
180 THexoticSizeMaps _sizeMaps;
181 std::string _hexoticWorkingDirectory;
183 double _firstLayerSize;
186 std::vector<int> _facesWithLayers;
187 std::vector<int> _imprintedFaces;