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 void SetVerbosity(int theVal);
155 int GetVerbosity() const { return _verb; }
157 void ClearEntry(const std::string& entry, const char * attEntry = 0);
158 void ClearSizeMaps();
160 void SetEnforceCadEdgesSize( bool toEnforce );
161 bool GetEnforceCadEdgesSize();
163 void SetJacobianRectificationRespectGeometry( bool allowRectification );
164 bool GetJacobianRectificationRespectGeometry();
166 void SetUseDeprecatedPatchMesher( bool useDeprecatedPatchMesher );
167 bool GetUseDeprecatedPatchMesher();
169 void SetJacobianRectification( bool allowRectification );
170 bool GetJacobianRectification();
172 void SetMaxNumberOfPointsPerPatch( int nb ) throw (std::invalid_argument);
173 int GetMaxNumberOfPointsPerPatch();
175 void SetMaxNumberOfThreads( int nb ) throw (std::invalid_argument);
176 int GetMaxNumberOfThreads();
178 void SetRespectGeometry( bool toRespect );
179 bool GetRespectGeometry();
181 void SetTinyEdgesAvoidSurfaceIntersections( bool toAvoidIntersection );
182 bool GetTinyEdgesAvoidSurfaceIntersections();
184 void SetClosedGeometry( bool isClosed );
185 bool GetClosedGeometry();
187 void SetDebug( bool isDebug );
190 void SetPeriodicTolerance( double tol ) throw (std::invalid_argument);
191 double GetPeriodicTolerance();
193 void SetRequiredEntities( const std::string& howToTreat ) throw (std::invalid_argument);
194 std::string GetRequiredEntities();
196 void SetSewingTolerance( double tol ) throw (std::invalid_argument);
197 double GetSewingTolerance();
199 void SetTags( const std::string& howToTreat ) throw (std::invalid_argument);
200 std::string GetTags();
203 typedef std::set< int > THyperPatchTags;
204 typedef std::vector< THyperPatchTags > THyperPatchList;
206 void SetHyperPatches(const THyperPatchList& hpl);
207 const THyperPatchList& GetHyperPatches() const { return _hyperPatchList; }
208 static int GetHyperPatchTag( int faceTag, const BLSURFPlugin_Hypothesis* hyp, int* iPatch=0 );
210 void SetPreCADMergeEdges(bool theVal);
211 bool GetPreCADMergeEdges() const { return _preCADMergeEdges; }
213 void SetPreCADRemoveDuplicateCADFaces(bool theVal);
214 bool GetPreCADRemoveDuplicateCADFaces() const { return _preCADRemoveDuplicateCADFaces; }
216 void SetPreCADProcess3DTopology(bool theVal);
217 bool GetPreCADProcess3DTopology() const { return _preCADProcess3DTopology; }
219 void SetPreCADDiscardInput(bool theVal);
220 bool GetPreCADDiscardInput() const { return _preCADDiscardInput; }
222 static bool HasPreCADOptions(const BLSURFPlugin_Hypothesis* hyp);
224 typedef std::map<std::string,std::string> TSizeMap;
226 void SetSizeMapEntry(const std::string& entry,const std::string& sizeMap );
227 std::string GetSizeMapEntry(const std::string& entry);
228 const TSizeMap& _GetSizeMapEntries() const { return _sizeMap; }
230 * \brief Return the size maps
232 static TSizeMap GetSizeMapEntries(const BLSURFPlugin_Hypothesis* hyp);
235 void SetAttractorEntry(const std::string& entry,const std::string& attractor );
236 std::string GetAttractorEntry(const std::string& entry);
237 const TSizeMap& _GetAttractorEntries() const { return _attractors; };
239 * \brief Return the attractors
241 static TSizeMap GetAttractorEntries(const BLSURFPlugin_Hypothesis* hyp);
245 void SetCustomSizeMapEntry(const std::string& entry,const std::string& sizeMap );
246 std::string GetCustomSizeMapEntry(const std::string& entry);
247 void UnsetCustomSizeMap(const std::string& entry);
248 const TSizeMap& GetCustomSizeMapEntries() const { return _customSizeMap; }
251 typedef std::multimap< std::string, BLSURFPlugin_Attractor* > TAttractorMap;
252 typedef std::map< std::string, std::vector<double> > TParamsMap; //TODO ?? finir
254 void SetClassAttractorEntry(const std::string& entry, const std::string& att_entry, double StartSize, double EndSize, double ActionRadius, double ConstantRadius);
255 std::string GetClassAttractorEntry(const std::string& entry);
256 const TAttractorMap& _GetClassAttractorEntries() const { return _classAttractors; }
258 * \brief Return the attractors entries
260 static TAttractorMap GetClassAttractorEntries(const BLSURFPlugin_Hypothesis* hyp);
263 * To set/get/unset an enforced vertex
266 typedef std::string TEnfName;
268 typedef std::string TEntry;
270 typedef std::set<TEntry> TEntryList;
272 typedef std::string TEnfGroupName;
274 typedef std::vector<double> TEnfVertexCoords;
275 typedef std::set< TEnfVertexCoords > TEnfVertexCoordsList;
281 TEnfVertexCoords coords;
282 TEnfGroupName grpName;
283 TEntryList faceEntries;
284 TopoDS_Vertex vertex;
287 struct CompareEnfVertices
289 bool operator () (const TEnfVertex* e1, const TEnfVertex* e2) const {
291 if (e1->coords.size() && e2->coords.size())
292 return (e1->coords < e2->coords);
294 return (e1->geomEntry < e2->geomEntry);
300 // PreCad Face and Edge periodicity
301 struct TPreCadPeriodicity {
304 std::vector<std::string> theSourceVerticesEntries;
305 std::vector<std::string> theTargetVerticesEntries;
309 struct TEdgePeriodicity {
310 TEntry theFace1Entry;
311 TEntry theEdge1Entry;
312 TEntry theFace2Entry;
313 TEntry theEdge2Entry;
314 int edge_orientation;
317 // Vertex periodicity
318 struct TVertexPeriodicity {
319 TEntry theEdge1Entry;
320 TEntry theVertex1Entry;
321 TEntry theEdge2Entry;
322 TEntry theVertex2Entry;
325 typedef std::pair< TEntry, TEntry > TFacesPeriodicity;
327 // List of enforced vertices
328 typedef std::set< TEnfVertex*, CompareEnfVertices > TEnfVertexList;
330 // Map Face Entry / List of enforced vertices
331 typedef std::map< TEntry, TEnfVertexList > TFaceEntryEnfVertexListMap;
333 // List of Face Entry with internal enforced vertices activated
334 typedef std::set< TEntry > TFaceEntryInternalVerticesList;
336 // Map Face Entry / List of coords
337 typedef std::map< TEntry, TEnfVertexCoordsList > TFaceEntryCoordsListMap;
339 // Map Face Entry / List of Vertex entry
340 typedef std::map< TEntry, TEntryList > TFaceEntryEnfVertexEntryListMap;
342 // Map Coords / Enforced vertex
343 typedef std::map< TEnfVertexCoords, TEnfVertex* > TCoordsEnfVertexMap;
345 // Map Vertex entry / Enforced vertex
346 typedef std::map< TEntry, TEnfVertex* > TEnfVertexEntryEnfVertexMap;
348 typedef std::map< TEnfGroupName, std::set<int> > TGroupNameNodeIDMap;
350 // Map Group Name / List of enforced vertices
351 typedef std::map< TEnfGroupName , TEnfVertexList > TGroupNameEnfVertexListMap;
354 // Vector of pairs of entries
355 typedef std::vector< TPreCadPeriodicity > TPreCadPeriodicityVector;
356 typedef std::vector< TFacesPeriodicity > TFacesPeriodicityVector;
357 typedef std::vector< TEdgePeriodicity > TEdgesPeriodicityVector;
358 typedef std::vector< TVertexPeriodicity > TVerticesPeriodicityVector;
361 bool SetEnforcedVertex(TEntry theFaceEntry, TEnfName theVertexName, TEntry theVertexEntry, TEnfGroupName theGroupName,
362 double x = 0.0, double y = 0.0, double z = 0.0);
363 TEnfVertexList GetEnfVertexList(const TEntry& theFaceEntry) throw (std::invalid_argument);
364 TEnfVertexCoordsList GetEnfVertexCoordsList(const TEntry& theFaceEntry) throw (std::invalid_argument);
365 TEntryList GetEnfVertexEntryList (const TEntry& theFaceEntry) throw (std::invalid_argument);
366 TEnfVertex* GetEnfVertex(TEnfVertexCoords coords) throw (std::invalid_argument);
367 TEnfVertex* GetEnfVertex(const TEntry& theEnfVertexEntry) throw (std::invalid_argument);
368 void AddEnfVertexNodeID(TEnfGroupName theGroupName,int theNodeID);
369 std::set<int> GetEnfVertexNodeIDs(TEnfGroupName theGroupName) throw (std::invalid_argument);
370 void RemoveEnfVertexNodeID(TEnfGroupName theGroupName,int theNodeID) throw (std::invalid_argument);
372 bool ClearEnforcedVertex(const TEntry& theFaceEntry, double x = 0.0, double y = 0.0, double z = 0.0, const TEntry& theVertexEntry="") throw (std::invalid_argument);
373 bool ClearEnforcedVertices(const TEntry& theFaceEntry) throw (std::invalid_argument);
375 void ClearAllEnforcedVertices();
376 void AddEnforcedVertex( const TEntry& theFaceEntry, TEnfVertex * theEnfVertex );
378 const TFaceEntryEnfVertexListMap& _GetAllEnforcedVerticesByFace() const { return _faceEntryEnfVertexListMap; }
379 const TEnfVertexList& _GetAllEnforcedVertices() const { return _enfVertexList; }
381 const TFaceEntryCoordsListMap& _GetAllCoordsByFace() const { return _faceEntryCoordsListMap; }
382 const TCoordsEnfVertexMap& _GetAllEnforcedVerticesByCoords() const { return _coordsEnfVertexMap; }
384 const TFaceEntryEnfVertexEntryListMap& _GetAllEnfVertexEntriesByFace() const { return _faceEntryEnfVertexEntryListMap; }
385 const TEnfVertexEntryEnfVertexMap& _GetAllEnforcedVerticesByEnfVertexEntry() const { return _enfVertexEntryEnfVertexMap; }
388 // const TEnfVertexGroupNameMap _GetEnforcedVertexGroupNameMap() const { return _enfVertexGroupNameMap; }
392 * \brief Return the enforced vertices
394 static TFaceEntryEnfVertexListMap GetAllEnforcedVerticesByFace(const BLSURFPlugin_Hypothesis* hyp);
395 static TEnfVertexList GetAllEnforcedVertices(const BLSURFPlugin_Hypothesis* hyp);
397 static TFaceEntryCoordsListMap GetAllCoordsByFace(const BLSURFPlugin_Hypothesis* hyp);
398 static TCoordsEnfVertexMap GetAllEnforcedVerticesByCoords(const BLSURFPlugin_Hypothesis* hyp);
400 static TFaceEntryEnfVertexEntryListMap GetAllEnfVertexEntriesByFace(const BLSURFPlugin_Hypothesis* hyp);
401 static TEnfVertexEntryEnfVertexMap GetAllEnforcedVerticesByEnfVertexEntry(const BLSURFPlugin_Hypothesis* hyp);
404 * \brief Internal enforced vertices
406 void SetInternalEnforcedVertexAllFaces(bool toEnforceInternalVertices);
407 const bool _GetInternalEnforcedVertexAllFaces() const { return _enforcedInternalVerticesAllFaces; }
408 static bool GetInternalEnforcedVertexAllFaces( const BLSURFPlugin_Hypothesis* hyp );
409 void SetInternalEnforcedVertexAllFacesGroup(TEnfGroupName theGroupName);
410 const TEnfGroupName _GetInternalEnforcedVertexAllFacesGroup() const { return _enforcedInternalVerticesAllFacesGroup; }
411 static TEnfGroupName GetInternalEnforcedVertexAllFacesGroup( const BLSURFPlugin_Hypothesis* hyp );
413 // Enable internal enforced vertices on specific face if requested by user
414 // static TFaceEntryInternalVerticesList GetDefaultFaceEntryInternalVerticesMap() { return TFaceEntryInternalVerticesList(); }
415 // const TFaceEntryInternalVerticesList _GetAllInternalEnforcedVerticesByFace() const { return _faceEntryInternalVerticesList; }
416 // static TFaceEntryInternalVerticesList GetAllInternalEnforcedVerticesByFace(const BLSURFPlugin_Hypothesis* hyp);
417 // void SetInternalEnforcedVertex(TEntry theFaceEntry, bool toEnforceInternalVertices, TEnfGroupName theGroupName);
418 // bool GetInternalEnforcedVertex(const TEntry& theFaceEntry);
420 static PhysicalMesh GetDefaultPhysicalMesh() { return PhysicalGlobalSize; }
421 static GeometricMesh GetDefaultGeometricMesh() { return GeometricalGlobalSize; }
422 static double GetDefaultPhySize(double diagonal, double bbSegmentation);
423 static double GetDefaultPhySize() { return undefinedDouble(); }
424 static bool GetDefaultPhySizeRel() { return false; }
425 static double GetDefaultMinSize(double diagonal);
426 static double GetDefaultMinSize() { return undefinedDouble(); }
427 static bool GetDefaultMinSizeRel() { return false; }
428 static double GetDefaultMaxSize(double diagonal);
429 static double GetDefaultMaxSize() { return undefinedDouble(); }
430 static bool GetDefaultMaxSizeRel() { return false; }
431 static bool GetDefaultUseGradation() { return true; }
432 static double GetDefaultGradation() { return 1.3; }
433 static bool GetDefaultUseVolumeGradation() { return false; }
434 static double GetDefaultVolumeGradation() { return 2; }
435 static ElementType GetDefaultElementType() { return Triangles; }
436 static double GetDefaultAngleMesh() { return 8.0; }
438 static double GetDefaultChordalError(double diagonal);
439 static double GetDefaultChordalError() { return undefinedDouble(); }
440 static bool GetDefaultAnisotropic() { return false; }
441 static double GetDefaultAnisotropicRatio() { return 0.0; }
442 static bool GetDefaultRemoveTinyEdges() { return false; }
443 static double GetDefaultTinyEdgeLength(double diagonal);
444 static double GetDefaultTinyEdgeLength() { return undefinedDouble(); }
445 static bool GetDefaultOptimiseTinyEdges() { return false; }
446 static double GetDefaultTinyEdgeOptimisationLength(double diagonal);
447 static double GetDefaultTinyEdgeOptimisationLength() { return undefinedDouble(); }
448 static bool GetDefaultCorrectSurfaceIntersection() { return true; }
449 static double GetDefaultCorrectSurfaceIntersectionMaxCost() { return 15.; }
450 static bool GetDefaultBadElementRemoval() { return false; }
451 static double GetDefaultBadElementAspectRatio() {return 1000.0; }
452 static bool GetDefaultOptimizeMesh() { return true; }
453 static bool GetDefaultQuadraticMesh() { return false; }
455 static int GetDefaultVerbosity() { return 3; }
456 static Topology GetDefaultTopology() { return FromCAD; }
458 static bool GetDefaultPreCADMergeEdges() { return false; }
459 static bool GetDefaultPreCADRemoveDuplicateCADFaces() { return false; }
460 static bool GetDefaultPreCADProcess3DTopology() { return false; }
461 static bool GetDefaultPreCADDiscardInput() { return false; }
463 static TSizeMap GetDefaultSizeMap() { return TSizeMap();}
464 static TAttractorMap GetDefaultAttractorMap() { return TAttractorMap(); }
466 static TFaceEntryEnfVertexListMap GetDefaultFaceEntryEnfVertexListMap() { return TFaceEntryEnfVertexListMap(); }
467 static TEnfVertexList GetDefaultEnfVertexList() { return TEnfVertexList(); }
468 static TFaceEntryCoordsListMap GetDefaultFaceEntryCoordsListMap() { return TFaceEntryCoordsListMap(); }
469 static TCoordsEnfVertexMap GetDefaultCoordsEnfVertexMap() { return TCoordsEnfVertexMap(); }
470 static TFaceEntryEnfVertexEntryListMap GetDefaultFaceEntryEnfVertexEntryListMap() { return TFaceEntryEnfVertexEntryListMap(); }
471 static TEnfVertexEntryEnfVertexMap GetDefaultEnfVertexEntryEnfVertexMap() { return TEnfVertexEntryEnfVertexMap(); }
472 static TGroupNameNodeIDMap GetDefaultGroupNameNodeIDMap() { return TGroupNameNodeIDMap(); }
474 static bool GetDefaultInternalEnforcedVertex() { return false; }
477 static TGroupNameEnfVertexListMap GetDefaultGroupNameEnfVertexListMap() { return TGroupNameEnfVertexListMap(); }
478 static TEnfVertexGroupNameMap GetDefaultEnfVertexGroupNameMap() { return TEnfVertexGroupNameMap(); }
481 // const TPreCadPeriodicityEntriesVector _GetPreCadFacesPeriodicityEntries() const { return _preCadFacesPeriodicityEntriesVector; }
483 static TPreCadPeriodicityVector GetDefaultPreCadFacesPeriodicityVector() { return TPreCadPeriodicityVector(); }
484 const TPreCadPeriodicityVector& _GetPreCadFacesPeriodicityVector() const { return _preCadFacesPeriodicityVector; }
485 static TPreCadPeriodicityVector GetPreCadFacesPeriodicityVector(const BLSURFPlugin_Hypothesis* hyp);
487 static TPreCadPeriodicityVector GetDefaultPreCadEdgesPeriodicityVector() { return TPreCadPeriodicityVector(); }
488 const TPreCadPeriodicityVector& _GetPreCadEdgesPeriodicityVector() const { return _preCadEdgesPeriodicityVector; }
489 static TPreCadPeriodicityVector GetPreCadEdgesPeriodicityVector(const BLSURFPlugin_Hypothesis* hyp);
491 static TFacesPeriodicityVector GetDefaultFacesPeriodicityVector() { return TFacesPeriodicityVector(); }
492 const TFacesPeriodicityVector& _GetFacesPeriodicityVector() const { return _facesPeriodicityVector; }
493 static TFacesPeriodicityVector GetFacesPeriodicityVector(const BLSURFPlugin_Hypothesis* hyp);
495 static TEdgesPeriodicityVector GetDefaultEdgesPeriodicityVector() { return TEdgesPeriodicityVector(); }
496 const TEdgesPeriodicityVector& _GetEdgesPeriodicityVector() const { return _edgesPeriodicityVector; }
497 static TEdgesPeriodicityVector GetEdgesPeriodicityVector(const BLSURFPlugin_Hypothesis* hyp);
499 static TVerticesPeriodicityVector GetDefaultVerticesPeriodicityVector() { return TVerticesPeriodicityVector(); }
500 const TVerticesPeriodicityVector& _GetVerticesPeriodicityVector() const { return _verticesPeriodicityVector; }
501 static TVerticesPeriodicityVector GetVerticesPeriodicityVector(const BLSURFPlugin_Hypothesis* hyp);
503 void ClearPreCadPeriodicityVectors();
505 void AddPreCadFacesPeriodicity(TEntry theFace1Entry, TEntry theFace2Entry,
506 std::vector<std::string> &theSourceVerticesEntries, std::vector<std::string> &theTargetVerticesEntries);
507 void AddPreCadEdgesPeriodicity(TEntry theEdge1Entry, TEntry theEdge2Entry,
508 std::vector<std::string> &theSourceVerticesEntries, std::vector<std::string> &theTargetVerticesEntries);
510 static double undefinedDouble() { return -1.0; }
512 typedef std::map< std::string, std::string > TOptionValues;
513 typedef std::set< std::string > TOptionNames;
515 void SetOptionValue(const std::string& optionName,
516 const std::string& optionValue) throw (std::invalid_argument);
517 void SetPreCADOptionValue(const std::string& optionName,
518 const std::string& optionValue) throw (std::invalid_argument);
519 std::string GetOptionValue(const std::string& optionName, bool* isDefault=0) const throw (std::invalid_argument);
520 std::string GetPreCADOptionValue(const std::string& optionName, bool* isDefault=0) const throw (std::invalid_argument);
521 void ClearOption(const std::string& optionName);
522 void ClearPreCADOption(const std::string& optionName);
523 TOptionValues GetOptionValues() const;
524 TOptionValues GetPreCADOptionValues() const;
525 const TOptionValues& GetCustomOptionValues() const { return _customOption2value; }
527 void AddOption(const std::string& optionName, const std::string& optionValue);
528 void AddPreCADOption(const std::string& optionName, const std::string& optionValue);
529 std::string GetOption(const std::string& optionName) const;
530 std::string GetPreCADOption(const std::string& optionName) const;
532 static bool ToBool(const std::string& str, bool* isOk=0) throw (std::invalid_argument);
533 static double ToDbl(const std::string& str, bool* isOk=0) throw (std::invalid_argument);
534 static int ToInt(const std::string& str, bool* isOk=0) throw (std::invalid_argument);
537 * Sets the file for export resulting mesh in GMF format
539 // void SetGMFFile(const std::string& theFileName, bool isBinary);
540 void SetGMFFile(const std::string& theFileName);
541 std::string GetGMFFile() const { return _GMFFileName; }
542 static std::string GetDefaultGMFFile() { return "";}
543 // bool GetGMFFileMode() const { return _GMFFileMode; }
546 virtual std::ostream & SaveTo(std::ostream & save);
547 virtual std::istream & LoadFrom(std::istream & load);
548 friend std::ostream & operator <<(std::ostream & save, BLSURFPlugin_Hypothesis & hyp);
549 friend std::istream & operator >>(std::istream & load, BLSURFPlugin_Hypothesis & hyp);
552 * \brief Does nothing
553 * \param theMesh - the built mesh
554 * \param theShape - the geometry of interest
555 * \retval bool - always false
557 virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
560 * \brief Initialize my parameter values by default parameters.
561 * \retval bool - true if parameter values have been successfully defined
563 virtual bool SetParametersByDefaults(const TDefaults& dflts, const SMESH_Mesh* theMesh=0);
567 PhysicalMesh _physicalMesh;
568 GeometricMesh _geometricMesh;
571 double _minSize, _maxSize;
572 bool _minSizeRel, _maxSizeRel;
575 bool _useVolumeGradation;
576 double _volumeGradation;
577 ElementType _elementType;
579 double _chordalError;
581 double _anisotropicRatio;
582 bool _removeTinyEdges;
583 double _tinyEdgeLength;
584 bool _optimiseTinyEdges;
585 double _tinyEdgeOptimisationLength;
586 bool _correctSurfaceIntersec;
587 double _corrSurfaceIntersCost;
588 bool _badElementRemoval;
589 double _badElementAspectRatio;
595 bool _preCADMergeEdges;
596 bool _preCADRemoveDuplicateCADFaces;
597 bool _preCADProcess3DTopology;
598 bool _preCADDiscardInput;
599 double _preCADEpsNano;
601 TOptionValues _option2value, _preCADoption2value, _customOption2value; // user defined values
602 TOptionValues _defaultOptionValues; // default values
603 TOptionNames _doubleOptions, _charOptions, _boolOptions; // to find a type of option
604 TOptionNames _preCADdoubleOptions, _preCADcharOptions;
607 TSizeMap _attractors;
608 TAttractorMap _classAttractors;
610 TFaceEntryEnfVertexListMap _faceEntryEnfVertexListMap;
611 TEnfVertexList _enfVertexList;
612 // maps to get "manual" enf vertex (through their coordinates)
613 TFaceEntryCoordsListMap _faceEntryCoordsListMap;
614 TCoordsEnfVertexMap _coordsEnfVertexMap;
615 // maps to get "geom" enf vertex (through their geom entries)
616 TFaceEntryEnfVertexEntryListMap _faceEntryEnfVertexEntryListMap;
617 TEnfVertexEntryEnfVertexMap _enfVertexEntryEnfVertexMap;
618 TGroupNameNodeIDMap _groupNameNodeIDMap;
620 // Enable internal enforced vertices on specific face if requested by user
621 // TFaceEntryInternalVerticesList _faceEntryInternalVerticesList;
622 bool _enforcedInternalVerticesAllFaces;
623 TEnfGroupName _enforcedInternalVerticesAllFacesGroup;
625 TPreCadPeriodicityVector _preCadFacesPeriodicityVector;
626 TPreCadPeriodicityVector _preCadEdgesPeriodicityVector;
628 TFacesPeriodicityVector _facesPeriodicityVector;
629 TEdgesPeriodicityVector _edgesPeriodicityVector;
630 TVerticesPeriodicityVector _verticesPeriodicityVector;
632 THyperPatchList _hyperPatchList;
634 // Called by SaveTo to store content of _preCadFacesPeriodicityVector and _preCadEdgesPeriodicityVector
635 void SavePreCADPeriodicity(std::ostream & save, const char* shapeType);
637 // Called by LoadFrom to fill _preCadFacesPeriodicityVector and _preCadEdgesPeriodicityVector
638 void LoadPreCADPeriodicity(std::istream & load, const char* shapeType);
640 // Called by LoadFrom to fill _facesPeriodicityVector
641 void LoadFacesPeriodicity(std::istream & load);
643 // Called by LoadFrom to fill _edgesPeriodicityVector
644 void LoadEdgesPeriodicity(std::istream & load);
646 // Called by LoadFrom to fill _verticesPeriodicityVector
647 void LoadVerticesPeriodicity(std::istream & load);
649 // Called by SaveTo to store content of _facesPeriodicityVector
650 void SaveFacesPeriodicity(std::ostream & save);
652 // Called by SaveTo to store content of _edgesPeriodicityVector
653 void SaveEdgesPeriodicity(std::ostream & save);
655 // Called by SaveTo to store content of _verticesPeriodicityVector
656 void SaveVerticesPeriodicity(std::ostream & save);
658 std::string _GMFFileName;
659 // bool _GMFFileMode;
661 // TSizeMap _customSizeMap;