Salome HOME
8bfd8db833e5f10a9ed993447ea6e887b6dad33c
[plugins/blsurfplugin.git] / src / BLSURFPlugin / BLSURFPlugin_Hypothesis.hxx
1 // Copyright (C) 2007-2021  CEA/DEN, EDF R&D
2 //
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.
7 //
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.
12 //
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
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 // ---
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)
25 // ---
26 //
27 #ifndef _BLSURFPlugin_Hypothesis_HXX_
28 #define _BLSURFPlugin_Hypothesis_HXX_
29
30 #include "SMESH_Hypothesis.hxx"
31 #include <vector>
32 #include <map>
33 #include <set>
34 #include <stdexcept>
35 #include <string>
36 #include <cstring>
37 #include <sstream>
38 #include <utilities.h>
39 #include "BLSURFPlugin_Attractor.hxx"
40
41 //  Parameters for work of MG-CADSurf
42
43 class BLSURFPlugin_Hypothesis: public SMESH_Hypothesis
44 {
45 public:
46   BLSURFPlugin_Hypothesis(int hypId, SMESH_Gen * gen, bool hasgeom);
47
48   enum Topology {
49     FromCAD,
50     Process,
51     Process2,
52     PreCAD
53   };
54
55   enum PhysicalMesh {
56     DefaultSize,
57     PhysicalGlobalSize,
58     PhysicalLocalSize
59   };
60
61   enum GeometricMesh {
62     DefaultGeom,
63     GeometricalGlobalSize,
64     GeometricalLocalSize
65   };
66
67   enum ElementType {
68     Triangles,
69     QuadrangleDominant,
70     Quadrangles
71   };
72
73   static const char* GetHypType(bool hasgeom)
74   { return hasgeom ? "MG-CADSurf Parameters" : "MG-CADSurf Parameters_NOGEOM"; }
75
76   TopoDS_Shape entryToShape(std::string entry);
77
78   static std::string GetMeshGemsVersion();
79
80   void SetPhysicalMesh(PhysicalMesh thePhysicalMesh);
81   PhysicalMesh GetPhysicalMesh() const { return _physicalMesh; }
82
83   void SetGeometricMesh(GeometricMesh theGeometricMesh);
84   GeometricMesh GetGeometricMesh() const { return _geometricMesh; }
85
86   void SetPhySize(double thePhySize, bool isRelative = false);
87   double GetPhySize() const { return _phySize; }
88   bool IsPhySizeRel() const { return _phySizeRel; }
89
90   void SetMinSize(double theMinSize, bool isRelative = false);
91   double GetMinSize() const { return _minSize; }
92   bool IsMinSizeRel() const { return _minSizeRel; }
93
94   void SetMaxSize(double theMaxSize, bool isRelative = false);
95   double GetMaxSize() const { return _maxSize; }
96   bool IsMaxSizeRel() const { return _maxSizeRel; }
97
98   void SetUseGradation(bool toUse);
99   bool GetUseGradation() const { return _useGradation; }
100   void SetGradation(double theGradation);
101   double GetGradation() const { return _gradation; }
102
103   void SetUseVolumeGradation(bool toUse);
104   bool GetUseVolumeGradation() const { return _useVolumeGradation; }
105   void SetVolumeGradation(double theGradation);
106   double GetVolumeGradation() const { return _volumeGradation; }
107
108   void SetElementType(ElementType theElementType);
109   ElementType GetElementType() const { return _elementType; }
110
111   void SetAngleMesh(double theAngle);
112   double GetAngleMesh() const { return _angleMesh; }
113
114   void SetChordalError(double theDistance);
115   double GetChordalError() const { return _chordalError; }
116
117   void SetAnisotropic(bool theVal);
118   bool GetAnisotropic() const { return _anisotropic; }
119
120   void SetAnisotropicRatio(double theVal);
121   double GetAnisotropicRatio() const { return _anisotropicRatio; }
122
123   void SetRemoveTinyEdges(bool theVal);
124   bool GetRemoveTinyEdges() const { return _removeTinyEdges; }
125
126   void SetTinyEdgeLength(double theVal);
127   double GetTinyEdgeLength() const { return _tinyEdgeLength; }
128
129   void SetOptimiseTinyEdges(bool theVal);
130   bool GetOptimiseTinyEdges() const { return _optimiseTinyEdges; }
131
132   void SetTinyEdgeOptimisationLength(double theVal);
133   double GetTinyEdgeOptimisationLength() const { return _tinyEdgeOptimisationLength; }
134
135   void SetCorrectSurfaceIntersection(bool theVal);
136   bool GetCorrectSurfaceIntersection() const { return _correctSurfaceIntersec; }
137
138   void SetCorrectSurfaceIntersectionMaxCost(double theVal);
139   double GetCorrectSurfaceIntersectionMaxCost() const { return _corrSurfaceIntersCost; }
140
141   void SetBadElementRemoval(bool theVal);
142   bool GetBadElementRemoval() const { return _badElementRemoval; }
143
144   void SetBadElementAspectRatio(double theVal);
145   double GetBadElementAspectRatio() const { return _badElementAspectRatio; }
146
147   void SetOptimizeMesh(bool theVal);
148   bool GetOptimizeMesh() const { return _optimizeMesh; }
149
150   void SetQuadraticMesh(bool theVal);
151   bool GetQuadraticMesh() const { return _quadraticMesh; }
152
153   void SetTopology(Topology theTopology);
154   Topology GetTopology() const { return _topology; }
155
156   bool GetUseSurfaceProximity() const { return _useSurfaceProximity; }
157   void SetUseSurfaceProximity( bool toUse );
158
159   int GetNbSurfaceProximityLayers() const { return _nbSurfaceProximityLayers; }
160   void SetNbSurfaceProximityLayers( int nbLayers );
161
162   double GetSurfaceProximityRatio() const { return _surfaceProximityRatio; }
163   void SetSurfaceProximityRatio( double ratio );
164
165   bool GetUseVolumeProximity() const { return _useVolumeProximity; }
166   void SetUseVolumeProximity( bool toUse );
167
168   int GetNbVolumeProximityLayers() const { return _nbVolumeProximityLayers; }
169   void SetNbVolumeProximityLayers( int nbLayers );
170
171   double GetVolumeProximityRatio() const { return _volumeProximityRatio; }
172   void SetVolumeProximityRatio( double ratio );
173
174   void SetVerbosity(int theVal);
175   int GetVerbosity() const { return _verb; }
176
177   void ClearEntry(const std::string& entry, const char * attEntry = 0);
178   void ClearSizeMaps();
179
180   void SetEnforceCadEdgesSize( bool toEnforce );
181   bool GetEnforceCadEdgesSize();
182
183   void SetJacobianRectificationRespectGeometry( bool allowRectification );
184   bool GetJacobianRectificationRespectGeometry();
185
186   void SetUseDeprecatedPatchMesher( bool useDeprecatedPatchMesher );
187   bool GetUseDeprecatedPatchMesher();
188
189   void SetJacobianRectification( bool allowRectification );
190   bool GetJacobianRectification();
191
192   void SetMaxNumberOfPointsPerPatch( int nb );
193   int  GetMaxNumberOfPointsPerPatch();
194
195   void SetMaxNumberOfThreads( int nb );
196   int  GetMaxNumberOfThreads();
197
198   void SetRespectGeometry( bool toRespect );
199   bool GetRespectGeometry();
200
201   void SetTinyEdgesAvoidSurfaceIntersections( bool toAvoidIntersection );
202   bool GetTinyEdgesAvoidSurfaceIntersections();
203
204   void SetClosedGeometry( bool isClosed );
205   bool GetClosedGeometry();
206
207   void SetDebug( bool isDebug );
208   bool GetDebug();
209
210   void SetPeriodicTolerance( double tol );
211   double GetPeriodicTolerance();
212
213   void SetRequiredEntities( const std::string& howToTreat );
214   std::string GetRequiredEntities();
215
216   void SetSewingTolerance( double tol );
217   double GetSewingTolerance();
218
219   void SetTags( const std::string& howToTreat );
220   std::string GetTags();
221
222   // Hyper-patches
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;
227
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 );
235
236
237   void SetPreCADMergeEdges(bool theVal);
238   bool GetPreCADMergeEdges() const { return _preCADMergeEdges; }
239
240   void SetPreCADRemoveDuplicateCADFaces(bool theVal);
241   bool GetPreCADRemoveDuplicateCADFaces() const { return _preCADRemoveDuplicateCADFaces; }
242
243   void SetPreCADProcess3DTopology(bool theVal);
244   bool GetPreCADProcess3DTopology() const { return _preCADProcess3DTopology; }
245
246   void SetPreCADDiscardInput(bool theVal);
247   bool GetPreCADDiscardInput() const { return _preCADDiscardInput; }
248
249   static bool HasPreCADOptions(const BLSURFPlugin_Hypothesis* hyp);
250     
251   typedef std::map<std::string,std::string> TSizeMap;
252
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; }
256   /*!
257    * \brief Return the size maps
258    */
259   static TSizeMap GetSizeMapEntries(const BLSURFPlugin_Hypothesis* hyp);
260
261
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; };
265   /*!
266    * \brief Return the attractors
267    */
268   static TSizeMap GetAttractorEntries(const BLSURFPlugin_Hypothesis* hyp);
269
270
271 /*
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; }
276  */
277   
278   typedef std::multimap< std::string, BLSURFPlugin_Attractor* > TAttractorMap;
279   typedef std::map< std::string, std::vector<double> > TParamsMap; //TODO ?? finir 
280   
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; }
284   /*!
285    * \brief Return the attractors entries
286    */
287   static TAttractorMap GetClassAttractorEntries(const BLSURFPlugin_Hypothesis* hyp);
288
289   /*!
290    * To set/get/unset an enforced vertex
291    */
292   // Name
293   typedef std::string TEnfName;
294   // Entry
295   typedef std::string TEntry;
296   // List of entries
297   typedef std::set<TEntry> TEntryList;
298   // Group name
299   typedef std::string TEnfGroupName;
300   // Coordinates
301   typedef std::vector<double> TEnfVertexCoords;
302   typedef std::set< TEnfVertexCoords > TEnfVertexCoordsList;
303
304   // Enforced vertex
305   struct TEnfVertex {
306     TEnfName name;
307     TEntry geomEntry;
308     TEnfVertexCoords coords;
309     TEnfGroupName grpName;
310     TEntryList faceEntries;
311     TopoDS_Vertex vertex;
312   };
313     
314   struct CompareEnfVertices
315   {
316     bool operator () (const TEnfVertex* e1, const TEnfVertex* e2) const {
317       if (e1 && e2) {
318         if (e1->coords.size() && e2->coords.size())
319           return (e1->coords < e2->coords);
320         else
321           return (e1->geomEntry < e2->geomEntry);
322       }
323       return false;
324     }
325   };
326
327   // PreCad Face and Edge periodicity
328   struct TPreCadPeriodicity {
329     TEntry shape1Entry;
330     TEntry shape2Entry;
331     std::vector<std::string> theSourceVerticesEntries;
332     std::vector<std::string> theTargetVerticesEntries;
333   };
334
335   // Edge periodicity
336   struct TEdgePeriodicity {
337     TEntry theFace1Entry;
338     TEntry theEdge1Entry;
339     TEntry theFace2Entry;
340     TEntry theEdge2Entry;
341     int edge_orientation;
342   };
343
344   // Vertex periodicity
345   struct TVertexPeriodicity {
346     TEntry theEdge1Entry;
347     TEntry theVertex1Entry;
348     TEntry theEdge2Entry;
349     TEntry theVertex2Entry;
350   };
351
352   typedef std::pair< TEntry, TEntry > TFacesPeriodicity;
353
354   // List of enforced vertices
355   typedef std::set< TEnfVertex*, CompareEnfVertices > TEnfVertexList;
356
357   // Map Face Entry / List of enforced vertices
358   typedef std::map< TEntry, TEnfVertexList > TFaceEntryEnfVertexListMap;
359
360   // List of Face Entry with internal enforced vertices activated
361   typedef std::set< TEntry > TFaceEntryInternalVerticesList;
362
363   // Map Face Entry / List of coords
364   typedef std::map< TEntry, TEnfVertexCoordsList > TFaceEntryCoordsListMap;
365
366   // Map Face Entry / List of Vertex entry
367   typedef std::map< TEntry, TEntryList > TFaceEntryEnfVertexEntryListMap;
368   
369   // Map Coords / Enforced vertex
370   typedef std::map< TEnfVertexCoords, TEnfVertex* > TCoordsEnfVertexMap;
371
372   // Map Vertex entry / Enforced vertex
373   typedef std::map< TEntry, TEnfVertex* > TEnfVertexEntryEnfVertexMap;
374
375   typedef std::map< TEnfGroupName, std::set<int> > TGroupNameNodeIDMap;
376   /* TODO GROUPS
377   // Map Group Name / List of enforced vertices
378   typedef std::map< TEnfGroupName , TEnfVertexList > TGroupNameEnfVertexListMap;
379   */
380
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;
386   
387
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);
398   
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);
401
402   void ClearAllEnforcedVertices();
403   void AddEnforcedVertex( const TEntry& theFaceEntry, TEnfVertex * theEnfVertex );
404
405   const TFaceEntryEnfVertexListMap&  _GetAllEnforcedVerticesByFace() const { return _faceEntryEnfVertexListMap; }
406   const TEnfVertexList&              _GetAllEnforcedVertices() const { return _enfVertexList; }
407
408   const TFaceEntryCoordsListMap&     _GetAllCoordsByFace() const { return _faceEntryCoordsListMap; }
409   const TCoordsEnfVertexMap&         _GetAllEnforcedVerticesByCoords() const { return _coordsEnfVertexMap; }
410
411   const TFaceEntryEnfVertexEntryListMap& _GetAllEnfVertexEntriesByFace() const { return _faceEntryEnfVertexEntryListMap; }
412   const TEnfVertexEntryEnfVertexMap&     _GetAllEnforcedVerticesByEnfVertexEntry() const { return _enfVertexEntryEnfVertexMap; }
413
414 //   TODO GROUPS
415 //   const TEnfVertexGroupNameMap _GetEnforcedVertexGroupNameMap() const { return _enfVertexGroupNameMap; }
416   
417
418   /*!
419    * \brief Return the enforced vertices
420    */
421   static TFaceEntryEnfVertexListMap       GetAllEnforcedVerticesByFace(const BLSURFPlugin_Hypothesis* hyp);
422   static TEnfVertexList                   GetAllEnforcedVertices(const BLSURFPlugin_Hypothesis* hyp);
423
424   static TFaceEntryCoordsListMap          GetAllCoordsByFace(const BLSURFPlugin_Hypothesis* hyp);
425   static TCoordsEnfVertexMap              GetAllEnforcedVerticesByCoords(const BLSURFPlugin_Hypothesis* hyp);
426
427   static TFaceEntryEnfVertexEntryListMap  GetAllEnfVertexEntriesByFace(const BLSURFPlugin_Hypothesis* hyp);
428   static TEnfVertexEntryEnfVertexMap      GetAllEnforcedVerticesByEnfVertexEntry(const BLSURFPlugin_Hypothesis* hyp);
429
430   /*!
431    * \brief Internal enforced vertices
432    */
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 );
439
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);
446
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.; }
470
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; }
487
488   static int             GetDefaultVerbosity() { return 3; }
489   static Topology        GetDefaultTopology() { return FromCAD; }
490   // PreCAD
491   static bool            GetDefaultPreCADMergeEdges() { return false; }
492   static bool            GetDefaultPreCADRemoveDuplicateCADFaces() { return false; }
493   static bool            GetDefaultPreCADProcess3DTopology() { return false; }
494   static bool            GetDefaultPreCADDiscardInput() { return false; }
495
496   static TSizeMap        GetDefaultSizeMap() { return TSizeMap();}
497   static TAttractorMap   GetDefaultAttractorMap() { return TAttractorMap(); }
498
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(); }
506
507   static bool            GetDefaultInternalEnforcedVertex() { return false; }
508
509   /* TODO GROUPS
510   static TGroupNameEnfVertexListMap GetDefaultGroupNameEnfVertexListMap() { return TGroupNameEnfVertexListMap(); }
511   static TEnfVertexGroupNameMap     GetDefaultEnfVertexGroupNameMap() { return TEnfVertexGroupNameMap(); }
512   */
513
514 //  const TPreCadPeriodicityEntriesVector _GetPreCadFacesPeriodicityEntries() const { return _preCadFacesPeriodicityEntriesVector; }
515
516   static TPreCadPeriodicityVector GetDefaultPreCadFacesPeriodicityVector() { return TPreCadPeriodicityVector(); }
517   const TPreCadPeriodicityVector&  _GetPreCadFacesPeriodicityVector() const { return _preCadFacesPeriodicityVector; }
518   static TPreCadPeriodicityVector GetPreCadFacesPeriodicityVector(const BLSURFPlugin_Hypothesis* hyp);
519
520   static TPreCadPeriodicityVector GetDefaultPreCadEdgesPeriodicityVector() { return TPreCadPeriodicityVector(); }
521   const TPreCadPeriodicityVector&  _GetPreCadEdgesPeriodicityVector() const { return _preCadEdgesPeriodicityVector; }
522   static TPreCadPeriodicityVector GetPreCadEdgesPeriodicityVector(const BLSURFPlugin_Hypothesis* hyp);
523
524   static TFacesPeriodicityVector GetDefaultFacesPeriodicityVector() { return TFacesPeriodicityVector(); }
525   const TFacesPeriodicityVector&  _GetFacesPeriodicityVector() const { return _facesPeriodicityVector; }
526   static TFacesPeriodicityVector GetFacesPeriodicityVector(const BLSURFPlugin_Hypothesis* hyp);
527
528   static TEdgesPeriodicityVector GetDefaultEdgesPeriodicityVector() { return TEdgesPeriodicityVector(); }
529   const TEdgesPeriodicityVector&  _GetEdgesPeriodicityVector() const { return _edgesPeriodicityVector; }
530   static TEdgesPeriodicityVector GetEdgesPeriodicityVector(const BLSURFPlugin_Hypothesis* hyp);
531
532   static TVerticesPeriodicityVector GetDefaultVerticesPeriodicityVector() { return TVerticesPeriodicityVector(); }
533   const TVerticesPeriodicityVector&  _GetVerticesPeriodicityVector() const { return _verticesPeriodicityVector; }
534   static TVerticesPeriodicityVector GetVerticesPeriodicityVector(const BLSURFPlugin_Hypothesis* hyp);
535
536   void ClearPreCadPeriodicityVectors();
537
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);
542
543   static double undefinedDouble() { return -1.0; }
544
545   typedef std::map< std::string, std::string > TOptionValues;
546   typedef std::set< std::string >              TOptionNames;
547
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; }
559
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;
564
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);
568
569   /*!
570     * Sets the file for export resulting mesh in GMF format
571     */
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; }
577   
578   // Persistence
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);
583
584   /*!
585    * \brief Does nothing
586    * \param theMesh - the built mesh
587    * \param theShape - the geometry of interest
588    * \retval bool - always false
589    */
590   virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
591
592   /*!
593    * \brief Initialize my parameter values by default parameters.
594    *  \retval bool - true if parameter values have been successfully defined
595    */
596   virtual bool SetParametersByDefaults(const TDefaults& dflts, const SMESH_Mesh* theMesh=0);
597
598
599 private:
600   PhysicalMesh    _physicalMesh;
601   GeometricMesh   _geometricMesh;
602   double          _phySize;
603   bool            _phySizeRel;
604   double          _minSize, _maxSize;
605   bool            _minSizeRel, _maxSizeRel;
606   bool            _useGradation;
607   double          _gradation;
608   bool            _useVolumeGradation;
609   double          _volumeGradation;
610   ElementType     _elementType;
611   double          _angleMesh;
612   double          _chordalError;
613   bool            _anisotropic;
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;
623   bool            _optimizeMesh;
624   bool            _quadraticMesh;
625   int             _verb;
626   Topology        _topology;
627   bool            _useSurfaceProximity;
628   int             _nbSurfaceProximityLayers;
629   double          _surfaceProximityRatio;
630   bool            _useVolumeProximity;
631   int             _nbVolumeProximityLayers;
632   double          _volumeProximityRatio;
633
634   bool            _preCADMergeEdges;
635   bool            _preCADRemoveDuplicateCADFaces;
636   bool            _preCADProcess3DTopology;
637   bool            _preCADDiscardInput;
638   double          _preCADEpsNano;
639
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;
644
645   TSizeMap        _sizeMap;
646   TSizeMap        _attractors;
647   TAttractorMap   _classAttractors;
648
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;
658   
659 //  Enable internal enforced vertices on specific face if requested by user
660 //  TFaceEntryInternalVerticesList  _faceEntryInternalVerticesList;
661   bool            _enforcedInternalVerticesAllFaces;
662   TEnfGroupName   _enforcedInternalVerticesAllFacesGroup;
663   
664   TPreCadPeriodicityVector _preCadFacesPeriodicityVector;
665   TPreCadPeriodicityVector _preCadEdgesPeriodicityVector;
666
667   TFacesPeriodicityVector    _facesPeriodicityVector;
668   TEdgesPeriodicityVector    _edgesPeriodicityVector;
669   TVerticesPeriodicityVector _verticesPeriodicityVector;
670
671   THyperPatchList        _hyperPatchList;
672   THyperPatchEntriesList _hyperPatchEntriesList;
673
674   // Called by SaveTo to store content of _preCadFacesPeriodicityVector and _preCadEdgesPeriodicityVector
675   void SavePreCADPeriodicity(std::ostream & save, const char* shapeType);
676
677   // Called by LoadFrom to fill _preCadFacesPeriodicityVector and _preCadEdgesPeriodicityVector
678   void LoadPreCADPeriodicity(std::istream & load, const char* shapeType);
679
680   // Called by LoadFrom to fill _facesPeriodicityVector
681   void LoadFacesPeriodicity(std::istream & load);
682
683   // Called by LoadFrom to fill _edgesPeriodicityVector
684   void LoadEdgesPeriodicity(std::istream & load);
685
686   // Called by LoadFrom to fill _verticesPeriodicityVector
687   void LoadVerticesPeriodicity(std::istream & load);
688
689   // Called by SaveTo to store content of _facesPeriodicityVector
690   void SaveFacesPeriodicity(std::ostream & save);
691
692   // Called by SaveTo to store content of _edgesPeriodicityVector
693   void SaveEdgesPeriodicity(std::ostream & save);
694
695   // Called by SaveTo to store content of _verticesPeriodicityVector
696   void SaveVerticesPeriodicity(std::ostream & save);
697
698   std::string     _GMFFileName;
699 //   bool            _GMFFileMode;
700
701 //   TSizeMap      _customSizeMap;
702 };
703
704 #endif