1 // Copyright (C) 2007-2020 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();
176 void SetEnforceCadEdgesSize( CORBA::Boolean toEnforce );
177 CORBA::Boolean GetEnforceCadEdgesSize();
179 void SetJacobianRectificationRespectGeometry( CORBA::Boolean allowRectification );
180 CORBA::Boolean GetJacobianRectificationRespectGeometry();
182 void SetUseDeprecatedPatchMesher( CORBA::Boolean useDeprecatedPatchMesher );
183 CORBA::Boolean GetUseDeprecatedPatchMesher();
185 void SetJacobianRectification( CORBA::Boolean allowRectification );
186 CORBA::Boolean GetJacobianRectification();
188 void SetMaxNumberOfPointsPerPatch( CORBA::Long nb );
189 CORBA::Long GetMaxNumberOfPointsPerPatch();
191 void SetMaxNumberOfThreads( CORBA::Long nb );
192 CORBA::Long GetMaxNumberOfThreads();
194 void SetRespectGeometry( CORBA::Boolean toRespect );
195 CORBA::Boolean GetRespectGeometry();
197 void SetTinyEdgesAvoidSurfaceIntersections( CORBA::Boolean toAvoidIntersection );
198 CORBA::Boolean GetTinyEdgesAvoidSurfaceIntersections();
200 void SetClosedGeometry( CORBA::Boolean isClosed );
201 CORBA::Boolean GetClosedGeometry();
203 void SetDebug( CORBA::Boolean isDebug );
206 void SetPeriodicTolerance( CORBA::Double tol );
207 double GetPeriodicTolerance();
209 void SetRequiredEntities( const char* howToTreat );
210 char* GetRequiredEntities();
212 void SetSewingTolerance( CORBA::Double tol );
213 CORBA::Double GetSewingTolerance();
215 void SetTags( const char* howToTreat );
218 void SetHyperPatches(const BLSURFPlugin::THyperPatchList& hpl);
219 BLSURFPlugin::THyperPatchList* GetHyperPatches();
221 void SetPreCADMergeEdges(CORBA::Boolean theValue);
222 CORBA::Boolean GetPreCADMergeEdges();
224 void SetPreCADRemoveDuplicateCADFaces(CORBA::Boolean theValue);
225 CORBA::Boolean GetPreCADRemoveDuplicateCADFaces();
227 void SetPreCADProcess3DTopology(CORBA::Boolean theValue);
228 CORBA::Boolean GetPreCADProcess3DTopology();
230 void SetPreCADDiscardInput(CORBA::Boolean theValue);
231 CORBA::Boolean GetPreCADDiscardInput();
233 void SetOptionValue(const char* optionName, const char* optionValue);
234 void SetPreCADOptionValue(const char* optionName, const char* optionValue);
235 char* GetOptionValue(const char* optionName);
236 char* GetPreCADOptionValue(const char* optionName);
238 void UnsetOption(const char* optionName);
239 void UnsetPreCADOption(const char* optionName);
241 BLSURFPlugin::string_array* GetOptionValues();
242 BLSURFPlugin::string_array* GetPreCADOptionValues();
243 BLSURFPlugin::string_array* GetAdvancedOptionValues();
245 void SetOptionValues(const BLSURFPlugin::string_array& options);
246 void SetPreCADOptionValues(const BLSURFPlugin::string_array& options);
247 void SetAdvancedOptionValues(const BLSURFPlugin::string_array& options);
248 void SetAdvancedOption(const char* optionsAndValues);
250 void AddOption(const char* optionName, const char* optionValue);
251 void AddPreCADOption(const char* optionName, const char* optionValue);
252 char* GetOption(const char* optionName);
253 char* GetPreCADOption(const char* optionName);
255 void SetSizeMapEntry(const char* entry, const char* sizeMap);
257 void SetConstantSizeMapEntry(const char* entry, GEOM::shape_type shapeType, CORBA::Double sizeMap);
259 char* GetSizeMapEntry(const char* entry);
261 void UnsetEntry(const char* entry);
263 BLSURFPlugin::string_array* GetSizeMapEntries();
265 void SetSizeMapEntries(const BLSURFPlugin::string_array& sizeMaps);
267 void SetSizeMap(GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap);
269 void SetConstantSizeMap(GEOM::GEOM_Object_ptr GeomObj, CORBA::Double sizeMap);
271 void UnsetSizeMap(GEOM::GEOM_Object_ptr GeomObj);
273 void ClearSizeMaps();
275 void SetAttractor(GEOM::GEOM_Object_ptr GeomObj, const char* attractor);
277 void UnsetAttractor(GEOM::GEOM_Object_ptr GeomObj);
279 void SetAttractorEntry(const char* entry, const char* attractor);
281 char* GetAttractorEntry(const char* entry);
283 BLSURFPlugin::string_array* GetAttractorEntries();
287 * Set/get/unset an attractor on a face
290 void SetAttractorGeom(GEOM::GEOM_Object_ptr GeomObj, GEOM::GEOM_Object_ptr Attractor, CORBA::Double StartSize, CORBA::Double EndSize, CORBA::Double ActionRadius, CORBA::Double ConstantRadius );
292 void UnsetAttractorGeom(GEOM::GEOM_Object_ptr GeomObj,
293 GEOM::GEOM_Object_ptr theAttractor);
295 void UnsetAttractorEntry(const char* entry, const char* attractor);
296 void SetClassAttractorEntry(const char* entry, const char* att_entry, CORBA::Double StartSize, CORBA::Double EndSize, CORBA::Double ActionRadius, CORBA::Double ConstantRadius);
298 BLSURFPlugin::TAttParamsMap* GetAttractorParams();
302 void SetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap);
304 void UnsetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj);
306 void SetCustomSizeMapEntry(const char* entry,const char* sizeMap );
308 char* GetCustomSizeMapEntry(const char* entry);
310 BLSURFPlugin::string_array* GetCustomSizeMapEntries();
313 ///////////////////////
314 // ENFORCED VERTEXES //
315 ///////////////////////
317 BLSURFPlugin::TFaceEntryEnfVertexListMap* GetAllEnforcedVerticesByFace();
318 BLSURFPlugin::TEnfVertexList* GetAllEnforcedVertices();
320 BLSURFPlugin::TFaceEntryCoordsListMap* GetAllCoordsByFace();
321 BLSURFPlugin::TCoordsEnfVertexMap* GetAllEnforcedVerticesByCoords();
323 BLSURFPlugin::TFaceEntryEnfVertexEntryListMap* GetAllEnfVertexEntriesByFace();
324 BLSURFPlugin::TEnfVertexEntryEnfVertexMap* GetAllEnforcedVerticesByEnfVertexEntry();
326 void ClearAllEnforcedVertices();
329 * Set/get/unset an enforced vertex on geom object
332 bool SetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z);
333 bool SetEnforcedVertexNamed(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theVertexName);
334 bool SetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex);
335 bool SetEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theGroupName);
336 bool SetEnforcedVertexNamedWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theVertexName, const char* theGroupName);
337 bool SetEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex, const char* theGroupName);
339 BLSURFPlugin::TEnfVertexList* GetEnforcedVertices(GEOM::GEOM_Object_ptr theFace);
341 bool UnsetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z);
342 bool UnsetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex);
343 bool UnsetEnforcedVertices(GEOM::GEOM_Object_ptr theFace);
346 bool AddEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z);
347 bool AddEnforcedVertexNamed(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theVertexName);
348 bool AddEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex);
349 bool AddEnforcedVertexWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theGroupName);
350 bool AddEnforcedVertexNamedWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theVertexName, const char* theGroupName);
351 bool AddEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theVertex, const char* theGroupName);
353 bool RemoveEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z);
354 bool RemoveEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex);
355 bool RemoveEnforcedVertices();
358 * Set/get/unset an enforced vertex on geom object given by entry
360 bool SetEnforcedVertexEntry(const char* theFaceEntry, CORBA::Double x = 0, CORBA::Double y = 0, CORBA::Double z = 0,
361 const char* theVertexName = "", const char* theVertexEntry = "", const char* theGroupName = "");
363 BLSURFPlugin::TEnfVertexList* GetEnforcedVerticesEntry(const char* theFaceEntry);
365 bool UnsetEnforcedVertexEntry(const char* theFaceEntry, CORBA::Double x, CORBA::Double y, CORBA::Double z,
366 const char* theVertexEntry = "");
367 bool UnsetEnforcedVerticesEntry(const char* theFaceEntry);
370 * To add internal vertices as enforced vertices
372 void SetInternalEnforcedVertexAllFaces(CORBA::Boolean toEnforceInternalVertices);
373 CORBA::Boolean GetInternalEnforcedVertexAllFaces();
374 void SetInternalEnforcedVertexAllFacesGroup(const char* groupName = "");
375 char* GetInternalEnforcedVertexAllFacesGroup();
377 // Enable internal enforced vertices on specific face if requested by user
378 // void SetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices);
379 // void SetInternalEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName = "");
380 // void SetInternalEnforcedVertexEntry(const char* theFaceEntry, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName = "");
381 // CORBA::Boolean GetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace);
382 // CORBA::Boolean GetInternalEnforcedVertexEntry(const char* theFaceEntry);
384 ///////////////////////
386 ///////////////////////
388 void ClearPreCadPeriodicityVectors();
390 BLSURFPlugin::TPeriodicityList* GetPreCadFacesPeriodicityVector();
391 BLSURFPlugin::TPeriodicityList* GetPreCadEdgesPeriodicityVector();
393 BLSURFPlugin::TPeriodicityList* PreCadVectorToSequence(const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector& preCadPeriodicityVector);
395 void AddPreCadFacesPeriodicity(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2);
397 void AddPreCadFacesPeriodicityWithVertices(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2,
398 const GEOM::ListOfGO& theSourceVertices, const GEOM::ListOfGO& theTargetVertices);
400 void AddPreCadFacesPeriodicityEntry(const char* theFace1Entry, const char* theFace2Entry,
401 const BLSURFPlugin::TEntryList& theSourceVerticesEntries, const BLSURFPlugin::TEntryList& theTargetVerticesEntries);
403 void AddPreCadEdgesPeriodicity(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2);
405 void AddPreCadEdgesPeriodicityWithVertices(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2,
406 const GEOM::ListOfGO& theSourceVertices, const GEOM::ListOfGO& theTargetVertices);
408 void AddPreCadEdgesPeriodicityEntry(const char* theEdge1Entry, const char* theEdge2Entry,
409 const BLSURFPlugin::TEntryList& theSourceVerticesEntries, const BLSURFPlugin::TEntryList& theTargetVerticesEntries);
411 ///////////////////////
414 * Sets the file for export resulting mesh in GMF format
416 // void SetGMFFile(const char* theFileName, CORBA::Boolean isBinary);
417 void SetGMFFile(const char* theFileName);
419 // CORBA::Boolean GetGMFFileMode();
421 // Get implementation
422 ::BLSURFPlugin_Hypothesis* GetImpl();
424 // Verify whether hypothesis supports given entity type
425 CORBA::Boolean IsDimSupported(SMESH::Dimension type);
429 // Methods for copying mesh definition to other geometry
431 // Return geometry this hypothesis depends on. Return false if there is no geometry parameter
432 virtual bool getObjectsDependOn( std::vector< std::string > & entryArray,
433 std::vector< int > & subIDArray ) const;
435 // Set new geometry instead of that returned by getObjectsDependOn()
436 virtual bool setObjectsDependOn( std::vector< std::string > & entryArray,
437 std::vector< int > & subIDArray );
439 ///////////////////////
441 ///////////////////////
442 std::string ShapeTypeToString(GEOM::shape_type theShapeType);
443 void CheckShapeType(GEOM::GEOM_Object_ptr shape, GEOM::shape_type theShapeType);
444 void CheckShapeTypes(GEOM::GEOM_Object_ptr shape, std::vector<GEOM::shape_type> theShapeTypes);
445 std::string PublishIfNeeded(GEOM::GEOM_Object_ptr shape, GEOM::shape_type theShapeType, std::string prefix);
446 std::string FormatVerticesEntries(std::vector<std::string> &theSourceVerticesEntries, std::vector<std::string> &theTargetVerticesEntries);