1 // Copyright (C) 2007-2013 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.
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"
35 // class HexoticSizeMap
38 // SizeMap(const TopoDS_Shape& theShape, double theSize)
43 // TopoDS_Shape shape;
46 // Parameters for work of Hexotic
49 class HEXOTICPLUGIN_EXPORT HexoticPlugin_Hypothesis: public SMESH_Hypothesis
53 HexoticPlugin_Hypothesis(int hypId, int studyId, SMESH_Gen* gen);
55 void SetHexesMinLevel(int theVal);
56 int GetHexesMinLevel() const { return _hexesMinLevel; }
58 void SetHexesMaxLevel(int theVal);
59 int GetHexesMaxLevel() const { return _hexesMaxLevel; }
61 void SetMinSize(double theVal);
62 double GetMinSize() const { return _minSize; }
64 void SetMaxSize(double theVal);
65 double GetMaxSize() const { return _maxSize; }
67 void SetHexoticIgnoreRidges(bool theVal);
68 bool GetHexoticIgnoreRidges() const { return _hexoticIgnoreRidges; }
70 void SetHexoticInvalidElements(bool theVal);
71 bool GetHexoticInvalidElements() const { return _hexoticInvalidElements; }
73 void SetHexoticSharpAngleThreshold(double theVal);
74 double GetHexoticSharpAngleThreshold() const { return _hexoticSharpAngleThreshold; }
76 void SetHexoticNbProc(int theVal);
77 int GetHexoticNbProc() const { return _hexoticNbProc; }
79 void SetHexoticWorkingDirectory(const std::string& path);
80 std::string GetHexoticWorkingDirectory() const { return _hexoticWorkingDirectory; }
82 void SetHexoticSdMode(int theVal);
83 int GetHexoticSdMode() const { return _hexoticSdMode; }
85 void SetHexoticVerbosity(int theVal);
86 int GetHexoticVerbosity() const { return _hexoticVerbosity; }
88 void SetHexoticMaxMemory(int theVal);
89 int GetHexoticMaxMemory() const { return _hexoticMaxMemory; }
92 typedef std::map<std::string,double> THexoticSizeMaps;
94 // For the GUI HexoticPluginGUI_HypothesisCreator::storeParamToHypo
95 THexoticSizeMaps GetSizeMaps() const { return _sizeMaps; };
97 // Add one size map to the collection of size maps (user interface)
98 bool AddSizeMap(std::string theEntry, double theSize);
99 bool UnsetSizeMap(std::string theEntry);
101 // the parameters default values
102 static int GetDefaultHexesMinLevel();
103 static int GetDefaultHexesMaxLevel();
104 static double GetDefaultMinSize();
105 static double GetDefaultMaxSize();
106 static bool GetDefaultHexoticIgnoreRidges();
107 static bool GetDefaultHexoticInvalidElements();
108 static double GetDefaultHexoticSharpAngleThreshold();
109 static int GetDefaultHexoticNbProc();
110 static std::string GetDefaultHexoticWorkingDirectory();
111 static int GetDefaultHexoticSdMode();
112 static int GetDefaultHexoticVerbosity();
113 static int GetDefaultHexoticMaxMemory();
114 static THexoticSizeMaps GetDefaultHexoticSizeMaps();
117 virtual std::ostream& SaveTo(std::ostream& save);
118 virtual std::istream& LoadFrom(std::istream& load);
119 friend std::ostream& operator <<(std::ostream& save, HexoticPlugin_Hypothesis& hyp);
120 friend std::istream& operator >>(std::istream& load, HexoticPlugin_Hypothesis& hyp);
123 * \brief Does nothing
124 * \param theMesh - the built mesh
125 * \param theShape - the geometry of interest
126 * \retval bool - always false
128 virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
131 * \brief Initialize my parameter values by default parameters.
132 * \retval bool - true if parameter values have been successfully defined
134 virtual bool SetParametersByDefaults(const TDefaults& dflts, const SMESH_Mesh* theMesh=0);
141 bool _hexoticIgnoreRidges;
142 bool _hexoticInvalidElements;
143 double _hexoticSharpAngleThreshold;
146 int _hexoticVerbosity;
147 int _hexoticMaxMemory;
148 THexoticSizeMaps _sizeMaps;
149 std::string _hexoticWorkingDirectory ;