1 // Copyright (C) 2007-2021 CEA/DEN, EDF R&D
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
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)
26 #ifndef _BLSURFPlugin_Hypothesis_i_HXX_
27 #define _BLSURFPlugin_Hypothesis_i_HXX_
29 #include <SALOMEconfig.h>
30 #include CORBA_SERVER_HEADER(BLSURFPlugin_Algorithm)
32 #include "SMESH_Hypothesis_i.hxx"
33 #include "BLSURFPlugin_Hypothesis.hxx"
38 // BLSURFPlugin parameters hypothesis
40 class BLSURFPlugin_Hypothesis_i:
41 public virtual POA_BLSURFPlugin::BLSURFPlugin_Hypothesis,
42 public virtual SMESH_Hypothesis_i
46 BLSURFPlugin_Hypothesis_i(PortableServer::POA_ptr thePOA,
47 ::SMESH_Gen* theGenImpl,
50 virtual ~BLSURFPlugin_Hypothesis_i();
52 char* GetMeshGemsVersion();
54 void SetPhysicalMesh(CORBA::Long theValue);
55 CORBA::Long GetPhysicalMesh();
57 void SetGeometricMesh(CORBA::Long theValue);
58 CORBA::Long GetGeometricMesh();
60 void SetPhySize(CORBA::Double theValue);
61 void SetPhySizeRel(CORBA::Double theValue);
62 CORBA::Double GetPhySize();
63 CORBA::Boolean IsPhySizeRel();
65 void SetMinSize(CORBA::Double theMinSize);
66 void SetMinSizeRel(CORBA::Double theMinSize);
67 CORBA::Double GetMinSize();
68 CORBA::Boolean IsMinSizeRel();
70 void SetMaxSize(CORBA::Double theMaxSize);
71 void SetMaxSizeRel(CORBA::Double theMaxSize);
72 CORBA::Double GetMaxSize();
73 CORBA::Boolean IsMaxSizeRel();
75 void SetUseGradation(CORBA::Boolean theValue);
76 CORBA::Boolean GetUseGradation();
77 void SetGradation(CORBA::Double theValue);
78 CORBA::Double GetGradation();
80 void SetUseVolumeGradation(CORBA::Boolean theValue);
81 CORBA::Boolean GetUseVolumeGradation();
82 void SetVolumeGradation(CORBA::Double theValue);
83 CORBA::Double GetVolumeGradation();
85 void SetQuadAllowed(CORBA::Boolean theValue);
87 void SetElementType(CORBA::Long theValue);
88 CORBA::Long GetElementType();
90 void SetAngleMesh(CORBA::Double theValue);
91 CORBA::Double GetAngleMesh();
93 void SetChordalError(CORBA::Double distance);
94 CORBA::Double GetChordalError();
96 void SetAnisotropic(CORBA::Boolean anisotropic);
97 CORBA::Boolean GetAnisotropic();
99 void SetAnisotropicRatio(CORBA::Double ratio);
100 CORBA::Double GetAnisotropicRatio();
102 void SetRemoveTinyEdges(CORBA::Boolean remove);
103 CORBA::Boolean GetRemoveTinyEdges();
105 void SetTinyEdgeLength(CORBA::Double length);
106 CORBA::Double GetTinyEdgeLength();
108 void SetOptimiseTinyEdges(CORBA::Boolean toOptimise);
109 CORBA::Boolean GetOptimiseTinyEdges();
111 void SetTinyEdgeOptimisationLength(CORBA::Double length);
112 CORBA::Double GetTinyEdgeOptimisationLength();
114 void SetCorrectSurfaceIntersection(CORBA::Boolean toOptimise);
115 CORBA::Boolean GetCorrectSurfaceIntersection();
117 void SetCorrectSurfaceIntersectionMaxCost(CORBA::Double maxCost);
118 CORBA::Double GetCorrectSurfaceIntersectionMaxCost();
120 void SetBadElementRemoval(CORBA::Boolean remove);
121 CORBA::Boolean GetBadElementRemoval();
123 void SetBadElementAspectRatio(CORBA::Double ratio);
124 CORBA::Double GetBadElementAspectRatio();
126 void SetOptimizeMesh(CORBA::Boolean optimize);
127 CORBA::Boolean GetOptimizeMesh();
129 void SetQuadraticMesh(CORBA::Boolean quadratic);
130 CORBA::Boolean GetQuadraticMesh();
132 void SetTopology(CORBA::Long theValue);
133 CORBA::Long GetTopology();
137 * Activate/deactivate surface proximity computation
139 void SetSurfaceProximity( CORBA::Boolean toUse );
140 CORBA::Boolean GetSurfaceProximity();
143 * Set number of surface element layers to be generated due to surface proximity
145 void SetNbSurfaceProximityLayers( CORBA::Short nbLayers );
146 CORBA::Short GetNbSurfaceProximityLayers();
149 * Set coefficient by which size of element refined due to surface proximity is increased
151 void SetSurfaceProximityRatio( CORBA::Double ratio );
152 CORBA::Double GetSurfaceProximityRatio();
155 * Activate/deactivate volume proximity computation
157 void SetVolumeProximity( CORBA::Boolean toUse );
158 CORBA::Boolean GetVolumeProximity();
161 * Set number of surface element layers to be generated due to volume proximity
163 void SetNbVolumeProximityLayers( CORBA::Short nbLayers );
164 CORBA::Short GetNbVolumeProximityLayers();
167 * Set coefficient by which size of element refined due to volume proximity is increased
169 void SetVolumeProximityRatio( CORBA::Double ratio );
170 CORBA::Double GetVolumeProximityRatio();
173 void SetVerbosity(CORBA::Short theVal);
174 CORBA::Short GetVerbosity();
177 * Set/Get enforced 1D meshes
179 void SetEnforcedMeshes( const BLSURFPlugin::EnforcedMeshesList& enforcedMeshes );
180 BLSURFPlugin::EnforcedMeshesList* GetEnforcedMeshes();
182 void SetEnforceCadEdgesSize( CORBA::Boolean toEnforce );
183 CORBA::Boolean GetEnforceCadEdgesSize();
185 void SetJacobianRectificationRespectGeometry( CORBA::Boolean allowRectification );
186 CORBA::Boolean GetJacobianRectificationRespectGeometry();
188 void SetUseDeprecatedPatchMesher( CORBA::Boolean useDeprecatedPatchMesher );
189 CORBA::Boolean GetUseDeprecatedPatchMesher();
191 void SetJacobianRectification( CORBA::Boolean allowRectification );
192 CORBA::Boolean GetJacobianRectification();
194 void SetMaxNumberOfPointsPerPatch( CORBA::Long nb );
195 CORBA::Long GetMaxNumberOfPointsPerPatch();
197 void SetMaxNumberOfThreads( CORBA::Long nb );
198 CORBA::Long GetMaxNumberOfThreads();
200 void SetRespectGeometry( CORBA::Boolean toRespect );
201 CORBA::Boolean GetRespectGeometry();
203 void SetTinyEdgesAvoidSurfaceIntersections( CORBA::Boolean toAvoidIntersection );
204 CORBA::Boolean GetTinyEdgesAvoidSurfaceIntersections();
206 void SetClosedGeometry( CORBA::Boolean isClosed );
207 CORBA::Boolean GetClosedGeometry();
209 void SetDebug( CORBA::Boolean isDebug );
212 void SetPeriodicTolerance( CORBA::Double tol );
213 double GetPeriodicTolerance();
215 void SetRequiredEntities( const char* howToTreat );
216 char* GetRequiredEntities();
218 void SetSewingTolerance( CORBA::Double tol );
219 CORBA::Double GetSewingTolerance();
221 void SetTags( const char* howToTreat );
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);
230 void SetPreCADMergeEdges(CORBA::Boolean theValue);
231 CORBA::Boolean GetPreCADMergeEdges();
233 void SetPreCADRemoveDuplicateCADFaces(CORBA::Boolean theValue);
234 CORBA::Boolean GetPreCADRemoveDuplicateCADFaces();
236 void SetPreCADProcess3DTopology(CORBA::Boolean theValue);
237 CORBA::Boolean GetPreCADProcess3DTopology();
239 void SetPreCADDiscardInput(CORBA::Boolean theValue);
240 CORBA::Boolean GetPreCADDiscardInput();
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);
247 void UnsetOption(const char* optionName);
248 void UnsetPreCADOption(const char* optionName);
250 BLSURFPlugin::string_array* GetOptionValues();
251 BLSURFPlugin::string_array* GetPreCADOptionValues();
252 BLSURFPlugin::string_array* GetAdvancedOptionValues();
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);
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);
264 void SetSizeMapEntry(const char* entry, const char* sizeMap);
266 void SetConstantSizeMapEntry(const char* entry, GEOM::shape_type shapeType, CORBA::Double sizeMap);
268 char* GetSizeMapEntry(const char* entry);
270 void UnsetEntry(const char* entry);
272 BLSURFPlugin::string_array* GetSizeMapEntries();
274 void SetSizeMapEntries(const BLSURFPlugin::string_array& sizeMaps);
276 void SetSizeMap(GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap);
278 void SetConstantSizeMap(GEOM::GEOM_Object_ptr GeomObj, CORBA::Double sizeMap);
280 void UnsetSizeMap(GEOM::GEOM_Object_ptr GeomObj);
282 void ClearSizeMaps();
284 void SetAttractor(GEOM::GEOM_Object_ptr GeomObj, const char* attractor);
286 void UnsetAttractor(GEOM::GEOM_Object_ptr GeomObj);
288 void SetAttractorEntry(const char* entry, const char* attractor);
290 char* GetAttractorEntry(const char* entry);
292 BLSURFPlugin::string_array* GetAttractorEntries();
296 * Set/get/unset an attractor on a face
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 );
301 void UnsetAttractorGeom(GEOM::GEOM_Object_ptr GeomObj,
302 GEOM::GEOM_Object_ptr theAttractor);
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);
307 BLSURFPlugin::TAttParamsMap* GetAttractorParams();
311 void SetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap);
313 void UnsetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj);
315 void SetCustomSizeMapEntry(const char* entry,const char* sizeMap );
317 char* GetCustomSizeMapEntry(const char* entry);
319 BLSURFPlugin::string_array* GetCustomSizeMapEntries();
322 ///////////////////////
323 // ENFORCED VERTEXES //
324 ///////////////////////
326 BLSURFPlugin::TFaceEntryEnfVertexListMap* GetAllEnforcedVerticesByFace();
327 BLSURFPlugin::TEnfVertexList* GetAllEnforcedVertices();
329 BLSURFPlugin::TFaceEntryCoordsListMap* GetAllCoordsByFace();
330 BLSURFPlugin::TCoordsEnfVertexMap* GetAllEnforcedVerticesByCoords();
332 BLSURFPlugin::TFaceEntryEnfVertexEntryListMap* GetAllEnfVertexEntriesByFace();
333 BLSURFPlugin::TEnfVertexEntryEnfVertexMap* GetAllEnforcedVerticesByEnfVertexEntry();
335 void ClearAllEnforcedVertices();
338 * Set/get/unset an enforced vertex on geom object
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);
348 BLSURFPlugin::TEnfVertexList* GetEnforcedVertices(GEOM::GEOM_Object_ptr theFace);
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);
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);
362 bool RemoveEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z);
363 bool RemoveEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex);
364 bool RemoveEnforcedVertices();
367 * Set/get/unset an enforced vertex on geom object given by entry
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 = "");
372 BLSURFPlugin::TEnfVertexList* GetEnforcedVerticesEntry(const char* theFaceEntry);
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);
379 * To add internal vertices as enforced vertices
381 void SetInternalEnforcedVertexAllFaces(CORBA::Boolean toEnforceInternalVertices);
382 CORBA::Boolean GetInternalEnforcedVertexAllFaces();
383 void SetInternalEnforcedVertexAllFacesGroup(const char* groupName = "");
384 char* GetInternalEnforcedVertexAllFacesGroup();
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);
393 ///////////////////////
395 ///////////////////////
397 void ClearPreCadPeriodicityVectors();
399 BLSURFPlugin::TPeriodicityList* GetPreCadFacesPeriodicityVector();
400 BLSURFPlugin::TPeriodicityList* GetPreCadEdgesPeriodicityVector();
402 BLSURFPlugin::TPeriodicityList* PreCadVectorToSequence(const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector& preCadPeriodicityVector);
404 void AddPreCadFacesPeriodicity(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2);
406 void AddPreCadFacesPeriodicityWithVertices(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2,
407 const GEOM::ListOfGO& theSourceVertices, const GEOM::ListOfGO& theTargetVertices);
409 void AddPreCadFacesPeriodicityEntry(const char* theFace1Entry, const char* theFace2Entry,
410 const BLSURFPlugin::TEntryList& theSourceVerticesEntries, const BLSURFPlugin::TEntryList& theTargetVerticesEntries);
412 void AddPreCadEdgesPeriodicity(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2);
414 void AddPreCadEdgesPeriodicityWithVertices(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2,
415 const GEOM::ListOfGO& theSourceVertices, const GEOM::ListOfGO& theTargetVertices);
417 void AddPreCadEdgesPeriodicityEntry(const char* theEdge1Entry, const char* theEdge2Entry,
418 const BLSURFPlugin::TEntryList& theSourceVerticesEntries, const BLSURFPlugin::TEntryList& theTargetVerticesEntries);
420 ///////////////////////
423 * Sets the file for export resulting mesh in GMF format
425 // void SetGMFFile(const char* theFileName, CORBA::Boolean isBinary);
426 void SetGMFFile(const char* theFileName);
428 // CORBA::Boolean GetGMFFileMode();
430 // Get implementation
431 ::BLSURFPlugin_Hypothesis* GetImpl();
433 // Verify whether hypothesis supports given entity type
434 CORBA::Boolean IsDimSupported(SMESH::Dimension type);
438 // Methods for copying mesh definition to other geometry
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;
444 // Set new geometry instead of that returned by getObjectsDependOn()
445 virtual bool setObjectsDependOn( std::vector< std::string > & entryArray,
446 std::vector< int > & subIDArray );
448 ///////////////////////
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);