1 // Copyright (C) 2007-2019 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 "BLSURFPlugin_Attractor.hxx"
41 // Parameters for work of MG-CADSurf
43 class BLSURFPlugin_Hypothesis: public SMESH_Hypothesis
46 BLSURFPlugin_Hypothesis(int hypId, SMESH_Gen * gen, bool hasgeom);
63 GeometricalGlobalSize,
73 static const char* GetHypType(bool hasgeom)
74 { return hasgeom ? "MG-CADSurf Parameters" : "MG-CADSurf Parameters_NOGEOM"; }
76 TopoDS_Shape entryToShape(std::string entry);
78 void SetPhysicalMesh(PhysicalMesh thePhysicalMesh);
79 PhysicalMesh GetPhysicalMesh() const { return _physicalMesh; }
81 void SetGeometricMesh(GeometricMesh theGeometricMesh);
82 GeometricMesh GetGeometricMesh() const { return _geometricMesh; }
84 void SetPhySize(double thePhySize, bool isRelative = false);
85 double GetPhySize() const { return _phySize; }
86 bool IsPhySizeRel() const { return _phySizeRel; }
88 void SetMinSize(double theMinSize, bool isRelative = false);
89 double GetMinSize() const { return _minSize; }
90 bool IsMinSizeRel() const { return _minSizeRel; }
92 void SetMaxSize(double theMaxSize, bool isRelative = false);
93 double GetMaxSize() const { return _maxSize; }
94 bool IsMaxSizeRel() const { return _maxSizeRel; }
96 void SetUseGradation(bool toUse);
97 bool GetUseGradation() const { return _useGradation; }
98 void SetGradation(double theGradation);
99 double GetGradation() const { return _gradation; }
101 void SetUseVolumeGradation(bool toUse);
102 bool GetUseVolumeGradation() const { return _useVolumeGradation; }
103 void SetVolumeGradation(double theGradation);
104 double GetVolumeGradation() const { return _volumeGradation; }
106 void SetElementType(ElementType theElementType);
107 ElementType GetElementType() const { return _elementType; }
109 void SetAngleMesh(double theAngle);
110 double GetAngleMesh() const { return _angleMesh; }
112 void SetChordalError(double theDistance);
113 double GetChordalError() const { return _chordalError; }
115 void SetAnisotropic(bool theVal);
116 bool GetAnisotropic() const { return _anisotropic; }
118 void SetAnisotropicRatio(double theVal);
119 double GetAnisotropicRatio() const { return _anisotropicRatio; }
121 void SetRemoveTinyEdges(bool theVal);
122 bool GetRemoveTinyEdges() const { return _removeTinyEdges; }
124 void SetTinyEdgeLength(double theVal);
125 double GetTinyEdgeLength() const { return _tinyEdgeLength; }
127 void SetOptimiseTinyEdges(bool theVal);
128 bool GetOptimiseTinyEdges() const { return _optimiseTinyEdges; }
130 void SetTinyEdgeOptimisationLength(double theVal);
131 double GetTinyEdgeOptimisationLength() const { return _tinyEdgeOptimisationLength; }
133 void SetCorrectSurfaceIntersection(bool theVal);
134 bool GetCorrectSurfaceIntersection() const { return _correctSurfaceIntersec; }
136 void SetCorrectSurfaceIntersectionMaxCost(double theVal);
137 double GetCorrectSurfaceIntersectionMaxCost() const { return _corrSurfaceIntersCost; }
139 void SetBadElementRemoval(bool theVal);
140 bool GetBadElementRemoval() const { return _badElementRemoval; }
142 void SetBadElementAspectRatio(double theVal);
143 double GetBadElementAspectRatio() const { return _badElementAspectRatio; }
145 void SetOptimizeMesh(bool theVal);
146 bool GetOptimizeMesh() const { return _optimizeMesh; }
148 void SetQuadraticMesh(bool theVal);
149 bool GetQuadraticMesh() const { return _quadraticMesh; }
151 void SetTopology(Topology theTopology);
152 Topology GetTopology() const { return _topology; }
154 bool GetUseSurfaceProximity() const { return _useSurfaceProximity; }
155 void SetUseSurfaceProximity( bool toUse );
157 int GetNbSurfaceProximityLayers() const { return _nbSurfaceProximityLayers; }
158 void SetNbSurfaceProximityLayers( int nbLayers );
160 double GetSurfaceProximityRatio() const { return _surfaceProximityRatio; }
161 void SetSurfaceProximityRatio( double ratio );
163 bool GetUseVolumeProximity() const { return _useVolumeProximity; }
164 void SetUseVolumeProximity( bool toUse );
166 int GetNbVolumeProximityLayers() const { return _nbVolumeProximityLayers; }
167 void SetNbVolumeProximityLayers( int nbLayers );
169 double GetVolumeProximityRatio() const { return _volumeProximityRatio; }
170 void SetVolumeProximityRatio( double ratio );
172 void SetVerbosity(int theVal);
173 int GetVerbosity() const { return _verb; }
175 void ClearEntry(const std::string& entry, const char * attEntry = 0);
176 void ClearSizeMaps();
178 void SetEnforceCadEdgesSize( bool toEnforce );
179 bool GetEnforceCadEdgesSize();
181 void SetJacobianRectificationRespectGeometry( bool allowRectification );
182 bool GetJacobianRectificationRespectGeometry();
184 void SetUseDeprecatedPatchMesher( bool useDeprecatedPatchMesher );
185 bool GetUseDeprecatedPatchMesher();
187 void SetJacobianRectification( bool allowRectification );
188 bool GetJacobianRectification();
190 void SetMaxNumberOfPointsPerPatch( int nb ) throw (std::invalid_argument);
191 int GetMaxNumberOfPointsPerPatch();
193 void SetMaxNumberOfThreads( int nb ) throw (std::invalid_argument);
194 int GetMaxNumberOfThreads();
196 void SetRespectGeometry( bool toRespect );
197 bool GetRespectGeometry();
199 void SetTinyEdgesAvoidSurfaceIntersections( bool toAvoidIntersection );
200 bool GetTinyEdgesAvoidSurfaceIntersections();
202 void SetClosedGeometry( bool isClosed );
203 bool GetClosedGeometry();
205 void SetDebug( bool isDebug );
208 void SetPeriodicTolerance( double tol ) throw (std::invalid_argument);
209 double GetPeriodicTolerance();
211 void SetRequiredEntities( const std::string& howToTreat ) throw (std::invalid_argument);
212 std::string GetRequiredEntities();
214 void SetSewingTolerance( double tol ) throw (std::invalid_argument);
215 double GetSewingTolerance();
217 void SetTags( const std::string& howToTreat ) throw (std::invalid_argument);
218 std::string GetTags();
221 typedef std::set< int > THyperPatchTags;
222 typedef std::vector< THyperPatchTags > THyperPatchList;
224 void SetHyperPatches(const THyperPatchList& hpl);
225 const THyperPatchList& GetHyperPatches() const { return _hyperPatchList; }
226 static int GetHyperPatchTag( int faceTag, const BLSURFPlugin_Hypothesis* hyp, int* iPatch=0 );
228 void SetPreCADMergeEdges(bool theVal);
229 bool GetPreCADMergeEdges() const { return _preCADMergeEdges; }
231 void SetPreCADRemoveDuplicateCADFaces(bool theVal);
232 bool GetPreCADRemoveDuplicateCADFaces() const { return _preCADRemoveDuplicateCADFaces; }
234 void SetPreCADProcess3DTopology(bool theVal);
235 bool GetPreCADProcess3DTopology() const { return _preCADProcess3DTopology; }
237 void SetPreCADDiscardInput(bool theVal);
238 bool GetPreCADDiscardInput() const { return _preCADDiscardInput; }
240 static bool HasPreCADOptions(const BLSURFPlugin_Hypothesis* hyp);
242 typedef std::map<std::string,std::string> TSizeMap;
244 void SetSizeMapEntry(const std::string& entry,const std::string& sizeMap );
245 std::string GetSizeMapEntry(const std::string& entry);
246 const TSizeMap& _GetSizeMapEntries() const { return _sizeMap; }
248 * \brief Return the size maps
250 static TSizeMap GetSizeMapEntries(const BLSURFPlugin_Hypothesis* hyp);
253 void SetAttractorEntry(const std::string& entry,const std::string& attractor );
254 std::string GetAttractorEntry(const std::string& entry);
255 const TSizeMap& _GetAttractorEntries() const { return _attractors; };
257 * \brief Return the attractors
259 static TSizeMap GetAttractorEntries(const BLSURFPlugin_Hypothesis* hyp);
263 void SetCustomSizeMapEntry(const std::string& entry,const std::string& sizeMap );
264 std::string GetCustomSizeMapEntry(const std::string& entry);
265 void UnsetCustomSizeMap(const std::string& entry);
266 const TSizeMap& GetCustomSizeMapEntries() const { return _customSizeMap; }
269 typedef std::multimap< std::string, BLSURFPlugin_Attractor* > TAttractorMap;
270 typedef std::map< std::string, std::vector<double> > TParamsMap; //TODO ?? finir
272 void SetClassAttractorEntry(const std::string& entry, const std::string& att_entry, double StartSize, double EndSize, double ActionRadius, double ConstantRadius);
273 std::string GetClassAttractorEntry(const std::string& entry);
274 const TAttractorMap& _GetClassAttractorEntries() const { return _classAttractors; }
276 * \brief Return the attractors entries
278 static TAttractorMap GetClassAttractorEntries(const BLSURFPlugin_Hypothesis* hyp);
281 * To set/get/unset an enforced vertex
284 typedef std::string TEnfName;
286 typedef std::string TEntry;
288 typedef std::set<TEntry> TEntryList;
290 typedef std::string TEnfGroupName;
292 typedef std::vector<double> TEnfVertexCoords;
293 typedef std::set< TEnfVertexCoords > TEnfVertexCoordsList;
299 TEnfVertexCoords coords;
300 TEnfGroupName grpName;
301 TEntryList faceEntries;
302 TopoDS_Vertex vertex;
305 struct CompareEnfVertices
307 bool operator () (const TEnfVertex* e1, const TEnfVertex* e2) const {
309 if (e1->coords.size() && e2->coords.size())
310 return (e1->coords < e2->coords);
312 return (e1->geomEntry < e2->geomEntry);
318 // PreCad Face and Edge periodicity
319 struct TPreCadPeriodicity {
322 std::vector<std::string> theSourceVerticesEntries;
323 std::vector<std::string> theTargetVerticesEntries;
327 struct TEdgePeriodicity {
328 TEntry theFace1Entry;
329 TEntry theEdge1Entry;
330 TEntry theFace2Entry;
331 TEntry theEdge2Entry;
332 int edge_orientation;
335 // Vertex periodicity
336 struct TVertexPeriodicity {
337 TEntry theEdge1Entry;
338 TEntry theVertex1Entry;
339 TEntry theEdge2Entry;
340 TEntry theVertex2Entry;
343 typedef std::pair< TEntry, TEntry > TFacesPeriodicity;
345 // List of enforced vertices
346 typedef std::set< TEnfVertex*, CompareEnfVertices > TEnfVertexList;
348 // Map Face Entry / List of enforced vertices
349 typedef std::map< TEntry, TEnfVertexList > TFaceEntryEnfVertexListMap;
351 // List of Face Entry with internal enforced vertices activated
352 typedef std::set< TEntry > TFaceEntryInternalVerticesList;
354 // Map Face Entry / List of coords
355 typedef std::map< TEntry, TEnfVertexCoordsList > TFaceEntryCoordsListMap;
357 // Map Face Entry / List of Vertex entry
358 typedef std::map< TEntry, TEntryList > TFaceEntryEnfVertexEntryListMap;
360 // Map Coords / Enforced vertex
361 typedef std::map< TEnfVertexCoords, TEnfVertex* > TCoordsEnfVertexMap;
363 // Map Vertex entry / Enforced vertex
364 typedef std::map< TEntry, TEnfVertex* > TEnfVertexEntryEnfVertexMap;
366 typedef std::map< TEnfGroupName, std::set<int> > TGroupNameNodeIDMap;
368 // Map Group Name / List of enforced vertices
369 typedef std::map< TEnfGroupName , TEnfVertexList > TGroupNameEnfVertexListMap;
372 // Vector of pairs of entries
373 typedef std::vector< TPreCadPeriodicity > TPreCadPeriodicityVector;
374 typedef std::vector< TFacesPeriodicity > TFacesPeriodicityVector;
375 typedef std::vector< TEdgePeriodicity > TEdgesPeriodicityVector;
376 typedef std::vector< TVertexPeriodicity > TVerticesPeriodicityVector;
379 bool SetEnforcedVertex(TEntry theFaceEntry, TEnfName theVertexName, TEntry theVertexEntry, TEnfGroupName theGroupName,
380 double x = 0.0, double y = 0.0, double z = 0.0);
381 TEnfVertexList GetEnfVertexList(const TEntry& theFaceEntry) throw (std::invalid_argument);
382 TEnfVertexCoordsList GetEnfVertexCoordsList(const TEntry& theFaceEntry) throw (std::invalid_argument);
383 TEntryList GetEnfVertexEntryList (const TEntry& theFaceEntry) throw (std::invalid_argument);
384 TEnfVertex* GetEnfVertex(TEnfVertexCoords coords) throw (std::invalid_argument);
385 TEnfVertex* GetEnfVertex(const TEntry& theEnfVertexEntry) throw (std::invalid_argument);
386 void AddEnfVertexNodeID(TEnfGroupName theGroupName,int theNodeID);
387 std::set<int> GetEnfVertexNodeIDs(TEnfGroupName theGroupName) throw (std::invalid_argument);
388 void RemoveEnfVertexNodeID(TEnfGroupName theGroupName,int theNodeID) throw (std::invalid_argument);
390 bool ClearEnforcedVertex(const TEntry& theFaceEntry, double x = 0.0, double y = 0.0, double z = 0.0, const TEntry& theVertexEntry="") throw (std::invalid_argument);
391 bool ClearEnforcedVertices(const TEntry& theFaceEntry) throw (std::invalid_argument);
393 void ClearAllEnforcedVertices();
394 void AddEnforcedVertex( const TEntry& theFaceEntry, TEnfVertex * theEnfVertex );
396 const TFaceEntryEnfVertexListMap& _GetAllEnforcedVerticesByFace() const { return _faceEntryEnfVertexListMap; }
397 const TEnfVertexList& _GetAllEnforcedVertices() const { return _enfVertexList; }
399 const TFaceEntryCoordsListMap& _GetAllCoordsByFace() const { return _faceEntryCoordsListMap; }
400 const TCoordsEnfVertexMap& _GetAllEnforcedVerticesByCoords() const { return _coordsEnfVertexMap; }
402 const TFaceEntryEnfVertexEntryListMap& _GetAllEnfVertexEntriesByFace() const { return _faceEntryEnfVertexEntryListMap; }
403 const TEnfVertexEntryEnfVertexMap& _GetAllEnforcedVerticesByEnfVertexEntry() const { return _enfVertexEntryEnfVertexMap; }
406 // const TEnfVertexGroupNameMap _GetEnforcedVertexGroupNameMap() const { return _enfVertexGroupNameMap; }
410 * \brief Return the enforced vertices
412 static TFaceEntryEnfVertexListMap GetAllEnforcedVerticesByFace(const BLSURFPlugin_Hypothesis* hyp);
413 static TEnfVertexList GetAllEnforcedVertices(const BLSURFPlugin_Hypothesis* hyp);
415 static TFaceEntryCoordsListMap GetAllCoordsByFace(const BLSURFPlugin_Hypothesis* hyp);
416 static TCoordsEnfVertexMap GetAllEnforcedVerticesByCoords(const BLSURFPlugin_Hypothesis* hyp);
418 static TFaceEntryEnfVertexEntryListMap GetAllEnfVertexEntriesByFace(const BLSURFPlugin_Hypothesis* hyp);
419 static TEnfVertexEntryEnfVertexMap GetAllEnforcedVerticesByEnfVertexEntry(const BLSURFPlugin_Hypothesis* hyp);
422 * \brief Internal enforced vertices
424 void SetInternalEnforcedVertexAllFaces(bool toEnforceInternalVertices);
425 const bool _GetInternalEnforcedVertexAllFaces() const { return _enforcedInternalVerticesAllFaces; }
426 static bool GetInternalEnforcedVertexAllFaces( const BLSURFPlugin_Hypothesis* hyp );
427 void SetInternalEnforcedVertexAllFacesGroup(TEnfGroupName theGroupName);
428 const TEnfGroupName _GetInternalEnforcedVertexAllFacesGroup() const { return _enforcedInternalVerticesAllFacesGroup; }
429 static TEnfGroupName GetInternalEnforcedVertexAllFacesGroup( const BLSURFPlugin_Hypothesis* hyp );
431 // Enable internal enforced vertices on specific face if requested by user
432 // static TFaceEntryInternalVerticesList GetDefaultFaceEntryInternalVerticesMap() { return TFaceEntryInternalVerticesList(); }
433 // const TFaceEntryInternalVerticesList _GetAllInternalEnforcedVerticesByFace() const { return _faceEntryInternalVerticesList; }
434 // static TFaceEntryInternalVerticesList GetAllInternalEnforcedVerticesByFace(const BLSURFPlugin_Hypothesis* hyp);
435 // void SetInternalEnforcedVertex(TEntry theFaceEntry, bool toEnforceInternalVertices, TEnfGroupName theGroupName);
436 // bool GetInternalEnforcedVertex(const TEntry& theFaceEntry);
438 static PhysicalMesh GetDefaultPhysicalMesh() { return PhysicalGlobalSize; }
439 static GeometricMesh GetDefaultGeometricMesh() { return GeometricalGlobalSize; }
440 static double GetDefaultPhySize(double diagonal, double bbSegmentation);
441 static double GetDefaultPhySize() { return undefinedDouble(); }
442 static bool GetDefaultPhySizeRel() { return false; }
443 static double GetDefaultMinSize(double diagonal);
444 static double GetDefaultMinSize() { return undefinedDouble(); }
445 static bool GetDefaultMinSizeRel() { return false; }
446 static double GetDefaultMaxSize(double diagonal);
447 static double GetDefaultMaxSize() { return undefinedDouble(); }
448 static bool GetDefaultMaxSizeRel() { return false; }
449 static bool GetDefaultUseGradation() { return true; }
450 static double GetDefaultGradation() { return 1.3; }
451 static bool GetDefaultUseVolumeGradation() { return false; }
452 static double GetDefaultVolumeGradation() { return 2; }
453 static ElementType GetDefaultElementType() { return Triangles; }
454 static double GetDefaultAngleMesh() { return 8.0; }
455 static bool GetDefaultUseSurfaceProximity() { return false; }
456 static int GetDefaultNbSurfaceProximityLayers() { return 1; }
457 static double GetDefaultSurfaceProximityRatio() { return 1.; }
458 static bool GetDefaultUseVolumeProximity() { return false; }
459 static int GetDefaultNbVolumeProximityLayers() { return 1; }
460 static double GetDefaultVolumeProximityRatio() { return 1.; }
462 static double GetDefaultChordalError(double diagonal);
463 static double GetDefaultChordalError() { return undefinedDouble(); }
464 static bool GetDefaultAnisotropic() { return false; }
465 static double GetDefaultAnisotropicRatio() { return 0.0; }
466 static bool GetDefaultRemoveTinyEdges() { return false; }
467 static double GetDefaultTinyEdgeLength(double diagonal);
468 static double GetDefaultTinyEdgeLength() { return undefinedDouble(); }
469 static bool GetDefaultOptimiseTinyEdges() { return false; }
470 static double GetDefaultTinyEdgeOptimisationLength(double diagonal);
471 static double GetDefaultTinyEdgeOptimisationLength() { return undefinedDouble(); }
472 static bool GetDefaultCorrectSurfaceIntersection() { return true; }
473 static double GetDefaultCorrectSurfaceIntersectionMaxCost() { return 15.; }
474 static bool GetDefaultBadElementRemoval() { return false; }
475 static double GetDefaultBadElementAspectRatio() {return 1000.0; }
476 static bool GetDefaultOptimizeMesh() { return true; }
477 static bool GetDefaultQuadraticMesh() { return false; }
479 static int GetDefaultVerbosity() { return 3; }
480 static Topology GetDefaultTopology() { return FromCAD; }
482 static bool GetDefaultPreCADMergeEdges() { return false; }
483 static bool GetDefaultPreCADRemoveDuplicateCADFaces() { return false; }
484 static bool GetDefaultPreCADProcess3DTopology() { return false; }
485 static bool GetDefaultPreCADDiscardInput() { return false; }
487 static TSizeMap GetDefaultSizeMap() { return TSizeMap();}
488 static TAttractorMap GetDefaultAttractorMap() { return TAttractorMap(); }
490 static TFaceEntryEnfVertexListMap GetDefaultFaceEntryEnfVertexListMap() { return TFaceEntryEnfVertexListMap(); }
491 static TEnfVertexList GetDefaultEnfVertexList() { return TEnfVertexList(); }
492 static TFaceEntryCoordsListMap GetDefaultFaceEntryCoordsListMap() { return TFaceEntryCoordsListMap(); }
493 static TCoordsEnfVertexMap GetDefaultCoordsEnfVertexMap() { return TCoordsEnfVertexMap(); }
494 static TFaceEntryEnfVertexEntryListMap GetDefaultFaceEntryEnfVertexEntryListMap() { return TFaceEntryEnfVertexEntryListMap(); }
495 static TEnfVertexEntryEnfVertexMap GetDefaultEnfVertexEntryEnfVertexMap() { return TEnfVertexEntryEnfVertexMap(); }
496 static TGroupNameNodeIDMap GetDefaultGroupNameNodeIDMap() { return TGroupNameNodeIDMap(); }
498 static bool GetDefaultInternalEnforcedVertex() { return false; }
501 static TGroupNameEnfVertexListMap GetDefaultGroupNameEnfVertexListMap() { return TGroupNameEnfVertexListMap(); }
502 static TEnfVertexGroupNameMap GetDefaultEnfVertexGroupNameMap() { return TEnfVertexGroupNameMap(); }
505 // const TPreCadPeriodicityEntriesVector _GetPreCadFacesPeriodicityEntries() const { return _preCadFacesPeriodicityEntriesVector; }
507 static TPreCadPeriodicityVector GetDefaultPreCadFacesPeriodicityVector() { return TPreCadPeriodicityVector(); }
508 const TPreCadPeriodicityVector& _GetPreCadFacesPeriodicityVector() const { return _preCadFacesPeriodicityVector; }
509 static TPreCadPeriodicityVector GetPreCadFacesPeriodicityVector(const BLSURFPlugin_Hypothesis* hyp);
511 static TPreCadPeriodicityVector GetDefaultPreCadEdgesPeriodicityVector() { return TPreCadPeriodicityVector(); }
512 const TPreCadPeriodicityVector& _GetPreCadEdgesPeriodicityVector() const { return _preCadEdgesPeriodicityVector; }
513 static TPreCadPeriodicityVector GetPreCadEdgesPeriodicityVector(const BLSURFPlugin_Hypothesis* hyp);
515 static TFacesPeriodicityVector GetDefaultFacesPeriodicityVector() { return TFacesPeriodicityVector(); }
516 const TFacesPeriodicityVector& _GetFacesPeriodicityVector() const { return _facesPeriodicityVector; }
517 static TFacesPeriodicityVector GetFacesPeriodicityVector(const BLSURFPlugin_Hypothesis* hyp);
519 static TEdgesPeriodicityVector GetDefaultEdgesPeriodicityVector() { return TEdgesPeriodicityVector(); }
520 const TEdgesPeriodicityVector& _GetEdgesPeriodicityVector() const { return _edgesPeriodicityVector; }
521 static TEdgesPeriodicityVector GetEdgesPeriodicityVector(const BLSURFPlugin_Hypothesis* hyp);
523 static TVerticesPeriodicityVector GetDefaultVerticesPeriodicityVector() { return TVerticesPeriodicityVector(); }
524 const TVerticesPeriodicityVector& _GetVerticesPeriodicityVector() const { return _verticesPeriodicityVector; }
525 static TVerticesPeriodicityVector GetVerticesPeriodicityVector(const BLSURFPlugin_Hypothesis* hyp);
527 void ClearPreCadPeriodicityVectors();
529 void AddPreCadFacesPeriodicity(TEntry theFace1Entry, TEntry theFace2Entry,
530 std::vector<std::string> &theSourceVerticesEntries, std::vector<std::string> &theTargetVerticesEntries);
531 void AddPreCadEdgesPeriodicity(TEntry theEdge1Entry, TEntry theEdge2Entry,
532 std::vector<std::string> &theSourceVerticesEntries, std::vector<std::string> &theTargetVerticesEntries);
534 static double undefinedDouble() { return -1.0; }
536 typedef std::map< std::string, std::string > TOptionValues;
537 typedef std::set< std::string > TOptionNames;
539 void SetOptionValue(const std::string& optionName,
540 const std::string& optionValue) throw (std::invalid_argument);
541 void SetPreCADOptionValue(const std::string& optionName,
542 const std::string& optionValue) throw (std::invalid_argument);
543 std::string GetOptionValue(const std::string& optionName, bool* isDefault=0) const throw (std::invalid_argument);
544 std::string GetPreCADOptionValue(const std::string& optionName, bool* isDefault=0) const throw (std::invalid_argument);
545 void ClearOption(const std::string& optionName);
546 void ClearPreCADOption(const std::string& optionName);
547 TOptionValues GetOptionValues() const;
548 TOptionValues GetPreCADOptionValues() const;
549 const TOptionValues& GetCustomOptionValues() const { return _customOption2value; }
551 void AddOption(const std::string& optionName, const std::string& optionValue);
552 void AddPreCADOption(const std::string& optionName, const std::string& optionValue);
553 std::string GetOption(const std::string& optionName) const;
554 std::string GetPreCADOption(const std::string& optionName) const;
556 static bool ToBool(const std::string& str, bool* isOk=0) throw (std::invalid_argument);
557 static double ToDbl(const std::string& str, bool* isOk=0) throw (std::invalid_argument);
558 static int ToInt(const std::string& str, bool* isOk=0) throw (std::invalid_argument);
561 * Sets the file for export resulting mesh in GMF format
563 // void SetGMFFile(const std::string& theFileName, bool isBinary);
564 void SetGMFFile(const std::string& theFileName);
565 std::string GetGMFFile() const { return _GMFFileName; }
566 static std::string GetDefaultGMFFile() { return "";}
567 // bool GetGMFFileMode() const { return _GMFFileMode; }
570 virtual std::ostream & SaveTo(std::ostream & save);
571 virtual std::istream & LoadFrom(std::istream & load);
572 friend std::ostream & operator <<(std::ostream & save, BLSURFPlugin_Hypothesis & hyp);
573 friend std::istream & operator >>(std::istream & load, BLSURFPlugin_Hypothesis & hyp);
576 * \brief Does nothing
577 * \param theMesh - the built mesh
578 * \param theShape - the geometry of interest
579 * \retval bool - always false
581 virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
584 * \brief Initialize my parameter values by default parameters.
585 * \retval bool - true if parameter values have been successfully defined
587 virtual bool SetParametersByDefaults(const TDefaults& dflts, const SMESH_Mesh* theMesh=0);
591 PhysicalMesh _physicalMesh;
592 GeometricMesh _geometricMesh;
595 double _minSize, _maxSize;
596 bool _minSizeRel, _maxSizeRel;
599 bool _useVolumeGradation;
600 double _volumeGradation;
601 ElementType _elementType;
603 double _chordalError;
605 double _anisotropicRatio;
606 bool _removeTinyEdges;
607 double _tinyEdgeLength;
608 bool _optimiseTinyEdges;
609 double _tinyEdgeOptimisationLength;
610 bool _correctSurfaceIntersec;
611 double _corrSurfaceIntersCost;
612 bool _badElementRemoval;
613 double _badElementAspectRatio;
618 bool _useSurfaceProximity;
619 int _nbSurfaceProximityLayers;
620 double _surfaceProximityRatio;
621 bool _useVolumeProximity;
622 int _nbVolumeProximityLayers;
623 double _volumeProximityRatio;
625 bool _preCADMergeEdges;
626 bool _preCADRemoveDuplicateCADFaces;
627 bool _preCADProcess3DTopology;
628 bool _preCADDiscardInput;
629 double _preCADEpsNano;
631 TOptionValues _option2value, _preCADoption2value, _customOption2value; // user defined values
632 TOptionValues _defaultOptionValues; // default values
633 TOptionNames _doubleOptions, _charOptions, _boolOptions; // to find a type of option
634 TOptionNames _preCADdoubleOptions, _preCADcharOptions;
637 TSizeMap _attractors;
638 TAttractorMap _classAttractors;
640 TFaceEntryEnfVertexListMap _faceEntryEnfVertexListMap;
641 TEnfVertexList _enfVertexList;
642 // maps to get "manual" enf vertex (through their coordinates)
643 TFaceEntryCoordsListMap _faceEntryCoordsListMap;
644 TCoordsEnfVertexMap _coordsEnfVertexMap;
645 // maps to get "geom" enf vertex (through their geom entries)
646 TFaceEntryEnfVertexEntryListMap _faceEntryEnfVertexEntryListMap;
647 TEnfVertexEntryEnfVertexMap _enfVertexEntryEnfVertexMap;
648 TGroupNameNodeIDMap _groupNameNodeIDMap;
650 // Enable internal enforced vertices on specific face if requested by user
651 // TFaceEntryInternalVerticesList _faceEntryInternalVerticesList;
652 bool _enforcedInternalVerticesAllFaces;
653 TEnfGroupName _enforcedInternalVerticesAllFacesGroup;
655 TPreCadPeriodicityVector _preCadFacesPeriodicityVector;
656 TPreCadPeriodicityVector _preCadEdgesPeriodicityVector;
658 TFacesPeriodicityVector _facesPeriodicityVector;
659 TEdgesPeriodicityVector _edgesPeriodicityVector;
660 TVerticesPeriodicityVector _verticesPeriodicityVector;
662 THyperPatchList _hyperPatchList;
664 // Called by SaveTo to store content of _preCadFacesPeriodicityVector and _preCadEdgesPeriodicityVector
665 void SavePreCADPeriodicity(std::ostream & save, const char* shapeType);
667 // Called by LoadFrom to fill _preCadFacesPeriodicityVector and _preCadEdgesPeriodicityVector
668 void LoadPreCADPeriodicity(std::istream & load, const char* shapeType);
670 // Called by LoadFrom to fill _facesPeriodicityVector
671 void LoadFacesPeriodicity(std::istream & load);
673 // Called by LoadFrom to fill _edgesPeriodicityVector
674 void LoadEdgesPeriodicity(std::istream & load);
676 // Called by LoadFrom to fill _verticesPeriodicityVector
677 void LoadVerticesPeriodicity(std::istream & load);
679 // Called by SaveTo to store content of _facesPeriodicityVector
680 void SaveFacesPeriodicity(std::ostream & save);
682 // Called by SaveTo to store content of _edgesPeriodicityVector
683 void SaveEdgesPeriodicity(std::ostream & save);
685 // Called by SaveTo to store content of _verticesPeriodicityVector
686 void SaveVerticesPeriodicity(std::ostream & save);
688 std::string _GMFFileName;
689 // bool _GMFFileMode;
691 // TSizeMap _customSizeMap;