Salome HOME
Revert "Synchronize adm files"
[plugins/hexoticplugin.git] / src / HexoticPlugin / HexoticPlugin_Hypothesis.hxx
1 // Copyright (C) 2007-2014  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
35 // class HexoticSizeMap
36 // {
37 // public:
38 //   SizeMap(const TopoDS_Shape& theShape, double theSize)
39 //   {
40 //     shape=theShape;
41 //     size=theSize;
42 //   };
43 //   TopoDS_Shape shape;
44 //   double size;
45 // }
46 //  Parameters for work of Hexotic
47 //
48
49 class HEXOTICPLUGIN_EXPORT HexoticPlugin_Hypothesis: public SMESH_Hypothesis
50 {
51 public:
52
53   HexoticPlugin_Hypothesis(int hypId, int studyId, SMESH_Gen* gen);
54
55   void SetHexesMinLevel(int theVal);
56   int GetHexesMinLevel() const { return _hexesMinLevel; }
57
58   void SetHexesMaxLevel(int theVal);
59   int GetHexesMaxLevel() const { return _hexesMaxLevel; }
60
61   void SetMinSize(double theVal);
62   double GetMinSize() const { return _minSize; }
63
64   void SetMaxSize(double theVal);
65   double GetMaxSize() const { return _maxSize; }
66
67   void SetHexoticIgnoreRidges(bool theVal);
68   bool GetHexoticIgnoreRidges() const { return _hexoticIgnoreRidges; }
69
70   void SetHexoticInvalidElements(bool theVal);
71   bool GetHexoticInvalidElements() const { return _hexoticInvalidElements; }
72    
73   void SetHexoticSharpAngleThreshold(double theVal);
74   double GetHexoticSharpAngleThreshold() const { return _hexoticSharpAngleThreshold; }
75    
76   void SetHexoticNbProc(int theVal);
77   int GetHexoticNbProc() const { return _hexoticNbProc; }
78   
79   void SetHexoticWorkingDirectory(const std::string& path);
80   std::string GetHexoticWorkingDirectory() const { return _hexoticWorkingDirectory; }
81
82   void SetHexoticSdMode(int theVal);
83   int GetHexoticSdMode() const { return _hexoticSdMode; }
84
85   void SetHexoticVerbosity(int theVal);
86   int GetHexoticVerbosity() const { return _hexoticVerbosity; }
87
88   void SetHexoticMaxMemory(int theVal);
89   int GetHexoticMaxMemory() const { return _hexoticMaxMemory; }
90   
91   // Size Maps
92   typedef std::map<std::string,double> THexoticSizeMaps;
93   
94   // For the GUI HexoticPluginGUI_HypothesisCreator::storeParamToHypo
95   THexoticSizeMaps GetSizeMaps() const { return _sizeMaps; }; 
96   
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);
100
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();
115
116   // Persistence
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);
121
122   /*!
123    * \brief Does nothing
124    * \param theMesh - the built mesh
125    * \param theShape - the geometry of interest
126    * \retval bool - always false
127    */
128   virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
129
130   /*!
131    * \brief Initialize my parameter values by default parameters.
132    *  \retval bool - true if parameter values have been successfully defined
133    */
134   virtual bool SetParametersByDefaults(const TDefaults& dflts, const SMESH_Mesh* theMesh=0);
135
136 private:
137   int    _hexesMinLevel;
138   int    _hexesMaxLevel;
139   double _minSize;
140   double _maxSize;
141   bool   _hexoticIgnoreRidges;
142   bool   _hexoticInvalidElements;
143   double _hexoticSharpAngleThreshold;
144   int    _hexoticNbProc;
145   int    _hexoticSdMode;
146   int    _hexoticVerbosity;
147   int    _hexoticMaxMemory;
148   THexoticSizeMaps _sizeMaps;
149   std::string _hexoticWorkingDirectory ;
150 };
151
152 #endif