Salome HOME
Copyrights update 2015.
[plugins/hexoticplugin.git] / src / HexoticPlugin / HexoticPlugin_Hypothesis.hxx
1 // Copyright (C) 2007-2015  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 MG-Hexa
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   static const char* GetHypType() { return "MG-Hexa Parameters"; }
56
57   void SetHexesMinLevel(int theVal);
58   int GetHexesMinLevel() const { return _hexesMinLevel; }
59
60   void SetHexesMaxLevel(int theVal);
61   int GetHexesMaxLevel() const { return _hexesMaxLevel; }
62
63   void SetMinSize(double theVal);
64   double GetMinSize() const { return _minSize; }
65
66   void SetMaxSize(double theVal);
67   double GetMaxSize() const { return _maxSize; }
68
69   void SetHexoticIgnoreRidges(bool theVal);
70   bool GetHexoticIgnoreRidges() const { return _hexoticIgnoreRidges; }
71
72   void SetHexoticInvalidElements(bool theVal);
73   bool GetHexoticInvalidElements() const { return _hexoticInvalidElements; }
74    
75   void SetHexoticSharpAngleThreshold(double theVal);
76   double GetHexoticSharpAngleThreshold() const { return _hexoticSharpAngleThreshold; }
77    
78   void SetHexoticNbProc(int theVal);
79   int GetHexoticNbProc() const { return _hexoticNbProc; }
80   
81   void SetHexoticWorkingDirectory(const std::string& path);
82   std::string GetHexoticWorkingDirectory() const { return _hexoticWorkingDirectory; }
83
84   void SetHexoticSdMode(int theVal);
85   int GetHexoticSdMode() const { return _hexoticSdMode; }
86
87   void SetHexoticVerbosity(int theVal);
88   int GetHexoticVerbosity() const { return _hexoticVerbosity; }
89
90   void SetHexoticMaxMemory(int theVal);
91   int GetHexoticMaxMemory() const { return _hexoticMaxMemory; }
92   
93   // Size Maps
94   typedef std::map<std::string,double> THexoticSizeMaps;
95   
96   // For the GUI HexoticPluginGUI_HypothesisCreator::storeParamToHypo
97   THexoticSizeMaps GetSizeMaps() const { return _sizeMaps; }; 
98   
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);
102
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();
117
118   // Persistence
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);
123
124   /*!
125    * \brief Does nothing
126    * \param theMesh - the built mesh
127    * \param theShape - the geometry of interest
128    * \retval bool - always false
129    */
130   virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
131
132   /*!
133    * \brief Initialize my parameter values by default parameters.
134    *  \retval bool - true if parameter values have been successfully defined
135    */
136   virtual bool SetParametersByDefaults(const TDefaults& dflts, const SMESH_Mesh* theMesh=0);
137
138 private:
139   int    _hexesMinLevel;
140   int    _hexesMaxLevel;
141   double _minSize;
142   double _maxSize;
143   bool   _hexoticIgnoreRidges;
144   bool   _hexoticInvalidElements;
145   double _hexoticSharpAngleThreshold;
146   int    _hexoticNbProc;
147   int    _hexoticSdMode;
148   int    _hexoticVerbosity;
149   int    _hexoticMaxMemory;
150   THexoticSizeMaps _sizeMaps;
151   std::string _hexoticWorkingDirectory ;
152 };
153
154 #endif