Salome HOME
Be able to use library by setting MG_Hybrid_Parameters.SetToUseLibrary(True)
[plugins/hybridplugin.git] / src / HYBRIDPlugin / HYBRIDPlugin_Hypothesis_i.hxx
1 // Copyright (C) 2007-2024  CEA, EDF
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   : HYBRIDPlugin_Hypothesis_i.hxx
22 // Author : Christian VAN WAMBEKE (CEA)
23 // ---
24 //
25 #ifndef _HYBRIDPlugin_Hypothesis_i_HXX_
26 #define _HYBRIDPlugin_Hypothesis_i_HXX_
27
28 #include "HYBRIDPlugin_Defs.hxx"
29
30 #include <SALOMEconfig.h>
31 #include CORBA_SERVER_HEADER(HYBRIDPlugin_Algorithm)
32
33 #include "SMESH_Hypothesis_i.hxx"
34 #include "SMESH_Mesh_i.hxx"
35 #include "HYBRIDPlugin_Hypothesis.hxx"
36
37 class SMESH_Gen;
38
39 // HYBRIDPlugin parameters hypothesis
40
41 class HYBRIDPLUGIN_EXPORT HYBRIDPlugin_Hypothesis_i:
42   public virtual POA_HYBRIDPlugin::HYBRIDPlugin_Hypothesis,
43   public virtual SMESH_Hypothesis_i
44 {
45  public:
46   // Constructor
47   HYBRIDPlugin_Hypothesis_i (PortableServer::POA_ptr thePOA,
48                              ::SMESH_Gen*            theGenImpl);
49   // Destructor
50   virtual ~HYBRIDPlugin_Hypothesis_i();
51
52   /*!
53    * Sizes of boundary layers are relative to the surface size. Default no
54    */
55   void SetHeightIsRelative( CORBA::Boolean isRelative );
56   CORBA::Boolean GetHeightIsRelative();
57   /*!
58    * Maximum internal angles of boundary elements (in degree)
59    */
60   void SetBoundaryLayersMaxElemAngle( CORBA::Double angle );
61   CORBA::Double GetBoundaryLayersMaxElemAngle();
62   /*!
63    * To mesh "holes" in a solid or not. Default is to mesh.
64    */
65   void SetToMeshHoles(CORBA::Boolean toMesh);
66   CORBA::Boolean GetToMeshHoles();
67   /*!
68    * IDs of faces to grow the layers on
69    */
70   void SetFacesWithLayers(const SMESH::long_array& faceIDs);
71   SMESH::long_array* GetFacesWithLayers();
72   /*!
73    * IDs of faces to imprint the layers on
74    */
75   void SetFacesWithImprinting(const SMESH::long_array& faceIDs);
76   SMESH::long_array* GetFacesWithImprinting();
77   /*!
78    * IDs of faces to snap the layers on (faces that already have surface layers)
79    */
80   void SetFacesWithSnapping(const SMESH::long_array& faceIDs);
81   SMESH::long_array* GetFacesWithSnapping();
82   /*!
83    * To call MG-Hybrid by library. Default is no (i.e. by executable)
84    */
85   void SetToUseLibrary(CORBA::Boolean toUseLib);
86   CORBA::Boolean GetToUseLibrary();
87   /*!
88    * To mesh "layers on all wrap". Default is to mesh.
89    */
90   void SetLayersOnAllWrap(CORBA::Boolean toMesh);
91   CORBA::Boolean GetLayersOnAllWrap();
92   /*!
93    * To make groups of volumes of different domains when mesh is generated from skin.
94    * Default is to make groups.
95    * This option works only (1) for the mesh w/o shape and (2) if GetToMeshHoles() == true
96    */
97   void SetToMakeGroupsOfDomains(CORBA::Boolean toMakeGroups);
98   CORBA::Boolean GetToMakeGroupsOfDomains();
99   /*!
100    * Maximal size of memory to be used by the algorithm (in Megabytes)
101    */
102   void SetMaximumMemory(CORBA::Double MB);
103   CORBA::Double GetMaximumMemory();
104   /*!
105    * Initial size of memory to be used by the algorithm (in Megabytes) in
106    * automatic memory adjustment mode. Default is zero
107    */
108   void SetInitialMemory(CORBA::Double MB);
109   CORBA::Double GetInitialMemory();
110   /*!
111    * Optimization level: 0-none, 1-light, 2-medium, 3-strong. Default is medium
112    */
113   void SetOptimizationLevel(CORBA::Short level);
114   CORBA::Short GetOptimizationLevel();
115   /*!
116    * Collision Mode: 0-decrease, 1-stop. Default is decrease
117    */
118   void SetCollisionMode(CORBA::Short mode);
119   CORBA::Short GetCollisionMode();
120   /*!
121    * Path to working directory
122    */
123   void SetWorkingDirectory(const char* path);
124   char* GetWorkingDirectory();
125   /*!
126    * To keep working files or remove them. Log file remains in case of errors anyway.
127    */
128   void SetKeepFiles(CORBA::Boolean toKeep);
129   CORBA::Boolean GetKeepFiles();
130   /*!
131    * Verbose level [0-10]
132    *  0 - no standard output,
133    *  2 - prints the data, quality statistics of the skin and final meshes and
134    *     indicates when the final mesh is being saved. In addition the software
135    *     gives indication regarding the CPU time.
136    * 10 - same as 2 plus the main steps in the computation, quality statistics
137    *     histogram of the skin mesh, quality statistics histogram together with
138    *     the characteristics of the final mesh.
139    */
140   void SetVerboseLevel(CORBA::Short level);
141   CORBA::Short GetVerboseLevel();
142   /*!
143    * To create new nodes
144    */
145   void SetToCreateNewNodes(CORBA::Boolean toCreate);
146   CORBA::Boolean GetToCreateNewNodes();
147   /*!
148    * To use boundary recovery version which tries to create mesh on a very poor
149    * quality surface mesh
150    */
151   void SetToUseBoundaryRecoveryVersion(CORBA::Boolean toUse);
152   CORBA::Boolean GetToUseBoundaryRecoveryVersion();
153   /*!
154    * Applies finite-element correction by replacing overconstrained elements where
155    * it is possible. The process is cutting first the overconstrained edges and
156    * second the overconstrained facets. This insure that no edges have two boundary
157    * vertices and that no facets have three boundary vertices.
158    */
159   void SetFEMCorrection(CORBA::Boolean toUseFem);
160   CORBA::Boolean GetFEMCorrection();
161   /*!
162    * To removes initial central point.
163    */
164   void SetToRemoveCentralPoint(CORBA::Boolean toRemove);
165   CORBA::Boolean GetToRemoveCentralPoint();
166
167   void SetOptionValue(const char* optionName, const char* optionValue);
168   char* GetOptionValue(const char* optionName);
169   void UnsetOption(const char* optionName);
170
171   HYBRIDPlugin::string_array* GetOptionValues();
172   HYBRIDPlugin::string_array* GetAdvancedOptionValues();
173
174   void SetOptionValues(const HYBRIDPlugin::string_array& options);
175   void SetAdvancedOptionValues(const HYBRIDPlugin::string_array& options);
176
177   void AddOption(const char* optionName, const char* optionValue);
178   char* GetOption(const char* optionName);
179   /*!
180    * To set hiden/undocumented/advanced options
181    */
182   void SetAdvancedOption(const char* theOptAndVals );
183   char* GetAdvancedOption();
184   void SetTextOption(const char* option);
185   char* GetTextOption();
186   /*!
187   * To define the volumic gradation
188   */
189   void SetGradation(CORBA::Double gradation);
190   CORBA::Double GetGradation();
191   /*!
192   * Print log in standard output
193   */
194   void SetStandardOutputLog(CORBA::Boolean logInStandardOutput);
195   CORBA::Boolean GetStandardOutputLog();
196   /*!
197   * Remove log file on success
198   */
199   void SetRemoveLogOnSuccess(CORBA::Boolean removeLogOnSuccess);
200   CORBA::Boolean GetRemoveLogOnSuccess();
201   
202   void SetBoundaryLayersGrowth(CORBA::Short mode);
203   CORBA::Short GetBoundaryLayersGrowth();
204
205   void SetElementGeneration(CORBA::Short mode);
206   CORBA::Short GetElementGeneration();
207
208   void SetAddMultinormals(CORBA::Boolean toAddMultinormals);
209   CORBA::Boolean GetAddMultinormals();
210
211   void SetSmoothNormals(CORBA::Boolean toSmoothNormals);
212   CORBA::Boolean GetSmoothNormals();
213
214   void SetHeightFirstLayer(CORBA::Double toHeightFirstLayer);
215   CORBA::Double GetHeightFirstLayer();
216
217   void SetBoundaryLayersProgression(CORBA::Double toBoundaryLayersProgression);
218   CORBA::Double GetBoundaryLayersProgression();
219   
220   void SetCoreSize(CORBA::Double toCoreSize);
221   CORBA::Double GetCoreSize();
222
223   void SetMultinormalsAngle(CORBA::Double toMultinormalsAngle);
224   CORBA::Double GetMultinormalsAngle();
225   
226   void SetNbOfBoundaryLayers(CORBA::Short toNbOfBoundaryLayers);
227   CORBA::Short GetNbOfBoundaryLayers();
228
229   /*!
230    * To set an enforced vertex
231    */
232   bool p_SetEnforcedVertex(CORBA::Double size, CORBA::Double x = 0, CORBA::Double y = 0, CORBA::Double z = 0,
233                            const char* theVertexName = "", const char* theVertexEntry = "", const char* theGroupName = "",
234                            CORBA::Boolean isCompound = false);
235   bool SetEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size);
236   bool SetEnforcedVertexNamed(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size, const char* theVertexName);
237   bool SetEnforcedVertexWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size, const char* theGroupName);
238   bool SetEnforcedVertexNamedWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size, const char* theVertexName, const char* theGroupName);
239   bool SetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex, CORBA::Double size);
240   bool SetEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theVertex, CORBA::Double size, const char* theGroupName);
241   CORBA::Double GetEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z);
242   CORBA::Double GetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex);
243   bool RemoveEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z);
244   bool RemoveEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex);
245   HYBRIDPlugin::HYBRIDEnforcedVertexList* GetEnforcedVertices();
246   void ClearEnforcedVertices();
247   /*!
248    * To set an enforced mesh
249    */  
250   bool p_SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType elementType, const char* theName="", const char* theGroupName="");
251   bool SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType elementType);
252   bool SetEnforcedMeshWithGroup(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType elementType, const char* theGroupName);
253
254   /* OBSOLETE FUNCTIONS */
255   bool SetEnforcedMeshSize(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType elementType, double size);
256   bool SetEnforcedMeshSizeWithGroup(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType elementType, double size, const char* theGroupName);
257   /* OBSOLETE FUNCTIONS */
258
259   HYBRIDPlugin::HYBRIDEnforcedMeshList* GetEnforcedMeshes();
260   void ClearEnforcedMeshes();
261
262   // Get implementation
263   ::HYBRIDPlugin_Hypothesis* GetImpl();
264
265   // Verify whether hypothesis supports given entity type
266   CORBA::Boolean IsDimSupported( SMESH::Dimension type );
267   
268   // Methods for copying mesh definition to other geometry
269   virtual bool getObjectsDependOn( std::vector< std::string > & /*entryArray*/,
270                                    std::vector< int >         & /*subIDArray*/ ) const { return false; }
271   virtual bool setObjectsDependOn( std::vector< std::string > & /*entryArray*/,
272                                    std::vector< int >         & /*subIDArray*/ ) { return true; }
273 };
274
275 #endif