Salome HOME
Merge remote branch 'origin/eap/23307'
[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 SetPreCADMergeEdges(CORBA::Boolean theValue);
167   CORBA::Boolean GetPreCADMergeEdges();
168
169   void SetPreCADRemoveTinyUVEdges(CORBA::Boolean theValue);
170   CORBA::Boolean GetPreCADRemoveTinyUVEdges();
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   bool SetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z)
280       throw (SALOME::SALOME_Exception);
281   bool SetEnforcedVertexNamed(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theVertexName)
282       throw (SALOME::SALOME_Exception);
283   bool SetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex)
284       throw (SALOME::SALOME_Exception);
285   bool SetEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theGroupName)
286       throw (SALOME::SALOME_Exception);
287   bool SetEnforcedVertexNamedWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theVertexName, const char* theGroupName)
288       throw (SALOME::SALOME_Exception);
289   bool SetEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex, const char* theGroupName)
290       throw (SALOME::SALOME_Exception);
291
292   BLSURFPlugin::TEnfVertexList* GetEnforcedVertices(GEOM::GEOM_Object_ptr theFace) throw (SALOME::SALOME_Exception);
293
294   bool UnsetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z)
295       throw (SALOME::SALOME_Exception);
296   bool UnsetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex)
297       throw (SALOME::SALOME_Exception);
298   bool UnsetEnforcedVertices(GEOM::GEOM_Object_ptr theFace) throw (SALOME::SALOME_Exception);
299
300   /*!
301    * Set/get/unset an enforced vertex on geom object given by entry
302    */
303   bool SetEnforcedVertexEntry(const char* theFaceEntry, CORBA::Double x = 0, CORBA::Double y = 0, CORBA::Double z = 0,
304       const char* theVertexName = "", const char* theVertexEntry = "", const char* theGroupName = "")
305       throw (SALOME::SALOME_Exception);
306
307   BLSURFPlugin::TEnfVertexList* GetEnforcedVerticesEntry(const char* theFaceEntry) throw (SALOME::SALOME_Exception);
308
309   bool UnsetEnforcedVertexEntry(const char* theFaceEntry, CORBA::Double x, CORBA::Double y, CORBA::Double z,
310       const char* theVertexEntry = "") throw (SALOME::SALOME_Exception);
311   bool UnsetEnforcedVerticesEntry(const char* theFaceEntry) throw (SALOME::SALOME_Exception);
312
313   /*!
314    * To add internal vertices as enforced vertices
315    */
316   void SetInternalEnforcedVertexAllFaces(CORBA::Boolean toEnforceInternalVertices);
317   CORBA::Boolean GetInternalEnforcedVertexAllFaces();
318   void SetInternalEnforcedVertexAllFacesGroup(const char*  groupName = "");
319   char* GetInternalEnforcedVertexAllFacesGroup();
320
321 // Enable internal enforced vertices on specific face if requested by user
322 //  void SetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices) throw (SALOME::SALOME_Exception);
323 //  void SetInternalEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName = "") throw (SALOME::SALOME_Exception);
324 //  void SetInternalEnforcedVertexEntry(const char* theFaceEntry, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName = "") throw (SALOME::SALOME_Exception);
325 //  CORBA::Boolean GetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace) throw (SALOME::SALOME_Exception);
326 //  CORBA::Boolean GetInternalEnforcedVertexEntry(const char* theFaceEntry) throw (SALOME::SALOME_Exception);
327   
328   ///////////////////////
329   // PERIODICITY       //
330   ///////////////////////
331
332   void ClearPreCadPeriodicityVectors();
333
334   BLSURFPlugin::TPeriodicityList* GetPreCadFacesPeriodicityVector();
335   BLSURFPlugin::TPeriodicityList* GetPreCadEdgesPeriodicityVector();
336
337   BLSURFPlugin::TPeriodicityList* PreCadVectorToSequence(const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector& preCadPeriodicityVector);
338
339   void AddPreCadFacesPeriodicity(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2)
340       throw (SALOME::SALOME_Exception);
341
342   void AddPreCadFacesPeriodicityWithVertices(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2,
343       const GEOM::ListOfGO& theSourceVertices, const GEOM::ListOfGO& theTargetVertices)
344       throw (SALOME::SALOME_Exception);
345
346   void AddPreCadFacesPeriodicityEntry(const char* theFace1Entry, const char* theFace2Entry,
347       const BLSURFPlugin::TEntryList& theSourceVerticesEntries, const BLSURFPlugin::TEntryList& theTargetVerticesEntries)
348       throw (SALOME::SALOME_Exception);
349
350   void AddPreCadEdgesPeriodicity(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2)
351       throw (SALOME::SALOME_Exception);
352
353   void AddPreCadEdgesPeriodicityWithVertices(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2,
354       const GEOM::ListOfGO& theSourceVertices, const GEOM::ListOfGO& theTargetVertices)
355       throw (SALOME::SALOME_Exception);
356
357   void AddPreCadEdgesPeriodicityEntry(const char* theEdge1Entry, const char* theEdge2Entry,
358       const BLSURFPlugin::TEntryList& theSourceVerticesEntries, const BLSURFPlugin::TEntryList& theTargetVerticesEntries)
359       throw (SALOME::SALOME_Exception);
360
361   ///////////////////////
362   
363   /*!
364     * Sets the file for export resulting mesh in GMF format
365     */
366 //   void SetGMFFile(const char* theFileName, CORBA::Boolean isBinary);
367   void SetGMFFile(const char* theFileName);
368   char* GetGMFFile();
369 //   CORBA::Boolean GetGMFFileMode();
370
371   // Get implementation
372   ::BLSURFPlugin_Hypothesis* GetImpl();
373
374   // Verify whether hypothesis supports given entity type 
375   CORBA::Boolean IsDimSupported(SMESH::Dimension type);
376
377
378   //
379   // Obsolete methods - To be removed in V7
380   //
381   void SetPhyMin(CORBA::Double theMinSize);
382   CORBA::Double GetPhyMin();
383   void SetPhyMax(CORBA::Double theMaxSize);
384   CORBA::Double GetPhyMax();
385   void SetGeoMin(CORBA::Double theMinSize);
386   CORBA::Double GetGeoMin();
387   void SetGeoMax(CORBA::Double theMaxSize);
388   CORBA::Double GetGeoMax();
389   void SetAngleMeshS(CORBA::Double angle);
390   CORBA::Double GetAngleMeshS();
391   void SetAngleMeshC(CORBA::Double angle);
392   CORBA::Double GetAngleMeshC();
393   void SetDecimesh(CORBA::Boolean toIgnoreEdges);
394   CORBA::Boolean GetDecimesh();
395   void SetPreCADRemoveNanoEdges(CORBA::Boolean toRemoveNanoEdges);
396   CORBA::Boolean GetPreCADRemoveNanoEdges();
397   void SetPreCADEpsNano(CORBA::Double epsNano);
398   CORBA::Double GetPreCADEpsNano();
399
400 private:
401   ///////////////////////
402   // PERIODICITY       //
403   ///////////////////////
404   std::string ShapeTypeToString(GEOM::shape_type theShapeType);
405   void CheckShapeType(GEOM::GEOM_Object_ptr shape, GEOM::shape_type theShapeType);
406   void CheckShapeTypes(GEOM::GEOM_Object_ptr shape, std::vector<GEOM::shape_type> theShapeTypes);
407   std::string PublishIfNeeded(GEOM::GEOM_Object_ptr shape, GEOM::shape_type theShapeType, std::string prefix);
408   std::string FormatVerticesEntries(std::vector<std::string> &theSourceVerticesEntries, std::vector<std::string> &theTargetVerticesEntries);
409
410 };
411
412 #endif