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 static std::string GetMeshGemsVersion();
80 void SetPhysicalMesh(PhysicalMesh thePhysicalMesh);
81 PhysicalMesh GetPhysicalMesh() const { return _physicalMesh; }
83 void SetGeometricMesh(GeometricMesh theGeometricMesh);
84 GeometricMesh GetGeometricMesh() const { return _geometricMesh; }
86 void SetPhySize(double thePhySize, bool isRelative = false);
87 double GetPhySize() const { return _phySize; }
88 bool IsPhySizeRel() const { return _phySizeRel; }
90 void SetMinSize(double theMinSize, bool isRelative = false);
91 double GetMinSize() const { return _minSize; }
92 bool IsMinSizeRel() const { return _minSizeRel; }
94 void SetMaxSize(double theMaxSize, bool isRelative = false);
95 double GetMaxSize() const { return _maxSize; }
96 bool IsMaxSizeRel() const { return _maxSizeRel; }
98 void SetUseGradation(bool toUse);
99 bool GetUseGradation() const { return _useGradation; }
100 void SetGradation(double theGradation);
101 double GetGradation() const { return _gradation; }
103 void SetUseVolumeGradation(bool toUse);
104 bool GetUseVolumeGradation() const { return _useVolumeGradation; }
105 void SetVolumeGradation(double theGradation);
106 double GetVolumeGradation() const { return _volumeGradation; }
108 void SetElementType(ElementType theElementType);
109 ElementType GetElementType() const { return _elementType; }
111 void SetAngleMesh(double theAngle);
112 double GetAngleMesh() const { return _angleMesh; }
114 void SetChordalError(double theDistance);
115 double GetChordalError() const { return _chordalError; }
117 void SetAnisotropic(bool theVal);
118 bool GetAnisotropic() const { return _anisotropic; }
120 void SetAnisotropicRatio(double theVal);
121 double GetAnisotropicRatio() const { return _anisotropicRatio; }
123 void SetRemoveTinyEdges(bool theVal);
124 bool GetRemoveTinyEdges() const { return _removeTinyEdges; }
126 void SetTinyEdgeLength(double theVal);
127 double GetTinyEdgeLength() const { return _tinyEdgeLength; }
129 void SetOptimiseTinyEdges(bool theVal);
130 bool GetOptimiseTinyEdges() const { return _optimiseTinyEdges; }
132 void SetTinyEdgeOptimisationLength(double theVal);
133 double GetTinyEdgeOptimisationLength() const { return _tinyEdgeOptimisationLength; }
135 void SetCorrectSurfaceIntersection(bool theVal);
136 bool GetCorrectSurfaceIntersection() const { return _correctSurfaceIntersec; }
138 void SetCorrectSurfaceIntersectionMaxCost(double theVal);
139 double GetCorrectSurfaceIntersectionMaxCost() const { return _corrSurfaceIntersCost; }
141 void SetBadElementRemoval(bool theVal);
142 bool GetBadElementRemoval() const { return _badElementRemoval; }
144 void SetBadElementAspectRatio(double theVal);
145 double GetBadElementAspectRatio() const { return _badElementAspectRatio; }
147 void SetOptimizeMesh(bool theVal);
148 bool GetOptimizeMesh() const { return _optimizeMesh; }
150 void SetQuadraticMesh(bool theVal);
151 bool GetQuadraticMesh() const { return _quadraticMesh; }
153 void SetTopology(Topology theTopology);
154 Topology GetTopology() const { return _topology; }
156 bool GetUseSurfaceProximity() const { return _useSurfaceProximity; }
157 void SetUseSurfaceProximity( bool toUse );
159 int GetNbSurfaceProximityLayers() const { return _nbSurfaceProximityLayers; }
160 void SetNbSurfaceProximityLayers( int nbLayers );
162 double GetSurfaceProximityRatio() const { return _surfaceProximityRatio; }
163 void SetSurfaceProximityRatio( double ratio );
165 bool GetUseVolumeProximity() const { return _useVolumeProximity; }
166 void SetUseVolumeProximity( bool toUse );
168 int GetNbVolumeProximityLayers() const { return _nbVolumeProximityLayers; }
169 void SetNbVolumeProximityLayers( int nbLayers );
171 double GetVolumeProximityRatio() const { return _volumeProximityRatio; }
172 void SetVolumeProximityRatio( double ratio );
174 void SetVerbosity(int theVal);
175 int GetVerbosity() const { return _verb; }
177 void ClearEntry(const std::string& entry, const char * attEntry = 0);
178 void ClearSizeMaps();
180 void SetEnforceCadEdgesSize( bool toEnforce );
181 bool GetEnforceCadEdgesSize();
183 void SetJacobianRectificationRespectGeometry( bool allowRectification );
184 bool GetJacobianRectificationRespectGeometry();
186 void SetUseDeprecatedPatchMesher( bool useDeprecatedPatchMesher );
187 bool GetUseDeprecatedPatchMesher();
189 void SetJacobianRectification( bool allowRectification );
190 bool GetJacobianRectification();
192 void SetMaxNumberOfPointsPerPatch( int nb ) throw (std::invalid_argument);
193 int GetMaxNumberOfPointsPerPatch();
195 void SetMaxNumberOfThreads( int nb ) throw (std::invalid_argument);
196 int GetMaxNumberOfThreads();
198 void SetRespectGeometry( bool toRespect );
199 bool GetRespectGeometry();
201 void SetTinyEdgesAvoidSurfaceIntersections( bool toAvoidIntersection );
202 bool GetTinyEdgesAvoidSurfaceIntersections();
204 void SetClosedGeometry( bool isClosed );
205 bool GetClosedGeometry();
207 void SetDebug( bool isDebug );
210 void SetPeriodicTolerance( double tol ) throw (std::invalid_argument);
211 double GetPeriodicTolerance();
213 void SetRequiredEntities( const std::string& howToTreat ) throw (std::invalid_argument);
214 std::string GetRequiredEntities();
216 void SetSewingTolerance( double tol ) throw (std::invalid_argument);
217 double GetSewingTolerance();
219 void SetTags( const std::string& howToTreat ) throw (std::invalid_argument);
220 std::string GetTags();
223 typedef std::set< int > THyperPatchTags;
224 typedef std::vector< THyperPatchTags > THyperPatchList;
226 void SetHyperPatches(const THyperPatchList& hpl);
227 const THyperPatchList& GetHyperPatches() const { return _hyperPatchList; }
228 static int GetHyperPatchTag( int faceTag, const BLSURFPlugin_Hypothesis* hyp, int* iPatch=0 );
230 void SetPreCADMergeEdges(bool theVal);
231 bool GetPreCADMergeEdges() const { return _preCADMergeEdges; }
233 void SetPreCADRemoveDuplicateCADFaces(bool theVal);
234 bool GetPreCADRemoveDuplicateCADFaces() const { return _preCADRemoveDuplicateCADFaces; }
236 void SetPreCADProcess3DTopology(bool theVal);
237 bool GetPreCADProcess3DTopology() const { return _preCADProcess3DTopology; }
239 void SetPreCADDiscardInput(bool theVal);
240 bool GetPreCADDiscardInput() const { return _preCADDiscardInput; }
242 static bool HasPreCADOptions(const BLSURFPlugin_Hypothesis* hyp);
244 typedef std::map<std::string,std::string> TSizeMap;
246 void SetSizeMapEntry(const std::string& entry,const std::string& sizeMap );
247 std::string GetSizeMapEntry(const std::string& entry);
248 const TSizeMap& _GetSizeMapEntries() const { return _sizeMap; }
250 * \brief Return the size maps
252 static TSizeMap GetSizeMapEntries(const BLSURFPlugin_Hypothesis* hyp);
255 void SetAttractorEntry(const std::string& entry,const std::string& attractor );
256 std::string GetAttractorEntry(const std::string& entry);
257 const TSizeMap& _GetAttractorEntries() const { return _attractors; };
259 * \brief Return the attractors
261 static TSizeMap GetAttractorEntries(const BLSURFPlugin_Hypothesis* hyp);
265 void SetCustomSizeMapEntry(const std::string& entry,const std::string& sizeMap );
266 std::string GetCustomSizeMapEntry(const std::string& entry);
267 void UnsetCustomSizeMap(const std::string& entry);
268 const TSizeMap& GetCustomSizeMapEntries() const { return _customSizeMap; }
271 typedef std::multimap< std::string, BLSURFPlugin_Attractor* > TAttractorMap;
272 typedef std::map< std::string, std::vector<double> > TParamsMap; //TODO ?? finir
274 void SetClassAttractorEntry(const std::string& entry, const std::string& att_entry, double StartSize, double EndSize, double ActionRadius, double ConstantRadius);
275 std::string GetClassAttractorEntry(const std::string& entry);
276 const TAttractorMap& _GetClassAttractorEntries() const { return _classAttractors; }
278 * \brief Return the attractors entries
280 static TAttractorMap GetClassAttractorEntries(const BLSURFPlugin_Hypothesis* hyp);
283 * To set/get/unset an enforced vertex
286 typedef std::string TEnfName;
288 typedef std::string TEntry;
290 typedef std::set<TEntry> TEntryList;
292 typedef std::string TEnfGroupName;
294 typedef std::vector<double> TEnfVertexCoords;
295 typedef std::set< TEnfVertexCoords > TEnfVertexCoordsList;
301 TEnfVertexCoords coords;
302 TEnfGroupName grpName;
303 TEntryList faceEntries;
304 TopoDS_Vertex vertex;
307 struct CompareEnfVertices
309 bool operator () (const TEnfVertex* e1, const TEnfVertex* e2) const {
311 if (e1->coords.size() && e2->coords.size())
312 return (e1->coords < e2->coords);
314 return (e1->geomEntry < e2->geomEntry);
320 // PreCad Face and Edge periodicity
321 struct TPreCadPeriodicity {
324 std::vector<std::string> theSourceVerticesEntries;
325 std::vector<std::string> theTargetVerticesEntries;
329 struct TEdgePeriodicity {
330 TEntry theFace1Entry;
331 TEntry theEdge1Entry;
332 TEntry theFace2Entry;
333 TEntry theEdge2Entry;
334 int edge_orientation;
337 // Vertex periodicity
338 struct TVertexPeriodicity {
339 TEntry theEdge1Entry;
340 TEntry theVertex1Entry;
341 TEntry theEdge2Entry;
342 TEntry theVertex2Entry;
345 typedef std::pair< TEntry, TEntry > TFacesPeriodicity;
347 // List of enforced vertices
348 typedef std::set< TEnfVertex*, CompareEnfVertices > TEnfVertexList;
350 // Map Face Entry / List of enforced vertices
351 typedef std::map< TEntry, TEnfVertexList > TFaceEntryEnfVertexListMap;
353 // List of Face Entry with internal enforced vertices activated
354 typedef std::set< TEntry > TFaceEntryInternalVerticesList;
356 // Map Face Entry / List of coords
357 typedef std::map< TEntry, TEnfVertexCoordsList > TFaceEntryCoordsListMap;
359 // Map Face Entry / List of Vertex entry
360 typedef std::map< TEntry, TEntryList > TFaceEntryEnfVertexEntryListMap;
362 // Map Coords / Enforced vertex
363 typedef std::map< TEnfVertexCoords, TEnfVertex* > TCoordsEnfVertexMap;
365 // Map Vertex entry / Enforced vertex
366 typedef std::map< TEntry, TEnfVertex* > TEnfVertexEntryEnfVertexMap;
368 typedef std::map< TEnfGroupName, std::set<int> > TGroupNameNodeIDMap;
370 // Map Group Name / List of enforced vertices
371 typedef std::map< TEnfGroupName , TEnfVertexList > TGroupNameEnfVertexListMap;
374 // Vector of pairs of entries
375 typedef std::vector< TPreCadPeriodicity > TPreCadPeriodicityVector;
376 typedef std::vector< TFacesPeriodicity > TFacesPeriodicityVector;
377 typedef std::vector< TEdgePeriodicity > TEdgesPeriodicityVector;
378 typedef std::vector< TVertexPeriodicity > TVerticesPeriodicityVector;
381 bool SetEnforcedVertex(TEntry theFaceEntry, TEnfName theVertexName, TEntry theVertexEntry, TEnfGroupName theGroupName,
382 double x = 0.0, double y = 0.0, double z = 0.0);
383 TEnfVertexList GetEnfVertexList(const TEntry& theFaceEntry) throw (std::invalid_argument);
384 TEnfVertexCoordsList GetEnfVertexCoordsList(const TEntry& theFaceEntry) throw (std::invalid_argument);
385 TEntryList GetEnfVertexEntryList (const TEntry& theFaceEntry) throw (std::invalid_argument);
386 TEnfVertex* GetEnfVertex(TEnfVertexCoords coords) throw (std::invalid_argument);
387 TEnfVertex* GetEnfVertex(const TEntry& theEnfVertexEntry) throw (std::invalid_argument);
388 void AddEnfVertexNodeID(TEnfGroupName theGroupName,int theNodeID);
389 std::set<int> GetEnfVertexNodeIDs(TEnfGroupName theGroupName) throw (std::invalid_argument);
390 void RemoveEnfVertexNodeID(TEnfGroupName theGroupName,int theNodeID) throw (std::invalid_argument);
392 bool ClearEnforcedVertex(const TEntry& theFaceEntry, double x = 0.0, double y = 0.0, double z = 0.0, const TEntry& theVertexEntry="") throw (std::invalid_argument);
393 bool ClearEnforcedVertices(const TEntry& theFaceEntry) throw (std::invalid_argument);
395 void ClearAllEnforcedVertices();
396 void AddEnforcedVertex( const TEntry& theFaceEntry, TEnfVertex * theEnfVertex );
398 const TFaceEntryEnfVertexListMap& _GetAllEnforcedVerticesByFace() const { return _faceEntryEnfVertexListMap; }
399 const TEnfVertexList& _GetAllEnforcedVertices() const { return _enfVertexList; }
401 const TFaceEntryCoordsListMap& _GetAllCoordsByFace() const { return _faceEntryCoordsListMap; }
402 const TCoordsEnfVertexMap& _GetAllEnforcedVerticesByCoords() const { return _coordsEnfVertexMap; }
404 const TFaceEntryEnfVertexEntryListMap& _GetAllEnfVertexEntriesByFace() const { return _faceEntryEnfVertexEntryListMap; }
405 const TEnfVertexEntryEnfVertexMap& _GetAllEnforcedVerticesByEnfVertexEntry() const { return _enfVertexEntryEnfVertexMap; }
408 // const TEnfVertexGroupNameMap _GetEnforcedVertexGroupNameMap() const { return _enfVertexGroupNameMap; }
412 * \brief Return the enforced vertices
414 static TFaceEntryEnfVertexListMap GetAllEnforcedVerticesByFace(const BLSURFPlugin_Hypothesis* hyp);
415 static TEnfVertexList GetAllEnforcedVertices(const BLSURFPlugin_Hypothesis* hyp);
417 static TFaceEntryCoordsListMap GetAllCoordsByFace(const BLSURFPlugin_Hypothesis* hyp);
418 static TCoordsEnfVertexMap GetAllEnforcedVerticesByCoords(const BLSURFPlugin_Hypothesis* hyp);
420 static TFaceEntryEnfVertexEntryListMap GetAllEnfVertexEntriesByFace(const BLSURFPlugin_Hypothesis* hyp);
421 static TEnfVertexEntryEnfVertexMap GetAllEnforcedVerticesByEnfVertexEntry(const BLSURFPlugin_Hypothesis* hyp);
424 * \brief Internal enforced vertices
426 void SetInternalEnforcedVertexAllFaces(bool toEnforceInternalVertices);
427 const bool _GetInternalEnforcedVertexAllFaces() const { return _enforcedInternalVerticesAllFaces; }
428 static bool GetInternalEnforcedVertexAllFaces( const BLSURFPlugin_Hypothesis* hyp );
429 void SetInternalEnforcedVertexAllFacesGroup(TEnfGroupName theGroupName);
430 const TEnfGroupName _GetInternalEnforcedVertexAllFacesGroup() const { return _enforcedInternalVerticesAllFacesGroup; }
431 static TEnfGroupName GetInternalEnforcedVertexAllFacesGroup( const BLSURFPlugin_Hypothesis* hyp );
433 // Enable internal enforced vertices on specific face if requested by user
434 // static TFaceEntryInternalVerticesList GetDefaultFaceEntryInternalVerticesMap() { return TFaceEntryInternalVerticesList(); }
435 // const TFaceEntryInternalVerticesList _GetAllInternalEnforcedVerticesByFace() const { return _faceEntryInternalVerticesList; }
436 // static TFaceEntryInternalVerticesList GetAllInternalEnforcedVerticesByFace(const BLSURFPlugin_Hypothesis* hyp);
437 // void SetInternalEnforcedVertex(TEntry theFaceEntry, bool toEnforceInternalVertices, TEnfGroupName theGroupName);
438 // bool GetInternalEnforcedVertex(const TEntry& theFaceEntry);
440 static PhysicalMesh GetDefaultPhysicalMesh() { return PhysicalGlobalSize; }
441 static GeometricMesh GetDefaultGeometricMesh() { return GeometricalGlobalSize; }
442 static double GetDefaultPhySize(double diagonal, double bbSegmentation);
443 static double GetDefaultPhySize() { return undefinedDouble(); }
444 static bool GetDefaultPhySizeRel() { return false; }
445 static double GetDefaultMinSize(double diagonal);
446 static double GetDefaultMinSize() { return undefinedDouble(); }
447 static bool GetDefaultMinSizeRel() { return false; }
448 static double GetDefaultMaxSize(double diagonal);
449 static double GetDefaultMaxSize() { return undefinedDouble(); }
450 static bool GetDefaultMaxSizeRel() { return false; }
451 static bool GetDefaultUseGradation() { return true; }
452 static double GetDefaultGradation() { return 1.3; }
453 static bool GetDefaultUseVolumeGradation() { return false; }
454 static double GetDefaultVolumeGradation() { return 2; }
455 static ElementType GetDefaultElementType() { return Triangles; }
456 static double GetDefaultAngleMesh() { return 8.0; }
457 static bool GetDefaultUseSurfaceProximity() { return false; }
458 static int GetDefaultNbSurfaceProximityLayers() { return 1; }
459 static double GetDefaultSurfaceProximityRatio() { return 1.; }
460 static bool GetDefaultUseVolumeProximity() { return false; }
461 static int GetDefaultNbVolumeProximityLayers() { return 1; }
462 static double GetDefaultVolumeProximityRatio() { return 1.; }
464 static double GetDefaultChordalError(double diagonal);
465 static double GetDefaultChordalError() { return undefinedDouble(); }
466 static bool GetDefaultAnisotropic() { return false; }
467 static double GetDefaultAnisotropicRatio() { return 0.0; }
468 static bool GetDefaultRemoveTinyEdges() { return false; }
469 static double GetDefaultTinyEdgeLength(double diagonal);
470 static double GetDefaultTinyEdgeLength() { return undefinedDouble(); }
471 static bool GetDefaultOptimiseTinyEdges() { return false; }
472 static double GetDefaultTinyEdgeOptimisationLength(double diagonal);
473 static double GetDefaultTinyEdgeOptimisationLength() { return undefinedDouble(); }
474 static bool GetDefaultCorrectSurfaceIntersection() { return true; }
475 static double GetDefaultCorrectSurfaceIntersectionMaxCost() { return 15.; }
476 static bool GetDefaultBadElementRemoval() { return false; }
477 static double GetDefaultBadElementAspectRatio() {return 1000.0; }
478 static bool GetDefaultOptimizeMesh() { return true; }
479 static bool GetDefaultQuadraticMesh() { return false; }
481 static int GetDefaultVerbosity() { return 3; }
482 static Topology GetDefaultTopology() { return FromCAD; }
484 static bool GetDefaultPreCADMergeEdges() { return false; }
485 static bool GetDefaultPreCADRemoveDuplicateCADFaces() { return false; }
486 static bool GetDefaultPreCADProcess3DTopology() { return false; }
487 static bool GetDefaultPreCADDiscardInput() { return false; }
489 static TSizeMap GetDefaultSizeMap() { return TSizeMap();}
490 static TAttractorMap GetDefaultAttractorMap() { return TAttractorMap(); }
492 static TFaceEntryEnfVertexListMap GetDefaultFaceEntryEnfVertexListMap() { return TFaceEntryEnfVertexListMap(); }
493 static TEnfVertexList GetDefaultEnfVertexList() { return TEnfVertexList(); }
494 static TFaceEntryCoordsListMap GetDefaultFaceEntryCoordsListMap() { return TFaceEntryCoordsListMap(); }
495 static TCoordsEnfVertexMap GetDefaultCoordsEnfVertexMap() { return TCoordsEnfVertexMap(); }
496 static TFaceEntryEnfVertexEntryListMap GetDefaultFaceEntryEnfVertexEntryListMap() { return TFaceEntryEnfVertexEntryListMap(); }
497 static TEnfVertexEntryEnfVertexMap GetDefaultEnfVertexEntryEnfVertexMap() { return TEnfVertexEntryEnfVertexMap(); }
498 static TGroupNameNodeIDMap GetDefaultGroupNameNodeIDMap() { return TGroupNameNodeIDMap(); }
500 static bool GetDefaultInternalEnforcedVertex() { return false; }
503 static TGroupNameEnfVertexListMap GetDefaultGroupNameEnfVertexListMap() { return TGroupNameEnfVertexListMap(); }
504 static TEnfVertexGroupNameMap GetDefaultEnfVertexGroupNameMap() { return TEnfVertexGroupNameMap(); }
507 // const TPreCadPeriodicityEntriesVector _GetPreCadFacesPeriodicityEntries() const { return _preCadFacesPeriodicityEntriesVector; }
509 static TPreCadPeriodicityVector GetDefaultPreCadFacesPeriodicityVector() { return TPreCadPeriodicityVector(); }
510 const TPreCadPeriodicityVector& _GetPreCadFacesPeriodicityVector() const { return _preCadFacesPeriodicityVector; }
511 static TPreCadPeriodicityVector GetPreCadFacesPeriodicityVector(const BLSURFPlugin_Hypothesis* hyp);
513 static TPreCadPeriodicityVector GetDefaultPreCadEdgesPeriodicityVector() { return TPreCadPeriodicityVector(); }
514 const TPreCadPeriodicityVector& _GetPreCadEdgesPeriodicityVector() const { return _preCadEdgesPeriodicityVector; }
515 static TPreCadPeriodicityVector GetPreCadEdgesPeriodicityVector(const BLSURFPlugin_Hypothesis* hyp);
517 static TFacesPeriodicityVector GetDefaultFacesPeriodicityVector() { return TFacesPeriodicityVector(); }
518 const TFacesPeriodicityVector& _GetFacesPeriodicityVector() const { return _facesPeriodicityVector; }
519 static TFacesPeriodicityVector GetFacesPeriodicityVector(const BLSURFPlugin_Hypothesis* hyp);
521 static TEdgesPeriodicityVector GetDefaultEdgesPeriodicityVector() { return TEdgesPeriodicityVector(); }
522 const TEdgesPeriodicityVector& _GetEdgesPeriodicityVector() const { return _edgesPeriodicityVector; }
523 static TEdgesPeriodicityVector GetEdgesPeriodicityVector(const BLSURFPlugin_Hypothesis* hyp);
525 static TVerticesPeriodicityVector GetDefaultVerticesPeriodicityVector() { return TVerticesPeriodicityVector(); }
526 const TVerticesPeriodicityVector& _GetVerticesPeriodicityVector() const { return _verticesPeriodicityVector; }
527 static TVerticesPeriodicityVector GetVerticesPeriodicityVector(const BLSURFPlugin_Hypothesis* hyp);
529 void ClearPreCadPeriodicityVectors();
531 void AddPreCadFacesPeriodicity(TEntry theFace1Entry, TEntry theFace2Entry,
532 std::vector<std::string> &theSourceVerticesEntries, std::vector<std::string> &theTargetVerticesEntries);
533 void AddPreCadEdgesPeriodicity(TEntry theEdge1Entry, TEntry theEdge2Entry,
534 std::vector<std::string> &theSourceVerticesEntries, std::vector<std::string> &theTargetVerticesEntries);
536 static double undefinedDouble() { return -1.0; }
538 typedef std::map< std::string, std::string > TOptionValues;
539 typedef std::set< std::string > TOptionNames;
541 void SetOptionValue(const std::string& optionName,
542 const std::string& optionValue) throw (std::invalid_argument);
543 void SetPreCADOptionValue(const std::string& optionName,
544 const std::string& optionValue) throw (std::invalid_argument);
545 std::string GetOptionValue(const std::string& optionName, bool* isDefault=0) const throw (std::invalid_argument);
546 std::string GetPreCADOptionValue(const std::string& optionName, bool* isDefault=0) const throw (std::invalid_argument);
547 void ClearOption(const std::string& optionName);
548 void ClearPreCADOption(const std::string& optionName);
549 TOptionValues GetOptionValues() const;
550 TOptionValues GetPreCADOptionValues() const;
551 const TOptionValues& GetCustomOptionValues() const { return _customOption2value; }
553 void AddOption(const std::string& optionName, const std::string& optionValue);
554 void AddPreCADOption(const std::string& optionName, const std::string& optionValue);
555 std::string GetOption(const std::string& optionName) const;
556 std::string GetPreCADOption(const std::string& optionName) const;
558 static bool ToBool(const std::string& str, bool* isOk=0) throw (std::invalid_argument);
559 static double ToDbl(const std::string& str, bool* isOk=0) throw (std::invalid_argument);
560 static int ToInt(const std::string& str, bool* isOk=0) throw (std::invalid_argument);
563 * Sets the file for export resulting mesh in GMF format
565 // void SetGMFFile(const std::string& theFileName, bool isBinary);
566 void SetGMFFile(const std::string& theFileName);
567 std::string GetGMFFile() const { return _GMFFileName; }
568 static std::string GetDefaultGMFFile() { return "";}
569 // bool GetGMFFileMode() const { return _GMFFileMode; }
572 virtual std::ostream & SaveTo(std::ostream & save);
573 virtual std::istream & LoadFrom(std::istream & load);
574 friend std::ostream & operator <<(std::ostream & save, BLSURFPlugin_Hypothesis & hyp);
575 friend std::istream & operator >>(std::istream & load, BLSURFPlugin_Hypothesis & hyp);
578 * \brief Does nothing
579 * \param theMesh - the built mesh
580 * \param theShape - the geometry of interest
581 * \retval bool - always false
583 virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
586 * \brief Initialize my parameter values by default parameters.
587 * \retval bool - true if parameter values have been successfully defined
589 virtual bool SetParametersByDefaults(const TDefaults& dflts, const SMESH_Mesh* theMesh=0);
593 PhysicalMesh _physicalMesh;
594 GeometricMesh _geometricMesh;
597 double _minSize, _maxSize;
598 bool _minSizeRel, _maxSizeRel;
601 bool _useVolumeGradation;
602 double _volumeGradation;
603 ElementType _elementType;
605 double _chordalError;
607 double _anisotropicRatio;
608 bool _removeTinyEdges;
609 double _tinyEdgeLength;
610 bool _optimiseTinyEdges;
611 double _tinyEdgeOptimisationLength;
612 bool _correctSurfaceIntersec;
613 double _corrSurfaceIntersCost;
614 bool _badElementRemoval;
615 double _badElementAspectRatio;
620 bool _useSurfaceProximity;
621 int _nbSurfaceProximityLayers;
622 double _surfaceProximityRatio;
623 bool _useVolumeProximity;
624 int _nbVolumeProximityLayers;
625 double _volumeProximityRatio;
627 bool _preCADMergeEdges;
628 bool _preCADRemoveDuplicateCADFaces;
629 bool _preCADProcess3DTopology;
630 bool _preCADDiscardInput;
631 double _preCADEpsNano;
633 TOptionValues _option2value, _preCADoption2value, _customOption2value; // user defined values
634 TOptionValues _defaultOptionValues; // default values
635 TOptionNames _doubleOptions, _charOptions, _boolOptions; // to find a type of option
636 TOptionNames _preCADdoubleOptions, _preCADcharOptions;
639 TSizeMap _attractors;
640 TAttractorMap _classAttractors;
642 TFaceEntryEnfVertexListMap _faceEntryEnfVertexListMap;
643 TEnfVertexList _enfVertexList;
644 // maps to get "manual" enf vertex (through their coordinates)
645 TFaceEntryCoordsListMap _faceEntryCoordsListMap;
646 TCoordsEnfVertexMap _coordsEnfVertexMap;
647 // maps to get "geom" enf vertex (through their geom entries)
648 TFaceEntryEnfVertexEntryListMap _faceEntryEnfVertexEntryListMap;
649 TEnfVertexEntryEnfVertexMap _enfVertexEntryEnfVertexMap;
650 TGroupNameNodeIDMap _groupNameNodeIDMap;
652 // Enable internal enforced vertices on specific face if requested by user
653 // TFaceEntryInternalVerticesList _faceEntryInternalVerticesList;
654 bool _enforcedInternalVerticesAllFaces;
655 TEnfGroupName _enforcedInternalVerticesAllFacesGroup;
657 TPreCadPeriodicityVector _preCadFacesPeriodicityVector;
658 TPreCadPeriodicityVector _preCadEdgesPeriodicityVector;
660 TFacesPeriodicityVector _facesPeriodicityVector;
661 TEdgesPeriodicityVector _edgesPeriodicityVector;
662 TVerticesPeriodicityVector _verticesPeriodicityVector;
664 THyperPatchList _hyperPatchList;
666 // Called by SaveTo to store content of _preCadFacesPeriodicityVector and _preCadEdgesPeriodicityVector
667 void SavePreCADPeriodicity(std::ostream & save, const char* shapeType);
669 // Called by LoadFrom to fill _preCadFacesPeriodicityVector and _preCadEdgesPeriodicityVector
670 void LoadPreCADPeriodicity(std::istream & load, const char* shapeType);
672 // Called by LoadFrom to fill _facesPeriodicityVector
673 void LoadFacesPeriodicity(std::istream & load);
675 // Called by LoadFrom to fill _edgesPeriodicityVector
676 void LoadEdgesPeriodicity(std::istream & load);
678 // Called by LoadFrom to fill _verticesPeriodicityVector
679 void LoadVerticesPeriodicity(std::istream & load);
681 // Called by SaveTo to store content of _facesPeriodicityVector
682 void SaveFacesPeriodicity(std::ostream & save);
684 // Called by SaveTo to store content of _edgesPeriodicityVector
685 void SaveEdgesPeriodicity(std::ostream & save);
687 // Called by SaveTo to store content of _verticesPeriodicityVector
688 void SaveVerticesPeriodicity(std::ostream & save);
690 std::string _GMFFileName;
691 // bool _GMFFileMode;
693 // TSizeMap _customSizeMap;