1 // Copyright (C) 2007-2023 CEA, EDF
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 // & Aurelien ALLEAUME (DISTENE)
24 // Size maps developement: Nicolas GEIMER (OCC) & Gilles DAVID (EURIWARE)
27 #ifndef _BLSURFPlugin_Hypothesis_HXX_
28 #define _BLSURFPlugin_Hypothesis_HXX_
30 #include "BLSURFPlugin_Attractor.hxx"
32 #include <SMDS_ElemIterator.hxx>
33 #include <SMESH_Hypothesis.hxx>
34 #include <smIdType.hxx>
43 // Parameters for work of MG-CADSurf
45 enum EnforcedMeshType { ENFORCED_MESH, ENFORCED_GROUP, ENFORCED_SUBMESH };
47 class BLSURFPlugin_Hypothesis: public SMESH_Hypothesis
50 BLSURFPlugin_Hypothesis(int hypId, SMESH_Gen * gen, bool hasgeom);
67 GeometricalGlobalSize,
77 static const char* GetHypType(bool hasgeom)
78 { return hasgeom ? "MG-CADSurf Parameters" : "MG-CADSurf Parameters_NOGEOM"; }
80 TopoDS_Shape entryToShape(std::string entry);
82 static std::string GetMeshGemsVersion();
84 void SetPhysicalMesh(PhysicalMesh thePhysicalMesh);
85 PhysicalMesh GetPhysicalMesh() const { return _physicalMesh; }
87 void SetGeometricMesh(GeometricMesh theGeometricMesh);
88 GeometricMesh GetGeometricMesh() const { return _geometricMesh; }
90 void SetPhySize(double thePhySize, bool isRelative = false);
91 double GetPhySize() const { return _phySize; }
92 bool IsPhySizeRel() const { return _phySizeRel; }
94 void SetMinSize(double theMinSize, bool isRelative = false);
95 double GetMinSize() const { return _minSize; }
96 bool IsMinSizeRel() const { return _minSizeRel; }
98 void SetMaxSize(double theMaxSize, bool isRelative = false);
99 double GetMaxSize() const { return _maxSize; }
100 bool IsMaxSizeRel() const { return _maxSizeRel; }
102 void SetUseGradation(bool toUse);
103 bool GetUseGradation() const { return _useGradation; }
104 void SetGradation(double theGradation);
105 double GetGradation() const { return _gradation; }
107 void SetUseVolumeGradation(bool toUse);
108 bool GetUseVolumeGradation() const { return _useVolumeGradation; }
109 void SetVolumeGradation(double theGradation);
110 double GetVolumeGradation() const { return _volumeGradation; }
112 void SetElementType(ElementType theElementType);
113 ElementType GetElementType() const { return _elementType; }
115 void SetAngleMesh(double theAngle);
116 double GetAngleMesh() const { return _angleMesh; }
118 void SetChordalError(double theDistance);
119 double GetChordalError() const { return _chordalError; }
121 void SetAnisotropic(bool theVal);
122 bool GetAnisotropic() const { return _anisotropic; }
124 void SetAnisotropicRatio(double theVal);
125 double GetAnisotropicRatio() const { return _anisotropicRatio; }
127 void SetRemoveTinyEdges(bool theVal);
128 bool GetRemoveTinyEdges() const { return _removeTinyEdges; }
130 void SetTinyEdgeLength(double theVal);
131 double GetTinyEdgeLength() const { return _tinyEdgeLength; }
133 void SetOptimiseTinyEdges(bool theVal);
134 bool GetOptimiseTinyEdges() const { return _optimiseTinyEdges; }
136 void SetTinyEdgeOptimisationLength(double theVal);
137 double GetTinyEdgeOptimisationLength() const { return _tinyEdgeOptimisationLength; }
139 void SetCorrectSurfaceIntersection(bool theVal);
140 bool GetCorrectSurfaceIntersection() const { return _correctSurfaceIntersec; }
142 void SetCorrectSurfaceIntersectionMaxCost(double theVal);
143 double GetCorrectSurfaceIntersectionMaxCost() const { return _corrSurfaceIntersCost; }
145 void SetBadElementRemoval(bool theVal);
146 bool GetBadElementRemoval() const { return _badElementRemoval; }
148 void SetBadElementAspectRatio(double theVal);
149 double GetBadElementAspectRatio() const { return _badElementAspectRatio; }
151 void SetOptimizeMesh(bool theVal);
152 bool GetOptimizeMesh() const { return _optimizeMesh; }
154 void SetQuadraticMesh(bool theVal);
155 bool GetQuadraticMesh() const { return _quadraticMesh; }
157 void SetTopology(Topology theTopology);
158 Topology GetTopology() const { return _topology; }
160 bool GetUseSurfaceProximity() const { return _useSurfaceProximity; }
161 void SetUseSurfaceProximity( bool toUse );
163 int GetNbSurfaceProximityLayers() const { return _nbSurfaceProximityLayers; }
164 void SetNbSurfaceProximityLayers( int nbLayers );
166 double GetSurfaceProximityRatio() const { return _surfaceProximityRatio; }
167 void SetSurfaceProximityRatio( double ratio );
169 bool GetUseVolumeProximity() const { return _useVolumeProximity; }
170 void SetUseVolumeProximity( bool toUse );
172 int GetNbVolumeProximityLayers() const { return _nbVolumeProximityLayers; }
173 void SetNbVolumeProximityLayers( int nbLayers );
175 double GetVolumeProximityRatio() const { return _volumeProximityRatio; }
176 void SetVolumeProximityRatio( double ratio );
178 void SetVerbosity(int theVal);
179 int GetVerbosity() const { return _verb; }
181 void ClearEntry(const std::string& entry, const char * attEntry = 0);
182 void ClearSizeMaps();
184 void SetEnforceCadEdgesSize( bool toEnforce );
185 bool GetEnforceCadEdgesSize();
187 void SetJacobianRectificationRespectGeometry( bool allowRectification );
188 bool GetJacobianRectificationRespectGeometry();
190 void SetUseDeprecatedPatchMesher( bool useDeprecatedPatchMesher );
191 bool GetUseDeprecatedPatchMesher();
193 void SetJacobianRectification( bool allowRectification );
194 bool GetJacobianRectification();
196 void SetMaxNumberOfPointsPerPatch( int nb );
197 int GetMaxNumberOfPointsPerPatch();
199 void SetMaxNumberOfThreads( int nb );
200 int GetMaxNumberOfThreads();
202 void SetRespectGeometry( bool toRespect );
203 bool GetRespectGeometry();
205 void SetTinyEdgesAvoidSurfaceIntersections( bool toAvoidIntersection );
206 bool GetTinyEdgesAvoidSurfaceIntersections();
208 void SetClosedGeometry( bool isClosed );
209 bool GetClosedGeometry();
211 void SetDebug( bool isDebug );
214 void SetPeriodicTolerance( double tol );
215 double GetPeriodicTolerance();
217 void SetRequiredEntities( const std::string& howToTreat );
218 std::string GetRequiredEntities();
220 void SetSewingTolerance( double tol );
221 double GetSewingTolerance();
223 void SetTags( const std::string& howToTreat );
224 std::string GetTags();
227 typedef std::set< int > THyperPatchTags;
228 typedef std::vector< THyperPatchTags > THyperPatchList;
229 typedef std::set< std::string > THyperPatchEntries;
230 typedef std::vector< THyperPatchEntries > THyperPatchEntriesList;
232 void SetHyperPatches(const THyperPatchList& hpl, bool notifyMesh=true);
233 void SetHyperPatches(const THyperPatchEntriesList& hpl);
234 void SetHyperPatchIDsByEntry( const TopoDS_Shape& mainShape,
235 const std::map< std::string, TopoDS_Shape >& entryToShape);
236 const THyperPatchList& GetHyperPatches() const { return _hyperPatchList; }
237 const THyperPatchEntriesList& GetHyperPatchEntries() const { return _hyperPatchEntriesList; }
238 static int GetHyperPatchTag( int faceTag, const BLSURFPlugin_Hypothesis* hyp, int* iPatch=0 );
243 int _meshID; // persistent mesh ID
244 int _subID; // either persistent group ID or sub-shape ID for sub-mesh
245 EnforcedMeshType _type; /* specify what _subID means:
246 - nothing for ENFORCED_MESH
247 - group ID for ENFORCED_GROUP
248 - sub-shape ID for ENFORCED_SUBMESH */
249 std::string _groupName; // name of a group to add mesh edges to
251 bool operator==(const EnforcedMesh& em ) const
253 return ( _meshID == em._meshID && _subID == em._subID &&
254 _type == em._type && _groupName == em._groupName );
258 void SetEnforcedMeshes( std::vector< EnforcedMesh > & enforcedMeshes );
259 const std::vector< EnforcedMesh > & GetEnforcedMeshes() const { return _enforcedMeshes; }
260 SMDS_ElemIteratorPtr GetEnforcedSegments( const EnforcedMesh& enfMesh,
261 SMESH_Mesh* & mesh ) const;
264 void SetPreCADMergeEdges(bool theVal);
265 bool GetPreCADMergeEdges() const { return _preCADMergeEdges; }
267 void SetPreCADRemoveDuplicateCADFaces(bool theVal);
268 bool GetPreCADRemoveDuplicateCADFaces() const { return _preCADRemoveDuplicateCADFaces; }
270 void SetPreCADProcess3DTopology(bool theVal);
271 bool GetPreCADProcess3DTopology() const { return _preCADProcess3DTopology; }
273 void SetPreCADDiscardInput(bool theVal);
274 bool GetPreCADDiscardInput() const { return _preCADDiscardInput; }
276 static bool HasPreCADOptions(const BLSURFPlugin_Hypothesis* hyp);
278 typedef std::map<std::string,std::string> TSizeMap;
280 void SetSizeMapEntry(const std::string& entry,const std::string& sizeMap );
281 std::string GetSizeMapEntry(const std::string& entry);
282 const TSizeMap& _GetSizeMapEntries() const { return _sizeMap; }
284 * \brief Return the size maps
286 static TSizeMap GetSizeMapEntries(const BLSURFPlugin_Hypothesis* hyp);
289 void SetAttractorEntry(const std::string& entry,const std::string& attractor );
290 std::string GetAttractorEntry(const std::string& entry);
291 const TSizeMap& _GetAttractorEntries() const { return _attractors; };
293 * \brief Return the attractors
295 static TSizeMap GetAttractorEntries(const BLSURFPlugin_Hypothesis* hyp);
299 void SetCustomSizeMapEntry(const std::string& entry,const std::string& sizeMap );
300 std::string GetCustomSizeMapEntry(const std::string& entry);
301 void UnsetCustomSizeMap(const std::string& entry);
302 const TSizeMap& GetCustomSizeMapEntries() const { return _customSizeMap; }
305 typedef std::multimap< std::string, BLSURFPlugin_Attractor* > TAttractorMap;
306 typedef std::map< std::string, std::vector<double> > TParamsMap; //TODO ?? finir
308 void SetClassAttractorEntry(const std::string& entry, const std::string& att_entry, double StartSize, double EndSize, double ActionRadius, double ConstantRadius);
309 std::string GetClassAttractorEntry(const std::string& entry);
310 const TAttractorMap& _GetClassAttractorEntries() const { return _classAttractors; }
312 * \brief Return the attractors entries
314 static TAttractorMap GetClassAttractorEntries(const BLSURFPlugin_Hypothesis* hyp);
317 * To set/get/unset an enforced vertex
320 typedef std::string TEnfName;
322 typedef std::string TEntry;
324 typedef std::set<TEntry> TEntryList;
326 typedef std::string TEnfGroupName;
328 typedef std::vector<double> TEnfVertexCoords;
329 typedef std::set< TEnfVertexCoords > TEnfVertexCoordsList;
335 TEnfVertexCoords coords;
336 TEnfGroupName grpName;
337 TEntryList faceEntries;
338 TopoDS_Vertex vertex;
341 struct CompareEnfVertices
343 bool operator () (const TEnfVertex* e1, const TEnfVertex* e2) const {
345 if (e1->coords.size() && e2->coords.size())
346 return (e1->coords < e2->coords);
348 return (e1->geomEntry < e2->geomEntry);
354 // PreCad Face and Edge periodicity
355 struct TPreCadPeriodicity {
358 std::vector<std::string> theSourceVerticesEntries;
359 std::vector<std::string> theTargetVerticesEntries;
363 struct TEdgePeriodicity {
364 TEntry theFace1Entry;
365 TEntry theEdge1Entry;
366 TEntry theFace2Entry;
367 TEntry theEdge2Entry;
368 int edge_orientation;
371 // Vertex periodicity
372 struct TVertexPeriodicity {
373 TEntry theEdge1Entry;
374 TEntry theVertex1Entry;
375 TEntry theEdge2Entry;
376 TEntry theVertex2Entry;
379 typedef std::pair< TEntry, TEntry > TFacesPeriodicity;
381 // List of enforced vertices
382 typedef std::set< TEnfVertex*, CompareEnfVertices > TEnfVertexList;
384 // Map Face Entry / List of enforced vertices
385 typedef std::map< TEntry, TEnfVertexList > TFaceEntryEnfVertexListMap;
387 // List of Face Entry with internal enforced vertices activated
388 typedef std::set< TEntry > TFaceEntryInternalVerticesList;
390 // Map Face Entry / List of coords
391 typedef std::map< TEntry, TEnfVertexCoordsList > TFaceEntryCoordsListMap;
393 // Map Face Entry / List of Vertex entry
394 typedef std::map< TEntry, TEntryList > TFaceEntryEnfVertexEntryListMap;
396 // Map Coords / Enforced vertex
397 typedef std::map< TEnfVertexCoords, TEnfVertex* > TCoordsEnfVertexMap;
399 // Map Vertex entry / Enforced vertex
400 typedef std::map< TEntry, TEnfVertex* > TEnfVertexEntryEnfVertexMap;
402 typedef std::map< TEnfGroupName, std::set<smIdType> > TGroupNameNodeIDMap;
404 // Map Group Name / List of enforced vertices
405 typedef std::map< TEnfGroupName , TEnfVertexList > TGroupNameEnfVertexListMap;
408 // Vector of pairs of entries
409 typedef std::vector< TPreCadPeriodicity > TPreCadPeriodicityVector;
410 typedef std::vector< TFacesPeriodicity > TFacesPeriodicityVector;
411 typedef std::vector< TEdgePeriodicity > TEdgesPeriodicityVector;
412 typedef std::vector< TVertexPeriodicity > TVerticesPeriodicityVector;
415 bool SetEnforcedVertex(TEntry theFaceEntry, TEnfName theVertexName, TEntry theVertexEntry, TEnfGroupName theGroupName,
416 double x = 0.0, double y = 0.0, double z = 0.0);
417 TEnfVertexList GetEnfVertexList(const TEntry& theFaceEntry);
418 TEnfVertexCoordsList GetEnfVertexCoordsList(const TEntry& theFaceEntry);
419 TEntryList GetEnfVertexEntryList (const TEntry& theFaceEntry);
420 TEnfVertex* GetEnfVertex(TEnfVertexCoords coords);
421 TEnfVertex* GetEnfVertex(const TEntry& theEnfVertexEntry);
422 void AddEnfVertexNodeID(TEnfGroupName theGroupName,smIdType theNodeID);
423 std::set<smIdType> GetEnfVertexNodeIDs(TEnfGroupName theGroupName);
424 void RemoveEnfVertexNodeID(TEnfGroupName theGroupName,smIdType theNodeID);
426 bool ClearEnforcedVertex(const TEntry& theFaceEntry, double x = 0.0, double y = 0.0, double z = 0.0, const TEntry& theVertexEntry="");
427 bool ClearEnforcedVertices(const TEntry& theFaceEntry);
429 void ClearAllEnforcedVertices();
430 void AddEnforcedVertex( const TEntry& theFaceEntry, TEnfVertex * theEnfVertex );
432 const TFaceEntryEnfVertexListMap& _GetAllEnforcedVerticesByFace() const { return _faceEntryEnfVertexListMap; }
433 const TEnfVertexList& _GetAllEnforcedVertices() const { return _enfVertexList; }
435 const TFaceEntryCoordsListMap& _GetAllCoordsByFace() const { return _faceEntryCoordsListMap; }
436 const TCoordsEnfVertexMap& _GetAllEnforcedVerticesByCoords() const { return _coordsEnfVertexMap; }
438 const TFaceEntryEnfVertexEntryListMap& _GetAllEnfVertexEntriesByFace() const { return _faceEntryEnfVertexEntryListMap; }
439 const TEnfVertexEntryEnfVertexMap& _GetAllEnforcedVerticesByEnfVertexEntry() const { return _enfVertexEntryEnfVertexMap; }
442 // const TEnfVertexGroupNameMap _GetEnforcedVertexGroupNameMap() const { return _enfVertexGroupNameMap; }
446 * \brief Return the enforced vertices
448 static TFaceEntryEnfVertexListMap GetAllEnforcedVerticesByFace(const BLSURFPlugin_Hypothesis* hyp);
449 static TEnfVertexList GetAllEnforcedVertices(const BLSURFPlugin_Hypothesis* hyp);
451 static TFaceEntryCoordsListMap GetAllCoordsByFace(const BLSURFPlugin_Hypothesis* hyp);
452 static TCoordsEnfVertexMap GetAllEnforcedVerticesByCoords(const BLSURFPlugin_Hypothesis* hyp);
454 static TFaceEntryEnfVertexEntryListMap GetAllEnfVertexEntriesByFace(const BLSURFPlugin_Hypothesis* hyp);
455 static TEnfVertexEntryEnfVertexMap GetAllEnforcedVerticesByEnfVertexEntry(const BLSURFPlugin_Hypothesis* hyp);
458 * \brief Internal enforced vertices
460 void SetInternalEnforcedVertexAllFaces(bool toEnforceInternalVertices);
461 bool _GetInternalEnforcedVertexAllFaces() const { return _enforcedInternalVerticesAllFaces; }
462 static bool GetInternalEnforcedVertexAllFaces( const BLSURFPlugin_Hypothesis* hyp );
463 void SetInternalEnforcedVertexAllFacesGroup(TEnfGroupName theGroupName);
464 const TEnfGroupName _GetInternalEnforcedVertexAllFacesGroup() const { return _enforcedInternalVerticesAllFacesGroup; }
465 static TEnfGroupName GetInternalEnforcedVertexAllFacesGroup( const BLSURFPlugin_Hypothesis* hyp );
467 // Enable internal enforced vertices on specific face if requested by user
468 // static TFaceEntryInternalVerticesList GetDefaultFaceEntryInternalVerticesMap() { return TFaceEntryInternalVerticesList(); }
469 // const TFaceEntryInternalVerticesList _GetAllInternalEnforcedVerticesByFace() const { return _faceEntryInternalVerticesList; }
470 // static TFaceEntryInternalVerticesList GetAllInternalEnforcedVerticesByFace(const BLSURFPlugin_Hypothesis* hyp);
471 // void SetInternalEnforcedVertex(TEntry theFaceEntry, bool toEnforceInternalVertices, TEnfGroupName theGroupName);
472 // bool GetInternalEnforcedVertex(const TEntry& theFaceEntry);
474 static PhysicalMesh GetDefaultPhysicalMesh() { return PhysicalGlobalSize; }
475 static GeometricMesh GetDefaultGeometricMesh() { return GeometricalGlobalSize; }
476 static double GetDefaultPhySize(double diagonal, double bbSegmentation);
477 static double GetDefaultPhySize() { return undefinedDouble(); }
478 static bool GetDefaultPhySizeRel() { return false; }
479 static double GetDefaultMinSize(double diagonal);
480 static double GetDefaultMinSize() { return undefinedDouble(); }
481 static bool GetDefaultMinSizeRel() { return false; }
482 static double GetDefaultMaxSize(double diagonal);
483 static double GetDefaultMaxSize() { return undefinedDouble(); }
484 static bool GetDefaultMaxSizeRel() { return false; }
485 static bool GetDefaultUseGradation() { return true; }
486 static double GetDefaultGradation() { return 1.3; }
487 static bool GetDefaultUseVolumeGradation() { return false; }
488 static double GetDefaultVolumeGradation() { return 2; }
489 static ElementType GetDefaultElementType() { return Triangles; }
490 static double GetDefaultAngleMesh() { return 8.0; }
491 static bool GetDefaultUseSurfaceProximity() { return false; }
492 static int GetDefaultNbSurfaceProximityLayers() { return 1; }
493 static double GetDefaultSurfaceProximityRatio() { return 1.; }
494 static bool GetDefaultUseVolumeProximity() { return false; }
495 static int GetDefaultNbVolumeProximityLayers() { return 1; }
496 static double GetDefaultVolumeProximityRatio() { return 1.; }
498 static double GetDefaultChordalError(double diagonal);
499 static double GetDefaultChordalError() { return undefinedDouble(); }
500 static bool GetDefaultAnisotropic() { return false; }
501 static double GetDefaultAnisotropicRatio() { return 0.0; }
502 static bool GetDefaultRemoveTinyEdges() { return false; }
503 static double GetDefaultTinyEdgeLength(double diagonal);
504 static double GetDefaultTinyEdgeLength() { return undefinedDouble(); }
505 static bool GetDefaultOptimiseTinyEdges() { return false; }
506 static double GetDefaultTinyEdgeOptimisationLength(double diagonal);
507 static double GetDefaultTinyEdgeOptimisationLength() { return undefinedDouble(); }
508 static bool GetDefaultCorrectSurfaceIntersection() { return true; }
509 static double GetDefaultCorrectSurfaceIntersectionMaxCost() { return 15.; }
510 static bool GetDefaultBadElementRemoval() { return false; }
511 static double GetDefaultBadElementAspectRatio() {return 1000.0; }
512 static bool GetDefaultOptimizeMesh() { return true; }
513 static bool GetDefaultQuadraticMesh() { return false; }
515 static int GetDefaultVerbosity() { return 3; }
516 static Topology GetDefaultTopology() { return FromCAD; }
518 static bool GetDefaultPreCADMergeEdges() { return false; }
519 static bool GetDefaultPreCADRemoveDuplicateCADFaces() { return false; }
520 static bool GetDefaultPreCADProcess3DTopology() { return false; }
521 static bool GetDefaultPreCADDiscardInput() { return false; }
523 static TSizeMap GetDefaultSizeMap() { return TSizeMap();}
524 static TAttractorMap GetDefaultAttractorMap() { return TAttractorMap(); }
526 static TFaceEntryEnfVertexListMap GetDefaultFaceEntryEnfVertexListMap() { return TFaceEntryEnfVertexListMap(); }
527 static TEnfVertexList GetDefaultEnfVertexList() { return TEnfVertexList(); }
528 static TFaceEntryCoordsListMap GetDefaultFaceEntryCoordsListMap() { return TFaceEntryCoordsListMap(); }
529 static TCoordsEnfVertexMap GetDefaultCoordsEnfVertexMap() { return TCoordsEnfVertexMap(); }
530 static TFaceEntryEnfVertexEntryListMap GetDefaultFaceEntryEnfVertexEntryListMap() { return TFaceEntryEnfVertexEntryListMap(); }
531 static TEnfVertexEntryEnfVertexMap GetDefaultEnfVertexEntryEnfVertexMap() { return TEnfVertexEntryEnfVertexMap(); }
532 static TGroupNameNodeIDMap GetDefaultGroupNameNodeIDMap() { return TGroupNameNodeIDMap(); }
534 static bool GetDefaultInternalEnforcedVertex() { return false; }
537 static TGroupNameEnfVertexListMap GetDefaultGroupNameEnfVertexListMap() { return TGroupNameEnfVertexListMap(); }
538 static TEnfVertexGroupNameMap GetDefaultEnfVertexGroupNameMap() { return TEnfVertexGroupNameMap(); }
541 // const TPreCadPeriodicityEntriesVector _GetPreCadFacesPeriodicityEntries() const { return _preCadFacesPeriodicityEntriesVector; }
543 static TPreCadPeriodicityVector GetDefaultPreCadFacesPeriodicityVector() { return TPreCadPeriodicityVector(); }
544 const TPreCadPeriodicityVector& _GetPreCadFacesPeriodicityVector() const { return _preCadFacesPeriodicityVector; }
545 static TPreCadPeriodicityVector GetPreCadFacesPeriodicityVector(const BLSURFPlugin_Hypothesis* hyp);
547 static TPreCadPeriodicityVector GetDefaultPreCadEdgesPeriodicityVector() { return TPreCadPeriodicityVector(); }
548 const TPreCadPeriodicityVector& _GetPreCadEdgesPeriodicityVector() const { return _preCadEdgesPeriodicityVector; }
549 static TPreCadPeriodicityVector GetPreCadEdgesPeriodicityVector(const BLSURFPlugin_Hypothesis* hyp);
551 static TFacesPeriodicityVector GetDefaultFacesPeriodicityVector() { return TFacesPeriodicityVector(); }
552 const TFacesPeriodicityVector& _GetFacesPeriodicityVector() const { return _facesPeriodicityVector; }
553 static TFacesPeriodicityVector GetFacesPeriodicityVector(const BLSURFPlugin_Hypothesis* hyp);
555 static TEdgesPeriodicityVector GetDefaultEdgesPeriodicityVector() { return TEdgesPeriodicityVector(); }
556 const TEdgesPeriodicityVector& _GetEdgesPeriodicityVector() const { return _edgesPeriodicityVector; }
557 static TEdgesPeriodicityVector GetEdgesPeriodicityVector(const BLSURFPlugin_Hypothesis* hyp);
559 static TVerticesPeriodicityVector GetDefaultVerticesPeriodicityVector() { return TVerticesPeriodicityVector(); }
560 const TVerticesPeriodicityVector& _GetVerticesPeriodicityVector() const { return _verticesPeriodicityVector; }
561 static TVerticesPeriodicityVector GetVerticesPeriodicityVector(const BLSURFPlugin_Hypothesis* hyp);
563 void ClearPreCadPeriodicityVectors();
565 void AddPreCadFacesPeriodicity(TEntry theFace1Entry, TEntry theFace2Entry,
566 std::vector<std::string> &theSourceVerticesEntries, std::vector<std::string> &theTargetVerticesEntries);
567 void AddPreCadEdgesPeriodicity(TEntry theEdge1Entry, TEntry theEdge2Entry,
568 std::vector<std::string> &theSourceVerticesEntries, std::vector<std::string> &theTargetVerticesEntries);
570 static double undefinedDouble() { return -1.0; }
572 typedef std::map< std::string, std::string > TOptionValues;
573 typedef std::set< std::string > TOptionNames;
575 void SetOptionValue(const std::string& optionName,
576 const std::string& optionValue);
577 void SetPreCADOptionValue(const std::string& optionName,
578 const std::string& optionValue);
579 std::string GetOptionValue(const std::string& optionName, bool* isDefault=0) const;
580 std::string GetPreCADOptionValue(const std::string& optionName, bool* isDefault=0) const;
581 void ClearOption(const std::string& optionName);
582 void ClearPreCADOption(const std::string& optionName);
583 TOptionValues GetOptionValues() const;
584 TOptionValues GetPreCADOptionValues() const;
585 const TOptionValues& GetCustomOptionValues() const { return _customOption2value; }
587 void AddOption(const std::string& optionName, const std::string& optionValue);
588 void AddPreCADOption(const std::string& optionName, const std::string& optionValue);
589 std::string GetOption(const std::string& optionName) const;
590 std::string GetPreCADOption(const std::string& optionName) const;
592 static bool ToBool(const std::string& str, bool* isOk=0);
593 static double ToDbl(const std::string& str, bool* isOk=0);
594 static int ToInt(const std::string& str, bool* isOk=0);
597 * Sets the file for export resulting mesh in GMF format
599 // void SetGMFFile(const std::string& theFileName, bool isBinary);
600 void SetGMFFile(const std::string& theFileName);
601 std::string GetGMFFile() const { return _GMFFileName; }
602 static std::string GetDefaultGMFFile() { return "";}
603 // bool GetGMFFileMode() const { return _GMFFileMode; }
606 virtual std::ostream & SaveTo(std::ostream & save);
607 virtual std::istream & LoadFrom(std::istream & load);
608 friend std::ostream & operator <<(std::ostream & save, BLSURFPlugin_Hypothesis & hyp);
609 friend std::istream & operator >>(std::istream & load, BLSURFPlugin_Hypothesis & hyp);
612 * \brief Does nothing
613 * \param theMesh - the built mesh
614 * \param theShape - the geometry of interest
615 * \retval bool - always false
617 virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
620 * \brief Initialize my parameter values by default parameters.
621 * \retval bool - true if parameter values have been successfully defined
623 virtual bool SetParametersByDefaults(const TDefaults& dflts, const SMESH_Mesh* theMesh=0);
627 PhysicalMesh _physicalMesh;
628 GeometricMesh _geometricMesh;
631 double _minSize, _maxSize;
632 bool _minSizeRel, _maxSizeRel;
635 bool _useVolumeGradation;
636 double _volumeGradation;
637 ElementType _elementType;
639 double _chordalError;
641 double _anisotropicRatio;
642 bool _removeTinyEdges;
643 double _tinyEdgeLength;
644 bool _optimiseTinyEdges;
645 double _tinyEdgeOptimisationLength;
646 bool _correctSurfaceIntersec;
647 double _corrSurfaceIntersCost;
648 bool _badElementRemoval;
649 double _badElementAspectRatio;
654 bool _useSurfaceProximity;
655 int _nbSurfaceProximityLayers;
656 double _surfaceProximityRatio;
657 bool _useVolumeProximity;
658 int _nbVolumeProximityLayers;
659 double _volumeProximityRatio;
661 bool _preCADMergeEdges;
662 bool _preCADRemoveDuplicateCADFaces;
663 bool _preCADProcess3DTopology;
664 bool _preCADDiscardInput;
665 double _preCADEpsNano;
667 TOptionValues _option2value, _preCADoption2value, _customOption2value; // user defined values
668 TOptionValues _defaultOptionValues; // default values
669 TOptionNames _doubleOptions, _charOptions, _boolOptions; // to find a type of option
670 TOptionNames _preCADdoubleOptions, _preCADcharOptions;
673 TSizeMap _attractors;
674 TAttractorMap _classAttractors;
676 TFaceEntryEnfVertexListMap _faceEntryEnfVertexListMap;
677 TEnfVertexList _enfVertexList;
678 // maps to get "manual" enf vertex (through their coordinates)
679 TFaceEntryCoordsListMap _faceEntryCoordsListMap;
680 TCoordsEnfVertexMap _coordsEnfVertexMap;
681 // maps to get "geom" enf vertex (through their geom entries)
682 TFaceEntryEnfVertexEntryListMap _faceEntryEnfVertexEntryListMap;
683 TEnfVertexEntryEnfVertexMap _enfVertexEntryEnfVertexMap;
684 TGroupNameNodeIDMap _groupNameNodeIDMap;
686 // Enable internal enforced vertices on specific face if requested by user
687 // TFaceEntryInternalVerticesList _faceEntryInternalVerticesList;
688 bool _enforcedInternalVerticesAllFaces;
689 TEnfGroupName _enforcedInternalVerticesAllFacesGroup;
691 TPreCadPeriodicityVector _preCadFacesPeriodicityVector;
692 TPreCadPeriodicityVector _preCadEdgesPeriodicityVector;
694 TFacesPeriodicityVector _facesPeriodicityVector;
695 TEdgesPeriodicityVector _edgesPeriodicityVector;
696 TVerticesPeriodicityVector _verticesPeriodicityVector;
698 THyperPatchList _hyperPatchList;
699 THyperPatchEntriesList _hyperPatchEntriesList;
701 std::vector< EnforcedMesh > _enforcedMeshes; // enforced 1D meshes
703 // Called by SaveTo to store content of _preCadFacesPeriodicityVector and _preCadEdgesPeriodicityVector
704 void SavePreCADPeriodicity(std::ostream & save, const char* shapeType);
706 // Called by LoadFrom to fill _preCadFacesPeriodicityVector and _preCadEdgesPeriodicityVector
707 void LoadPreCADPeriodicity(std::istream & load, const char* shapeType);
709 // Called by LoadFrom to fill _facesPeriodicityVector
710 void LoadFacesPeriodicity(std::istream & load);
712 // Called by LoadFrom to fill _edgesPeriodicityVector
713 void LoadEdgesPeriodicity(std::istream & load);
715 // Called by LoadFrom to fill _verticesPeriodicityVector
716 void LoadVerticesPeriodicity(std::istream & load);
718 // Called by SaveTo to store content of _facesPeriodicityVector
719 void SaveFacesPeriodicity(std::ostream & save);
721 // Called by SaveTo to store content of _edgesPeriodicityVector
722 void SaveEdgesPeriodicity(std::ostream & save);
724 // Called by SaveTo to store content of _verticesPeriodicityVector
725 void SaveVerticesPeriodicity(std::ostream & save);
727 std::string _GMFFileName;
728 // bool _GMFFileMode;
730 // TSizeMap _customSizeMap;