Salome HOME
Fix the option remove_tiny_uv_edges to use the new advanced options mechanism
[plugins/blsurfplugin.git] / src / BLSURFPlugin / BLSURFPlugin_Hypothesis_i.hxx
1 // Copyright (C) 2007-2016  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    : BLSURFPlugin_Hypothesis.hxx
22 // Authors : Francis KLOSS (OCC) & Patrick LAUG (INRIA) & Lioka RAZAFINDRAZAKA (CEA)
23 //           Size maps developement: Nicolas GEIMER (OCC) & Gilles DAVID (EURIWARE)
24 // ---
25 //
26 #ifndef _BLSURFPlugin_Hypothesis_i_HXX_
27 #define _BLSURFPlugin_Hypothesis_i_HXX_
28
29 #include <SALOMEconfig.h>
30 #include CORBA_SERVER_HEADER(BLSURFPlugin_Algorithm)
31
32 #include "SMESH_Hypothesis_i.hxx"
33 #include "BLSURFPlugin_Hypothesis.hxx"
34
35 class SMESH_Gen;
36 class GEOM_Object;
37
38 // BLSURFPlugin parameters hypothesis
39
40 class BLSURFPlugin_Hypothesis_i: public virtual POA_BLSURFPlugin::BLSURFPlugin_Hypothesis,
41     public virtual SMESH_Hypothesis_i {
42 public:
43   // Constructor
44   BLSURFPlugin_Hypothesis_i(PortableServer::POA_ptr thePOA, int theStudyId, ::SMESH_Gen* theGenImpl);
45   // Destructor
46   virtual ~BLSURFPlugin_Hypothesis_i();
47
48   void SetPhysicalMesh(CORBA::Long theValue);
49   CORBA::Long GetPhysicalMesh();
50
51   void SetGeometricMesh(CORBA::Long theValue);
52   CORBA::Long GetGeometricMesh();
53
54   void SetPhySize(CORBA::Double theValue);
55   void SetPhySizeRel(CORBA::Double theValue);
56   CORBA::Double GetPhySize();
57   CORBA::Boolean IsPhySizeRel();
58
59   void SetMinSize(CORBA::Double theMinSize);
60   void SetMinSizeRel(CORBA::Double theMinSize);
61   CORBA::Double GetMinSize();
62   CORBA::Boolean IsMinSizeRel();
63
64   void SetMaxSize(CORBA::Double theMaxSize);
65   void SetMaxSizeRel(CORBA::Double theMaxSize);
66   CORBA::Double GetMaxSize();
67   CORBA::Boolean IsMaxSizeRel();
68
69   void SetUseGradation(CORBA::Boolean theValue);
70   CORBA::Boolean GetUseGradation();
71   void SetGradation(CORBA::Double theValue);
72   CORBA::Double GetGradation();
73
74   void SetUseVolumeGradation(CORBA::Boolean theValue);
75   CORBA::Boolean GetUseVolumeGradation();
76   void SetVolumeGradation(CORBA::Double theValue);
77   CORBA::Double GetVolumeGradation();
78
79   void SetQuadAllowed(CORBA::Boolean theValue);
80   CORBA::Boolean GetQuadAllowed();
81
82   void SetAngleMesh(CORBA::Double theValue);
83   CORBA::Double GetAngleMesh();
84
85   void SetChordalError(CORBA::Double distance);
86   CORBA::Double GetChordalError();
87
88   void SetAnisotropic(CORBA::Boolean anisotropic);
89   CORBA::Boolean GetAnisotropic();
90
91   void SetAnisotropicRatio(CORBA::Double ratio);
92   CORBA::Double GetAnisotropicRatio();
93
94   void SetRemoveTinyEdges(CORBA::Boolean remove);
95   CORBA::Boolean GetRemoveTinyEdges();
96
97   void SetTinyEdgeLength(CORBA::Double length);
98   CORBA::Double GetTinyEdgeLength();
99
100   void SetOptimiseTinyEdges(CORBA::Boolean toOptimise);
101   CORBA::Boolean GetOptimiseTinyEdges();
102
103   void SetTinyEdgeOptimisationLength(CORBA::Double length);
104   CORBA::Double GetTinyEdgeOptimisationLength();
105
106   void SetCorrectSurfaceIntersection(CORBA::Boolean toOptimise);
107   CORBA::Boolean GetCorrectSurfaceIntersection();
108
109   void SetCorrectSurfaceIntersectionMaxCost(CORBA::Double maxCost);
110   CORBA::Double GetCorrectSurfaceIntersectionMaxCost();
111
112   void SetBadElementRemoval(CORBA::Boolean remove);
113   CORBA::Boolean GetBadElementRemoval();
114
115   void SetBadElementAspectRatio(CORBA::Double ratio);
116   CORBA::Double GetBadElementAspectRatio();
117
118   void SetOptimizeMesh(CORBA::Boolean optimize);
119   CORBA::Boolean GetOptimizeMesh();
120
121   void SetQuadraticMesh(CORBA::Boolean quadratic);
122   CORBA::Boolean GetQuadraticMesh();
123
124   void SetTopology(CORBA::Long theValue);
125   CORBA::Long GetTopology();
126
127   void SetVerbosity(CORBA::Short theVal) throw (SALOME::SALOME_Exception);
128   CORBA::Short GetVerbosity();
129
130   void SetEnforceCadEdgesSize( CORBA::Boolean toEnforce );
131   CORBA::Boolean GetEnforceCadEdgesSize();
132
133   void SetJacobianRectificationRespectGeometry( CORBA::Boolean allowRectification );
134   CORBA::Boolean GetJacobianRectificationRespectGeometry();
135
136   void SetJacobianRectification( CORBA::Boolean allowRectification );
137   CORBA::Boolean GetJacobianRectification();
138
139   void SetMaxNumberOfPointsPerPatch( CORBA::Long nb ) throw (SALOME::SALOME_Exception);
140   CORBA::Long GetMaxNumberOfPointsPerPatch();
141
142   void SetRespectGeometry( CORBA::Boolean toRespect );
143   CORBA::Boolean GetRespectGeometry();
144
145   void SetTinyEdgesAvoidSurfaceIntersections( CORBA::Boolean toAvoidIntersection );
146   CORBA::Boolean GetTinyEdgesAvoidSurfaceIntersections();
147
148   void SetClosedGeometry( CORBA::Boolean isClosed );
149   CORBA::Boolean GetClosedGeometry();
150
151   void SetDebug( CORBA::Boolean isDebug );
152   bool GetDebug();
153
154   void SetPeriodicTolerance( CORBA::Double tol ) throw (SALOME::SALOME_Exception);
155   double GetPeriodicTolerance() throw (SALOME::SALOME_Exception);
156
157   void SetRequiredEntities( const char* howToTreat ) throw (SALOME::SALOME_Exception);
158   char* GetRequiredEntities();
159
160   void SetSewingTolerance( CORBA::Double tol ) throw (SALOME::SALOME_Exception);
161   CORBA::Double GetSewingTolerance() throw (SALOME::SALOME_Exception);
162
163   void SetTags( const char* howToTreat ) throw (SALOME::SALOME_Exception);
164   char* GetTags();
165
166   void SetHyperPatches(const BLSURFPlugin::THyperPatchList& hpl);
167   BLSURFPlugin::THyperPatchList* GetHyperPatches();
168
169   void SetPreCADMergeEdges(CORBA::Boolean theValue);
170   CORBA::Boolean GetPreCADMergeEdges();
171
172   void SetPreCADRemoveDuplicateCADFaces(CORBA::Boolean theValue);
173   CORBA::Boolean GetPreCADRemoveDuplicateCADFaces();
174
175   void SetPreCADProcess3DTopology(CORBA::Boolean theValue);
176   CORBA::Boolean GetPreCADProcess3DTopology();
177
178   void SetPreCADDiscardInput(CORBA::Boolean theValue);
179   CORBA::Boolean GetPreCADDiscardInput();
180
181   void SetOptionValue(const char* optionName, const char* optionValue) throw (SALOME::SALOME_Exception);
182   void SetPreCADOptionValue(const char* optionName, const char* optionValue) throw (SALOME::SALOME_Exception);
183   char* GetOptionValue(const char* optionName) throw (SALOME::SALOME_Exception);
184   char* GetPreCADOptionValue(const char* optionName) throw (SALOME::SALOME_Exception);
185
186   void UnsetOption(const char* optionName);
187   void UnsetPreCADOption(const char* optionName);
188
189   BLSURFPlugin::string_array* GetOptionValues();
190   BLSURFPlugin::string_array* GetPreCADOptionValues();
191   BLSURFPlugin::string_array* GetAdvancedOptionValues();
192
193   void SetOptionValues(const BLSURFPlugin::string_array& options) throw (SALOME::SALOME_Exception);
194   void SetPreCADOptionValues(const BLSURFPlugin::string_array& options) throw (SALOME::SALOME_Exception);
195   void SetAdvancedOptionValues(const BLSURFPlugin::string_array& options);
196   void SetAdvancedOption(const char* optionsAndValues) throw (SALOME::SALOME_Exception);
197
198   void AddOption(const char* optionName, const char* optionValue);
199   void AddPreCADOption(const char* optionName, const char* optionValue);
200   char* GetOption(const char* optionName);
201   char* GetPreCADOption(const char* optionName);
202
203   void SetSizeMapEntry(const char* entry, const char* sizeMap) throw (SALOME::SALOME_Exception);
204
205   void SetConstantSizeMapEntry(const char* entry, GEOM::shape_type shapeType, CORBA::Double sizeMap) throw (SALOME::SALOME_Exception);
206
207   char* GetSizeMapEntry(const char* entry) throw (SALOME::SALOME_Exception);
208
209   void UnsetEntry(const char* entry);
210
211   BLSURFPlugin::string_array* GetSizeMapEntries();
212
213   void SetSizeMapEntries(const BLSURFPlugin::string_array& sizeMaps) throw (SALOME::SALOME_Exception);
214
215   void SetSizeMap(GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap) throw (SALOME::SALOME_Exception);
216
217   void SetConstantSizeMap(GEOM::GEOM_Object_ptr GeomObj, CORBA::Double sizeMap);
218
219   void UnsetSizeMap(GEOM::GEOM_Object_ptr GeomObj);
220
221   void ClearSizeMaps();
222
223   void SetAttractor(GEOM::GEOM_Object_ptr GeomObj, const char* attractor);
224
225   void UnsetAttractor(GEOM::GEOM_Object_ptr GeomObj);
226
227   void SetAttractorEntry(const char* entry, const char* attractor) throw (SALOME::SALOME_Exception);
228
229   char* GetAttractorEntry(const char* entry) throw (SALOME::SALOME_Exception);
230
231   BLSURFPlugin::string_array* GetAttractorEntries();
232   
233   
234   /*!
235     * Set/get/unset an attractor on a face 
236     */
237   
238   void SetAttractorGeom(GEOM::GEOM_Object_ptr GeomObj, GEOM::GEOM_Object_ptr Attractor, CORBA::Double StartSize, CORBA::Double EndSize, CORBA::Double ActionRadius, CORBA::Double ConstantRadius );
239
240   void UnsetAttractorGeom(GEOM::GEOM_Object_ptr GeomObj,
241                           GEOM::GEOM_Object_ptr theAttractor);
242
243   void UnsetAttractorEntry(const char* entry, const char* attractor);
244   void SetClassAttractorEntry(const char* entry, const char* att_entry, CORBA::Double StartSize, CORBA::Double EndSize, CORBA::Double ActionRadius, CORBA::Double ConstantRadius)  throw (SALOME::SALOME_Exception);
245
246   BLSURFPlugin::TAttParamsMap* GetAttractorParams();
247   
248
249   /*
250    void SetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap);
251
252    void UnsetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj);
253
254    void SetCustomSizeMapEntry(const char* entry,const char* sizeMap )  throw (SALOME::SALOME_Exception);
255
256    char* GetCustomSizeMapEntry(const char* entry)  throw (SALOME::SALOME_Exception);
257
258    BLSURFPlugin::string_array* GetCustomSizeMapEntries();
259    */
260
261   ///////////////////////
262   // ENFORCED VERTEXES //
263   ///////////////////////
264
265   BLSURFPlugin::TFaceEntryEnfVertexListMap* GetAllEnforcedVerticesByFace();
266   BLSURFPlugin::TEnfVertexList* GetAllEnforcedVertices();
267
268   BLSURFPlugin::TFaceEntryCoordsListMap* GetAllCoordsByFace();
269   BLSURFPlugin::TCoordsEnfVertexMap* GetAllEnforcedVerticesByCoords();
270
271   BLSURFPlugin::TFaceEntryEnfVertexEntryListMap* GetAllEnfVertexEntriesByFace();
272   BLSURFPlugin::TEnfVertexEntryEnfVertexMap* GetAllEnforcedVerticesByEnfVertexEntry();
273
274   void ClearAllEnforcedVertices();
275
276   /*!
277    * Set/get/unset an enforced vertex on geom object
278    */
279   // OBSOLETE
280   bool SetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z)
281       throw (SALOME::SALOME_Exception);
282   bool SetEnforcedVertexNamed(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theVertexName)
283       throw (SALOME::SALOME_Exception);
284   bool SetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex)
285       throw (SALOME::SALOME_Exception);
286   bool SetEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theGroupName)
287       throw (SALOME::SALOME_Exception);
288   bool SetEnforcedVertexNamedWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theVertexName, const char* theGroupName)
289       throw (SALOME::SALOME_Exception);
290   bool SetEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex, const char* theGroupName)
291       throw (SALOME::SALOME_Exception);
292
293   BLSURFPlugin::TEnfVertexList* GetEnforcedVertices(GEOM::GEOM_Object_ptr theFace) throw (SALOME::SALOME_Exception);
294
295   bool UnsetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z)
296       throw (SALOME::SALOME_Exception);
297   bool UnsetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex)
298       throw (SALOME::SALOME_Exception);
299   bool UnsetEnforcedVertices(GEOM::GEOM_Object_ptr theFace) throw (SALOME::SALOME_Exception);
300
301   // NEW - no face
302   bool AddEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z)
303       throw (SALOME::SALOME_Exception);
304   bool AddEnforcedVertexNamed(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theVertexName)
305       throw (SALOME::SALOME_Exception);
306   bool AddEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex)
307       throw (SALOME::SALOME_Exception);
308   bool AddEnforcedVertexWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theGroupName)
309       throw (SALOME::SALOME_Exception);
310   bool AddEnforcedVertexNamedWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theVertexName, const char* theGroupName)
311       throw (SALOME::SALOME_Exception);
312   bool AddEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theVertex, const char* theGroupName)
313       throw (SALOME::SALOME_Exception);
314
315   bool RemoveEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z)
316       throw (SALOME::SALOME_Exception);
317   bool RemoveEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex)
318       throw (SALOME::SALOME_Exception);
319   bool RemoveEnforcedVertices() throw (SALOME::SALOME_Exception);
320
321   /*!
322    * Set/get/unset an enforced vertex on geom object given by entry
323    */
324   bool SetEnforcedVertexEntry(const char* theFaceEntry, CORBA::Double x = 0, CORBA::Double y = 0, CORBA::Double z = 0,
325       const char* theVertexName = "", const char* theVertexEntry = "", const char* theGroupName = "")
326       throw (SALOME::SALOME_Exception);
327
328   BLSURFPlugin::TEnfVertexList* GetEnforcedVerticesEntry(const char* theFaceEntry) throw (SALOME::SALOME_Exception);
329
330   bool UnsetEnforcedVertexEntry(const char* theFaceEntry, CORBA::Double x, CORBA::Double y, CORBA::Double z,
331       const char* theVertexEntry = "") throw (SALOME::SALOME_Exception);
332   bool UnsetEnforcedVerticesEntry(const char* theFaceEntry) throw (SALOME::SALOME_Exception);
333
334   /*!
335    * To add internal vertices as enforced vertices
336    */
337   void SetInternalEnforcedVertexAllFaces(CORBA::Boolean toEnforceInternalVertices);
338   CORBA::Boolean GetInternalEnforcedVertexAllFaces();
339   void SetInternalEnforcedVertexAllFacesGroup(const char*  groupName = "");
340   char* GetInternalEnforcedVertexAllFacesGroup();
341
342 // Enable internal enforced vertices on specific face if requested by user
343 //  void SetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices) throw (SALOME::SALOME_Exception);
344 //  void SetInternalEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName = "") throw (SALOME::SALOME_Exception);
345 //  void SetInternalEnforcedVertexEntry(const char* theFaceEntry, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName = "") throw (SALOME::SALOME_Exception);
346 //  CORBA::Boolean GetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace) throw (SALOME::SALOME_Exception);
347 //  CORBA::Boolean GetInternalEnforcedVertexEntry(const char* theFaceEntry) throw (SALOME::SALOME_Exception);
348   
349   ///////////////////////
350   // PERIODICITY       //
351   ///////////////////////
352
353   void ClearPreCadPeriodicityVectors();
354
355   BLSURFPlugin::TPeriodicityList* GetPreCadFacesPeriodicityVector();
356   BLSURFPlugin::TPeriodicityList* GetPreCadEdgesPeriodicityVector();
357
358   BLSURFPlugin::TPeriodicityList* PreCadVectorToSequence(const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector& preCadPeriodicityVector);
359
360   void AddPreCadFacesPeriodicity(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2)
361       throw (SALOME::SALOME_Exception);
362
363   void AddPreCadFacesPeriodicityWithVertices(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2,
364       const GEOM::ListOfGO& theSourceVertices, const GEOM::ListOfGO& theTargetVertices)
365       throw (SALOME::SALOME_Exception);
366
367   void AddPreCadFacesPeriodicityEntry(const char* theFace1Entry, const char* theFace2Entry,
368       const BLSURFPlugin::TEntryList& theSourceVerticesEntries, const BLSURFPlugin::TEntryList& theTargetVerticesEntries)
369       throw (SALOME::SALOME_Exception);
370
371   void AddPreCadEdgesPeriodicity(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2)
372       throw (SALOME::SALOME_Exception);
373
374   void AddPreCadEdgesPeriodicityWithVertices(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2,
375       const GEOM::ListOfGO& theSourceVertices, const GEOM::ListOfGO& theTargetVertices)
376       throw (SALOME::SALOME_Exception);
377
378   void AddPreCadEdgesPeriodicityEntry(const char* theEdge1Entry, const char* theEdge2Entry,
379       const BLSURFPlugin::TEntryList& theSourceVerticesEntries, const BLSURFPlugin::TEntryList& theTargetVerticesEntries)
380       throw (SALOME::SALOME_Exception);
381
382   ///////////////////////
383   
384   /*!
385     * Sets the file for export resulting mesh in GMF format
386     */
387 //   void SetGMFFile(const char* theFileName, CORBA::Boolean isBinary);
388   void SetGMFFile(const char* theFileName);
389   char* GetGMFFile();
390 //   CORBA::Boolean GetGMFFileMode();
391
392   // Get implementation
393   ::BLSURFPlugin_Hypothesis* GetImpl();
394
395   // Verify whether hypothesis supports given entity type 
396   CORBA::Boolean IsDimSupported(SMESH::Dimension type);
397
398
399   //
400   // Obsolete methods - To be removed in V7
401   //
402   void SetPhyMin(CORBA::Double theMinSize);
403   CORBA::Double GetPhyMin();
404   void SetPhyMax(CORBA::Double theMaxSize);
405   CORBA::Double GetPhyMax();
406   void SetGeoMin(CORBA::Double theMinSize);
407   CORBA::Double GetGeoMin();
408   void SetGeoMax(CORBA::Double theMaxSize);
409   CORBA::Double GetGeoMax();
410   void SetAngleMeshS(CORBA::Double angle);
411   CORBA::Double GetAngleMeshS();
412   void SetAngleMeshC(CORBA::Double angle);
413   CORBA::Double GetAngleMeshC();
414   void SetDecimesh(CORBA::Boolean toIgnoreEdges);
415   CORBA::Boolean GetDecimesh();
416   void SetPreCADRemoveNanoEdges(CORBA::Boolean toRemoveNanoEdges);
417   CORBA::Boolean GetPreCADRemoveNanoEdges();
418   void SetPreCADEpsNano(CORBA::Double epsNano);
419   CORBA::Double GetPreCADEpsNano();
420
421 private:
422   ///////////////////////
423   // PERIODICITY       //
424   ///////////////////////
425   std::string ShapeTypeToString(GEOM::shape_type theShapeType);
426   void CheckShapeType(GEOM::GEOM_Object_ptr shape, GEOM::shape_type theShapeType);
427   void CheckShapeTypes(GEOM::GEOM_Object_ptr shape, std::vector<GEOM::shape_type> theShapeTypes);
428   std::string PublishIfNeeded(GEOM::GEOM_Object_ptr shape, GEOM::shape_type theShapeType, std::string prefix);
429   std::string FormatVerticesEntries(std::vector<std::string> &theSourceVerticesEntries, std::vector<std::string> &theTargetVerticesEntries);
430
431 };
432
433 #endif