Salome HOME
1c59739768c7a29236797cf27d7ec38f76458a9f
[plugins/ghs3dplugin.git] / src / GHS3DPlugin_Hypothesis.hxx
1 //  Copyright (C) 2004-2008  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.
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 //  GHS3DPlugin : C++ implementation
20 // File      : GHS3DPlugin_Hypothesis.hxx
21 // Created   : Wed Apr  2 12:21:17 2008
22 // Author    : Edward AGAPOV (eap)
23 //
24 #ifndef GHS3DPlugin_Hypothesis_HeaderFile
25 #define GHS3DPlugin_Hypothesis_HeaderFile
26
27 #include "GHS3DPlugin_Defs.hxx"
28
29 #include <SMESH_Hypothesis.hxx>
30
31 using namespace std;
32
33 class GHS3DPLUGIN_EXPORT GHS3DPlugin_Hypothesis: public SMESH_Hypothesis
34 {
35 public:
36
37   GHS3DPlugin_Hypothesis(int hypId, int studyId, SMESH_Gen * gen);
38
39   /*!
40    * To mesh "holes" in a solid or not. Default is to mesh.
41    */
42   void SetToMeshHoles(bool toMesh);
43   bool GetToMeshHoles(bool checkFreeOption = false) const;
44   /*!
45    * Maximal size of memory to be used by the algorithm (in Megabytes)
46    */
47   void SetMaximumMemory(short MB);
48   short GetMaximumMemory() const;
49   /*!
50    * Initial size of memory to be used by the algorithm (in Megabytes) in
51    * automatic memory adjustment mode. Default is zero
52    */
53   void SetInitialMemory(short MB);
54   short GetInitialMemory() const;
55   /*!
56    * Optimization level: 0-none, 1-light, 2-medium, 3-strong. Default is medium
57    */
58   enum OptimizationLevel { None = 0, Light, Medium, Strong };
59   void SetOptimizationLevel(OptimizationLevel level);
60   OptimizationLevel GetOptimizationLevel() const;
61   /*!
62    * Path to working directory
63    */
64   void SetWorkingDirectory(const string& path);
65   string GetWorkingDirectory() const;
66   /*!
67    * To keep working files or remove them. Log file remains in case of errors anyway.
68    */
69   void SetKeepFiles(bool toKeep);
70   bool GetKeepFiles() const;
71   /*!
72    * Verbose level [0-10]
73    *  0 - no standard output,
74    *  2 - prints the data, quality statistics of the skin and final meshes and
75    *     indicates when the final mesh is being saved. In addition the software
76    *     gives indication regarding the CPU time.
77    * 10 - same as 2 plus the main steps in the computation, quality statistics
78    *     histogram of the skin mesh, quality statistics histogram together with
79    *     the characteristics of the final mesh.
80    */
81   void SetVerboseLevel(short level);
82   short GetVerboseLevel() const;
83   /*!
84    * To create new nodes
85    */
86   void SetToCreateNewNodes(bool toCreate);
87   bool GetToCreateNewNodes() const;
88   /*!
89    * To use boundary recovery version which tries to create mesh on a very poor
90    * quality surface mesh
91    */
92   void SetToUseBoundaryRecoveryVersion(bool toUse);
93   bool GetToUseBoundaryRecoveryVersion() const;
94   /*!
95    * To set hiden/undocumented/advanced options
96    */
97   void SetTextOption(const string& option);
98   string GetTextOption() const;
99
100   static bool   DefaultMeshHoles();
101   static short  DefaultMaximumMemory();
102   static short  DefaultInitialMemory();
103   static short  DefaultOptimizationLevel();
104   static string DefaultWorkingDirectory();
105   static bool   DefaultKeepFiles();
106   static short  DefaultVerboseLevel();
107   static bool   DefaultToCreateNewNodes();
108   static bool   DefaultToUseBoundaryRecoveryVersion();
109
110   /*!
111    * \brief Return command to run ghs3d mesher excluding file prefix (-f)
112    */
113   static std::string CommandToRun(const GHS3DPlugin_Hypothesis* hyp,
114                                   const bool                    hasShapeToMesh=true);
115   /*!
116    * \brief Return a unique file name
117    */
118   static std::string GetFileName(const GHS3DPlugin_Hypothesis* hyp);
119
120   // Persistence
121   virtual ostream & SaveTo(ostream & save);
122   virtual istream & LoadFrom(istream & load);
123   friend GHS3DPLUGIN_EXPORT ostream & operator <<(ostream & save, GHS3DPlugin_Hypothesis & hyp);
124   friend GHS3DPLUGIN_EXPORT istream & operator >>(istream & load, GHS3DPlugin_Hypothesis & hyp);
125
126   /*!
127    * \brief Does nothing
128    */
129   virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
130
131   /*!
132    * \brief Does nothing
133    */
134   virtual bool SetParametersByDefaults(const TDefaults& dflts, const SMESH_Mesh* theMesh=0);
135
136 private:
137
138   bool   myToMeshHoles;
139   short  myMaximumMemory;
140   short  myInitialMemory;
141   short  myOptimizationLevel;
142   bool   myKeepFiles;
143   string myWorkingDirectory;
144   short  myVerboseLevel;
145   bool   myToCreateNewNodes;
146   bool   myToUseBoundaryRecoveryVersion;
147   string myTextOption;
148   
149 };
150
151
152 #endif