]> SALOME platform Git repositories - plugins/blsurfplugin.git/blob - src/BLSURFPlugin/BLSURFPlugin_Hypothesis.hxx
Salome HOME
705dc72b8ca0fde385733345d01c402fe22c9d40
[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   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 ) throw (std::invalid_argument);
193   int  GetMaxNumberOfPointsPerPatch();
194
195   void SetMaxNumberOfThreads( int nb ) throw (std::invalid_argument);
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 ) throw (std::invalid_argument);
211   double GetPeriodicTolerance();
212
213   void SetRequiredEntities( const std::string& howToTreat ) throw (std::invalid_argument);
214   std::string GetRequiredEntities();
215
216   void SetSewingTolerance( double tol ) throw (std::invalid_argument);
217   double GetSewingTolerance();
218
219   void SetTags( const std::string& howToTreat ) throw (std::invalid_argument);
220   std::string GetTags();
221
222   // Hyper-patches
223   typedef std::set< int > THyperPatchTags;
224   typedef std::vector< THyperPatchTags > THyperPatchList;
225
226   void SetHyperPatches(const THyperPatchList& hpl);
227   const THyperPatchList& GetHyperPatches() const { return _hyperPatchList; }
228   static int GetHyperPatchTag( int faceTag, const BLSURFPlugin_Hypothesis* hyp, int* iPatch=0 );
229
230   void SetPreCADMergeEdges(bool theVal);
231   bool GetPreCADMergeEdges() const { return _preCADMergeEdges; }
232
233   void SetPreCADRemoveDuplicateCADFaces(bool theVal);
234   bool GetPreCADRemoveDuplicateCADFaces() const { return _preCADRemoveDuplicateCADFaces; }
235
236   void SetPreCADProcess3DTopology(bool theVal);
237   bool GetPreCADProcess3DTopology() const { return _preCADProcess3DTopology; }
238
239   void SetPreCADDiscardInput(bool theVal);
240   bool GetPreCADDiscardInput() const { return _preCADDiscardInput; }
241
242   static bool HasPreCADOptions(const BLSURFPlugin_Hypothesis* hyp);
243     
244   typedef std::map<std::string,std::string> TSizeMap;
245
246   void SetSizeMapEntry(const std::string& entry,const std::string& sizeMap );
247   std::string  GetSizeMapEntry(const std::string& entry);
248   const TSizeMap& _GetSizeMapEntries() const { return _sizeMap; }
249   /*!
250    * \brief Return the size maps
251    */
252   static TSizeMap GetSizeMapEntries(const BLSURFPlugin_Hypothesis* hyp);
253
254
255   void SetAttractorEntry(const std::string& entry,const std::string& attractor );
256   std::string GetAttractorEntry(const std::string& entry);
257   const TSizeMap& _GetAttractorEntries() const { return _attractors; };
258   /*!
259    * \brief Return the attractors
260    */
261   static TSizeMap GetAttractorEntries(const BLSURFPlugin_Hypothesis* hyp);
262
263
264 /*
265   void SetCustomSizeMapEntry(const std::string& entry,const std::string& sizeMap );
266   std::string  GetCustomSizeMapEntry(const std::string& entry);
267   void UnsetCustomSizeMap(const std::string& entry);
268   const TSizeMap& GetCustomSizeMapEntries() const { return _customSizeMap; }
269  */
270   
271   typedef std::multimap< std::string, BLSURFPlugin_Attractor* > TAttractorMap;
272   typedef std::map< std::string, std::vector<double> > TParamsMap; //TODO ?? finir 
273   
274   void SetClassAttractorEntry(const std::string& entry, const std::string& att_entry, double StartSize, double EndSize, double ActionRadius, double ConstantRadius);
275   std::string  GetClassAttractorEntry(const std::string& entry);
276   const TAttractorMap& _GetClassAttractorEntries() const { return _classAttractors; }
277   /*!
278    * \brief Return the attractors entries
279    */
280   static TAttractorMap GetClassAttractorEntries(const BLSURFPlugin_Hypothesis* hyp);
281
282   /*!
283    * To set/get/unset an enforced vertex
284    */
285   // Name
286   typedef std::string TEnfName;
287   // Entry
288   typedef std::string TEntry;
289   // List of entries
290   typedef std::set<TEntry> TEntryList;
291   // Group name
292   typedef std::string TEnfGroupName;
293   // Coordinates
294   typedef std::vector<double> TEnfVertexCoords;
295   typedef std::set< TEnfVertexCoords > TEnfVertexCoordsList;
296
297   // Enforced vertex
298   struct TEnfVertex {
299     TEnfName name;
300     TEntry geomEntry;
301     TEnfVertexCoords coords;
302     TEnfGroupName grpName;
303     TEntryList faceEntries;
304     TopoDS_Vertex vertex;
305   };
306     
307   struct CompareEnfVertices
308   {
309     bool operator () (const TEnfVertex* e1, const TEnfVertex* e2) const {
310       if (e1 && e2) {
311         if (e1->coords.size() && e2->coords.size())
312           return (e1->coords < e2->coords);
313         else
314           return (e1->geomEntry < e2->geomEntry);
315       }
316       return false;
317     }
318   };
319
320   // PreCad Face and Edge periodicity
321   struct TPreCadPeriodicity {
322     TEntry shape1Entry;
323     TEntry shape2Entry;
324     std::vector<std::string> theSourceVerticesEntries;
325     std::vector<std::string> theTargetVerticesEntries;
326   };
327
328   // Edge periodicity
329   struct TEdgePeriodicity {
330     TEntry theFace1Entry;
331     TEntry theEdge1Entry;
332     TEntry theFace2Entry;
333     TEntry theEdge2Entry;
334     int edge_orientation;
335   };
336
337   // Vertex periodicity
338   struct TVertexPeriodicity {
339     TEntry theEdge1Entry;
340     TEntry theVertex1Entry;
341     TEntry theEdge2Entry;
342     TEntry theVertex2Entry;
343   };
344
345   typedef std::pair< TEntry, TEntry > TFacesPeriodicity;
346
347   // List of enforced vertices
348   typedef std::set< TEnfVertex*, CompareEnfVertices > TEnfVertexList;
349
350   // Map Face Entry / List of enforced vertices
351   typedef std::map< TEntry, TEnfVertexList > TFaceEntryEnfVertexListMap;
352
353   // List of Face Entry with internal enforced vertices activated
354   typedef std::set< TEntry > TFaceEntryInternalVerticesList;
355
356   // Map Face Entry / List of coords
357   typedef std::map< TEntry, TEnfVertexCoordsList > TFaceEntryCoordsListMap;
358
359   // Map Face Entry / List of Vertex entry
360   typedef std::map< TEntry, TEntryList > TFaceEntryEnfVertexEntryListMap;
361   
362   // Map Coords / Enforced vertex
363   typedef std::map< TEnfVertexCoords, TEnfVertex* > TCoordsEnfVertexMap;
364
365   // Map Vertex entry / Enforced vertex
366   typedef std::map< TEntry, TEnfVertex* > TEnfVertexEntryEnfVertexMap;
367
368   typedef std::map< TEnfGroupName, std::set<int> > TGroupNameNodeIDMap;
369   /* TODO GROUPS
370   // Map Group Name / List of enforced vertices
371   typedef std::map< TEnfGroupName , TEnfVertexList > TGroupNameEnfVertexListMap;
372   */
373
374   // Vector of pairs of entries
375   typedef std::vector< TPreCadPeriodicity > TPreCadPeriodicityVector;
376   typedef std::vector< TFacesPeriodicity > TFacesPeriodicityVector;
377   typedef std::vector< TEdgePeriodicity > TEdgesPeriodicityVector;
378   typedef std::vector< TVertexPeriodicity > TVerticesPeriodicityVector;
379   
380
381   bool                  SetEnforcedVertex(TEntry theFaceEntry, TEnfName theVertexName, TEntry theVertexEntry, TEnfGroupName theGroupName,
382                                           double x = 0.0, double y = 0.0, double z = 0.0);
383   TEnfVertexList        GetEnfVertexList(const TEntry& theFaceEntry) throw (std::invalid_argument);
384   TEnfVertexCoordsList  GetEnfVertexCoordsList(const TEntry& theFaceEntry) throw (std::invalid_argument);
385   TEntryList            GetEnfVertexEntryList (const TEntry& theFaceEntry) throw (std::invalid_argument);
386   TEnfVertex*           GetEnfVertex(TEnfVertexCoords coords) throw (std::invalid_argument);
387   TEnfVertex*           GetEnfVertex(const TEntry& theEnfVertexEntry) throw (std::invalid_argument);
388   void                  AddEnfVertexNodeID(TEnfGroupName theGroupName,int theNodeID);
389   std::set<int>         GetEnfVertexNodeIDs(TEnfGroupName theGroupName) throw (std::invalid_argument);
390   void                  RemoveEnfVertexNodeID(TEnfGroupName theGroupName,int theNodeID) throw (std::invalid_argument);
391   
392   bool ClearEnforcedVertex(const TEntry& theFaceEntry, double x = 0.0, double y = 0.0, double z = 0.0, const TEntry& theVertexEntry="") throw (std::invalid_argument);
393   bool ClearEnforcedVertices(const TEntry& theFaceEntry) throw (std::invalid_argument);
394
395   void ClearAllEnforcedVertices();
396   void AddEnforcedVertex( const TEntry& theFaceEntry, TEnfVertex * theEnfVertex );
397
398   const TFaceEntryEnfVertexListMap&  _GetAllEnforcedVerticesByFace() const { return _faceEntryEnfVertexListMap; }
399   const TEnfVertexList&              _GetAllEnforcedVertices() const { return _enfVertexList; }
400
401   const TFaceEntryCoordsListMap&     _GetAllCoordsByFace() const { return _faceEntryCoordsListMap; }
402   const TCoordsEnfVertexMap&         _GetAllEnforcedVerticesByCoords() const { return _coordsEnfVertexMap; }
403
404   const TFaceEntryEnfVertexEntryListMap& _GetAllEnfVertexEntriesByFace() const { return _faceEntryEnfVertexEntryListMap; }
405   const TEnfVertexEntryEnfVertexMap&     _GetAllEnforcedVerticesByEnfVertexEntry() const { return _enfVertexEntryEnfVertexMap; }
406
407 //   TODO GROUPS
408 //   const TEnfVertexGroupNameMap _GetEnforcedVertexGroupNameMap() const { return _enfVertexGroupNameMap; }
409   
410
411   /*!
412    * \brief Return the enforced vertices
413    */
414   static TFaceEntryEnfVertexListMap       GetAllEnforcedVerticesByFace(const BLSURFPlugin_Hypothesis* hyp);
415   static TEnfVertexList                   GetAllEnforcedVertices(const BLSURFPlugin_Hypothesis* hyp);
416
417   static TFaceEntryCoordsListMap          GetAllCoordsByFace(const BLSURFPlugin_Hypothesis* hyp);
418   static TCoordsEnfVertexMap              GetAllEnforcedVerticesByCoords(const BLSURFPlugin_Hypothesis* hyp);
419
420   static TFaceEntryEnfVertexEntryListMap  GetAllEnfVertexEntriesByFace(const BLSURFPlugin_Hypothesis* hyp);
421   static TEnfVertexEntryEnfVertexMap      GetAllEnforcedVerticesByEnfVertexEntry(const BLSURFPlugin_Hypothesis* hyp);
422
423   /*!
424    * \brief Internal enforced vertices
425    */
426   void SetInternalEnforcedVertexAllFaces(bool toEnforceInternalVertices);
427   const bool _GetInternalEnforcedVertexAllFaces() const { return _enforcedInternalVerticesAllFaces; }
428   static bool GetInternalEnforcedVertexAllFaces( const BLSURFPlugin_Hypothesis* hyp );
429   void SetInternalEnforcedVertexAllFacesGroup(TEnfGroupName theGroupName);
430   const TEnfGroupName _GetInternalEnforcedVertexAllFacesGroup() const { return _enforcedInternalVerticesAllFacesGroup; }
431   static TEnfGroupName GetInternalEnforcedVertexAllFacesGroup( const BLSURFPlugin_Hypothesis* hyp );
432
433 //  Enable internal enforced vertices on specific face if requested by user
434 //  static TFaceEntryInternalVerticesList GetDefaultFaceEntryInternalVerticesMap() { return TFaceEntryInternalVerticesList(); }
435 //  const TFaceEntryInternalVerticesList  _GetAllInternalEnforcedVerticesByFace() const { return _faceEntryInternalVerticesList; }
436 //  static TFaceEntryInternalVerticesList GetAllInternalEnforcedVerticesByFace(const BLSURFPlugin_Hypothesis* hyp);
437 //  void SetInternalEnforcedVertex(TEntry theFaceEntry, bool toEnforceInternalVertices, TEnfGroupName theGroupName);
438 //  bool GetInternalEnforcedVertex(const TEntry& theFaceEntry);
439
440   static PhysicalMesh    GetDefaultPhysicalMesh() { return PhysicalGlobalSize; }
441   static GeometricMesh   GetDefaultGeometricMesh() { return GeometricalGlobalSize; }
442   static double          GetDefaultPhySize(double diagonal, double bbSegmentation);
443   static double          GetDefaultPhySize() { return undefinedDouble(); }
444   static bool            GetDefaultPhySizeRel() { return false; }
445   static double          GetDefaultMinSize(double diagonal);
446   static double          GetDefaultMinSize() { return undefinedDouble(); }
447   static bool            GetDefaultMinSizeRel() { return false; }
448   static double          GetDefaultMaxSize(double diagonal);
449   static double          GetDefaultMaxSize() { return undefinedDouble(); }
450   static bool            GetDefaultMaxSizeRel() { return false; }
451   static bool            GetDefaultUseGradation() { return true; }
452   static double          GetDefaultGradation() { return 1.3; }
453   static bool            GetDefaultUseVolumeGradation() { return false; }
454   static double          GetDefaultVolumeGradation() { return 2; }
455   static ElementType     GetDefaultElementType() { return Triangles; }
456   static double          GetDefaultAngleMesh() { return 8.0; }
457   static bool            GetDefaultUseSurfaceProximity() { return false; }
458   static int             GetDefaultNbSurfaceProximityLayers() { return 1; }
459   static double          GetDefaultSurfaceProximityRatio() { return 1.; }
460   static bool            GetDefaultUseVolumeProximity() { return false; }
461   static int             GetDefaultNbVolumeProximityLayers() { return 1; }
462   static double          GetDefaultVolumeProximityRatio() { return 1.; }
463
464   static double          GetDefaultChordalError(double diagonal);
465   static double          GetDefaultChordalError() { return undefinedDouble(); }
466   static bool            GetDefaultAnisotropic() { return false; }
467   static double          GetDefaultAnisotropicRatio() { return 0.0; }
468   static bool            GetDefaultRemoveTinyEdges() { return false; }
469   static double          GetDefaultTinyEdgeLength(double diagonal);
470   static double          GetDefaultTinyEdgeLength() { return undefinedDouble(); }
471   static bool            GetDefaultOptimiseTinyEdges() { return false; }
472   static double          GetDefaultTinyEdgeOptimisationLength(double diagonal);
473   static double          GetDefaultTinyEdgeOptimisationLength() { return undefinedDouble(); }
474   static bool            GetDefaultCorrectSurfaceIntersection() { return true; }
475   static double          GetDefaultCorrectSurfaceIntersectionMaxCost() { return 15.; }
476   static bool            GetDefaultBadElementRemoval() { return false; }
477   static double          GetDefaultBadElementAspectRatio() {return 1000.0; }
478   static bool            GetDefaultOptimizeMesh() { return true; }
479   static bool            GetDefaultQuadraticMesh() { return false; }
480
481   static int             GetDefaultVerbosity() { return 3; }
482   static Topology        GetDefaultTopology() { return FromCAD; }
483   // PreCAD
484   static bool            GetDefaultPreCADMergeEdges() { return false; }
485   static bool            GetDefaultPreCADRemoveDuplicateCADFaces() { return false; }
486   static bool            GetDefaultPreCADProcess3DTopology() { return false; }
487   static bool            GetDefaultPreCADDiscardInput() { return false; }
488
489   static TSizeMap        GetDefaultSizeMap() { return TSizeMap();}
490   static TAttractorMap   GetDefaultAttractorMap() { return TAttractorMap(); }
491
492   static TFaceEntryEnfVertexListMap       GetDefaultFaceEntryEnfVertexListMap() { return TFaceEntryEnfVertexListMap(); }
493   static TEnfVertexList                   GetDefaultEnfVertexList() { return TEnfVertexList(); }
494   static TFaceEntryCoordsListMap          GetDefaultFaceEntryCoordsListMap() { return TFaceEntryCoordsListMap(); }
495   static TCoordsEnfVertexMap              GetDefaultCoordsEnfVertexMap() { return TCoordsEnfVertexMap(); }
496   static TFaceEntryEnfVertexEntryListMap  GetDefaultFaceEntryEnfVertexEntryListMap() { return TFaceEntryEnfVertexEntryListMap(); }
497   static TEnfVertexEntryEnfVertexMap      GetDefaultEnfVertexEntryEnfVertexMap() { return TEnfVertexEntryEnfVertexMap(); }
498   static TGroupNameNodeIDMap              GetDefaultGroupNameNodeIDMap() { return TGroupNameNodeIDMap(); }
499
500   static bool            GetDefaultInternalEnforcedVertex() { return false; }
501
502   /* TODO GROUPS
503   static TGroupNameEnfVertexListMap GetDefaultGroupNameEnfVertexListMap() { return TGroupNameEnfVertexListMap(); }
504   static TEnfVertexGroupNameMap     GetDefaultEnfVertexGroupNameMap() { return TEnfVertexGroupNameMap(); }
505   */
506
507 //  const TPreCadPeriodicityEntriesVector _GetPreCadFacesPeriodicityEntries() const { return _preCadFacesPeriodicityEntriesVector; }
508
509   static TPreCadPeriodicityVector GetDefaultPreCadFacesPeriodicityVector() { return TPreCadPeriodicityVector(); }
510   const TPreCadPeriodicityVector&  _GetPreCadFacesPeriodicityVector() const { return _preCadFacesPeriodicityVector; }
511   static TPreCadPeriodicityVector GetPreCadFacesPeriodicityVector(const BLSURFPlugin_Hypothesis* hyp);
512
513   static TPreCadPeriodicityVector GetDefaultPreCadEdgesPeriodicityVector() { return TPreCadPeriodicityVector(); }
514   const TPreCadPeriodicityVector&  _GetPreCadEdgesPeriodicityVector() const { return _preCadEdgesPeriodicityVector; }
515   static TPreCadPeriodicityVector GetPreCadEdgesPeriodicityVector(const BLSURFPlugin_Hypothesis* hyp);
516
517   static TFacesPeriodicityVector GetDefaultFacesPeriodicityVector() { return TFacesPeriodicityVector(); }
518   const TFacesPeriodicityVector&  _GetFacesPeriodicityVector() const { return _facesPeriodicityVector; }
519   static TFacesPeriodicityVector GetFacesPeriodicityVector(const BLSURFPlugin_Hypothesis* hyp);
520
521   static TEdgesPeriodicityVector GetDefaultEdgesPeriodicityVector() { return TEdgesPeriodicityVector(); }
522   const TEdgesPeriodicityVector&  _GetEdgesPeriodicityVector() const { return _edgesPeriodicityVector; }
523   static TEdgesPeriodicityVector GetEdgesPeriodicityVector(const BLSURFPlugin_Hypothesis* hyp);
524
525   static TVerticesPeriodicityVector GetDefaultVerticesPeriodicityVector() { return TVerticesPeriodicityVector(); }
526   const TVerticesPeriodicityVector&  _GetVerticesPeriodicityVector() const { return _verticesPeriodicityVector; }
527   static TVerticesPeriodicityVector GetVerticesPeriodicityVector(const BLSURFPlugin_Hypothesis* hyp);
528
529   void ClearPreCadPeriodicityVectors();
530
531   void AddPreCadFacesPeriodicity(TEntry theFace1Entry, TEntry theFace2Entry,
532       std::vector<std::string> &theSourceVerticesEntries, std::vector<std::string> &theTargetVerticesEntries);
533   void AddPreCadEdgesPeriodicity(TEntry theEdge1Entry, TEntry theEdge2Entry,
534       std::vector<std::string> &theSourceVerticesEntries, std::vector<std::string> &theTargetVerticesEntries);
535
536   static double undefinedDouble() { return -1.0; }
537
538   typedef std::map< std::string, std::string > TOptionValues;
539   typedef std::set< std::string >              TOptionNames;
540
541   void SetOptionValue(const std::string& optionName,
542                       const std::string& optionValue) throw (std::invalid_argument);
543   void SetPreCADOptionValue(const std::string& optionName,
544                             const std::string& optionValue) throw (std::invalid_argument);
545   std::string GetOptionValue(const std::string& optionName, bool* isDefault=0) const throw (std::invalid_argument);
546   std::string GetPreCADOptionValue(const std::string& optionName, bool* isDefault=0) const throw (std::invalid_argument);
547   void ClearOption(const std::string& optionName);
548   void ClearPreCADOption(const std::string& optionName);
549   TOptionValues        GetOptionValues()       const;
550   TOptionValues        GetPreCADOptionValues() const;
551   const TOptionValues& GetCustomOptionValues() const { return _customOption2value; }
552
553   void AddOption(const std::string& optionName, const std::string& optionValue);
554   void AddPreCADOption(const std::string& optionName, const std::string& optionValue);
555   std::string GetOption(const std::string& optionName) const;
556   std::string GetPreCADOption(const std::string& optionName) const;
557
558   static bool  ToBool(const std::string& str, bool* isOk=0) throw (std::invalid_argument);
559   static double ToDbl(const std::string& str, bool* isOk=0) throw (std::invalid_argument);
560   static int    ToInt(const std::string& str, bool* isOk=0) throw (std::invalid_argument);
561
562   /*!
563     * Sets the file for export resulting mesh in GMF format
564     */
565 //   void SetGMFFile(const std::string& theFileName, bool isBinary);
566   void SetGMFFile(const std::string& theFileName);
567   std::string GetGMFFile() const { return _GMFFileName; }
568   static std::string GetDefaultGMFFile() { return "";}
569 //   bool GetGMFFileMode() const { return _GMFFileMode; }
570   
571   // Persistence
572   virtual std::ostream & SaveTo(std::ostream & save);
573   virtual std::istream & LoadFrom(std::istream & load);
574   friend std::ostream & operator <<(std::ostream & save, BLSURFPlugin_Hypothesis & hyp);
575   friend std::istream & operator >>(std::istream & load, BLSURFPlugin_Hypothesis & hyp);
576
577   /*!
578    * \brief Does nothing
579    * \param theMesh - the built mesh
580    * \param theShape - the geometry of interest
581    * \retval bool - always false
582    */
583   virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
584
585   /*!
586    * \brief Initialize my parameter values by default parameters.
587    *  \retval bool - true if parameter values have been successfully defined
588    */
589   virtual bool SetParametersByDefaults(const TDefaults& dflts, const SMESH_Mesh* theMesh=0);
590
591
592 private:
593   PhysicalMesh    _physicalMesh;
594   GeometricMesh   _geometricMesh;
595   double          _phySize;
596   bool            _phySizeRel;
597   double          _minSize, _maxSize;
598   bool            _minSizeRel, _maxSizeRel;
599   bool            _useGradation;
600   double          _gradation;
601   bool            _useVolumeGradation;
602   double          _volumeGradation;
603   ElementType     _elementType;
604   double          _angleMesh;
605   double          _chordalError;
606   bool            _anisotropic;
607   double          _anisotropicRatio;
608   bool            _removeTinyEdges;
609   double          _tinyEdgeLength;
610   bool            _optimiseTinyEdges;
611   double          _tinyEdgeOptimisationLength;
612   bool            _correctSurfaceIntersec;
613   double          _corrSurfaceIntersCost;
614   bool            _badElementRemoval;
615   double          _badElementAspectRatio;
616   bool            _optimizeMesh;
617   bool            _quadraticMesh;
618   int             _verb;
619   Topology        _topology;
620   bool            _useSurfaceProximity;
621   int             _nbSurfaceProximityLayers;
622   double          _surfaceProximityRatio;
623   bool            _useVolumeProximity;
624   int             _nbVolumeProximityLayers;
625   double          _volumeProximityRatio;
626
627   bool            _preCADMergeEdges;
628   bool            _preCADRemoveDuplicateCADFaces;
629   bool            _preCADProcess3DTopology;
630   bool            _preCADDiscardInput;
631   double          _preCADEpsNano;
632
633   TOptionValues   _option2value, _preCADoption2value, _customOption2value; // user defined values
634   TOptionValues   _defaultOptionValues;               // default values
635   TOptionNames    _doubleOptions, _charOptions, _boolOptions; // to find a type of option
636   TOptionNames    _preCADdoubleOptions, _preCADcharOptions;
637
638   TSizeMap        _sizeMap;
639   TSizeMap        _attractors;
640   TAttractorMap   _classAttractors;
641
642   TFaceEntryEnfVertexListMap      _faceEntryEnfVertexListMap;
643   TEnfVertexList                  _enfVertexList;
644   // maps to get "manual" enf vertex (through their coordinates)
645   TFaceEntryCoordsListMap         _faceEntryCoordsListMap;
646   TCoordsEnfVertexMap             _coordsEnfVertexMap;
647   // maps to get "geom" enf vertex (through their geom entries)
648   TFaceEntryEnfVertexEntryListMap _faceEntryEnfVertexEntryListMap;
649   TEnfVertexEntryEnfVertexMap     _enfVertexEntryEnfVertexMap;
650   TGroupNameNodeIDMap             _groupNameNodeIDMap;
651   
652 //  Enable internal enforced vertices on specific face if requested by user
653 //  TFaceEntryInternalVerticesList  _faceEntryInternalVerticesList;
654   bool            _enforcedInternalVerticesAllFaces;
655   TEnfGroupName   _enforcedInternalVerticesAllFacesGroup;
656   
657   TPreCadPeriodicityVector _preCadFacesPeriodicityVector;
658   TPreCadPeriodicityVector _preCadEdgesPeriodicityVector;
659
660   TFacesPeriodicityVector _facesPeriodicityVector;
661   TEdgesPeriodicityVector _edgesPeriodicityVector;
662   TVerticesPeriodicityVector _verticesPeriodicityVector;
663
664   THyperPatchList _hyperPatchList;
665
666   // Called by SaveTo to store content of _preCadFacesPeriodicityVector and _preCadEdgesPeriodicityVector
667   void SavePreCADPeriodicity(std::ostream & save, const char* shapeType);
668
669   // Called by LoadFrom to fill _preCadFacesPeriodicityVector and _preCadEdgesPeriodicityVector
670   void LoadPreCADPeriodicity(std::istream & load, const char* shapeType);
671
672   // Called by LoadFrom to fill _facesPeriodicityVector
673   void LoadFacesPeriodicity(std::istream & load);
674
675   // Called by LoadFrom to fill _edgesPeriodicityVector
676   void LoadEdgesPeriodicity(std::istream & load);
677
678   // Called by LoadFrom to fill _verticesPeriodicityVector
679   void LoadVerticesPeriodicity(std::istream & load);
680
681   // Called by SaveTo to store content of _facesPeriodicityVector
682   void SaveFacesPeriodicity(std::ostream & save);
683
684   // Called by SaveTo to store content of _edgesPeriodicityVector
685   void SaveEdgesPeriodicity(std::ostream & save);
686
687   // Called by SaveTo to store content of _verticesPeriodicityVector
688   void SaveVerticesPeriodicity(std::ostream & save);
689
690   std::string     _GMFFileName;
691 //   bool            _GMFFileMode;
692
693 //   TSizeMap      _customSizeMap;
694 };
695
696 #endif