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