1 // Copyright (C) 2007-2021 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 );
193 int GetMaxNumberOfPointsPerPatch();
195 void SetMaxNumberOfThreads( int nb );
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 );
211 double GetPeriodicTolerance();
213 void SetRequiredEntities( const std::string& howToTreat );
214 std::string GetRequiredEntities();
216 void SetSewingTolerance( double tol );
217 double GetSewingTolerance();
219 void SetTags( const std::string& howToTreat );
220 std::string GetTags();
223 typedef std::set< int > THyperPatchTags;
224 typedef std::vector< THyperPatchTags > THyperPatchList;
225 typedef std::set< std::string > THyperPatchEntries;
226 typedef std::vector< THyperPatchEntries > THyperPatchEntriesList;
228 void SetHyperPatches(const THyperPatchList& hpl, bool notifyMesh=true);
229 void SetHyperPatches(const THyperPatchEntriesList& hpl);
230 void SetHyperPatchIDsByEntry( const TopoDS_Shape& mainShape,
231 const std::map< std::string, TopoDS_Shape >& entryToShape);
232 const THyperPatchList& GetHyperPatches() const { return _hyperPatchList; }
233 const THyperPatchEntriesList& GetHyperPatchEntries() const { return _hyperPatchEntriesList; }
234 static int GetHyperPatchTag( int faceTag, const BLSURFPlugin_Hypothesis* hyp, int* iPatch=0 );
237 void SetPreCADMergeEdges(bool theVal);
238 bool GetPreCADMergeEdges() const { return _preCADMergeEdges; }
240 void SetPreCADRemoveDuplicateCADFaces(bool theVal);
241 bool GetPreCADRemoveDuplicateCADFaces() const { return _preCADRemoveDuplicateCADFaces; }
243 void SetPreCADProcess3DTopology(bool theVal);
244 bool GetPreCADProcess3DTopology() const { return _preCADProcess3DTopology; }
246 void SetPreCADDiscardInput(bool theVal);
247 bool GetPreCADDiscardInput() const { return _preCADDiscardInput; }
249 static bool HasPreCADOptions(const BLSURFPlugin_Hypothesis* hyp);
251 typedef std::map<std::string,std::string> TSizeMap;
253 void SetSizeMapEntry(const std::string& entry,const std::string& sizeMap );
254 std::string GetSizeMapEntry(const std::string& entry);
255 const TSizeMap& _GetSizeMapEntries() const { return _sizeMap; }
257 * \brief Return the size maps
259 static TSizeMap GetSizeMapEntries(const BLSURFPlugin_Hypothesis* hyp);
262 void SetAttractorEntry(const std::string& entry,const std::string& attractor );
263 std::string GetAttractorEntry(const std::string& entry);
264 const TSizeMap& _GetAttractorEntries() const { return _attractors; };
266 * \brief Return the attractors
268 static TSizeMap GetAttractorEntries(const BLSURFPlugin_Hypothesis* hyp);
272 void SetCustomSizeMapEntry(const std::string& entry,const std::string& sizeMap );
273 std::string GetCustomSizeMapEntry(const std::string& entry);
274 void UnsetCustomSizeMap(const std::string& entry);
275 const TSizeMap& GetCustomSizeMapEntries() const { return _customSizeMap; }
278 typedef std::multimap< std::string, BLSURFPlugin_Attractor* > TAttractorMap;
279 typedef std::map< std::string, std::vector<double> > TParamsMap; //TODO ?? finir
281 void SetClassAttractorEntry(const std::string& entry, const std::string& att_entry, double StartSize, double EndSize, double ActionRadius, double ConstantRadius);
282 std::string GetClassAttractorEntry(const std::string& entry);
283 const TAttractorMap& _GetClassAttractorEntries() const { return _classAttractors; }
285 * \brief Return the attractors entries
287 static TAttractorMap GetClassAttractorEntries(const BLSURFPlugin_Hypothesis* hyp);
290 * To set/get/unset an enforced vertex
293 typedef std::string TEnfName;
295 typedef std::string TEntry;
297 typedef std::set<TEntry> TEntryList;
299 typedef std::string TEnfGroupName;
301 typedef std::vector<double> TEnfVertexCoords;
302 typedef std::set< TEnfVertexCoords > TEnfVertexCoordsList;
308 TEnfVertexCoords coords;
309 TEnfGroupName grpName;
310 TEntryList faceEntries;
311 TopoDS_Vertex vertex;
314 struct CompareEnfVertices
316 bool operator () (const TEnfVertex* e1, const TEnfVertex* e2) const {
318 if (e1->coords.size() && e2->coords.size())
319 return (e1->coords < e2->coords);
321 return (e1->geomEntry < e2->geomEntry);
327 // PreCad Face and Edge periodicity
328 struct TPreCadPeriodicity {
331 std::vector<std::string> theSourceVerticesEntries;
332 std::vector<std::string> theTargetVerticesEntries;
336 struct TEdgePeriodicity {
337 TEntry theFace1Entry;
338 TEntry theEdge1Entry;
339 TEntry theFace2Entry;
340 TEntry theEdge2Entry;
341 int edge_orientation;
344 // Vertex periodicity
345 struct TVertexPeriodicity {
346 TEntry theEdge1Entry;
347 TEntry theVertex1Entry;
348 TEntry theEdge2Entry;
349 TEntry theVertex2Entry;
352 typedef std::pair< TEntry, TEntry > TFacesPeriodicity;
354 // List of enforced vertices
355 typedef std::set< TEnfVertex*, CompareEnfVertices > TEnfVertexList;
357 // Map Face Entry / List of enforced vertices
358 typedef std::map< TEntry, TEnfVertexList > TFaceEntryEnfVertexListMap;
360 // List of Face Entry with internal enforced vertices activated
361 typedef std::set< TEntry > TFaceEntryInternalVerticesList;
363 // Map Face Entry / List of coords
364 typedef std::map< TEntry, TEnfVertexCoordsList > TFaceEntryCoordsListMap;
366 // Map Face Entry / List of Vertex entry
367 typedef std::map< TEntry, TEntryList > TFaceEntryEnfVertexEntryListMap;
369 // Map Coords / Enforced vertex
370 typedef std::map< TEnfVertexCoords, TEnfVertex* > TCoordsEnfVertexMap;
372 // Map Vertex entry / Enforced vertex
373 typedef std::map< TEntry, TEnfVertex* > TEnfVertexEntryEnfVertexMap;
375 typedef std::map< TEnfGroupName, std::set<int> > TGroupNameNodeIDMap;
377 // Map Group Name / List of enforced vertices
378 typedef std::map< TEnfGroupName , TEnfVertexList > TGroupNameEnfVertexListMap;
381 // Vector of pairs of entries
382 typedef std::vector< TPreCadPeriodicity > TPreCadPeriodicityVector;
383 typedef std::vector< TFacesPeriodicity > TFacesPeriodicityVector;
384 typedef std::vector< TEdgePeriodicity > TEdgesPeriodicityVector;
385 typedef std::vector< TVertexPeriodicity > TVerticesPeriodicityVector;
388 bool SetEnforcedVertex(TEntry theFaceEntry, TEnfName theVertexName, TEntry theVertexEntry, TEnfGroupName theGroupName,
389 double x = 0.0, double y = 0.0, double z = 0.0);
390 TEnfVertexList GetEnfVertexList(const TEntry& theFaceEntry);
391 TEnfVertexCoordsList GetEnfVertexCoordsList(const TEntry& theFaceEntry);
392 TEntryList GetEnfVertexEntryList (const TEntry& theFaceEntry);
393 TEnfVertex* GetEnfVertex(TEnfVertexCoords coords);
394 TEnfVertex* GetEnfVertex(const TEntry& theEnfVertexEntry);
395 void AddEnfVertexNodeID(TEnfGroupName theGroupName,int theNodeID);
396 std::set<int> GetEnfVertexNodeIDs(TEnfGroupName theGroupName);
397 void RemoveEnfVertexNodeID(TEnfGroupName theGroupName,int theNodeID);
399 bool ClearEnforcedVertex(const TEntry& theFaceEntry, double x = 0.0, double y = 0.0, double z = 0.0, const TEntry& theVertexEntry="");
400 bool ClearEnforcedVertices(const TEntry& theFaceEntry);
402 void ClearAllEnforcedVertices();
403 void AddEnforcedVertex( const TEntry& theFaceEntry, TEnfVertex * theEnfVertex );
405 const TFaceEntryEnfVertexListMap& _GetAllEnforcedVerticesByFace() const { return _faceEntryEnfVertexListMap; }
406 const TEnfVertexList& _GetAllEnforcedVertices() const { return _enfVertexList; }
408 const TFaceEntryCoordsListMap& _GetAllCoordsByFace() const { return _faceEntryCoordsListMap; }
409 const TCoordsEnfVertexMap& _GetAllEnforcedVerticesByCoords() const { return _coordsEnfVertexMap; }
411 const TFaceEntryEnfVertexEntryListMap& _GetAllEnfVertexEntriesByFace() const { return _faceEntryEnfVertexEntryListMap; }
412 const TEnfVertexEntryEnfVertexMap& _GetAllEnforcedVerticesByEnfVertexEntry() const { return _enfVertexEntryEnfVertexMap; }
415 // const TEnfVertexGroupNameMap _GetEnforcedVertexGroupNameMap() const { return _enfVertexGroupNameMap; }
419 * \brief Return the enforced vertices
421 static TFaceEntryEnfVertexListMap GetAllEnforcedVerticesByFace(const BLSURFPlugin_Hypothesis* hyp);
422 static TEnfVertexList GetAllEnforcedVertices(const BLSURFPlugin_Hypothesis* hyp);
424 static TFaceEntryCoordsListMap GetAllCoordsByFace(const BLSURFPlugin_Hypothesis* hyp);
425 static TCoordsEnfVertexMap GetAllEnforcedVerticesByCoords(const BLSURFPlugin_Hypothesis* hyp);
427 static TFaceEntryEnfVertexEntryListMap GetAllEnfVertexEntriesByFace(const BLSURFPlugin_Hypothesis* hyp);
428 static TEnfVertexEntryEnfVertexMap GetAllEnforcedVerticesByEnfVertexEntry(const BLSURFPlugin_Hypothesis* hyp);
431 * \brief Internal enforced vertices
433 void SetInternalEnforcedVertexAllFaces(bool toEnforceInternalVertices);
434 bool _GetInternalEnforcedVertexAllFaces() const { return _enforcedInternalVerticesAllFaces; }
435 static bool GetInternalEnforcedVertexAllFaces( const BLSURFPlugin_Hypothesis* hyp );
436 void SetInternalEnforcedVertexAllFacesGroup(TEnfGroupName theGroupName);
437 const TEnfGroupName _GetInternalEnforcedVertexAllFacesGroup() const { return _enforcedInternalVerticesAllFacesGroup; }
438 static TEnfGroupName GetInternalEnforcedVertexAllFacesGroup( const BLSURFPlugin_Hypothesis* hyp );
440 // Enable internal enforced vertices on specific face if requested by user
441 // static TFaceEntryInternalVerticesList GetDefaultFaceEntryInternalVerticesMap() { return TFaceEntryInternalVerticesList(); }
442 // const TFaceEntryInternalVerticesList _GetAllInternalEnforcedVerticesByFace() const { return _faceEntryInternalVerticesList; }
443 // static TFaceEntryInternalVerticesList GetAllInternalEnforcedVerticesByFace(const BLSURFPlugin_Hypothesis* hyp);
444 // void SetInternalEnforcedVertex(TEntry theFaceEntry, bool toEnforceInternalVertices, TEnfGroupName theGroupName);
445 // bool GetInternalEnforcedVertex(const TEntry& theFaceEntry);
447 static PhysicalMesh GetDefaultPhysicalMesh() { return PhysicalGlobalSize; }
448 static GeometricMesh GetDefaultGeometricMesh() { return GeometricalGlobalSize; }
449 static double GetDefaultPhySize(double diagonal, double bbSegmentation);
450 static double GetDefaultPhySize() { return undefinedDouble(); }
451 static bool GetDefaultPhySizeRel() { return false; }
452 static double GetDefaultMinSize(double diagonal);
453 static double GetDefaultMinSize() { return undefinedDouble(); }
454 static bool GetDefaultMinSizeRel() { return false; }
455 static double GetDefaultMaxSize(double diagonal);
456 static double GetDefaultMaxSize() { return undefinedDouble(); }
457 static bool GetDefaultMaxSizeRel() { return false; }
458 static bool GetDefaultUseGradation() { return true; }
459 static double GetDefaultGradation() { return 1.3; }
460 static bool GetDefaultUseVolumeGradation() { return false; }
461 static double GetDefaultVolumeGradation() { return 2; }
462 static ElementType GetDefaultElementType() { return Triangles; }
463 static double GetDefaultAngleMesh() { return 8.0; }
464 static bool GetDefaultUseSurfaceProximity() { return false; }
465 static int GetDefaultNbSurfaceProximityLayers() { return 1; }
466 static double GetDefaultSurfaceProximityRatio() { return 1.; }
467 static bool GetDefaultUseVolumeProximity() { return false; }
468 static int GetDefaultNbVolumeProximityLayers() { return 1; }
469 static double GetDefaultVolumeProximityRatio() { return 1.; }
471 static double GetDefaultChordalError(double diagonal);
472 static double GetDefaultChordalError() { return undefinedDouble(); }
473 static bool GetDefaultAnisotropic() { return false; }
474 static double GetDefaultAnisotropicRatio() { return 0.0; }
475 static bool GetDefaultRemoveTinyEdges() { return false; }
476 static double GetDefaultTinyEdgeLength(double diagonal);
477 static double GetDefaultTinyEdgeLength() { return undefinedDouble(); }
478 static bool GetDefaultOptimiseTinyEdges() { return false; }
479 static double GetDefaultTinyEdgeOptimisationLength(double diagonal);
480 static double GetDefaultTinyEdgeOptimisationLength() { return undefinedDouble(); }
481 static bool GetDefaultCorrectSurfaceIntersection() { return true; }
482 static double GetDefaultCorrectSurfaceIntersectionMaxCost() { return 15.; }
483 static bool GetDefaultBadElementRemoval() { return false; }
484 static double GetDefaultBadElementAspectRatio() {return 1000.0; }
485 static bool GetDefaultOptimizeMesh() { return true; }
486 static bool GetDefaultQuadraticMesh() { return false; }
488 static int GetDefaultVerbosity() { return 3; }
489 static Topology GetDefaultTopology() { return FromCAD; }
491 static bool GetDefaultPreCADMergeEdges() { return false; }
492 static bool GetDefaultPreCADRemoveDuplicateCADFaces() { return false; }
493 static bool GetDefaultPreCADProcess3DTopology() { return false; }
494 static bool GetDefaultPreCADDiscardInput() { return false; }
496 static TSizeMap GetDefaultSizeMap() { return TSizeMap();}
497 static TAttractorMap GetDefaultAttractorMap() { return TAttractorMap(); }
499 static TFaceEntryEnfVertexListMap GetDefaultFaceEntryEnfVertexListMap() { return TFaceEntryEnfVertexListMap(); }
500 static TEnfVertexList GetDefaultEnfVertexList() { return TEnfVertexList(); }
501 static TFaceEntryCoordsListMap GetDefaultFaceEntryCoordsListMap() { return TFaceEntryCoordsListMap(); }
502 static TCoordsEnfVertexMap GetDefaultCoordsEnfVertexMap() { return TCoordsEnfVertexMap(); }
503 static TFaceEntryEnfVertexEntryListMap GetDefaultFaceEntryEnfVertexEntryListMap() { return TFaceEntryEnfVertexEntryListMap(); }
504 static TEnfVertexEntryEnfVertexMap GetDefaultEnfVertexEntryEnfVertexMap() { return TEnfVertexEntryEnfVertexMap(); }
505 static TGroupNameNodeIDMap GetDefaultGroupNameNodeIDMap() { return TGroupNameNodeIDMap(); }
507 static bool GetDefaultInternalEnforcedVertex() { return false; }
510 static TGroupNameEnfVertexListMap GetDefaultGroupNameEnfVertexListMap() { return TGroupNameEnfVertexListMap(); }
511 static TEnfVertexGroupNameMap GetDefaultEnfVertexGroupNameMap() { return TEnfVertexGroupNameMap(); }
514 // const TPreCadPeriodicityEntriesVector _GetPreCadFacesPeriodicityEntries() const { return _preCadFacesPeriodicityEntriesVector; }
516 static TPreCadPeriodicityVector GetDefaultPreCadFacesPeriodicityVector() { return TPreCadPeriodicityVector(); }
517 const TPreCadPeriodicityVector& _GetPreCadFacesPeriodicityVector() const { return _preCadFacesPeriodicityVector; }
518 static TPreCadPeriodicityVector GetPreCadFacesPeriodicityVector(const BLSURFPlugin_Hypothesis* hyp);
520 static TPreCadPeriodicityVector GetDefaultPreCadEdgesPeriodicityVector() { return TPreCadPeriodicityVector(); }
521 const TPreCadPeriodicityVector& _GetPreCadEdgesPeriodicityVector() const { return _preCadEdgesPeriodicityVector; }
522 static TPreCadPeriodicityVector GetPreCadEdgesPeriodicityVector(const BLSURFPlugin_Hypothesis* hyp);
524 static TFacesPeriodicityVector GetDefaultFacesPeriodicityVector() { return TFacesPeriodicityVector(); }
525 const TFacesPeriodicityVector& _GetFacesPeriodicityVector() const { return _facesPeriodicityVector; }
526 static TFacesPeriodicityVector GetFacesPeriodicityVector(const BLSURFPlugin_Hypothesis* hyp);
528 static TEdgesPeriodicityVector GetDefaultEdgesPeriodicityVector() { return TEdgesPeriodicityVector(); }
529 const TEdgesPeriodicityVector& _GetEdgesPeriodicityVector() const { return _edgesPeriodicityVector; }
530 static TEdgesPeriodicityVector GetEdgesPeriodicityVector(const BLSURFPlugin_Hypothesis* hyp);
532 static TVerticesPeriodicityVector GetDefaultVerticesPeriodicityVector() { return TVerticesPeriodicityVector(); }
533 const TVerticesPeriodicityVector& _GetVerticesPeriodicityVector() const { return _verticesPeriodicityVector; }
534 static TVerticesPeriodicityVector GetVerticesPeriodicityVector(const BLSURFPlugin_Hypothesis* hyp);
536 void ClearPreCadPeriodicityVectors();
538 void AddPreCadFacesPeriodicity(TEntry theFace1Entry, TEntry theFace2Entry,
539 std::vector<std::string> &theSourceVerticesEntries, std::vector<std::string> &theTargetVerticesEntries);
540 void AddPreCadEdgesPeriodicity(TEntry theEdge1Entry, TEntry theEdge2Entry,
541 std::vector<std::string> &theSourceVerticesEntries, std::vector<std::string> &theTargetVerticesEntries);
543 static double undefinedDouble() { return -1.0; }
545 typedef std::map< std::string, std::string > TOptionValues;
546 typedef std::set< std::string > TOptionNames;
548 void SetOptionValue(const std::string& optionName,
549 const std::string& optionValue);
550 void SetPreCADOptionValue(const std::string& optionName,
551 const std::string& optionValue);
552 std::string GetOptionValue(const std::string& optionName, bool* isDefault=0) const;
553 std::string GetPreCADOptionValue(const std::string& optionName, bool* isDefault=0) const;
554 void ClearOption(const std::string& optionName);
555 void ClearPreCADOption(const std::string& optionName);
556 TOptionValues GetOptionValues() const;
557 TOptionValues GetPreCADOptionValues() const;
558 const TOptionValues& GetCustomOptionValues() const { return _customOption2value; }
560 void AddOption(const std::string& optionName, const std::string& optionValue);
561 void AddPreCADOption(const std::string& optionName, const std::string& optionValue);
562 std::string GetOption(const std::string& optionName) const;
563 std::string GetPreCADOption(const std::string& optionName) const;
565 static bool ToBool(const std::string& str, bool* isOk=0);
566 static double ToDbl(const std::string& str, bool* isOk=0);
567 static int ToInt(const std::string& str, bool* isOk=0);
570 * Sets the file for export resulting mesh in GMF format
572 // void SetGMFFile(const std::string& theFileName, bool isBinary);
573 void SetGMFFile(const std::string& theFileName);
574 std::string GetGMFFile() const { return _GMFFileName; }
575 static std::string GetDefaultGMFFile() { return "";}
576 // bool GetGMFFileMode() const { return _GMFFileMode; }
579 virtual std::ostream & SaveTo(std::ostream & save);
580 virtual std::istream & LoadFrom(std::istream & load);
581 friend std::ostream & operator <<(std::ostream & save, BLSURFPlugin_Hypothesis & hyp);
582 friend std::istream & operator >>(std::istream & load, BLSURFPlugin_Hypothesis & hyp);
585 * \brief Does nothing
586 * \param theMesh - the built mesh
587 * \param theShape - the geometry of interest
588 * \retval bool - always false
590 virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
593 * \brief Initialize my parameter values by default parameters.
594 * \retval bool - true if parameter values have been successfully defined
596 virtual bool SetParametersByDefaults(const TDefaults& dflts, const SMESH_Mesh* theMesh=0);
600 PhysicalMesh _physicalMesh;
601 GeometricMesh _geometricMesh;
604 double _minSize, _maxSize;
605 bool _minSizeRel, _maxSizeRel;
608 bool _useVolumeGradation;
609 double _volumeGradation;
610 ElementType _elementType;
612 double _chordalError;
614 double _anisotropicRatio;
615 bool _removeTinyEdges;
616 double _tinyEdgeLength;
617 bool _optimiseTinyEdges;
618 double _tinyEdgeOptimisationLength;
619 bool _correctSurfaceIntersec;
620 double _corrSurfaceIntersCost;
621 bool _badElementRemoval;
622 double _badElementAspectRatio;
627 bool _useSurfaceProximity;
628 int _nbSurfaceProximityLayers;
629 double _surfaceProximityRatio;
630 bool _useVolumeProximity;
631 int _nbVolumeProximityLayers;
632 double _volumeProximityRatio;
634 bool _preCADMergeEdges;
635 bool _preCADRemoveDuplicateCADFaces;
636 bool _preCADProcess3DTopology;
637 bool _preCADDiscardInput;
638 double _preCADEpsNano;
640 TOptionValues _option2value, _preCADoption2value, _customOption2value; // user defined values
641 TOptionValues _defaultOptionValues; // default values
642 TOptionNames _doubleOptions, _charOptions, _boolOptions; // to find a type of option
643 TOptionNames _preCADdoubleOptions, _preCADcharOptions;
646 TSizeMap _attractors;
647 TAttractorMap _classAttractors;
649 TFaceEntryEnfVertexListMap _faceEntryEnfVertexListMap;
650 TEnfVertexList _enfVertexList;
651 // maps to get "manual" enf vertex (through their coordinates)
652 TFaceEntryCoordsListMap _faceEntryCoordsListMap;
653 TCoordsEnfVertexMap _coordsEnfVertexMap;
654 // maps to get "geom" enf vertex (through their geom entries)
655 TFaceEntryEnfVertexEntryListMap _faceEntryEnfVertexEntryListMap;
656 TEnfVertexEntryEnfVertexMap _enfVertexEntryEnfVertexMap;
657 TGroupNameNodeIDMap _groupNameNodeIDMap;
659 // Enable internal enforced vertices on specific face if requested by user
660 // TFaceEntryInternalVerticesList _faceEntryInternalVerticesList;
661 bool _enforcedInternalVerticesAllFaces;
662 TEnfGroupName _enforcedInternalVerticesAllFacesGroup;
664 TPreCadPeriodicityVector _preCadFacesPeriodicityVector;
665 TPreCadPeriodicityVector _preCadEdgesPeriodicityVector;
667 TFacesPeriodicityVector _facesPeriodicityVector;
668 TEdgesPeriodicityVector _edgesPeriodicityVector;
669 TVerticesPeriodicityVector _verticesPeriodicityVector;
671 THyperPatchList _hyperPatchList;
672 THyperPatchEntriesList _hyperPatchEntriesList;
674 // Called by SaveTo to store content of _preCadFacesPeriodicityVector and _preCadEdgesPeriodicityVector
675 void SavePreCADPeriodicity(std::ostream & save, const char* shapeType);
677 // Called by LoadFrom to fill _preCadFacesPeriodicityVector and _preCadEdgesPeriodicityVector
678 void LoadPreCADPeriodicity(std::istream & load, const char* shapeType);
680 // Called by LoadFrom to fill _facesPeriodicityVector
681 void LoadFacesPeriodicity(std::istream & load);
683 // Called by LoadFrom to fill _edgesPeriodicityVector
684 void LoadEdgesPeriodicity(std::istream & load);
686 // Called by LoadFrom to fill _verticesPeriodicityVector
687 void LoadVerticesPeriodicity(std::istream & load);
689 // Called by SaveTo to store content of _facesPeriodicityVector
690 void SaveFacesPeriodicity(std::ostream & save);
692 // Called by SaveTo to store content of _edgesPeriodicityVector
693 void SaveEdgesPeriodicity(std::ostream & save);
695 // Called by SaveTo to store content of _verticesPeriodicityVector
696 void SaveVerticesPeriodicity(std::ostream & save);
698 std::string _GMFFileName;
699 // bool _GMFFileMode;
701 // TSizeMap _customSizeMap;