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