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 // & 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 "SMESH_Hypothesis.hxx"
38 #include <utilities.h>
39 #include <smIdType.hxx>
40 #include "BLSURFPlugin_Attractor.hxx"
42 // Parameters for work of MG-CADSurf
44 class BLSURFPlugin_Hypothesis: public SMESH_Hypothesis
47 BLSURFPlugin_Hypothesis(int hypId, SMESH_Gen * gen, bool hasgeom);
64 GeometricalGlobalSize,
74 static const char* GetHypType(bool hasgeom)
75 { return hasgeom ? "MG-CADSurf Parameters" : "MG-CADSurf Parameters_NOGEOM"; }
77 TopoDS_Shape entryToShape(std::string entry);
79 static std::string GetMeshGemsVersion();
81 void SetPhysicalMesh(PhysicalMesh thePhysicalMesh);
82 PhysicalMesh GetPhysicalMesh() const { return _physicalMesh; }
84 void SetGeometricMesh(GeometricMesh theGeometricMesh);
85 GeometricMesh GetGeometricMesh() const { return _geometricMesh; }
87 void SetPhySize(double thePhySize, bool isRelative = false);
88 double GetPhySize() const { return _phySize; }
89 bool IsPhySizeRel() const { return _phySizeRel; }
91 void SetMinSize(double theMinSize, bool isRelative = false);
92 double GetMinSize() const { return _minSize; }
93 bool IsMinSizeRel() const { return _minSizeRel; }
95 void SetMaxSize(double theMaxSize, bool isRelative = false);
96 double GetMaxSize() const { return _maxSize; }
97 bool IsMaxSizeRel() const { return _maxSizeRel; }
99 void SetUseGradation(bool toUse);
100 bool GetUseGradation() const { return _useGradation; }
101 void SetGradation(double theGradation);
102 double GetGradation() const { return _gradation; }
104 void SetUseVolumeGradation(bool toUse);
105 bool GetUseVolumeGradation() const { return _useVolumeGradation; }
106 void SetVolumeGradation(double theGradation);
107 double GetVolumeGradation() const { return _volumeGradation; }
109 void SetElementType(ElementType theElementType);
110 ElementType GetElementType() const { return _elementType; }
112 void SetAngleMesh(double theAngle);
113 double GetAngleMesh() const { return _angleMesh; }
115 void SetChordalError(double theDistance);
116 double GetChordalError() const { return _chordalError; }
118 void SetAnisotropic(bool theVal);
119 bool GetAnisotropic() const { return _anisotropic; }
121 void SetAnisotropicRatio(double theVal);
122 double GetAnisotropicRatio() const { return _anisotropicRatio; }
124 void SetRemoveTinyEdges(bool theVal);
125 bool GetRemoveTinyEdges() const { return _removeTinyEdges; }
127 void SetTinyEdgeLength(double theVal);
128 double GetTinyEdgeLength() const { return _tinyEdgeLength; }
130 void SetOptimiseTinyEdges(bool theVal);
131 bool GetOptimiseTinyEdges() const { return _optimiseTinyEdges; }
133 void SetTinyEdgeOptimisationLength(double theVal);
134 double GetTinyEdgeOptimisationLength() const { return _tinyEdgeOptimisationLength; }
136 void SetCorrectSurfaceIntersection(bool theVal);
137 bool GetCorrectSurfaceIntersection() const { return _correctSurfaceIntersec; }
139 void SetCorrectSurfaceIntersectionMaxCost(double theVal);
140 double GetCorrectSurfaceIntersectionMaxCost() const { return _corrSurfaceIntersCost; }
142 void SetBadElementRemoval(bool theVal);
143 bool GetBadElementRemoval() const { return _badElementRemoval; }
145 void SetBadElementAspectRatio(double theVal);
146 double GetBadElementAspectRatio() const { return _badElementAspectRatio; }
148 void SetOptimizeMesh(bool theVal);
149 bool GetOptimizeMesh() const { return _optimizeMesh; }
151 void SetQuadraticMesh(bool theVal);
152 bool GetQuadraticMesh() const { return _quadraticMesh; }
154 void SetTopology(Topology theTopology);
155 Topology GetTopology() const { return _topology; }
157 bool GetUseSurfaceProximity() const { return _useSurfaceProximity; }
158 void SetUseSurfaceProximity( bool toUse );
160 int GetNbSurfaceProximityLayers() const { return _nbSurfaceProximityLayers; }
161 void SetNbSurfaceProximityLayers( int nbLayers );
163 double GetSurfaceProximityRatio() const { return _surfaceProximityRatio; }
164 void SetSurfaceProximityRatio( double ratio );
166 bool GetUseVolumeProximity() const { return _useVolumeProximity; }
167 void SetUseVolumeProximity( bool toUse );
169 int GetNbVolumeProximityLayers() const { return _nbVolumeProximityLayers; }
170 void SetNbVolumeProximityLayers( int nbLayers );
172 double GetVolumeProximityRatio() const { return _volumeProximityRatio; }
173 void SetVolumeProximityRatio( double ratio );
175 void SetVerbosity(int theVal);
176 int GetVerbosity() const { return _verb; }
178 void ClearEntry(const std::string& entry, const char * attEntry = 0);
179 void ClearSizeMaps();
181 void SetEnforceCadEdgesSize( bool toEnforce );
182 bool GetEnforceCadEdgesSize();
184 void SetJacobianRectificationRespectGeometry( bool allowRectification );
185 bool GetJacobianRectificationRespectGeometry();
187 void SetUseDeprecatedPatchMesher( bool useDeprecatedPatchMesher );
188 bool GetUseDeprecatedPatchMesher();
190 void SetJacobianRectification( bool allowRectification );
191 bool GetJacobianRectification();
193 void SetMaxNumberOfPointsPerPatch( int nb );
194 int GetMaxNumberOfPointsPerPatch();
196 void SetMaxNumberOfThreads( int nb );
197 int GetMaxNumberOfThreads();
199 void SetRespectGeometry( bool toRespect );
200 bool GetRespectGeometry();
202 void SetTinyEdgesAvoidSurfaceIntersections( bool toAvoidIntersection );
203 bool GetTinyEdgesAvoidSurfaceIntersections();
205 void SetClosedGeometry( bool isClosed );
206 bool GetClosedGeometry();
208 void SetDebug( bool isDebug );
211 void SetPeriodicTolerance( double tol );
212 double GetPeriodicTolerance();
214 void SetRequiredEntities( const std::string& howToTreat );
215 std::string GetRequiredEntities();
217 void SetSewingTolerance( double tol );
218 double GetSewingTolerance();
220 void SetTags( const std::string& howToTreat );
221 std::string GetTags();
224 typedef std::set< int > THyperPatchTags;
225 typedef std::vector< THyperPatchTags > THyperPatchList;
226 typedef std::set< std::string > THyperPatchEntries;
227 typedef std::vector< THyperPatchEntries > THyperPatchEntriesList;
229 void SetHyperPatches(const THyperPatchList& hpl, bool notifyMesh=true);
230 void SetHyperPatches(const THyperPatchEntriesList& hpl);
231 void SetHyperPatchIDsByEntry( const TopoDS_Shape& mainShape,
232 const std::map< std::string, TopoDS_Shape >& entryToShape);
233 const THyperPatchList& GetHyperPatches() const { return _hyperPatchList; }
234 const THyperPatchEntriesList& GetHyperPatchEntries() const { return _hyperPatchEntriesList; }
235 static int GetHyperPatchTag( int faceTag, const BLSURFPlugin_Hypothesis* hyp, int* iPatch=0 );
238 void SetPreCADMergeEdges(bool theVal);
239 bool GetPreCADMergeEdges() const { return _preCADMergeEdges; }
241 void SetPreCADRemoveDuplicateCADFaces(bool theVal);
242 bool GetPreCADRemoveDuplicateCADFaces() const { return _preCADRemoveDuplicateCADFaces; }
244 void SetPreCADProcess3DTopology(bool theVal);
245 bool GetPreCADProcess3DTopology() const { return _preCADProcess3DTopology; }
247 void SetPreCADDiscardInput(bool theVal);
248 bool GetPreCADDiscardInput() const { return _preCADDiscardInput; }
250 static bool HasPreCADOptions(const BLSURFPlugin_Hypothesis* hyp);
252 typedef std::map<std::string,std::string> TSizeMap;
254 void SetSizeMapEntry(const std::string& entry,const std::string& sizeMap );
255 std::string GetSizeMapEntry(const std::string& entry);
256 const TSizeMap& _GetSizeMapEntries() const { return _sizeMap; }
258 * \brief Return the size maps
260 static TSizeMap GetSizeMapEntries(const BLSURFPlugin_Hypothesis* hyp);
263 void SetAttractorEntry(const std::string& entry,const std::string& attractor );
264 std::string GetAttractorEntry(const std::string& entry);
265 const TSizeMap& _GetAttractorEntries() const { return _attractors; };
267 * \brief Return the attractors
269 static TSizeMap GetAttractorEntries(const BLSURFPlugin_Hypothesis* hyp);
273 void SetCustomSizeMapEntry(const std::string& entry,const std::string& sizeMap );
274 std::string GetCustomSizeMapEntry(const std::string& entry);
275 void UnsetCustomSizeMap(const std::string& entry);
276 const TSizeMap& GetCustomSizeMapEntries() const { return _customSizeMap; }
279 typedef std::multimap< std::string, BLSURFPlugin_Attractor* > TAttractorMap;
280 typedef std::map< std::string, std::vector<double> > TParamsMap; //TODO ?? finir
282 void SetClassAttractorEntry(const std::string& entry, const std::string& att_entry, double StartSize, double EndSize, double ActionRadius, double ConstantRadius);
283 std::string GetClassAttractorEntry(const std::string& entry);
284 const TAttractorMap& _GetClassAttractorEntries() const { return _classAttractors; }
286 * \brief Return the attractors entries
288 static TAttractorMap GetClassAttractorEntries(const BLSURFPlugin_Hypothesis* hyp);
291 * To set/get/unset an enforced vertex
294 typedef std::string TEnfName;
296 typedef std::string TEntry;
298 typedef std::set<TEntry> TEntryList;
300 typedef std::string TEnfGroupName;
302 typedef std::vector<double> TEnfVertexCoords;
303 typedef std::set< TEnfVertexCoords > TEnfVertexCoordsList;
309 TEnfVertexCoords coords;
310 TEnfGroupName grpName;
311 TEntryList faceEntries;
312 TopoDS_Vertex vertex;
315 struct CompareEnfVertices
317 bool operator () (const TEnfVertex* e1, const TEnfVertex* e2) const {
319 if (e1->coords.size() && e2->coords.size())
320 return (e1->coords < e2->coords);
322 return (e1->geomEntry < e2->geomEntry);
328 // PreCad Face and Edge periodicity
329 struct TPreCadPeriodicity {
332 std::vector<std::string> theSourceVerticesEntries;
333 std::vector<std::string> theTargetVerticesEntries;
337 struct TEdgePeriodicity {
338 TEntry theFace1Entry;
339 TEntry theEdge1Entry;
340 TEntry theFace2Entry;
341 TEntry theEdge2Entry;
342 int edge_orientation;
345 // Vertex periodicity
346 struct TVertexPeriodicity {
347 TEntry theEdge1Entry;
348 TEntry theVertex1Entry;
349 TEntry theEdge2Entry;
350 TEntry theVertex2Entry;
353 typedef std::pair< TEntry, TEntry > TFacesPeriodicity;
355 // List of enforced vertices
356 typedef std::set< TEnfVertex*, CompareEnfVertices > TEnfVertexList;
358 // Map Face Entry / List of enforced vertices
359 typedef std::map< TEntry, TEnfVertexList > TFaceEntryEnfVertexListMap;
361 // List of Face Entry with internal enforced vertices activated
362 typedef std::set< TEntry > TFaceEntryInternalVerticesList;
364 // Map Face Entry / List of coords
365 typedef std::map< TEntry, TEnfVertexCoordsList > TFaceEntryCoordsListMap;
367 // Map Face Entry / List of Vertex entry
368 typedef std::map< TEntry, TEntryList > TFaceEntryEnfVertexEntryListMap;
370 // Map Coords / Enforced vertex
371 typedef std::map< TEnfVertexCoords, TEnfVertex* > TCoordsEnfVertexMap;
373 // Map Vertex entry / Enforced vertex
374 typedef std::map< TEntry, TEnfVertex* > TEnfVertexEntryEnfVertexMap;
376 typedef std::map< TEnfGroupName, std::set<smIdType> > TGroupNameNodeIDMap;
378 // Map Group Name / List of enforced vertices
379 typedef std::map< TEnfGroupName , TEnfVertexList > TGroupNameEnfVertexListMap;
382 // Vector of pairs of entries
383 typedef std::vector< TPreCadPeriodicity > TPreCadPeriodicityVector;
384 typedef std::vector< TFacesPeriodicity > TFacesPeriodicityVector;
385 typedef std::vector< TEdgePeriodicity > TEdgesPeriodicityVector;
386 typedef std::vector< TVertexPeriodicity > TVerticesPeriodicityVector;
389 bool SetEnforcedVertex(TEntry theFaceEntry, TEnfName theVertexName, TEntry theVertexEntry, TEnfGroupName theGroupName,
390 double x = 0.0, double y = 0.0, double z = 0.0);
391 TEnfVertexList GetEnfVertexList(const TEntry& theFaceEntry);
392 TEnfVertexCoordsList GetEnfVertexCoordsList(const TEntry& theFaceEntry);
393 TEntryList GetEnfVertexEntryList (const TEntry& theFaceEntry);
394 TEnfVertex* GetEnfVertex(TEnfVertexCoords coords);
395 TEnfVertex* GetEnfVertex(const TEntry& theEnfVertexEntry);
396 void AddEnfVertexNodeID(TEnfGroupName theGroupName,smIdType theNodeID);
397 std::set<smIdType> GetEnfVertexNodeIDs(TEnfGroupName theGroupName);
398 void RemoveEnfVertexNodeID(TEnfGroupName theGroupName,smIdType theNodeID);
400 bool ClearEnforcedVertex(const TEntry& theFaceEntry, double x = 0.0, double y = 0.0, double z = 0.0, const TEntry& theVertexEntry="");
401 bool ClearEnforcedVertices(const TEntry& theFaceEntry);
403 void ClearAllEnforcedVertices();
404 void AddEnforcedVertex( const TEntry& theFaceEntry, TEnfVertex * theEnfVertex );
406 const TFaceEntryEnfVertexListMap& _GetAllEnforcedVerticesByFace() const { return _faceEntryEnfVertexListMap; }
407 const TEnfVertexList& _GetAllEnforcedVertices() const { return _enfVertexList; }
409 const TFaceEntryCoordsListMap& _GetAllCoordsByFace() const { return _faceEntryCoordsListMap; }
410 const TCoordsEnfVertexMap& _GetAllEnforcedVerticesByCoords() const { return _coordsEnfVertexMap; }
412 const TFaceEntryEnfVertexEntryListMap& _GetAllEnfVertexEntriesByFace() const { return _faceEntryEnfVertexEntryListMap; }
413 const TEnfVertexEntryEnfVertexMap& _GetAllEnforcedVerticesByEnfVertexEntry() const { return _enfVertexEntryEnfVertexMap; }
416 // const TEnfVertexGroupNameMap _GetEnforcedVertexGroupNameMap() const { return _enfVertexGroupNameMap; }
420 * \brief Return the enforced vertices
422 static TFaceEntryEnfVertexListMap GetAllEnforcedVerticesByFace(const BLSURFPlugin_Hypothesis* hyp);
423 static TEnfVertexList GetAllEnforcedVertices(const BLSURFPlugin_Hypothesis* hyp);
425 static TFaceEntryCoordsListMap GetAllCoordsByFace(const BLSURFPlugin_Hypothesis* hyp);
426 static TCoordsEnfVertexMap GetAllEnforcedVerticesByCoords(const BLSURFPlugin_Hypothesis* hyp);
428 static TFaceEntryEnfVertexEntryListMap GetAllEnfVertexEntriesByFace(const BLSURFPlugin_Hypothesis* hyp);
429 static TEnfVertexEntryEnfVertexMap GetAllEnforcedVerticesByEnfVertexEntry(const BLSURFPlugin_Hypothesis* hyp);
432 * \brief Internal enforced vertices
434 void SetInternalEnforcedVertexAllFaces(bool toEnforceInternalVertices);
435 bool _GetInternalEnforcedVertexAllFaces() const { return _enforcedInternalVerticesAllFaces; }
436 static bool GetInternalEnforcedVertexAllFaces( const BLSURFPlugin_Hypothesis* hyp );
437 void SetInternalEnforcedVertexAllFacesGroup(TEnfGroupName theGroupName);
438 const TEnfGroupName _GetInternalEnforcedVertexAllFacesGroup() const { return _enforcedInternalVerticesAllFacesGroup; }
439 static TEnfGroupName GetInternalEnforcedVertexAllFacesGroup( const BLSURFPlugin_Hypothesis* hyp );
441 // Enable internal enforced vertices on specific face if requested by user
442 // static TFaceEntryInternalVerticesList GetDefaultFaceEntryInternalVerticesMap() { return TFaceEntryInternalVerticesList(); }
443 // const TFaceEntryInternalVerticesList _GetAllInternalEnforcedVerticesByFace() const { return _faceEntryInternalVerticesList; }
444 // static TFaceEntryInternalVerticesList GetAllInternalEnforcedVerticesByFace(const BLSURFPlugin_Hypothesis* hyp);
445 // void SetInternalEnforcedVertex(TEntry theFaceEntry, bool toEnforceInternalVertices, TEnfGroupName theGroupName);
446 // bool GetInternalEnforcedVertex(const TEntry& theFaceEntry);
448 static PhysicalMesh GetDefaultPhysicalMesh() { return PhysicalGlobalSize; }
449 static GeometricMesh GetDefaultGeometricMesh() { return GeometricalGlobalSize; }
450 static double GetDefaultPhySize(double diagonal, double bbSegmentation);
451 static double GetDefaultPhySize() { return undefinedDouble(); }
452 static bool GetDefaultPhySizeRel() { return false; }
453 static double GetDefaultMinSize(double diagonal);
454 static double GetDefaultMinSize() { return undefinedDouble(); }
455 static bool GetDefaultMinSizeRel() { return false; }
456 static double GetDefaultMaxSize(double diagonal);
457 static double GetDefaultMaxSize() { return undefinedDouble(); }
458 static bool GetDefaultMaxSizeRel() { return false; }
459 static bool GetDefaultUseGradation() { return true; }
460 static double GetDefaultGradation() { return 1.3; }
461 static bool GetDefaultUseVolumeGradation() { return false; }
462 static double GetDefaultVolumeGradation() { return 2; }
463 static ElementType GetDefaultElementType() { return Triangles; }
464 static double GetDefaultAngleMesh() { return 8.0; }
465 static bool GetDefaultUseSurfaceProximity() { return false; }
466 static int GetDefaultNbSurfaceProximityLayers() { return 1; }
467 static double GetDefaultSurfaceProximityRatio() { return 1.; }
468 static bool GetDefaultUseVolumeProximity() { return false; }
469 static int GetDefaultNbVolumeProximityLayers() { return 1; }
470 static double GetDefaultVolumeProximityRatio() { return 1.; }
472 static double GetDefaultChordalError(double diagonal);
473 static double GetDefaultChordalError() { return undefinedDouble(); }
474 static bool GetDefaultAnisotropic() { return false; }
475 static double GetDefaultAnisotropicRatio() { return 0.0; }
476 static bool GetDefaultRemoveTinyEdges() { return false; }
477 static double GetDefaultTinyEdgeLength(double diagonal);
478 static double GetDefaultTinyEdgeLength() { return undefinedDouble(); }
479 static bool GetDefaultOptimiseTinyEdges() { return false; }
480 static double GetDefaultTinyEdgeOptimisationLength(double diagonal);
481 static double GetDefaultTinyEdgeOptimisationLength() { return undefinedDouble(); }
482 static bool GetDefaultCorrectSurfaceIntersection() { return true; }
483 static double GetDefaultCorrectSurfaceIntersectionMaxCost() { return 15.; }
484 static bool GetDefaultBadElementRemoval() { return false; }
485 static double GetDefaultBadElementAspectRatio() {return 1000.0; }
486 static bool GetDefaultOptimizeMesh() { return true; }
487 static bool GetDefaultQuadraticMesh() { return false; }
489 static int GetDefaultVerbosity() { return 3; }
490 static Topology GetDefaultTopology() { return FromCAD; }
492 static bool GetDefaultPreCADMergeEdges() { return false; }
493 static bool GetDefaultPreCADRemoveDuplicateCADFaces() { return false; }
494 static bool GetDefaultPreCADProcess3DTopology() { return false; }
495 static bool GetDefaultPreCADDiscardInput() { return false; }
497 static TSizeMap GetDefaultSizeMap() { return TSizeMap();}
498 static TAttractorMap GetDefaultAttractorMap() { return TAttractorMap(); }
500 static TFaceEntryEnfVertexListMap GetDefaultFaceEntryEnfVertexListMap() { return TFaceEntryEnfVertexListMap(); }
501 static TEnfVertexList GetDefaultEnfVertexList() { return TEnfVertexList(); }
502 static TFaceEntryCoordsListMap GetDefaultFaceEntryCoordsListMap() { return TFaceEntryCoordsListMap(); }
503 static TCoordsEnfVertexMap GetDefaultCoordsEnfVertexMap() { return TCoordsEnfVertexMap(); }
504 static TFaceEntryEnfVertexEntryListMap GetDefaultFaceEntryEnfVertexEntryListMap() { return TFaceEntryEnfVertexEntryListMap(); }
505 static TEnfVertexEntryEnfVertexMap GetDefaultEnfVertexEntryEnfVertexMap() { return TEnfVertexEntryEnfVertexMap(); }
506 static TGroupNameNodeIDMap GetDefaultGroupNameNodeIDMap() { return TGroupNameNodeIDMap(); }
508 static bool GetDefaultInternalEnforcedVertex() { return false; }
511 static TGroupNameEnfVertexListMap GetDefaultGroupNameEnfVertexListMap() { return TGroupNameEnfVertexListMap(); }
512 static TEnfVertexGroupNameMap GetDefaultEnfVertexGroupNameMap() { return TEnfVertexGroupNameMap(); }
515 // const TPreCadPeriodicityEntriesVector _GetPreCadFacesPeriodicityEntries() const { return _preCadFacesPeriodicityEntriesVector; }
517 static TPreCadPeriodicityVector GetDefaultPreCadFacesPeriodicityVector() { return TPreCadPeriodicityVector(); }
518 const TPreCadPeriodicityVector& _GetPreCadFacesPeriodicityVector() const { return _preCadFacesPeriodicityVector; }
519 static TPreCadPeriodicityVector GetPreCadFacesPeriodicityVector(const BLSURFPlugin_Hypothesis* hyp);
521 static TPreCadPeriodicityVector GetDefaultPreCadEdgesPeriodicityVector() { return TPreCadPeriodicityVector(); }
522 const TPreCadPeriodicityVector& _GetPreCadEdgesPeriodicityVector() const { return _preCadEdgesPeriodicityVector; }
523 static TPreCadPeriodicityVector GetPreCadEdgesPeriodicityVector(const BLSURFPlugin_Hypothesis* hyp);
525 static TFacesPeriodicityVector GetDefaultFacesPeriodicityVector() { return TFacesPeriodicityVector(); }
526 const TFacesPeriodicityVector& _GetFacesPeriodicityVector() const { return _facesPeriodicityVector; }
527 static TFacesPeriodicityVector GetFacesPeriodicityVector(const BLSURFPlugin_Hypothesis* hyp);
529 static TEdgesPeriodicityVector GetDefaultEdgesPeriodicityVector() { return TEdgesPeriodicityVector(); }
530 const TEdgesPeriodicityVector& _GetEdgesPeriodicityVector() const { return _edgesPeriodicityVector; }
531 static TEdgesPeriodicityVector GetEdgesPeriodicityVector(const BLSURFPlugin_Hypothesis* hyp);
533 static TVerticesPeriodicityVector GetDefaultVerticesPeriodicityVector() { return TVerticesPeriodicityVector(); }
534 const TVerticesPeriodicityVector& _GetVerticesPeriodicityVector() const { return _verticesPeriodicityVector; }
535 static TVerticesPeriodicityVector GetVerticesPeriodicityVector(const BLSURFPlugin_Hypothesis* hyp);
537 void ClearPreCadPeriodicityVectors();
539 void AddPreCadFacesPeriodicity(TEntry theFace1Entry, TEntry theFace2Entry,
540 std::vector<std::string> &theSourceVerticesEntries, std::vector<std::string> &theTargetVerticesEntries);
541 void AddPreCadEdgesPeriodicity(TEntry theEdge1Entry, TEntry theEdge2Entry,
542 std::vector<std::string> &theSourceVerticesEntries, std::vector<std::string> &theTargetVerticesEntries);
544 static double undefinedDouble() { return -1.0; }
546 typedef std::map< std::string, std::string > TOptionValues;
547 typedef std::set< std::string > TOptionNames;
549 void SetOptionValue(const std::string& optionName,
550 const std::string& optionValue);
551 void SetPreCADOptionValue(const std::string& optionName,
552 const std::string& optionValue);
553 std::string GetOptionValue(const std::string& optionName, bool* isDefault=0) const;
554 std::string GetPreCADOptionValue(const std::string& optionName, bool* isDefault=0) const;
555 void ClearOption(const std::string& optionName);
556 void ClearPreCADOption(const std::string& optionName);
557 TOptionValues GetOptionValues() const;
558 TOptionValues GetPreCADOptionValues() const;
559 const TOptionValues& GetCustomOptionValues() const { return _customOption2value; }
561 void AddOption(const std::string& optionName, const std::string& optionValue);
562 void AddPreCADOption(const std::string& optionName, const std::string& optionValue);
563 std::string GetOption(const std::string& optionName) const;
564 std::string GetPreCADOption(const std::string& optionName) const;
566 static bool ToBool(const std::string& str, bool* isOk=0);
567 static double ToDbl(const std::string& str, bool* isOk=0);
568 static int ToInt(const std::string& str, bool* isOk=0);
571 * Sets the file for export resulting mesh in GMF format
573 // void SetGMFFile(const std::string& theFileName, bool isBinary);
574 void SetGMFFile(const std::string& theFileName);
575 std::string GetGMFFile() const { return _GMFFileName; }
576 static std::string GetDefaultGMFFile() { return "";}
577 // bool GetGMFFileMode() const { return _GMFFileMode; }
580 virtual std::ostream & SaveTo(std::ostream & save);
581 virtual std::istream & LoadFrom(std::istream & load);
582 friend std::ostream & operator <<(std::ostream & save, BLSURFPlugin_Hypothesis & hyp);
583 friend std::istream & operator >>(std::istream & load, BLSURFPlugin_Hypothesis & hyp);
586 * \brief Does nothing
587 * \param theMesh - the built mesh
588 * \param theShape - the geometry of interest
589 * \retval bool - always false
591 virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
594 * \brief Initialize my parameter values by default parameters.
595 * \retval bool - true if parameter values have been successfully defined
597 virtual bool SetParametersByDefaults(const TDefaults& dflts, const SMESH_Mesh* theMesh=0);
601 PhysicalMesh _physicalMesh;
602 GeometricMesh _geometricMesh;
605 double _minSize, _maxSize;
606 bool _minSizeRel, _maxSizeRel;
609 bool _useVolumeGradation;
610 double _volumeGradation;
611 ElementType _elementType;
613 double _chordalError;
615 double _anisotropicRatio;
616 bool _removeTinyEdges;
617 double _tinyEdgeLength;
618 bool _optimiseTinyEdges;
619 double _tinyEdgeOptimisationLength;
620 bool _correctSurfaceIntersec;
621 double _corrSurfaceIntersCost;
622 bool _badElementRemoval;
623 double _badElementAspectRatio;
628 bool _useSurfaceProximity;
629 int _nbSurfaceProximityLayers;
630 double _surfaceProximityRatio;
631 bool _useVolumeProximity;
632 int _nbVolumeProximityLayers;
633 double _volumeProximityRatio;
635 bool _preCADMergeEdges;
636 bool _preCADRemoveDuplicateCADFaces;
637 bool _preCADProcess3DTopology;
638 bool _preCADDiscardInput;
639 double _preCADEpsNano;
641 TOptionValues _option2value, _preCADoption2value, _customOption2value; // user defined values
642 TOptionValues _defaultOptionValues; // default values
643 TOptionNames _doubleOptions, _charOptions, _boolOptions; // to find a type of option
644 TOptionNames _preCADdoubleOptions, _preCADcharOptions;
647 TSizeMap _attractors;
648 TAttractorMap _classAttractors;
650 TFaceEntryEnfVertexListMap _faceEntryEnfVertexListMap;
651 TEnfVertexList _enfVertexList;
652 // maps to get "manual" enf vertex (through their coordinates)
653 TFaceEntryCoordsListMap _faceEntryCoordsListMap;
654 TCoordsEnfVertexMap _coordsEnfVertexMap;
655 // maps to get "geom" enf vertex (through their geom entries)
656 TFaceEntryEnfVertexEntryListMap _faceEntryEnfVertexEntryListMap;
657 TEnfVertexEntryEnfVertexMap _enfVertexEntryEnfVertexMap;
658 TGroupNameNodeIDMap _groupNameNodeIDMap;
660 // Enable internal enforced vertices on specific face if requested by user
661 // TFaceEntryInternalVerticesList _faceEntryInternalVerticesList;
662 bool _enforcedInternalVerticesAllFaces;
663 TEnfGroupName _enforcedInternalVerticesAllFacesGroup;
665 TPreCadPeriodicityVector _preCadFacesPeriodicityVector;
666 TPreCadPeriodicityVector _preCadEdgesPeriodicityVector;
668 TFacesPeriodicityVector _facesPeriodicityVector;
669 TEdgesPeriodicityVector _edgesPeriodicityVector;
670 TVerticesPeriodicityVector _verticesPeriodicityVector;
672 THyperPatchList _hyperPatchList;
673 THyperPatchEntriesList _hyperPatchEntriesList;
675 // Called by SaveTo to store content of _preCadFacesPeriodicityVector and _preCadEdgesPeriodicityVector
676 void SavePreCADPeriodicity(std::ostream & save, const char* shapeType);
678 // Called by LoadFrom to fill _preCadFacesPeriodicityVector and _preCadEdgesPeriodicityVector
679 void LoadPreCADPeriodicity(std::istream & load, const char* shapeType);
681 // Called by LoadFrom to fill _facesPeriodicityVector
682 void LoadFacesPeriodicity(std::istream & load);
684 // Called by LoadFrom to fill _edgesPeriodicityVector
685 void LoadEdgesPeriodicity(std::istream & load);
687 // Called by LoadFrom to fill _verticesPeriodicityVector
688 void LoadVerticesPeriodicity(std::istream & load);
690 // Called by SaveTo to store content of _facesPeriodicityVector
691 void SaveFacesPeriodicity(std::ostream & save);
693 // Called by SaveTo to store content of _edgesPeriodicityVector
694 void SaveEdgesPeriodicity(std::ostream & save);
696 // Called by SaveTo to store content of _verticesPeriodicityVector
697 void SaveVerticesPeriodicity(std::ostream & save);
699 std::string _GMFFileName;
700 // bool _GMFFileMode;
702 // TSizeMap _customSizeMap;