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