1 // Copyright (C) 2007-2016 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, int studyId, SMESH_Gen * gen, bool hasgeom);
63 GeometricalGlobalSize,
67 static const char* GetHypType(bool hasgeom)
68 { return hasgeom ? "MG-CADSurf Parameters" : "MG-CADSurf Parameters_NOGEOM"; }
70 TopoDS_Shape entryToShape(std::string entry);
72 void SetPhysicalMesh(PhysicalMesh thePhysicalMesh);
73 PhysicalMesh GetPhysicalMesh() const { return _physicalMesh; }
75 void SetGeometricMesh(GeometricMesh theGeometricMesh);
76 GeometricMesh GetGeometricMesh() const { return _geometricMesh; }
78 void SetPhySize(double thePhySize, bool isRelative = false);
79 double GetPhySize() const { return _phySize; }
80 bool IsPhySizeRel() const { return _phySizeRel; }
82 void SetMinSize(double theMinSize, bool isRelative = false);
83 double GetMinSize() const { return _minSize; }
84 bool IsMinSizeRel() const { return _minSizeRel; }
86 void SetMaxSize(double theMaxSize, bool isRelative = false);
87 double GetMaxSize() const { return _maxSize; }
88 bool IsMaxSizeRel() const { return _maxSizeRel; }
90 void SetUseGradation(bool toUse);
91 bool GetUseGradation() const { return _useGradation; }
92 void SetGradation(double theGradation);
93 double GetGradation() const { return _gradation; }
95 void SetUseVolumeGradation(bool toUse);
96 bool GetUseVolumeGradation() const { return _useVolumeGradation; }
97 void SetVolumeGradation(double theGradation);
98 double GetVolumeGradation() const { return _volumeGradation; }
100 void SetQuadAllowed(bool theVal);
101 bool GetQuadAllowed() const { return _quadAllowed; }
103 void SetAngleMesh(double theAngle);
104 double GetAngleMesh() const { return _angleMesh; }
106 void SetChordalError(double theDistance);
107 double GetChordalError() const { return _chordalError; }
109 void SetAnisotropic(bool theVal);
110 bool GetAnisotropic() const { return _anisotropic; }
112 void SetAnisotropicRatio(double theVal);
113 double GetAnisotropicRatio() const { return _anisotropicRatio; }
115 void SetRemoveTinyEdges(bool theVal);
116 bool GetRemoveTinyEdges() const { return _removeTinyEdges; }
118 void SetTinyEdgeLength(double theVal);
119 double GetTinyEdgeLength() const { return _tinyEdgeLength; }
121 void SetOptimiseTinyEdges(bool theVal);
122 bool GetOptimiseTinyEdges() const { return _optimiseTinyEdges; }
124 void SetTinyEdgeOptimisationLength(double theVal);
125 double GetTinyEdgeOptimisationLength() const { return _tinyEdgeOptimisationLength; }
127 void SetCorrectSurfaceIntersection(bool theVal);
128 bool GetCorrectSurfaceIntersection() const { return _correctSurfaceIntersec; }
130 void SetCorrectSurfaceIntersectionMaxCost(double theVal);
131 double GetCorrectSurfaceIntersectionMaxCost() const { return _corrSurfaceIntersCost; }
133 void SetBadElementRemoval(bool theVal);
134 bool GetBadElementRemoval() const { return _badElementRemoval; }
136 void SetBadElementAspectRatio(double theVal);
137 double GetBadElementAspectRatio() const { return _badElementAspectRatio; }
139 void SetOptimizeMesh(bool theVal);
140 bool GetOptimizeMesh() const { return _optimizeMesh; }
142 void SetQuadraticMesh(bool theVal);
143 bool GetQuadraticMesh() const { return _quadraticMesh; }
145 void SetTopology(Topology theTopology);
146 Topology GetTopology() const { return _topology; }
148 void SetVerbosity(int theVal);
149 int GetVerbosity() const { return _verb; }
151 void ClearEntry(const std::string& entry, const char * attEntry = 0);
152 void ClearSizeMaps();
154 void SetEnforceCadEdgesSize( bool toEnforce );
155 bool GetEnforceCadEdgesSize();
157 void SetJacobianRectificationRespectGeometry( bool allowRectification );
158 bool GetJacobianRectificationRespectGeometry();
160 void SetJacobianRectification( bool allowRectification );
161 bool GetJacobianRectification();
163 void SetMaxNumberOfPointsPerPatch( int nb ) throw (std::invalid_argument);
164 int GetMaxNumberOfPointsPerPatch();
166 void SetRespectGeometry( bool toRespect );
167 bool GetRespectGeometry();
169 void SetTinyEdgesAvoidSurfaceIntersections( bool toAvoidIntersection );
170 bool GetTinyEdgesAvoidSurfaceIntersections();
172 void SetClosedGeometry( bool isClosed );
173 bool GetClosedGeometry();
175 void SetDebug( bool isDebug );
178 void SetPeriodicTolerance( double tol ) throw (std::invalid_argument);
179 double GetPeriodicTolerance();
181 void SetRequiredEntities( const std::string& howToTreat ) throw (std::invalid_argument);
182 std::string GetRequiredEntities();
184 void SetSewingTolerance( double tol ) throw (std::invalid_argument);
185 double GetSewingTolerance();
187 void SetTags( const std::string& howToTreat ) throw (std::invalid_argument);
188 std::string GetTags();
191 typedef std::set< int > THyperPatchTags;
192 typedef std::vector< THyperPatchTags > THyperPatchList;
194 void SetHyperPatches(const THyperPatchList& hpl);
195 const THyperPatchList& GetHyperPatches() const { return _hyperPatchList; }
196 static int GetHyperPatchTag( int faceTag, const BLSURFPlugin_Hypothesis* hyp, int* iPatch=0 );
198 void SetPreCADMergeEdges(bool theVal);
199 bool GetPreCADMergeEdges() const { return _preCADMergeEdges; }
201 void SetPreCADRemoveDuplicateCADFaces(bool theVal);
202 bool GetPreCADRemoveDuplicateCADFaces() const { return _preCADRemoveDuplicateCADFaces; }
204 void SetPreCADProcess3DTopology(bool theVal);
205 bool GetPreCADProcess3DTopology() const { return _preCADProcess3DTopology; }
207 void SetPreCADDiscardInput(bool theVal);
208 bool GetPreCADDiscardInput() const { return _preCADDiscardInput; }
210 static bool HasPreCADOptions(const BLSURFPlugin_Hypothesis* hyp);
212 typedef std::map<std::string,std::string> TSizeMap;
214 void SetSizeMapEntry(const std::string& entry,const std::string& sizeMap );
215 std::string GetSizeMapEntry(const std::string& entry);
216 const TSizeMap& _GetSizeMapEntries() const { return _sizeMap; }
218 * \brief Return the size maps
220 static TSizeMap GetSizeMapEntries(const BLSURFPlugin_Hypothesis* hyp);
223 void SetAttractorEntry(const std::string& entry,const std::string& attractor );
224 std::string GetAttractorEntry(const std::string& entry);
225 const TSizeMap& _GetAttractorEntries() const { return _attractors; };
227 * \brief Return the attractors
229 static TSizeMap GetAttractorEntries(const BLSURFPlugin_Hypothesis* hyp);
233 void SetCustomSizeMapEntry(const std::string& entry,const std::string& sizeMap );
234 std::string GetCustomSizeMapEntry(const std::string& entry);
235 void UnsetCustomSizeMap(const std::string& entry);
236 const TSizeMap& GetCustomSizeMapEntries() const { return _customSizeMap; }
239 typedef std::multimap< std::string, BLSURFPlugin_Attractor* > TAttractorMap;
240 typedef std::map< std::string, std::vector<double> > TParamsMap; //TODO à finir
242 void SetClassAttractorEntry(const std::string& entry, const std::string& att_entry, double StartSize, double EndSize, double ActionRadius, double ConstantRadius);
243 std::string GetClassAttractorEntry(const std::string& entry);
244 const TAttractorMap& _GetClassAttractorEntries() const { return _classAttractors; }
246 * \brief Return the attractors entries
248 static TAttractorMap GetClassAttractorEntries(const BLSURFPlugin_Hypothesis* hyp);
251 * To set/get/unset an enforced vertex
254 typedef std::string TEnfName;
256 typedef std::string TEntry;
258 typedef std::set<TEntry> TEntryList;
260 typedef std::string TEnfGroupName;
262 typedef std::vector<double> TEnfVertexCoords;
263 typedef std::set< TEnfVertexCoords > TEnfVertexCoordsList;
269 TEnfVertexCoords coords;
270 TEnfGroupName grpName;
271 TEntryList faceEntries;
272 TopoDS_Vertex vertex;
275 struct CompareEnfVertices
277 bool operator () (const TEnfVertex* e1, const TEnfVertex* e2) const {
279 if (e1->coords.size() && e2->coords.size())
280 return (e1->coords < e2->coords);
282 return (e1->geomEntry < e2->geomEntry);
288 // PreCad Face and Edge periodicity
289 struct TPreCadPeriodicity {
292 std::vector<std::string> theSourceVerticesEntries;
293 std::vector<std::string> theTargetVerticesEntries;
297 struct TEdgePeriodicity {
298 TEntry theFace1Entry;
299 TEntry theEdge1Entry;
300 TEntry theFace2Entry;
301 TEntry theEdge2Entry;
302 int edge_orientation;
305 // Vertex periodicity
306 struct TVertexPeriodicity {
307 TEntry theEdge1Entry;
308 TEntry theVertex1Entry;
309 TEntry theEdge2Entry;
310 TEntry theVertex2Entry;
313 typedef std::pair< TEntry, TEntry > TFacesPeriodicity;
315 // List of enforced vertices
316 typedef std::set< TEnfVertex*, CompareEnfVertices > TEnfVertexList;
318 // Map Face Entry / List of enforced vertices
319 typedef std::map< TEntry, TEnfVertexList > TFaceEntryEnfVertexListMap;
321 // List of Face Entry with internal enforced vertices activated
322 typedef std::set< TEntry > TFaceEntryInternalVerticesList;
324 // Map Face Entry / List of coords
325 typedef std::map< TEntry, TEnfVertexCoordsList > TFaceEntryCoordsListMap;
327 // Map Face Entry / List of Vertex entry
328 typedef std::map< TEntry, TEntryList > TFaceEntryEnfVertexEntryListMap;
330 // Map Coords / Enforced vertex
331 typedef std::map< TEnfVertexCoords, TEnfVertex* > TCoordsEnfVertexMap;
333 // Map Vertex entry / Enforced vertex
334 typedef std::map< TEntry, TEnfVertex* > TEnfVertexEntryEnfVertexMap;
336 typedef std::map< TEnfGroupName, std::set<int> > TGroupNameNodeIDMap;
338 // Map Group Name / List of enforced vertices
339 typedef std::map< TEnfGroupName , TEnfVertexList > TGroupNameEnfVertexListMap;
342 // Vector of pairs of entries
343 typedef std::vector< TPreCadPeriodicity > TPreCadPeriodicityVector;
344 typedef std::vector< TFacesPeriodicity > TFacesPeriodicityVector;
345 typedef std::vector< TEdgePeriodicity > TEdgesPeriodicityVector;
346 typedef std::vector< TVertexPeriodicity > TVerticesPeriodicityVector;
349 bool SetEnforcedVertex(TEntry theFaceEntry, TEnfName theVertexName, TEntry theVertexEntry, TEnfGroupName theGroupName,
350 double x = 0.0, double y = 0.0, double z = 0.0);
351 TEnfVertexList GetEnfVertexList(const TEntry& theFaceEntry) throw (std::invalid_argument);
352 TEnfVertexCoordsList GetEnfVertexCoordsList(const TEntry& theFaceEntry) throw (std::invalid_argument);
353 TEntryList GetEnfVertexEntryList (const TEntry& theFaceEntry) throw (std::invalid_argument);
354 TEnfVertex* GetEnfVertex(TEnfVertexCoords coords) throw (std::invalid_argument);
355 TEnfVertex* GetEnfVertex(const TEntry& theEnfVertexEntry) throw (std::invalid_argument);
356 void AddEnfVertexNodeID(TEnfGroupName theGroupName,int theNodeID);
357 std::set<int> GetEnfVertexNodeIDs(TEnfGroupName theGroupName) throw (std::invalid_argument);
358 void RemoveEnfVertexNodeID(TEnfGroupName theGroupName,int theNodeID) throw (std::invalid_argument);
360 bool ClearEnforcedVertex(const TEntry& theFaceEntry, double x = 0.0, double y = 0.0, double z = 0.0, const TEntry& theVertexEntry="") throw (std::invalid_argument);
361 bool ClearEnforcedVertices(const TEntry& theFaceEntry) throw (std::invalid_argument);
363 void ClearAllEnforcedVertices();
365 const TFaceEntryEnfVertexListMap _GetAllEnforcedVerticesByFace() const { return _faceEntryEnfVertexListMap; }
366 const TEnfVertexList _GetAllEnforcedVertices() const { return _enfVertexList; }
368 const TFaceEntryCoordsListMap _GetAllCoordsByFace() const { return _faceEntryCoordsListMap; }
369 const TCoordsEnfVertexMap _GetAllEnforcedVerticesByCoords() const { return _coordsEnfVertexMap; }
371 const TFaceEntryEnfVertexEntryListMap _GetAllEnfVertexEntriesByFace() const { return _faceEntryEnfVertexEntryListMap; }
372 const TEnfVertexEntryEnfVertexMap _GetAllEnforcedVerticesByEnfVertexEntry() const { return _enfVertexEntryEnfVertexMap; }
375 // const TEnfVertexGroupNameMap _GetEnforcedVertexGroupNameMap() const { return _enfVertexGroupNameMap; }
379 * \brief Return the enforced vertices
381 static TFaceEntryEnfVertexListMap GetAllEnforcedVerticesByFace(const BLSURFPlugin_Hypothesis* hyp);
382 static TEnfVertexList GetAllEnforcedVertices(const BLSURFPlugin_Hypothesis* hyp);
384 static TFaceEntryCoordsListMap GetAllCoordsByFace(const BLSURFPlugin_Hypothesis* hyp);
385 static TCoordsEnfVertexMap GetAllEnforcedVerticesByCoords(const BLSURFPlugin_Hypothesis* hyp);
387 static TFaceEntryEnfVertexEntryListMap GetAllEnfVertexEntriesByFace(const BLSURFPlugin_Hypothesis* hyp);
388 static TEnfVertexEntryEnfVertexMap GetAllEnforcedVerticesByEnfVertexEntry(const BLSURFPlugin_Hypothesis* hyp);
391 * \brief Internal enforced vertices
393 void SetInternalEnforcedVertexAllFaces(bool toEnforceInternalVertices);
394 const bool _GetInternalEnforcedVertexAllFaces() const { return _enforcedInternalVerticesAllFaces; }
395 static bool GetInternalEnforcedVertexAllFaces( const BLSURFPlugin_Hypothesis* hyp );
396 void SetInternalEnforcedVertexAllFacesGroup(TEnfGroupName theGroupName);
397 const TEnfGroupName _GetInternalEnforcedVertexAllFacesGroup() const { return _enforcedInternalVerticesAllFacesGroup; }
398 static TEnfGroupName GetInternalEnforcedVertexAllFacesGroup( const BLSURFPlugin_Hypothesis* hyp );
400 // Enable internal enforced vertices on specific face if requested by user
401 // static TFaceEntryInternalVerticesList GetDefaultFaceEntryInternalVerticesMap() { return TFaceEntryInternalVerticesList(); }
402 // const TFaceEntryInternalVerticesList _GetAllInternalEnforcedVerticesByFace() const { return _faceEntryInternalVerticesList; }
403 // static TFaceEntryInternalVerticesList GetAllInternalEnforcedVerticesByFace(const BLSURFPlugin_Hypothesis* hyp);
404 // void SetInternalEnforcedVertex(TEntry theFaceEntry, bool toEnforceInternalVertices, TEnfGroupName theGroupName);
405 // bool GetInternalEnforcedVertex(const TEntry& theFaceEntry);
407 static PhysicalMesh GetDefaultPhysicalMesh() { return PhysicalGlobalSize; }
408 static GeometricMesh GetDefaultGeometricMesh() { return GeometricalGlobalSize; }
409 static double GetDefaultPhySize(double diagonal, double bbSegmentation);
410 static double GetDefaultPhySize() { return undefinedDouble(); }
411 static bool GetDefaultPhySizeRel() { return false; }
412 static double GetDefaultMinSize(double diagonal);
413 static double GetDefaultMinSize() { return undefinedDouble(); }
414 static bool GetDefaultMinSizeRel() { return false; }
415 static double GetDefaultMaxSize(double diagonal);
416 static double GetDefaultMaxSize() { return undefinedDouble(); }
417 static bool GetDefaultMaxSizeRel() { return false; }
418 static bool GetDefaultUseGradation() { return true; }
419 static double GetDefaultGradation() { return 1.3; }
420 static bool GetDefaultUseVolumeGradation() { return false; }
421 static double GetDefaultVolumeGradation() { return 2; }
422 static bool GetDefaultQuadAllowed() { return false; }
423 static double GetDefaultAngleMesh() { return 8.0; }
425 static double GetDefaultChordalError(double diagonal);
426 static double GetDefaultChordalError() { return undefinedDouble(); }
427 static bool GetDefaultAnisotropic() { return false; }
428 static double GetDefaultAnisotropicRatio() { return 0.0; }
429 static bool GetDefaultRemoveTinyEdges() { return false; }
430 static double GetDefaultTinyEdgeLength(double diagonal);
431 static double GetDefaultTinyEdgeLength() { return undefinedDouble(); }
432 static bool GetDefaultOptimiseTinyEdges() { return false; }
433 static double GetDefaultTinyEdgeOptimisationLength(double diagonal);
434 static double GetDefaultTinyEdgeOptimisationLength() { return undefinedDouble(); }
435 static bool GetDefaultCorrectSurfaceIntersection() { return true; }
436 static double GetDefaultCorrectSurfaceIntersectionMaxCost() { return 15.; }
437 static bool GetDefaultBadElementRemoval() { return false; }
438 static double GetDefaultBadElementAspectRatio() {return 1000.0; }
439 static bool GetDefaultOptimizeMesh() { return true; }
440 static bool GetDefaultQuadraticMesh() { return false; }
442 static int GetDefaultVerbosity() { return 3; }
443 static Topology GetDefaultTopology() { return FromCAD; }
445 static bool GetDefaultPreCADMergeEdges() { return false; }
446 static bool GetDefaultPreCADRemoveDuplicateCADFaces() { return false; }
447 static bool GetDefaultPreCADProcess3DTopology() { return false; }
448 static bool GetDefaultPreCADDiscardInput() { return false; }
450 static TSizeMap GetDefaultSizeMap() { return TSizeMap();}
451 static TAttractorMap GetDefaultAttractorMap() { return TAttractorMap(); }
453 static TFaceEntryEnfVertexListMap GetDefaultFaceEntryEnfVertexListMap() { return TFaceEntryEnfVertexListMap(); }
454 static TEnfVertexList GetDefaultEnfVertexList() { return TEnfVertexList(); }
455 static TFaceEntryCoordsListMap GetDefaultFaceEntryCoordsListMap() { return TFaceEntryCoordsListMap(); }
456 static TCoordsEnfVertexMap GetDefaultCoordsEnfVertexMap() { return TCoordsEnfVertexMap(); }
457 static TFaceEntryEnfVertexEntryListMap GetDefaultFaceEntryEnfVertexEntryListMap() { return TFaceEntryEnfVertexEntryListMap(); }
458 static TEnfVertexEntryEnfVertexMap GetDefaultEnfVertexEntryEnfVertexMap() { return TEnfVertexEntryEnfVertexMap(); }
459 static TGroupNameNodeIDMap GetDefaultGroupNameNodeIDMap() { return TGroupNameNodeIDMap(); }
461 static bool GetDefaultInternalEnforcedVertex() { return false; }
464 static TGroupNameEnfVertexListMap GetDefaultGroupNameEnfVertexListMap() { return TGroupNameEnfVertexListMap(); }
465 static TEnfVertexGroupNameMap GetDefaultEnfVertexGroupNameMap() { return TEnfVertexGroupNameMap(); }
468 // const TPreCadPeriodicityEntriesVector _GetPreCadFacesPeriodicityEntries() const { return _preCadFacesPeriodicityEntriesVector; }
470 static TPreCadPeriodicityVector GetDefaultPreCadFacesPeriodicityVector() { return TPreCadPeriodicityVector(); }
471 const TPreCadPeriodicityVector _GetPreCadFacesPeriodicityVector() const { return _preCadFacesPeriodicityVector; }
472 static TPreCadPeriodicityVector GetPreCadFacesPeriodicityVector(const BLSURFPlugin_Hypothesis* hyp);
474 static TPreCadPeriodicityVector GetDefaultPreCadEdgesPeriodicityVector() { return TPreCadPeriodicityVector(); }
475 const TPreCadPeriodicityVector _GetPreCadEdgesPeriodicityVector() const { return _preCadEdgesPeriodicityVector; }
476 static TPreCadPeriodicityVector GetPreCadEdgesPeriodicityVector(const BLSURFPlugin_Hypothesis* hyp);
478 static TFacesPeriodicityVector GetDefaultFacesPeriodicityVector() { return TFacesPeriodicityVector(); }
479 const TFacesPeriodicityVector _GetFacesPeriodicityVector() const { return _facesPeriodicityVector; }
480 static TFacesPeriodicityVector GetFacesPeriodicityVector(const BLSURFPlugin_Hypothesis* hyp);
482 static TEdgesPeriodicityVector GetDefaultEdgesPeriodicityVector() { return TEdgesPeriodicityVector(); }
483 const TEdgesPeriodicityVector _GetEdgesPeriodicityVector() const { return _edgesPeriodicityVector; }
484 static TEdgesPeriodicityVector GetEdgesPeriodicityVector(const BLSURFPlugin_Hypothesis* hyp);
486 static TVerticesPeriodicityVector GetDefaultVerticesPeriodicityVector() { return TVerticesPeriodicityVector(); }
487 const TVerticesPeriodicityVector _GetVerticesPeriodicityVector() const { return _verticesPeriodicityVector; }
488 static TVerticesPeriodicityVector GetVerticesPeriodicityVector(const BLSURFPlugin_Hypothesis* hyp);
490 void ClearPreCadPeriodicityVectors();
492 void AddPreCadFacesPeriodicity(TEntry theFace1Entry, TEntry theFace2Entry,
493 std::vector<std::string> &theSourceVerticesEntries, std::vector<std::string> &theTargetVerticesEntries);
494 void AddPreCadEdgesPeriodicity(TEntry theEdge1Entry, TEntry theEdge2Entry,
495 std::vector<std::string> &theSourceVerticesEntries, std::vector<std::string> &theTargetVerticesEntries);
497 static double undefinedDouble() { return -1.0; }
499 typedef std::map< std::string, std::string > TOptionValues;
500 typedef std::set< std::string > TOptionNames;
502 void SetOptionValue(const std::string& optionName,
503 const std::string& optionValue) throw (std::invalid_argument);
504 void SetPreCADOptionValue(const std::string& optionName,
505 const std::string& optionValue) throw (std::invalid_argument);
506 std::string GetOptionValue(const std::string& optionName, bool* isDefault=0) const throw (std::invalid_argument);
507 std::string GetPreCADOptionValue(const std::string& optionName, bool* isDefault=0) const throw (std::invalid_argument);
508 void ClearOption(const std::string& optionName);
509 void ClearPreCADOption(const std::string& optionName);
510 TOptionValues GetOptionValues() const;
511 TOptionValues GetPreCADOptionValues() const;
512 const TOptionValues& GetCustomOptionValues() const { return _customOption2value; }
514 void AddOption(const std::string& optionName, const std::string& optionValue);
515 void AddPreCADOption(const std::string& optionName, const std::string& optionValue);
516 std::string GetOption(const std::string& optionName) const;
517 std::string GetPreCADOption(const std::string& optionName) const;
519 static bool ToBool(const std::string& str, bool* isOk=0) throw (std::invalid_argument);
520 static double ToDbl(const std::string& str, bool* isOk=0) throw (std::invalid_argument);
521 static int ToInt(const std::string& str, bool* isOk=0) throw (std::invalid_argument);
524 * Sets the file for export resulting mesh in GMF format
526 // void SetGMFFile(const std::string& theFileName, bool isBinary);
527 void SetGMFFile(const std::string& theFileName);
528 std::string GetGMFFile() const { return _GMFFileName; }
529 static std::string GetDefaultGMFFile() { return "";}
530 // bool GetGMFFileMode() const { return _GMFFileMode; }
533 virtual std::ostream & SaveTo(std::ostream & save);
534 virtual std::istream & LoadFrom(std::istream & load);
535 friend std::ostream & operator <<(std::ostream & save, BLSURFPlugin_Hypothesis & hyp);
536 friend std::istream & operator >>(std::istream & load, BLSURFPlugin_Hypothesis & hyp);
539 * \brief Does nothing
540 * \param theMesh - the built mesh
541 * \param theShape - the geometry of interest
542 * \retval bool - always false
544 virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
547 * \brief Initialize my parameter values by default parameters.
548 * \retval bool - true if parameter values have been successfully defined
550 virtual bool SetParametersByDefaults(const TDefaults& dflts, const SMESH_Mesh* theMesh=0);
554 PhysicalMesh _physicalMesh;
555 GeometricMesh _geometricMesh;
558 double _minSize, _maxSize;
559 bool _minSizeRel, _maxSizeRel;
562 bool _useVolumeGradation;
563 double _volumeGradation;
566 double _chordalError;
568 double _anisotropicRatio;
569 bool _removeTinyEdges;
570 double _tinyEdgeLength;
571 bool _optimiseTinyEdges;
572 double _tinyEdgeOptimisationLength;
573 bool _correctSurfaceIntersec;
574 double _corrSurfaceIntersCost;
575 bool _badElementRemoval;
576 double _badElementAspectRatio;
582 bool _preCADMergeEdges;
583 bool _preCADRemoveDuplicateCADFaces;
584 bool _preCADProcess3DTopology;
585 bool _preCADDiscardInput;
586 double _preCADEpsNano;
588 TOptionValues _option2value, _preCADoption2value, _customOption2value; // user defined values
589 TOptionValues _defaultOptionValues; // default values
590 TOptionNames _doubleOptions, _charOptions, _boolOptions; // to find a type of option
591 TOptionNames _preCADdoubleOptions, _preCADcharOptions;
594 TSizeMap _attractors;
595 TAttractorMap _classAttractors;
597 TParamsMap _attParams;
599 TFaceEntryEnfVertexListMap _faceEntryEnfVertexListMap;
600 TEnfVertexList _enfVertexList;
601 // maps to get "manual" enf vertex (through their coordinates)
602 TFaceEntryCoordsListMap _faceEntryCoordsListMap;
603 TCoordsEnfVertexMap _coordsEnfVertexMap;
604 // maps to get "geom" enf vertex (through their geom entries)
605 TFaceEntryEnfVertexEntryListMap _faceEntryEnfVertexEntryListMap;
606 TEnfVertexEntryEnfVertexMap _enfVertexEntryEnfVertexMap;
607 TGroupNameNodeIDMap _groupNameNodeIDMap;
609 // Enable internal enforced vertices on specific face if requested by user
610 // TFaceEntryInternalVerticesList _faceEntryInternalVerticesList;
611 bool _enforcedInternalVerticesAllFaces;
612 TEnfGroupName _enforcedInternalVerticesAllFacesGroup;
614 TPreCadPeriodicityVector _preCadFacesPeriodicityVector;
615 TPreCadPeriodicityVector _preCadEdgesPeriodicityVector;
617 TFacesPeriodicityVector _facesPeriodicityVector;
618 TEdgesPeriodicityVector _edgesPeriodicityVector;
619 TVerticesPeriodicityVector _verticesPeriodicityVector;
621 THyperPatchList _hyperPatchList;
623 // Called by SaveTo to store content of _preCadFacesPeriodicityVector and _preCadEdgesPeriodicityVector
624 void SavePreCADPeriodicity(std::ostream & save, const char* shapeType);
626 // Called by LoadFrom to fill _preCadFacesPeriodicityVector and _preCadEdgesPeriodicityVector
627 void LoadPreCADPeriodicity(std::istream & load, const char* shapeType);
629 // Called by LoadFrom to fill _facesPeriodicityVector
630 void LoadFacesPeriodicity(std::istream & load);
632 // Called by LoadFrom to fill _edgesPeriodicityVector
633 void LoadEdgesPeriodicity(std::istream & load);
635 // Called by LoadFrom to fill _verticesPeriodicityVector
636 void LoadVerticesPeriodicity(std::istream & load);
638 // Called by SaveTo to store content of _facesPeriodicityVector
639 void SaveFacesPeriodicity(std::ostream & save);
641 // Called by SaveTo to store content of _edgesPeriodicityVector
642 void SaveEdgesPeriodicity(std::ostream & save);
644 // Called by SaveTo to store content of _verticesPeriodicityVector
645 void SaveVerticesPeriodicity(std::ostream & save);
647 std::string _GMFFileName;
648 // bool _GMFFileMode;
650 // TSizeMap _customSizeMap;