Salome HOME
23368: [CEA 1865] Possibility to define faces to mesh as a single one: transpatch...
[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 SetPreCADRemoveTinyUVEdges(CORBA::Boolean theValue);
173   CORBA::Boolean GetPreCADRemoveTinyUVEdges();
174
175   void SetPreCADRemoveDuplicateCADFaces(CORBA::Boolean theValue);
176   CORBA::Boolean GetPreCADRemoveDuplicateCADFaces();
177
178   void SetPreCADProcess3DTopology(CORBA::Boolean theValue);
179   CORBA::Boolean GetPreCADProcess3DTopology();
180
181   void SetPreCADDiscardInput(CORBA::Boolean theValue);
182   CORBA::Boolean GetPreCADDiscardInput();
183
184   void SetOptionValue(const char* optionName, const char* optionValue) throw (SALOME::SALOME_Exception);
185   void SetPreCADOptionValue(const char* optionName, const char* optionValue) throw (SALOME::SALOME_Exception);
186   char* GetOptionValue(const char* optionName) throw (SALOME::SALOME_Exception);
187   char* GetPreCADOptionValue(const char* optionName) throw (SALOME::SALOME_Exception);
188
189   void UnsetOption(const char* optionName);
190   void UnsetPreCADOption(const char* optionName);
191
192   BLSURFPlugin::string_array* GetOptionValues();
193   BLSURFPlugin::string_array* GetPreCADOptionValues();
194   BLSURFPlugin::string_array* GetAdvancedOptionValues();
195
196   void SetOptionValues(const BLSURFPlugin::string_array& options) throw (SALOME::SALOME_Exception);
197   void SetPreCADOptionValues(const BLSURFPlugin::string_array& options) throw (SALOME::SALOME_Exception);
198   void SetAdvancedOptionValues(const BLSURFPlugin::string_array& options);
199   void SetAdvancedOption(const char* optionsAndValues) throw (SALOME::SALOME_Exception);
200
201   void AddOption(const char* optionName, const char* optionValue);
202   void AddPreCADOption(const char* optionName, const char* optionValue);
203   char* GetOption(const char* optionName);
204   char* GetPreCADOption(const char* optionName);
205
206   void SetSizeMapEntry(const char* entry, const char* sizeMap) throw (SALOME::SALOME_Exception);
207
208   void SetConstantSizeMapEntry(const char* entry, GEOM::shape_type shapeType, CORBA::Double sizeMap) throw (SALOME::SALOME_Exception);
209
210   char* GetSizeMapEntry(const char* entry) throw (SALOME::SALOME_Exception);
211
212   void UnsetEntry(const char* entry);
213
214   BLSURFPlugin::string_array* GetSizeMapEntries();
215
216   void SetSizeMapEntries(const BLSURFPlugin::string_array& sizeMaps) throw (SALOME::SALOME_Exception);
217
218   void SetSizeMap(GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap) throw (SALOME::SALOME_Exception);
219
220   void SetConstantSizeMap(GEOM::GEOM_Object_ptr GeomObj, CORBA::Double sizeMap);
221
222   void UnsetSizeMap(GEOM::GEOM_Object_ptr GeomObj);
223
224   void ClearSizeMaps();
225
226   void SetAttractor(GEOM::GEOM_Object_ptr GeomObj, const char* attractor);
227
228   void UnsetAttractor(GEOM::GEOM_Object_ptr GeomObj);
229
230   void SetAttractorEntry(const char* entry, const char* attractor) throw (SALOME::SALOME_Exception);
231
232   char* GetAttractorEntry(const char* entry) throw (SALOME::SALOME_Exception);
233
234   BLSURFPlugin::string_array* GetAttractorEntries();
235   
236   
237   /*!
238     * Set/get/unset an attractor on a face 
239     */
240   
241   void SetAttractorGeom(GEOM::GEOM_Object_ptr GeomObj, GEOM::GEOM_Object_ptr Attractor, CORBA::Double StartSize, CORBA::Double EndSize, CORBA::Double ActionRadius, CORBA::Double ConstantRadius );
242
243   void UnsetAttractorGeom(GEOM::GEOM_Object_ptr GeomObj,
244                           GEOM::GEOM_Object_ptr theAttractor);
245
246   void UnsetAttractorEntry(const char* entry, const char* attractor);
247   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);
248
249   BLSURFPlugin::TAttParamsMap* GetAttractorParams();
250   
251
252   /*
253    void SetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap);
254
255    void UnsetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj);
256
257    void SetCustomSizeMapEntry(const char* entry,const char* sizeMap )  throw (SALOME::SALOME_Exception);
258
259    char* GetCustomSizeMapEntry(const char* entry)  throw (SALOME::SALOME_Exception);
260
261    BLSURFPlugin::string_array* GetCustomSizeMapEntries();
262    */
263
264   ///////////////////////
265   // ENFORCED VERTEXES //
266   ///////////////////////
267
268   BLSURFPlugin::TFaceEntryEnfVertexListMap* GetAllEnforcedVerticesByFace();
269   BLSURFPlugin::TEnfVertexList* GetAllEnforcedVertices();
270
271   BLSURFPlugin::TFaceEntryCoordsListMap* GetAllCoordsByFace();
272   BLSURFPlugin::TCoordsEnfVertexMap* GetAllEnforcedVerticesByCoords();
273
274   BLSURFPlugin::TFaceEntryEnfVertexEntryListMap* GetAllEnfVertexEntriesByFace();
275   BLSURFPlugin::TEnfVertexEntryEnfVertexMap* GetAllEnforcedVerticesByEnfVertexEntry();
276
277   void ClearAllEnforcedVertices();
278
279   /*!
280    * Set/get/unset an enforced vertex on geom object
281    */
282   // OBSOLETE
283   bool SetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z)
284       throw (SALOME::SALOME_Exception);
285   bool SetEnforcedVertexNamed(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theVertexName)
286       throw (SALOME::SALOME_Exception);
287   bool SetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex)
288       throw (SALOME::SALOME_Exception);
289   bool SetEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theGroupName)
290       throw (SALOME::SALOME_Exception);
291   bool SetEnforcedVertexNamedWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theVertexName, const char* theGroupName)
292       throw (SALOME::SALOME_Exception);
293   bool SetEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex, const char* theGroupName)
294       throw (SALOME::SALOME_Exception);
295
296   BLSURFPlugin::TEnfVertexList* GetEnforcedVertices(GEOM::GEOM_Object_ptr theFace) throw (SALOME::SALOME_Exception);
297
298   bool UnsetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z)
299       throw (SALOME::SALOME_Exception);
300   bool UnsetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex)
301       throw (SALOME::SALOME_Exception);
302   bool UnsetEnforcedVertices(GEOM::GEOM_Object_ptr theFace) throw (SALOME::SALOME_Exception);
303
304   // NEW - no face
305   bool AddEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z)
306       throw (SALOME::SALOME_Exception);
307   bool AddEnforcedVertexNamed(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theVertexName)
308       throw (SALOME::SALOME_Exception);
309   bool AddEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex)
310       throw (SALOME::SALOME_Exception);
311   bool AddEnforcedVertexWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theGroupName)
312       throw (SALOME::SALOME_Exception);
313   bool AddEnforcedVertexNamedWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theVertexName, const char* theGroupName)
314       throw (SALOME::SALOME_Exception);
315   bool AddEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theVertex, const char* theGroupName)
316       throw (SALOME::SALOME_Exception);
317
318   bool RemoveEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z)
319       throw (SALOME::SALOME_Exception);
320   bool RemoveEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex)
321       throw (SALOME::SALOME_Exception);
322   bool RemoveEnforcedVertices() throw (SALOME::SALOME_Exception);
323
324   /*!
325    * Set/get/unset an enforced vertex on geom object given by entry
326    */
327   bool SetEnforcedVertexEntry(const char* theFaceEntry, CORBA::Double x = 0, CORBA::Double y = 0, CORBA::Double z = 0,
328       const char* theVertexName = "", const char* theVertexEntry = "", const char* theGroupName = "")
329       throw (SALOME::SALOME_Exception);
330
331   BLSURFPlugin::TEnfVertexList* GetEnforcedVerticesEntry(const char* theFaceEntry) throw (SALOME::SALOME_Exception);
332
333   bool UnsetEnforcedVertexEntry(const char* theFaceEntry, CORBA::Double x, CORBA::Double y, CORBA::Double z,
334       const char* theVertexEntry = "") throw (SALOME::SALOME_Exception);
335   bool UnsetEnforcedVerticesEntry(const char* theFaceEntry) throw (SALOME::SALOME_Exception);
336
337   /*!
338    * To add internal vertices as enforced vertices
339    */
340   void SetInternalEnforcedVertexAllFaces(CORBA::Boolean toEnforceInternalVertices);
341   CORBA::Boolean GetInternalEnforcedVertexAllFaces();
342   void SetInternalEnforcedVertexAllFacesGroup(const char*  groupName = "");
343   char* GetInternalEnforcedVertexAllFacesGroup();
344
345 // Enable internal enforced vertices on specific face if requested by user
346 //  void SetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices) throw (SALOME::SALOME_Exception);
347 //  void SetInternalEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName = "") throw (SALOME::SALOME_Exception);
348 //  void SetInternalEnforcedVertexEntry(const char* theFaceEntry, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName = "") throw (SALOME::SALOME_Exception);
349 //  CORBA::Boolean GetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace) throw (SALOME::SALOME_Exception);
350 //  CORBA::Boolean GetInternalEnforcedVertexEntry(const char* theFaceEntry) throw (SALOME::SALOME_Exception);
351   
352   ///////////////////////
353   // PERIODICITY       //
354   ///////////////////////
355
356   void ClearPreCadPeriodicityVectors();
357
358   BLSURFPlugin::TPeriodicityList* GetPreCadFacesPeriodicityVector();
359   BLSURFPlugin::TPeriodicityList* GetPreCadEdgesPeriodicityVector();
360
361   BLSURFPlugin::TPeriodicityList* PreCadVectorToSequence(const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector& preCadPeriodicityVector);
362
363   void AddPreCadFacesPeriodicity(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2)
364       throw (SALOME::SALOME_Exception);
365
366   void AddPreCadFacesPeriodicityWithVertices(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2,
367       const GEOM::ListOfGO& theSourceVertices, const GEOM::ListOfGO& theTargetVertices)
368       throw (SALOME::SALOME_Exception);
369
370   void AddPreCadFacesPeriodicityEntry(const char* theFace1Entry, const char* theFace2Entry,
371       const BLSURFPlugin::TEntryList& theSourceVerticesEntries, const BLSURFPlugin::TEntryList& theTargetVerticesEntries)
372       throw (SALOME::SALOME_Exception);
373
374   void AddPreCadEdgesPeriodicity(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2)
375       throw (SALOME::SALOME_Exception);
376
377   void AddPreCadEdgesPeriodicityWithVertices(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2,
378       const GEOM::ListOfGO& theSourceVertices, const GEOM::ListOfGO& theTargetVertices)
379       throw (SALOME::SALOME_Exception);
380
381   void AddPreCadEdgesPeriodicityEntry(const char* theEdge1Entry, const char* theEdge2Entry,
382       const BLSURFPlugin::TEntryList& theSourceVerticesEntries, const BLSURFPlugin::TEntryList& theTargetVerticesEntries)
383       throw (SALOME::SALOME_Exception);
384
385   ///////////////////////
386   
387   /*!
388     * Sets the file for export resulting mesh in GMF format
389     */
390 //   void SetGMFFile(const char* theFileName, CORBA::Boolean isBinary);
391   void SetGMFFile(const char* theFileName);
392   char* GetGMFFile();
393 //   CORBA::Boolean GetGMFFileMode();
394
395   // Get implementation
396   ::BLSURFPlugin_Hypothesis* GetImpl();
397
398   // Verify whether hypothesis supports given entity type 
399   CORBA::Boolean IsDimSupported(SMESH::Dimension type);
400
401
402   //
403   // Obsolete methods - To be removed in V7
404   //
405   void SetPhyMin(CORBA::Double theMinSize);
406   CORBA::Double GetPhyMin();
407   void SetPhyMax(CORBA::Double theMaxSize);
408   CORBA::Double GetPhyMax();
409   void SetGeoMin(CORBA::Double theMinSize);
410   CORBA::Double GetGeoMin();
411   void SetGeoMax(CORBA::Double theMaxSize);
412   CORBA::Double GetGeoMax();
413   void SetAngleMeshS(CORBA::Double angle);
414   CORBA::Double GetAngleMeshS();
415   void SetAngleMeshC(CORBA::Double angle);
416   CORBA::Double GetAngleMeshC();
417   void SetDecimesh(CORBA::Boolean toIgnoreEdges);
418   CORBA::Boolean GetDecimesh();
419   void SetPreCADRemoveNanoEdges(CORBA::Boolean toRemoveNanoEdges);
420   CORBA::Boolean GetPreCADRemoveNanoEdges();
421   void SetPreCADEpsNano(CORBA::Double epsNano);
422   CORBA::Double GetPreCADEpsNano();
423
424 private:
425   ///////////////////////
426   // PERIODICITY       //
427   ///////////////////////
428   std::string ShapeTypeToString(GEOM::shape_type theShapeType);
429   void CheckShapeType(GEOM::GEOM_Object_ptr shape, GEOM::shape_type theShapeType);
430   void CheckShapeTypes(GEOM::GEOM_Object_ptr shape, std::vector<GEOM::shape_type> theShapeTypes);
431   std::string PublishIfNeeded(GEOM::GEOM_Object_ptr shape, GEOM::shape_type theShapeType, std::string prefix);
432   std::string FormatVerticesEntries(std::vector<std::string> &theSourceVerticesEntries, std::vector<std::string> &theTargetVerticesEntries);
433
434 };
435
436 #endif