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, SMESH_Gen * gen);
63 GeometricalGlobalSize,
67 static const char* GetHypType() { return "MG-CADSurf Parameters"; }
69 TopoDS_Shape entryToShape(std::string entry);
71 void SetPhysicalMesh(PhysicalMesh thePhysicalMesh);
72 PhysicalMesh GetPhysicalMesh() const { return _physicalMesh; }
74 void SetGeometricMesh(GeometricMesh theGeometricMesh);
75 GeometricMesh GetGeometricMesh() const { return _geometricMesh; }
77 void SetPhySize(double thePhySize, bool isRelative = false);
78 double GetPhySize() const { return _phySize; }
79 bool IsPhySizeRel() const { return _phySizeRel; }
81 void SetMinSize(double theMinSize, bool isRelative = false);
82 double GetMinSize() const { return _minSize; }
83 bool IsMinSizeRel() const { return _minSizeRel; }
85 void SetMaxSize(double theMaxSize, bool isRelative = false);
86 double GetMaxSize() const { return _maxSize; }
87 bool IsMaxSizeRel() const { return _maxSizeRel; }
89 void SetUseGradation(bool toUse);
90 bool GetUseGradation() const { return _useGradation; }
91 void SetGradation(double theGradation);
92 double GetGradation() const { return _gradation; }
94 void SetUseVolumeGradation(bool toUse);
95 bool GetUseVolumeGradation() const { return _useVolumeGradation; }
96 void SetVolumeGradation(double theGradation);
97 double GetVolumeGradation() const { return _volumeGradation; }
99 void SetQuadAllowed(bool theVal);
100 bool GetQuadAllowed() const { return _quadAllowed; }
102 void SetAngleMesh(double theAngle);
103 double GetAngleMesh() const { return _angleMesh; }
105 void SetChordalError(double theDistance);
106 double GetChordalError() const { return _chordalError; }
108 void SetAnisotropic(bool theVal);
109 bool GetAnisotropic() const { return _anisotropic; }
111 void SetAnisotropicRatio(double theVal);
112 double GetAnisotropicRatio() const { return _anisotropicRatio; }
114 void SetRemoveTinyEdges(bool theVal);
115 bool GetRemoveTinyEdges() const { return _removeTinyEdges; }
117 void SetTinyEdgeLength(double theVal);
118 double GetTinyEdgeLength() const { return _tinyEdgeLength; }
120 void SetOptimiseTinyEdges(bool theVal);
121 bool GetOptimiseTinyEdges() const { return _optimiseTinyEdges; }
123 void SetTinyEdgeOptimisationLength(double theVal);
124 double GetTinyEdgeOptimisationLength() const { return _tinyEdgeOptimisationLength; }
126 void SetCorrectSurfaceIntersection(bool theVal);
127 bool GetCorrectSurfaceIntersection() const { return _correctSurfaceIntersec; }
129 void SetCorrectSurfaceIntersectionMaxCost(double theVal);
130 double GetCorrectSurfaceIntersectionMaxCost() const { return _corrSurfaceIntersCost; }
132 void SetBadElementRemoval(bool theVal);
133 bool GetBadElementRemoval() const { return _badElementRemoval; }
135 void SetBadElementAspectRatio(double theVal);
136 double GetBadElementAspectRatio() const { return _badElementAspectRatio; }
138 void SetOptimizeMesh(bool theVal);
139 bool GetOptimizeMesh() const { return _optimizeMesh; }
141 void SetQuadraticMesh(bool theVal);
142 bool GetQuadraticMesh() const { return _quadraticMesh; }
144 void SetTopology(Topology theTopology);
145 Topology GetTopology() const { return _topology; }
147 void SetVerbosity(int theVal);
148 int GetVerbosity() const { return _verb; }
150 void ClearEntry(const std::string& entry, const char * attEntry = 0);
151 void ClearSizeMaps();
153 void SetEnforceCadEdgesSize( bool toEnforce );
154 bool GetEnforceCadEdgesSize();
156 void SetJacobianRectificationRespectGeometry( bool allowRectification );
157 bool GetJacobianRectificationRespectGeometry();
159 void SetJacobianRectification( bool allowRectification );
160 bool GetJacobianRectification();
162 void SetMaxNumberOfPointsPerPatch( int nb ) throw (std::invalid_argument);
163 int GetMaxNumberOfPointsPerPatch();
165 void SetRespectGeometry( bool toRespect );
166 bool GetRespectGeometry();
168 void SetTinyEdgesAvoidSurfaceIntersections( bool toAvoidIntersection );
169 bool GetTinyEdgesAvoidSurfaceIntersections();
171 void SetClosedGeometry( bool isClosed );
172 bool GetClosedGeometry();
174 void SetDebug( bool isDebug );
177 void SetPeriodicTolerance( double tol ) throw (std::invalid_argument);
178 double GetPeriodicTolerance();
180 void SetRequiredEntities( const std::string& howToTreat ) throw (std::invalid_argument);
181 std::string GetRequiredEntities();
183 void SetSewingTolerance( double tol ) throw (std::invalid_argument);
184 double GetSewingTolerance();
186 void SetTags( const std::string& howToTreat ) throw (std::invalid_argument);
187 std::string GetTags();
189 void SetPreCADMergeEdges(bool theVal);
190 bool GetPreCADMergeEdges() const { return _preCADMergeEdges; }
192 void SetPreCADRemoveTinyUVEdges(bool theVal);
193 bool GetPreCADRemoveTinyUVEdges() const { return _preCADRemoveTinyUVEdges; }
195 void SetPreCADRemoveDuplicateCADFaces(bool theVal);
196 bool GetPreCADRemoveDuplicateCADFaces() const { return _preCADRemoveDuplicateCADFaces; }
198 void SetPreCADProcess3DTopology(bool theVal);
199 bool GetPreCADProcess3DTopology() const { return _preCADProcess3DTopology; }
201 void SetPreCADDiscardInput(bool theVal);
202 bool GetPreCADDiscardInput() const { return _preCADDiscardInput; }
204 static bool HasPreCADOptions(const BLSURFPlugin_Hypothesis* hyp);
206 typedef std::map<std::string,std::string> TSizeMap;
208 void SetSizeMapEntry(const std::string& entry,const std::string& sizeMap );
209 std::string GetSizeMapEntry(const std::string& entry);
210 const TSizeMap& _GetSizeMapEntries() const { return _sizeMap; }
212 * \brief Return the size maps
214 static TSizeMap GetSizeMapEntries(const BLSURFPlugin_Hypothesis* hyp);
217 void SetAttractorEntry(const std::string& entry,const std::string& attractor );
218 std::string GetAttractorEntry(const std::string& entry);
219 const TSizeMap& _GetAttractorEntries() const { return _attractors; };
221 * \brief Return the attractors
223 static TSizeMap GetAttractorEntries(const BLSURFPlugin_Hypothesis* hyp);
227 void SetCustomSizeMapEntry(const std::string& entry,const std::string& sizeMap );
228 std::string GetCustomSizeMapEntry(const std::string& entry);
229 void UnsetCustomSizeMap(const std::string& entry);
230 const TSizeMap& GetCustomSizeMapEntries() const { return _customSizeMap; }
233 typedef std::multimap< std::string, BLSURFPlugin_Attractor* > TAttractorMap;
234 typedef std::map< std::string, std::vector<double> > TParamsMap; //TODO à finir
236 void SetClassAttractorEntry(const std::string& entry, const std::string& att_entry, double StartSize, double EndSize, double ActionRadius, double ConstantRadius);
237 std::string GetClassAttractorEntry(const std::string& entry);
238 const TAttractorMap& _GetClassAttractorEntries() const { return _classAttractors; }
240 * \brief Return the attractors entries
242 static TAttractorMap GetClassAttractorEntries(const BLSURFPlugin_Hypothesis* hyp);
245 * To set/get/unset an enforced vertex
248 typedef std::string TEnfName;
250 typedef std::string TEntry;
252 typedef std::set<TEntry> TEntryList;
254 typedef std::string TEnfGroupName;
256 typedef std::vector<double> TEnfVertexCoords;
257 typedef std::set< TEnfVertexCoords > TEnfVertexCoordsList;
263 TEnfVertexCoords coords;
264 TEnfGroupName grpName;
265 TEntryList faceEntries;
266 TopoDS_Vertex vertex;
269 struct CompareEnfVertices
271 bool operator () (const TEnfVertex* e1, const TEnfVertex* e2) const {
273 if (e1->coords.size() && e2->coords.size())
274 return (e1->coords < e2->coords);
276 return (e1->geomEntry < e2->geomEntry);
282 // PreCad Face and Edge periodicity
283 struct TPreCadPeriodicity {
286 std::vector<std::string> theSourceVerticesEntries;
287 std::vector<std::string> theTargetVerticesEntries;
291 struct TEdgePeriodicity {
292 TEntry theFace1Entry;
293 TEntry theEdge1Entry;
294 TEntry theFace2Entry;
295 TEntry theEdge2Entry;
296 int edge_orientation;
299 // Vertex periodicity
300 struct TVertexPeriodicity {
301 TEntry theEdge1Entry;
302 TEntry theVertex1Entry;
303 TEntry theEdge2Entry;
304 TEntry theVertex2Entry;
307 typedef std::pair< TEntry, TEntry > TFacesPeriodicity;
309 // List of enforced vertices
310 typedef std::set< TEnfVertex*, CompareEnfVertices > TEnfVertexList;
312 // Map Face Entry / List of enforced vertices
313 typedef std::map< TEntry, TEnfVertexList > TFaceEntryEnfVertexListMap;
315 // List of Face Entry with internal enforced vertices activated
316 typedef std::set< TEntry > TFaceEntryInternalVerticesList;
318 // Map Face Entry / List of coords
319 typedef std::map< TEntry, TEnfVertexCoordsList > TFaceEntryCoordsListMap;
321 // Map Face Entry / List of Vertex entry
322 typedef std::map< TEntry, TEntryList > TFaceEntryEnfVertexEntryListMap;
324 // Map Coords / Enforced vertex
325 typedef std::map< TEnfVertexCoords, TEnfVertex* > TCoordsEnfVertexMap;
327 // Map Vertex entry / Enforced vertex
328 typedef std::map< TEntry, TEnfVertex* > TEnfVertexEntryEnfVertexMap;
330 typedef std::map< TEnfGroupName, std::set<int> > TGroupNameNodeIDMap;
332 // Map Group Name / List of enforced vertices
333 typedef std::map< TEnfGroupName , TEnfVertexList > TGroupNameEnfVertexListMap;
336 // Vector of pairs of entries
337 typedef std::vector< TPreCadPeriodicity > TPreCadPeriodicityVector;
338 typedef std::vector< TFacesPeriodicity > TFacesPeriodicityVector;
339 typedef std::vector< TEdgePeriodicity > TEdgesPeriodicityVector;
340 typedef std::vector< TVertexPeriodicity > TVerticesPeriodicityVector;
343 bool SetEnforcedVertex(TEntry theFaceEntry, TEnfName theVertexName, TEntry theVertexEntry, TEnfGroupName theGroupName,
344 double x = 0.0, double y = 0.0, double z = 0.0);
345 TEnfVertexList GetEnfVertexList(const TEntry& theFaceEntry) throw (std::invalid_argument);
346 TEnfVertexCoordsList GetEnfVertexCoordsList(const TEntry& theFaceEntry) throw (std::invalid_argument);
347 TEntryList GetEnfVertexEntryList (const TEntry& theFaceEntry) throw (std::invalid_argument);
348 TEnfVertex* GetEnfVertex(TEnfVertexCoords coords) throw (std::invalid_argument);
349 TEnfVertex* GetEnfVertex(const TEntry& theEnfVertexEntry) throw (std::invalid_argument);
350 void AddEnfVertexNodeID(TEnfGroupName theGroupName,int theNodeID);
351 std::set<int> GetEnfVertexNodeIDs(TEnfGroupName theGroupName) throw (std::invalid_argument);
352 void RemoveEnfVertexNodeID(TEnfGroupName theGroupName,int theNodeID) throw (std::invalid_argument);
354 bool ClearEnforcedVertex(const TEntry& theFaceEntry, double x = 0.0, double y = 0.0, double z = 0.0, const TEntry& theVertexEntry="") throw (std::invalid_argument);
355 bool ClearEnforcedVertices(const TEntry& theFaceEntry) throw (std::invalid_argument);
357 void ClearAllEnforcedVertices();
359 const TFaceEntryEnfVertexListMap _GetAllEnforcedVerticesByFace() const { return _faceEntryEnfVertexListMap; }
360 const TEnfVertexList _GetAllEnforcedVertices() const { return _enfVertexList; }
362 const TFaceEntryCoordsListMap _GetAllCoordsByFace() const { return _faceEntryCoordsListMap; }
363 const TCoordsEnfVertexMap _GetAllEnforcedVerticesByCoords() const { return _coordsEnfVertexMap; }
365 const TFaceEntryEnfVertexEntryListMap _GetAllEnfVertexEntriesByFace() const { return _faceEntryEnfVertexEntryListMap; }
366 const TEnfVertexEntryEnfVertexMap _GetAllEnforcedVerticesByEnfVertexEntry() const { return _enfVertexEntryEnfVertexMap; }
369 // const TEnfVertexGroupNameMap _GetEnforcedVertexGroupNameMap() const { return _enfVertexGroupNameMap; }
373 * \brief Return the enforced vertices
375 static TFaceEntryEnfVertexListMap GetAllEnforcedVerticesByFace(const BLSURFPlugin_Hypothesis* hyp);
376 static TEnfVertexList GetAllEnforcedVertices(const BLSURFPlugin_Hypothesis* hyp);
378 static TFaceEntryCoordsListMap GetAllCoordsByFace(const BLSURFPlugin_Hypothesis* hyp);
379 static TCoordsEnfVertexMap GetAllEnforcedVerticesByCoords(const BLSURFPlugin_Hypothesis* hyp);
381 static TFaceEntryEnfVertexEntryListMap GetAllEnfVertexEntriesByFace(const BLSURFPlugin_Hypothesis* hyp);
382 static TEnfVertexEntryEnfVertexMap GetAllEnforcedVerticesByEnfVertexEntry(const BLSURFPlugin_Hypothesis* hyp);
385 * \brief Internal enforced vertices
387 void SetInternalEnforcedVertexAllFaces(bool toEnforceInternalVertices);
388 const bool _GetInternalEnforcedVertexAllFaces() const { return _enforcedInternalVerticesAllFaces; }
389 static bool GetInternalEnforcedVertexAllFaces( const BLSURFPlugin_Hypothesis* hyp );
390 void SetInternalEnforcedVertexAllFacesGroup(TEnfGroupName theGroupName);
391 const TEnfGroupName _GetInternalEnforcedVertexAllFacesGroup() const { return _enforcedInternalVerticesAllFacesGroup; }
392 static TEnfGroupName GetInternalEnforcedVertexAllFacesGroup( const BLSURFPlugin_Hypothesis* hyp );
394 // Enable internal enforced vertices on specific face if requested by user
395 // static TFaceEntryInternalVerticesList GetDefaultFaceEntryInternalVerticesMap() { return TFaceEntryInternalVerticesList(); }
396 // const TFaceEntryInternalVerticesList _GetAllInternalEnforcedVerticesByFace() const { return _faceEntryInternalVerticesList; }
397 // static TFaceEntryInternalVerticesList GetAllInternalEnforcedVerticesByFace(const BLSURFPlugin_Hypothesis* hyp);
398 // void SetInternalEnforcedVertex(TEntry theFaceEntry, bool toEnforceInternalVertices, TEnfGroupName theGroupName);
399 // bool GetInternalEnforcedVertex(const TEntry& theFaceEntry);
401 static PhysicalMesh GetDefaultPhysicalMesh() { return PhysicalGlobalSize; }
402 static GeometricMesh GetDefaultGeometricMesh() { return GeometricalGlobalSize; }
403 static double GetDefaultPhySize(double diagonal, double bbSegmentation);
404 static double GetDefaultPhySize() { return undefinedDouble(); }
405 static bool GetDefaultPhySizeRel() { return false; }
406 static double GetDefaultMinSize(double diagonal);
407 static double GetDefaultMinSize() { return undefinedDouble(); }
408 static bool GetDefaultMinSizeRel() { return false; }
409 static double GetDefaultMaxSize(double diagonal);
410 static double GetDefaultMaxSize() { return undefinedDouble(); }
411 static bool GetDefaultMaxSizeRel() { return false; }
412 static bool GetDefaultUseGradation() { return true; }
413 static double GetDefaultGradation() { return 1.3; }
414 static bool GetDefaultUseVolumeGradation() { return false; }
415 static double GetDefaultVolumeGradation() { return 2; }
416 static bool GetDefaultQuadAllowed() { return false; }
417 static double GetDefaultAngleMesh() { return 8.0; }
419 static double GetDefaultChordalError(double diagonal);
420 static double GetDefaultChordalError() { return undefinedDouble(); }
421 static bool GetDefaultAnisotropic() { return false; }
422 static double GetDefaultAnisotropicRatio() { return 0.0; }
423 static bool GetDefaultRemoveTinyEdges() { return false; }
424 static double GetDefaultTinyEdgeLength(double diagonal);
425 static double GetDefaultTinyEdgeLength() { return undefinedDouble(); }
426 static bool GetDefaultOptimiseTinyEdges() { return false; }
427 static double GetDefaultTinyEdgeOptimisationLength(double diagonal);
428 static double GetDefaultTinyEdgeOptimisationLength() { return undefinedDouble(); }
429 static bool GetDefaultCorrectSurfaceIntersection() { return true; }
430 static double GetDefaultCorrectSurfaceIntersectionMaxCost() { return 15.; }
431 static bool GetDefaultBadElementRemoval() { return false; }
432 static double GetDefaultBadElementAspectRatio() {return 1000.0; }
433 static bool GetDefaultOptimizeMesh() { return true; }
434 static bool GetDefaultQuadraticMesh() { return false; }
436 static int GetDefaultVerbosity() { return 3; }
437 static Topology GetDefaultTopology() { return FromCAD; }
439 static bool GetDefaultPreCADMergeEdges() { return false; }
440 static bool GetDefaultPreCADRemoveTinyUVEdges() { return false; }
441 static bool GetDefaultPreCADRemoveDuplicateCADFaces() { return false; }
442 static bool GetDefaultPreCADProcess3DTopology() { return false; }
443 static bool GetDefaultPreCADDiscardInput() { return false; }
445 static TSizeMap GetDefaultSizeMap() { return TSizeMap();}
446 static TAttractorMap GetDefaultAttractorMap() { return TAttractorMap(); }
448 static TFaceEntryEnfVertexListMap GetDefaultFaceEntryEnfVertexListMap() { return TFaceEntryEnfVertexListMap(); }
449 static TEnfVertexList GetDefaultEnfVertexList() { return TEnfVertexList(); }
450 static TFaceEntryCoordsListMap GetDefaultFaceEntryCoordsListMap() { return TFaceEntryCoordsListMap(); }
451 static TCoordsEnfVertexMap GetDefaultCoordsEnfVertexMap() { return TCoordsEnfVertexMap(); }
452 static TFaceEntryEnfVertexEntryListMap GetDefaultFaceEntryEnfVertexEntryListMap() { return TFaceEntryEnfVertexEntryListMap(); }
453 static TEnfVertexEntryEnfVertexMap GetDefaultEnfVertexEntryEnfVertexMap() { return TEnfVertexEntryEnfVertexMap(); }
454 static TGroupNameNodeIDMap GetDefaultGroupNameNodeIDMap() { return TGroupNameNodeIDMap(); }
456 static bool GetDefaultInternalEnforcedVertex() { return false; }
459 static TGroupNameEnfVertexListMap GetDefaultGroupNameEnfVertexListMap() { return TGroupNameEnfVertexListMap(); }
460 static TEnfVertexGroupNameMap GetDefaultEnfVertexGroupNameMap() { return TEnfVertexGroupNameMap(); }
463 // const TPreCadPeriodicityEntriesVector _GetPreCadFacesPeriodicityEntries() const { return _preCadFacesPeriodicityEntriesVector; }
465 static TPreCadPeriodicityVector GetDefaultPreCadFacesPeriodicityVector() { return TPreCadPeriodicityVector(); }
466 const TPreCadPeriodicityVector _GetPreCadFacesPeriodicityVector() const { return _preCadFacesPeriodicityVector; }
467 static TPreCadPeriodicityVector GetPreCadFacesPeriodicityVector(const BLSURFPlugin_Hypothesis* hyp);
469 static TPreCadPeriodicityVector GetDefaultPreCadEdgesPeriodicityVector() { return TPreCadPeriodicityVector(); }
470 const TPreCadPeriodicityVector _GetPreCadEdgesPeriodicityVector() const { return _preCadEdgesPeriodicityVector; }
471 static TPreCadPeriodicityVector GetPreCadEdgesPeriodicityVector(const BLSURFPlugin_Hypothesis* hyp);
473 static TFacesPeriodicityVector GetDefaultFacesPeriodicityVector() { return TFacesPeriodicityVector(); }
474 const TFacesPeriodicityVector _GetFacesPeriodicityVector() const { return _facesPeriodicityVector; }
475 static TFacesPeriodicityVector GetFacesPeriodicityVector(const BLSURFPlugin_Hypothesis* hyp);
477 static TEdgesPeriodicityVector GetDefaultEdgesPeriodicityVector() { return TEdgesPeriodicityVector(); }
478 const TEdgesPeriodicityVector _GetEdgesPeriodicityVector() const { return _edgesPeriodicityVector; }
479 static TEdgesPeriodicityVector GetEdgesPeriodicityVector(const BLSURFPlugin_Hypothesis* hyp);
481 static TVerticesPeriodicityVector GetDefaultVerticesPeriodicityVector() { return TVerticesPeriodicityVector(); }
482 const TVerticesPeriodicityVector _GetVerticesPeriodicityVector() const { return _verticesPeriodicityVector; }
483 static TVerticesPeriodicityVector GetVerticesPeriodicityVector(const BLSURFPlugin_Hypothesis* hyp);
485 void ClearPreCadPeriodicityVectors();
487 void AddPreCadFacesPeriodicity(TEntry theFace1Entry, TEntry theFace2Entry,
488 std::vector<std::string> &theSourceVerticesEntries, std::vector<std::string> &theTargetVerticesEntries);
489 void AddPreCadEdgesPeriodicity(TEntry theEdge1Entry, TEntry theEdge2Entry,
490 std::vector<std::string> &theSourceVerticesEntries, std::vector<std::string> &theTargetVerticesEntries);
492 static double undefinedDouble() { return -1.0; }
494 typedef std::map< std::string, std::string > TOptionValues;
495 typedef std::set< std::string > TOptionNames;
497 void SetOptionValue(const std::string& optionName,
498 const std::string& optionValue) throw (std::invalid_argument);
499 void SetPreCADOptionValue(const std::string& optionName,
500 const std::string& optionValue) throw (std::invalid_argument);
501 std::string GetOptionValue(const std::string& optionName, bool* isDefault=0) const throw (std::invalid_argument);
502 std::string GetPreCADOptionValue(const std::string& optionName, bool* isDefault=0) const throw (std::invalid_argument);
503 void ClearOption(const std::string& optionName);
504 void ClearPreCADOption(const std::string& optionName);
505 TOptionValues GetOptionValues() const;
506 TOptionValues GetPreCADOptionValues() const;
507 const TOptionValues& GetCustomOptionValues() const { return _customOption2value; }
509 void AddOption(const std::string& optionName, const std::string& optionValue);
510 void AddPreCADOption(const std::string& optionName, const std::string& optionValue);
511 std::string GetOption(const std::string& optionName) const;
512 std::string GetPreCADOption(const std::string& optionName) const;
514 static bool ToBool(const std::string& str, bool* isOk=0) throw (std::invalid_argument);
515 static double ToDbl(const std::string& str, bool* isOk=0) throw (std::invalid_argument);
516 static int ToInt(const std::string& str, bool* isOk=0) throw (std::invalid_argument);
519 * Sets the file for export resulting mesh in GMF format
521 // void SetGMFFile(const std::string& theFileName, bool isBinary);
522 void SetGMFFile(const std::string& theFileName);
523 std::string GetGMFFile() const { return _GMFFileName; }
524 static std::string GetDefaultGMFFile() { return "";}
525 // bool GetGMFFileMode() const { return _GMFFileMode; }
528 virtual std::ostream & SaveTo(std::ostream & save);
529 virtual std::istream & LoadFrom(std::istream & load);
530 friend std::ostream & operator <<(std::ostream & save, BLSURFPlugin_Hypothesis & hyp);
531 friend std::istream & operator >>(std::istream & load, BLSURFPlugin_Hypothesis & hyp);
534 * \brief Does nothing
535 * \param theMesh - the built mesh
536 * \param theShape - the geometry of interest
537 * \retval bool - always false
539 virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
542 * \brief Initialize my parameter values by default parameters.
543 * \retval bool - true if parameter values have been successfully defined
545 virtual bool SetParametersByDefaults(const TDefaults& dflts, const SMESH_Mesh* theMesh=0);
549 PhysicalMesh _physicalMesh;
550 GeometricMesh _geometricMesh;
553 double _minSize, _maxSize;
554 bool _minSizeRel, _maxSizeRel;
557 bool _useVolumeGradation;
558 double _volumeGradation;
561 double _chordalError;
563 double _anisotropicRatio;
564 bool _removeTinyEdges;
565 double _tinyEdgeLength;
566 bool _optimiseTinyEdges;
567 double _tinyEdgeOptimisationLength;
568 bool _correctSurfaceIntersec;
569 double _corrSurfaceIntersCost;
570 bool _badElementRemoval;
571 double _badElementAspectRatio;
577 bool _preCADMergeEdges;
578 bool _preCADRemoveTinyUVEdges;
579 bool _preCADRemoveDuplicateCADFaces;
580 bool _preCADProcess3DTopology;
581 bool _preCADDiscardInput;
582 double _preCADEpsNano;
584 TOptionValues _option2value, _preCADoption2value, _customOption2value; // user defined values
585 TOptionValues _defaultOptionValues; // default values
586 TOptionNames _doubleOptions, _charOptions, _boolOptions; // to find a type of option
587 TOptionNames _preCADdoubleOptions, _preCADcharOptions;
590 TSizeMap _attractors;
591 TAttractorMap _classAttractors;
593 TParamsMap _attParams;
595 TFaceEntryEnfVertexListMap _faceEntryEnfVertexListMap;
596 TEnfVertexList _enfVertexList;
597 // maps to get "manual" enf vertex (through their coordinates)
598 TFaceEntryCoordsListMap _faceEntryCoordsListMap;
599 TCoordsEnfVertexMap _coordsEnfVertexMap;
600 // maps to get "geom" enf vertex (through their geom entries)
601 TFaceEntryEnfVertexEntryListMap _faceEntryEnfVertexEntryListMap;
602 TEnfVertexEntryEnfVertexMap _enfVertexEntryEnfVertexMap;
603 TGroupNameNodeIDMap _groupNameNodeIDMap;
605 // Enable internal enforced vertices on specific face if requested by user
606 // TFaceEntryInternalVerticesList _faceEntryInternalVerticesList;
607 bool _enforcedInternalVerticesAllFaces;
608 TEnfGroupName _enforcedInternalVerticesAllFacesGroup;
610 TPreCadPeriodicityVector _preCadFacesPeriodicityVector;
611 TPreCadPeriodicityVector _preCadEdgesPeriodicityVector;
613 TFacesPeriodicityVector _facesPeriodicityVector;
614 TEdgesPeriodicityVector _edgesPeriodicityVector;
615 TVerticesPeriodicityVector _verticesPeriodicityVector;
617 // Called by SaveTo to store content of _preCadFacesPeriodicityVector and _preCadEdgesPeriodicityVector
618 void SavePreCADPeriodicity(std::ostream & save, const char* shapeType);
620 // Called by LoadFrom to fill _preCadFacesPeriodicityVector and _preCadEdgesPeriodicityVector
621 void LoadPreCADPeriodicity(std::istream & load, const char* shapeType);
623 // Called by LoadFrom to fill _facesPeriodicityVector
624 void LoadFacesPeriodicity(std::istream & load);
626 // Called by LoadFrom to fill _edgesPeriodicityVector
627 void LoadEdgesPeriodicity(std::istream & load);
629 // Called by LoadFrom to fill _verticesPeriodicityVector
630 void LoadVerticesPeriodicity(std::istream & load);
632 // Called by SaveTo to store content of _facesPeriodicityVector
633 void SaveFacesPeriodicity(std::ostream & save);
635 // Called by SaveTo to store content of _edgesPeriodicityVector
636 void SaveEdgesPeriodicity(std::ostream & save);
638 // Called by SaveTo to store content of _verticesPeriodicityVector
639 void SaveVerticesPeriodicity(std::ostream & save);
641 std::string _GMFFileName;
642 // bool _GMFFileMode;
644 // TSizeMap _customSizeMap;