1 // Copyright (C) 2007-2014 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"
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 static const char* GetHypType() { return "MG-Hexa Parameters"; }
57 void SetHexesMinLevel(int theVal);
58 int GetHexesMinLevel() const { return _hexesMinLevel; }
60 void SetHexesMaxLevel(int theVal);
61 int GetHexesMaxLevel() const { return _hexesMaxLevel; }
63 void SetMinSize(double theVal);
64 double GetMinSize() const { return _minSize; }
66 void SetMaxSize(double theVal);
67 double GetMaxSize() const { return _maxSize; }
69 void SetHexoticIgnoreRidges(bool theVal);
70 bool GetHexoticIgnoreRidges() const { return _hexoticIgnoreRidges; }
72 void SetHexoticInvalidElements(bool theVal);
73 bool GetHexoticInvalidElements() const { return _hexoticInvalidElements; }
75 void SetHexoticSharpAngleThreshold(double theVal);
76 double GetHexoticSharpAngleThreshold() const { return _hexoticSharpAngleThreshold; }
78 void SetHexoticNbProc(int theVal);
79 int GetHexoticNbProc() const { return _hexoticNbProc; }
81 void SetHexoticWorkingDirectory(const std::string& path);
82 std::string GetHexoticWorkingDirectory() const { return _hexoticWorkingDirectory; }
84 void SetHexoticSdMode(int theVal);
85 int GetHexoticSdMode() const { return _hexoticSdMode; }
87 void SetHexoticVerbosity(int theVal);
88 int GetHexoticVerbosity() const { return _hexoticVerbosity; }
90 void SetHexoticMaxMemory(int theVal);
91 int GetHexoticMaxMemory() const { return _hexoticMaxMemory; }
94 typedef std::map<std::string,double> THexoticSizeMaps;
96 // For the GUI HexoticPluginGUI_HypothesisCreator::storeParamToHypo
97 THexoticSizeMaps GetSizeMaps() const { return _sizeMaps; };
99 // Add one size map to the collection of size maps (user interface)
100 bool AddSizeMap(std::string theEntry, double theSize);
101 bool UnsetSizeMap(std::string theEntry);
103 // the parameters default values
104 static int GetDefaultHexesMinLevel();
105 static int GetDefaultHexesMaxLevel();
106 static double GetDefaultMinSize();
107 static double GetDefaultMaxSize();
108 static bool GetDefaultHexoticIgnoreRidges();
109 static bool GetDefaultHexoticInvalidElements();
110 static double GetDefaultHexoticSharpAngleThreshold();
111 static int GetDefaultHexoticNbProc();
112 static std::string GetDefaultHexoticWorkingDirectory();
113 static int GetDefaultHexoticSdMode();
114 static int GetDefaultHexoticVerbosity();
115 static int GetDefaultHexoticMaxMemory();
116 static THexoticSizeMaps GetDefaultHexoticSizeMaps();
119 virtual std::ostream& SaveTo(std::ostream& save);
120 virtual std::istream& LoadFrom(std::istream& load);
121 friend std::ostream& operator <<(std::ostream& save, HexoticPlugin_Hypothesis& hyp);
122 friend std::istream& operator >>(std::istream& load, HexoticPlugin_Hypothesis& hyp);
125 * \brief Does nothing
126 * \param theMesh - the built mesh
127 * \param theShape - the geometry of interest
128 * \retval bool - always false
130 virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
133 * \brief Initialize my parameter values by default parameters.
134 * \retval bool - true if parameter values have been successfully defined
136 virtual bool SetParametersByDefaults(const TDefaults& dflts, const SMESH_Mesh* theMesh=0);
143 bool _hexoticIgnoreRidges;
144 bool _hexoticInvalidElements;
145 double _hexoticSharpAngleThreshold;
148 int _hexoticVerbosity;
149 int _hexoticMaxMemory;
150 THexoticSizeMaps _sizeMaps;
151 std::string _hexoticWorkingDirectory ;