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