Salome HOME
bos #20543: EDF 22638 - hyperpatch with CADSurf
[plugins/blsurfplugin.git] / src / BLSURFPlugin / BLSURFPlugin_Hypothesis_i.hxx
1 // Copyright (C) 2007-2020  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   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   void SetEnforceCadEdgesSize( CORBA::Boolean toEnforce );
177   CORBA::Boolean GetEnforceCadEdgesSize();
178
179   void SetJacobianRectificationRespectGeometry( CORBA::Boolean allowRectification );
180   CORBA::Boolean GetJacobianRectificationRespectGeometry();
181
182   void SetUseDeprecatedPatchMesher( CORBA::Boolean useDeprecatedPatchMesher );
183   CORBA::Boolean GetUseDeprecatedPatchMesher();
184
185   void SetJacobianRectification( CORBA::Boolean allowRectification );
186   CORBA::Boolean GetJacobianRectification();
187
188   void SetMaxNumberOfPointsPerPatch( CORBA::Long nb );
189   CORBA::Long GetMaxNumberOfPointsPerPatch();
190
191   void SetMaxNumberOfThreads( CORBA::Long nb );
192   CORBA::Long GetMaxNumberOfThreads();
193
194   void SetRespectGeometry( CORBA::Boolean toRespect );
195   CORBA::Boolean GetRespectGeometry();
196
197   void SetTinyEdgesAvoidSurfaceIntersections( CORBA::Boolean toAvoidIntersection );
198   CORBA::Boolean GetTinyEdgesAvoidSurfaceIntersections();
199
200   void SetClosedGeometry( CORBA::Boolean isClosed );
201   CORBA::Boolean GetClosedGeometry();
202
203   void SetDebug( CORBA::Boolean isDebug );
204   bool GetDebug();
205
206   void SetPeriodicTolerance( CORBA::Double tol );
207   double GetPeriodicTolerance();
208
209   void SetRequiredEntities( const char* howToTreat );
210   char* GetRequiredEntities();
211
212   void SetSewingTolerance( CORBA::Double tol );
213   CORBA::Double GetSewingTolerance();
214
215   void SetTags( const char* howToTreat );
216   char* GetTags();
217
218   void SetHyperPatches(const BLSURFPlugin::THyperPatchList& hpl);
219   BLSURFPlugin::THyperPatchList* GetHyperPatches( GEOM::GEOM_Object_ptr mainShape );
220   void SetHyperPatchShapes(const BLSURFPlugin::THyperPatchShapesList& hpsl);
221   BLSURFPlugin::THyperPatchEntriesList* GetHyperPatchShapes();
222   void SetHyperPatchEntries(const BLSURFPlugin::THyperPatchEntriesList& hpel);
223
224   void SetPreCADMergeEdges(CORBA::Boolean theValue);
225   CORBA::Boolean GetPreCADMergeEdges();
226
227   void SetPreCADRemoveDuplicateCADFaces(CORBA::Boolean theValue);
228   CORBA::Boolean GetPreCADRemoveDuplicateCADFaces();
229
230   void SetPreCADProcess3DTopology(CORBA::Boolean theValue);
231   CORBA::Boolean GetPreCADProcess3DTopology();
232
233   void SetPreCADDiscardInput(CORBA::Boolean theValue);
234   CORBA::Boolean GetPreCADDiscardInput();
235
236   void SetOptionValue(const char* optionName, const char* optionValue);
237   void SetPreCADOptionValue(const char* optionName, const char* optionValue);
238   char* GetOptionValue(const char* optionName);
239   char* GetPreCADOptionValue(const char* optionName);
240
241   void UnsetOption(const char* optionName);
242   void UnsetPreCADOption(const char* optionName);
243
244   BLSURFPlugin::string_array* GetOptionValues();
245   BLSURFPlugin::string_array* GetPreCADOptionValues();
246   BLSURFPlugin::string_array* GetAdvancedOptionValues();
247
248   void SetOptionValues(const BLSURFPlugin::string_array& options);
249   void SetPreCADOptionValues(const BLSURFPlugin::string_array& options);
250   void SetAdvancedOptionValues(const BLSURFPlugin::string_array& options);
251   void SetAdvancedOption(const char* optionsAndValues);
252
253   void AddOption(const char* optionName, const char* optionValue);
254   void AddPreCADOption(const char* optionName, const char* optionValue);
255   char* GetOption(const char* optionName);
256   char* GetPreCADOption(const char* optionName);
257
258   void SetSizeMapEntry(const char* entry, const char* sizeMap);
259
260   void SetConstantSizeMapEntry(const char* entry, GEOM::shape_type shapeType, CORBA::Double sizeMap);
261
262   char* GetSizeMapEntry(const char* entry);
263
264   void UnsetEntry(const char* entry);
265
266   BLSURFPlugin::string_array* GetSizeMapEntries();
267
268   void SetSizeMapEntries(const BLSURFPlugin::string_array& sizeMaps);
269
270   void SetSizeMap(GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap);
271
272   void SetConstantSizeMap(GEOM::GEOM_Object_ptr GeomObj, CORBA::Double sizeMap);
273
274   void UnsetSizeMap(GEOM::GEOM_Object_ptr GeomObj);
275
276   void ClearSizeMaps();
277
278   void SetAttractor(GEOM::GEOM_Object_ptr GeomObj, const char* attractor);
279
280   void UnsetAttractor(GEOM::GEOM_Object_ptr GeomObj);
281
282   void SetAttractorEntry(const char* entry, const char* attractor);
283
284   char* GetAttractorEntry(const char* entry);
285
286   BLSURFPlugin::string_array* GetAttractorEntries();
287   
288   
289   /*!
290     * Set/get/unset an attractor on a face 
291     */
292   
293   void SetAttractorGeom(GEOM::GEOM_Object_ptr GeomObj, GEOM::GEOM_Object_ptr Attractor, CORBA::Double StartSize, CORBA::Double EndSize, CORBA::Double ActionRadius, CORBA::Double ConstantRadius );
294
295   void UnsetAttractorGeom(GEOM::GEOM_Object_ptr GeomObj,
296                           GEOM::GEOM_Object_ptr theAttractor);
297
298   void UnsetAttractorEntry(const char* entry, const char* attractor);
299   void SetClassAttractorEntry(const char* entry, const char* att_entry, CORBA::Double StartSize, CORBA::Double EndSize, CORBA::Double ActionRadius, CORBA::Double ConstantRadius);
300
301   BLSURFPlugin::TAttParamsMap* GetAttractorParams();
302   
303
304   /*
305    void SetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap);
306
307    void UnsetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj);
308
309    void SetCustomSizeMapEntry(const char* entry,const char* sizeMap );
310
311    char* GetCustomSizeMapEntry(const char* entry);
312
313    BLSURFPlugin::string_array* GetCustomSizeMapEntries();
314    */
315
316   ///////////////////////
317   // ENFORCED VERTEXES //
318   ///////////////////////
319
320   BLSURFPlugin::TFaceEntryEnfVertexListMap* GetAllEnforcedVerticesByFace();
321   BLSURFPlugin::TEnfVertexList* GetAllEnforcedVertices();
322
323   BLSURFPlugin::TFaceEntryCoordsListMap* GetAllCoordsByFace();
324   BLSURFPlugin::TCoordsEnfVertexMap* GetAllEnforcedVerticesByCoords();
325
326   BLSURFPlugin::TFaceEntryEnfVertexEntryListMap* GetAllEnfVertexEntriesByFace();
327   BLSURFPlugin::TEnfVertexEntryEnfVertexMap* GetAllEnforcedVerticesByEnfVertexEntry();
328
329   void ClearAllEnforcedVertices();
330
331   /*!
332    * Set/get/unset an enforced vertex on geom object
333    */
334   // OBSOLETE
335   bool SetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z);
336   bool SetEnforcedVertexNamed(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theVertexName);
337   bool SetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex);
338   bool SetEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theGroupName);
339   bool SetEnforcedVertexNamedWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theVertexName, const char* theGroupName);
340   bool SetEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex, const char* theGroupName);
341
342   BLSURFPlugin::TEnfVertexList* GetEnforcedVertices(GEOM::GEOM_Object_ptr theFace);
343
344   bool UnsetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z);
345   bool UnsetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex);
346   bool UnsetEnforcedVertices(GEOM::GEOM_Object_ptr theFace);
347
348   // NEW - no face
349   bool AddEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z);
350   bool AddEnforcedVertexNamed(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theVertexName);
351   bool AddEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex);
352   bool AddEnforcedVertexWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theGroupName);
353   bool AddEnforcedVertexNamedWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theVertexName, const char* theGroupName);
354   bool AddEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theVertex, const char* theGroupName);
355
356   bool RemoveEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z);
357   bool RemoveEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex);
358   bool RemoveEnforcedVertices();
359
360   /*!
361    * Set/get/unset an enforced vertex on geom object given by entry
362    */
363   bool SetEnforcedVertexEntry(const char* theFaceEntry, CORBA::Double x = 0, CORBA::Double y = 0, CORBA::Double z = 0,
364       const char* theVertexName = "", const char* theVertexEntry = "", const char* theGroupName = "");
365
366   BLSURFPlugin::TEnfVertexList* GetEnforcedVerticesEntry(const char* theFaceEntry);
367
368   bool UnsetEnforcedVertexEntry(const char* theFaceEntry, CORBA::Double x, CORBA::Double y, CORBA::Double z,
369       const char* theVertexEntry = "");
370   bool UnsetEnforcedVerticesEntry(const char* theFaceEntry);
371
372   /*!
373    * To add internal vertices as enforced vertices
374    */
375   void SetInternalEnforcedVertexAllFaces(CORBA::Boolean toEnforceInternalVertices);
376   CORBA::Boolean GetInternalEnforcedVertexAllFaces();
377   void SetInternalEnforcedVertexAllFacesGroup(const char*  groupName = "");
378   char* GetInternalEnforcedVertexAllFacesGroup();
379
380 // Enable internal enforced vertices on specific face if requested by user
381 //  void SetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices);
382 //  void SetInternalEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName = "");
383 //  void SetInternalEnforcedVertexEntry(const char* theFaceEntry, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName = "");
384 //  CORBA::Boolean GetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace);
385 //  CORBA::Boolean GetInternalEnforcedVertexEntry(const char* theFaceEntry);
386   
387   ///////////////////////
388   // PERIODICITY       //
389   ///////////////////////
390
391   void ClearPreCadPeriodicityVectors();
392
393   BLSURFPlugin::TPeriodicityList* GetPreCadFacesPeriodicityVector();
394   BLSURFPlugin::TPeriodicityList* GetPreCadEdgesPeriodicityVector();
395
396   BLSURFPlugin::TPeriodicityList* PreCadVectorToSequence(const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector& preCadPeriodicityVector);
397
398   void AddPreCadFacesPeriodicity(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2);
399
400   void AddPreCadFacesPeriodicityWithVertices(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2,
401       const GEOM::ListOfGO& theSourceVertices, const GEOM::ListOfGO& theTargetVertices);
402
403   void AddPreCadFacesPeriodicityEntry(const char* theFace1Entry, const char* theFace2Entry,
404       const BLSURFPlugin::TEntryList& theSourceVerticesEntries, const BLSURFPlugin::TEntryList& theTargetVerticesEntries);
405
406   void AddPreCadEdgesPeriodicity(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2);
407
408   void AddPreCadEdgesPeriodicityWithVertices(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2,
409       const GEOM::ListOfGO& theSourceVertices, const GEOM::ListOfGO& theTargetVertices);
410
411   void AddPreCadEdgesPeriodicityEntry(const char* theEdge1Entry, const char* theEdge2Entry,
412       const BLSURFPlugin::TEntryList& theSourceVerticesEntries, const BLSURFPlugin::TEntryList& theTargetVerticesEntries);
413
414   ///////////////////////
415   
416   /*!
417     * Sets the file for export resulting mesh in GMF format
418     */
419 //   void SetGMFFile(const char* theFileName, CORBA::Boolean isBinary);
420   void SetGMFFile(const char* theFileName);
421   char* GetGMFFile();
422 //   CORBA::Boolean GetGMFFileMode();
423
424   // Get implementation
425   ::BLSURFPlugin_Hypothesis* GetImpl();
426
427   // Verify whether hypothesis supports given entity type 
428   CORBA::Boolean IsDimSupported(SMESH::Dimension type);
429
430
431
432   // Methods for copying mesh definition to other geometry
433
434   // Return geometry this hypothesis depends on. Return false if there is no geometry parameter
435   virtual bool getObjectsDependOn( std::vector< std::string > & entryArray,
436                                    std::vector< int >         & subIDArray ) const;
437
438   // Set new geometry instead of that returned by getObjectsDependOn()
439   virtual bool setObjectsDependOn( std::vector< std::string > & entryArray,
440                                    std::vector< int >         & subIDArray );
441 private:
442   ///////////////////////
443   // PERIODICITY       //
444   ///////////////////////
445   std::string ShapeTypeToString(GEOM::shape_type theShapeType);
446   void CheckShapeType(GEOM::GEOM_Object_ptr shape, GEOM::shape_type theShapeType);
447   void CheckShapeTypes(GEOM::GEOM_Object_ptr shape, std::vector<GEOM::shape_type> theShapeTypes);
448   std::string PublishIfNeeded(GEOM::GEOM_Object_ptr shape, GEOM::shape_type theShapeType, std::string prefix);
449   std::string FormatVerticesEntries(std::vector<std::string> &theSourceVerticesEntries, std::vector<std::string> &theTargetVerticesEntries);
450
451 };
452
453 #endif