Salome HOME
bos #20256: [CEA 18523] Porting SMESH to int 64 bits
[plugins/blsurfplugin.git] / src / BLSURFPlugin / BLSURFPlugin_Hypothesis.hxx
index 2b014b00a9aa73691207d5dbd42b6e24226957cc..134a51db1a2b33cd2bd2402ac0323589b2e0f969 100644 (file)
@@ -1,9 +1,9 @@
-// Copyright (C) 2007-2012  CEA/DEN, EDF R&D
+// Copyright (C) 2007-2021  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 // License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
 //
 // This library is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 #include <cstring>
 #include <sstream>
 #include <utilities.h>
+#include <smIdType.hxx>
 #include "BLSURFPlugin_Attractor.hxx"
 
-//  Parameters for work of BLSURF
+//  Parameters for work of MG-CADSurf
 
 class BLSURFPlugin_Hypothesis: public SMESH_Hypothesis
 {
 public:
-  BLSURFPlugin_Hypothesis(int hypId, int studyId, SMESH_Gen * gen);
+  BLSURFPlugin_Hypothesis(int hypId, SMESH_Gen * gen, bool hasgeom);
 
   enum Topology {
     FromCAD,
@@ -54,75 +55,199 @@ public:
 
   enum PhysicalMesh {
     DefaultSize,
-    PhysicalUserDefined,
-    SizeMap
+    PhysicalGlobalSize,
+    PhysicalLocalSize
   };
 
   enum GeometricMesh {
     DefaultGeom,
-    UserDefined
+    GeometricalGlobalSize,
+    GeometricalLocalSize
   };
 
-  static const char* GetHypType() { return "BLSURF_Parameters"; }
-  
+  enum ElementType {
+    Triangles,
+    QuadrangleDominant,
+    Quadrangles
+  };
+
+  static const char* GetHypType(bool hasgeom)
+  { return hasgeom ? "MG-CADSurf Parameters" : "MG-CADSurf Parameters_NOGEOM"; }
+
   TopoDS_Shape entryToShape(std::string entry);
 
-  void SetTopology(Topology theTopology);
-  Topology GetTopology() const { return _topology; }
+  static std::string GetMeshGemsVersion();
 
   void SetPhysicalMesh(PhysicalMesh thePhysicalMesh);
   PhysicalMesh GetPhysicalMesh() const { return _physicalMesh; }
 
-  void SetPhySize(double thePhySize);
+  void SetGeometricMesh(GeometricMesh theGeometricMesh);
+  GeometricMesh GetGeometricMesh() const { return _geometricMesh; }
+
+  void SetPhySize(double thePhySize, bool isRelative = false);
   double GetPhySize() const { return _phySize; }
+  bool IsPhySizeRel() const { return _phySizeRel; }
 
-  void SetPhyMin(double theMinSize);
-  double GetPhyMin() const { return _phyMin; }
+  void SetMinSize(double theMinSize, bool isRelative = false);
+  double GetMinSize() const { return _minSize; }
+  bool IsMinSizeRel() const { return _minSizeRel; }
 
-  void SetPhyMax(double theMaxSize);
-  double GetPhyMax() const { return _phyMax; }
+  void SetMaxSize(double theMaxSize, bool isRelative = false);
+  double GetMaxSize() const { return _maxSize; }
+  bool IsMaxSizeRel() const { return _maxSizeRel; }
 
-  void SetGeometricMesh(GeometricMesh theGeometricMesh);
-  GeometricMesh GetGeometricMesh() const { return _geometricMesh; }
+  void SetUseGradation(bool toUse);
+  bool GetUseGradation() const { return _useGradation; }
+  void SetGradation(double theGradation);
+  double GetGradation() const { return _gradation; }
 
-  void SetAngleMeshS(double theAngle);
-  double GetAngleMeshS() const { return _angleMeshS; }
+  void SetUseVolumeGradation(bool toUse);
+  bool GetUseVolumeGradation() const { return _useVolumeGradation; }
+  void SetVolumeGradation(double theGradation);
+  double GetVolumeGradation() const { return _volumeGradation; }
 
-  void SetAngleMeshC(double theAngle);
-  double GetAngleMeshC() const { return _angleMeshC; }
+  void SetElementType(ElementType theElementType);
+  ElementType GetElementType() const { return _elementType; }
 
-  void SetGeoMin(double theMinSize);
-  double GetGeoMin() const { return _hgeoMin; }
+  void SetAngleMesh(double theAngle);
+  double GetAngleMesh() const { return _angleMesh; }
 
-  void SetGeoMax(double theMaxSize);
-  double GetGeoMax() const { return _hgeoMax; }
+  void SetChordalError(double theDistance);
+  double GetChordalError() const { return _chordalError; }
 
-  void SetGradation(double theGradation);
-  double GetGradation() const { return _gradation; }
+  void SetAnisotropic(bool theVal);
+  bool GetAnisotropic() const { return _anisotropic; }
+
+  void SetAnisotropicRatio(double theVal);
+  double GetAnisotropicRatio() const { return _anisotropicRatio; }
+
+  void SetRemoveTinyEdges(bool theVal);
+  bool GetRemoveTinyEdges() const { return _removeTinyEdges; }
+
+  void SetTinyEdgeLength(double theVal);
+  double GetTinyEdgeLength() const { return _tinyEdgeLength; }
+
+  void SetOptimiseTinyEdges(bool theVal);
+  bool GetOptimiseTinyEdges() const { return _optimiseTinyEdges; }
+
+  void SetTinyEdgeOptimisationLength(double theVal);
+  double GetTinyEdgeOptimisationLength() const { return _tinyEdgeOptimisationLength; }
+
+  void SetCorrectSurfaceIntersection(bool theVal);
+  bool GetCorrectSurfaceIntersection() const { return _correctSurfaceIntersec; }
+
+  void SetCorrectSurfaceIntersectionMaxCost(double theVal);
+  double GetCorrectSurfaceIntersectionMaxCost() const { return _corrSurfaceIntersCost; }
+
+  void SetBadElementRemoval(bool theVal);
+  bool GetBadElementRemoval() const { return _badElementRemoval; }
 
-  void SetQuadAllowed(bool theVal);
-  bool GetQuadAllowed() const { return _quadAllowed; }
+  void SetBadElementAspectRatio(double theVal);
+  double GetBadElementAspectRatio() const { return _badElementAspectRatio; }
 
-  void SetDecimesh(bool theVal);
-  bool GetDecimesh() const { return _decimesh; }
+  void SetOptimizeMesh(bool theVal);
+  bool GetOptimizeMesh() const { return _optimizeMesh; }
+
+  void SetQuadraticMesh(bool theVal);
+  bool GetQuadraticMesh() const { return _quadraticMesh; }
+
+  void SetTopology(Topology theTopology);
+  Topology GetTopology() const { return _topology; }
+
+  bool GetUseSurfaceProximity() const { return _useSurfaceProximity; }
+  void SetUseSurfaceProximity( bool toUse );
+
+  int GetNbSurfaceProximityLayers() const { return _nbSurfaceProximityLayers; }
+  void SetNbSurfaceProximityLayers( int nbLayers );
+
+  double GetSurfaceProximityRatio() const { return _surfaceProximityRatio; }
+  void SetSurfaceProximityRatio( double ratio );
+
+  bool GetUseVolumeProximity() const { return _useVolumeProximity; }
+  void SetUseVolumeProximity( bool toUse );
+
+  int GetNbVolumeProximityLayers() const { return _nbVolumeProximityLayers; }
+  void SetNbVolumeProximityLayers( int nbLayers );
+
+  double GetVolumeProximityRatio() const { return _volumeProximityRatio; }
+  void SetVolumeProximityRatio( double ratio );
 
   void SetVerbosity(int theVal);
   int GetVerbosity() const { return _verb; }
-  
-  void ClearEntry(const std::string& entry);
+
+  void ClearEntry(const std::string& entry, const char * attEntry = 0);
   void ClearSizeMaps();
 
+  void SetEnforceCadEdgesSize( bool toEnforce );
+  bool GetEnforceCadEdgesSize();
+
+  void SetJacobianRectificationRespectGeometry( bool allowRectification );
+  bool GetJacobianRectificationRespectGeometry();
+
+  void SetUseDeprecatedPatchMesher( bool useDeprecatedPatchMesher );
+  bool GetUseDeprecatedPatchMesher();
+
+  void SetJacobianRectification( bool allowRectification );
+  bool GetJacobianRectification();
+
+  void SetMaxNumberOfPointsPerPatch( int nb );
+  int  GetMaxNumberOfPointsPerPatch();
+
+  void SetMaxNumberOfThreads( int nb );
+  int  GetMaxNumberOfThreads();
+
+  void SetRespectGeometry( bool toRespect );
+  bool GetRespectGeometry();
+
+  void SetTinyEdgesAvoidSurfaceIntersections( bool toAvoidIntersection );
+  bool GetTinyEdgesAvoidSurfaceIntersections();
+
+  void SetClosedGeometry( bool isClosed );
+  bool GetClosedGeometry();
+
+  void SetDebug( bool isDebug );
+  bool GetDebug();
+
+  void SetPeriodicTolerance( double tol );
+  double GetPeriodicTolerance();
+
+  void SetRequiredEntities( const std::string& howToTreat );
+  std::string GetRequiredEntities();
+
+  void SetSewingTolerance( double tol );
+  double GetSewingTolerance();
+
+  void SetTags( const std::string& howToTreat );
+  std::string GetTags();
+
+  // Hyper-patches
+  typedef std::set< int > THyperPatchTags;
+  typedef std::vector< THyperPatchTags > THyperPatchList;
+  typedef std::set< std::string > THyperPatchEntries;
+  typedef std::vector< THyperPatchEntries > THyperPatchEntriesList;
+
+  void SetHyperPatches(const THyperPatchList& hpl, bool notifyMesh=true);
+  void SetHyperPatches(const THyperPatchEntriesList& hpl);
+  void SetHyperPatchIDsByEntry( const TopoDS_Shape&                          mainShape,
+                                const std::map< std::string, TopoDS_Shape >& entryToShape);
+  const THyperPatchList&        GetHyperPatches() const { return _hyperPatchList; }
+  const THyperPatchEntriesList& GetHyperPatchEntries() const { return _hyperPatchEntriesList; }
+  static int GetHyperPatchTag( int faceTag, const BLSURFPlugin_Hypothesis* hyp, int* iPatch=0 );
+
+
   void SetPreCADMergeEdges(bool theVal);
   bool GetPreCADMergeEdges() const { return _preCADMergeEdges; }
 
-  void SetPreCADRemoveNanoEdges(bool theVal);
-  bool GetPreCADRemoveNanoEdges() const { return _preCADRemoveNanoEdges; }
+  void SetPreCADRemoveDuplicateCADFaces(bool theVal);
+  bool GetPreCADRemoveDuplicateCADFaces() const { return _preCADRemoveDuplicateCADFaces; }
+
+  void SetPreCADProcess3DTopology(bool theVal);
+  bool GetPreCADProcess3DTopology() const { return _preCADProcess3DTopology; }
 
   void SetPreCADDiscardInput(bool theVal);
   bool GetPreCADDiscardInput() const { return _preCADDiscardInput; }
 
-  void SetPreCADEpsNano(double theVal);
-  double GetPreCADEpsNano() const { return _preCADEpsNano; }
+  static bool HasPreCADOptions(const BLSURFPlugin_Hypothesis* hyp);
     
   typedef std::map<std::string,std::string> TSizeMap;
 
@@ -151,8 +276,8 @@ public:
   const TSizeMap& GetCustomSizeMapEntries() const { return _customSizeMap; }
  */
   
-  typedef std::map< std::string, BLSURFPlugin_Attractor* > TAttractorMap;
-  typedef std::map< std::string, std::vector<double> > TParamsMap; //TODO à finir 
+  typedef std::multimap< std::string, BLSURFPlugin_Attractor* > TAttractorMap;
+  typedef std::map< std::string, std::vector<double> > TParamsMap; //TODO ?? finir 
   
   void SetClassAttractorEntry(const std::string& entry, const std::string& att_entry, double StartSize, double EndSize, double ActionRadius, double ConstantRadius);
   std::string  GetClassAttractorEntry(const std::string& entry);
@@ -200,6 +325,33 @@ public:
     }
   };
 
+  // PreCad Face and Edge periodicity
+  struct TPreCadPeriodicity {
+    TEntry shape1Entry;
+    TEntry shape2Entry;
+    std::vector<std::string> theSourceVerticesEntries;
+    std::vector<std::string> theTargetVerticesEntries;
+  };
+
+  // Edge periodicity
+  struct TEdgePeriodicity {
+    TEntry theFace1Entry;
+    TEntry theEdge1Entry;
+    TEntry theFace2Entry;
+    TEntry theEdge2Entry;
+    int edge_orientation;
+  };
+
+  // Vertex periodicity
+  struct TVertexPeriodicity {
+    TEntry theEdge1Entry;
+    TEntry theVertex1Entry;
+    TEntry theEdge2Entry;
+    TEntry theVertex2Entry;
+  };
+
+  typedef std::pair< TEntry, TEntry > TFacesPeriodicity;
+
   // List of enforced vertices
   typedef std::set< TEnfVertex*, CompareEnfVertices > TEnfVertexList;
 
@@ -221,37 +373,44 @@ public:
   // Map Vertex entry / Enforced vertex
   typedef std::map< TEntry, TEnfVertex* > TEnfVertexEntryEnfVertexMap;
 
-  typedef std::map< TEnfGroupName, std::set<int> > TGroupNameNodeIDMap;
+  typedef std::map< TEnfGroupName, std::set<smIdType> > TGroupNameNodeIDMap;
   /* TODO GROUPS
   // Map Group Name / List of enforced vertices
   typedef std::map< TEnfGroupName , TEnfVertexList > TGroupNameEnfVertexListMap;
   */
 
+  // Vector of pairs of entries
+  typedef std::vector< TPreCadPeriodicity > TPreCadPeriodicityVector;
+  typedef std::vector< TFacesPeriodicity > TFacesPeriodicityVector;
+  typedef std::vector< TEdgePeriodicity > TEdgesPeriodicityVector;
+  typedef std::vector< TVertexPeriodicity > TVerticesPeriodicityVector;
   
+
   bool                  SetEnforcedVertex(TEntry theFaceEntry, TEnfName theVertexName, TEntry theVertexEntry, TEnfGroupName theGroupName,
                                           double x = 0.0, double y = 0.0, double z = 0.0);
-  TEnfVertexList        GetEnfVertexList(const TEntry& theFaceEntry) throw (std::invalid_argument);
-  TEnfVertexCoordsList  GetEnfVertexCoordsList(const TEntry& theFaceEntry) throw (std::invalid_argument);
-  TEntryList            GetEnfVertexEntryList (const TEntry& theFaceEntry) throw (std::invalid_argument);
-  TEnfVertex*           GetEnfVertex(TEnfVertexCoords coords) throw (std::invalid_argument);
-  TEnfVertex*           GetEnfVertex(const TEntry& theEnfVertexEntry) throw (std::invalid_argument);
-  void                  AddEnfVertexNodeID(TEnfGroupName theGroupName,int theNodeID);
-  std::set<int>         GetEnfVertexNodeIDs(TEnfGroupName theGroupName) throw (std::invalid_argument);
-  void                  RemoveEnfVertexNodeID(TEnfGroupName theGroupName,int theNodeID) throw (std::invalid_argument);
+  TEnfVertexList        GetEnfVertexList(const TEntry& theFaceEntry);
+  TEnfVertexCoordsList  GetEnfVertexCoordsList(const TEntry& theFaceEntry);
+  TEntryList            GetEnfVertexEntryList (const TEntry& theFaceEntry);
+  TEnfVertex*           GetEnfVertex(TEnfVertexCoords coords);
+  TEnfVertex*           GetEnfVertex(const TEntry& theEnfVertexEntry);
+  void                  AddEnfVertexNodeID(TEnfGroupName theGroupName,smIdType theNodeID);
+  std::set<smIdType>    GetEnfVertexNodeIDs(TEnfGroupName theGroupName);
+  void                  RemoveEnfVertexNodeID(TEnfGroupName theGroupName,smIdType theNodeID);
   
-  bool ClearEnforcedVertex(const TEntry& theFaceEntry, double x = 0.0, double y = 0.0, double z = 0.0, const TEntry& theVertexEntry="") throw (std::invalid_argument);
-  bool ClearEnforcedVertices(const TEntry& theFaceEntry) throw (std::invalid_argument);
+  bool ClearEnforcedVertex(const TEntry& theFaceEntry, double x = 0.0, double y = 0.0, double z = 0.0, const TEntry& theVertexEntry="");
+  bool ClearEnforcedVertices(const TEntry& theFaceEntry);
 
   void ClearAllEnforcedVertices();
+  void AddEnforcedVertex( const TEntry& theFaceEntry, TEnfVertex * theEnfVertex );
 
-  const TFaceEntryEnfVertexListMap  _GetAllEnforcedVerticesByFace() const { return _faceEntryEnfVertexListMap; }
-  const TEnfVertexList              _GetAllEnforcedVertices() const { return _enfVertexList; }
+  const TFaceEntryEnfVertexListMap&  _GetAllEnforcedVerticesByFace() const { return _faceEntryEnfVertexListMap; }
+  const TEnfVertexList&              _GetAllEnforcedVertices() const { return _enfVertexList; }
 
-  const TFaceEntryCoordsListMap     _GetAllCoordsByFace() const { return _faceEntryCoordsListMap; }
-  const TCoordsEnfVertexMap         _GetAllEnforcedVerticesByCoords() const { return _coordsEnfVertexMap; }
+  const TFaceEntryCoordsListMap&     _GetAllCoordsByFace() const { return _faceEntryCoordsListMap; }
+  const TCoordsEnfVertexMap&         _GetAllEnforcedVerticesByCoords() const { return _coordsEnfVertexMap; }
 
-  const TFaceEntryEnfVertexEntryListMap _GetAllEnfVertexEntriesByFace() const { return _faceEntryEnfVertexEntryListMap; }
-  const TEnfVertexEntryEnfVertexMap     _GetAllEnforcedVerticesByEnfVertexEntry() const { return _enfVertexEntryEnfVertexMap; }
+  const TFaceEntryEnfVertexEntryListMap& _GetAllEnfVertexEntriesByFace() const { return _faceEntryEnfVertexEntryListMap; }
+  const TEnfVertexEntryEnfVertexMap&     _GetAllEnforcedVerticesByEnfVertexEntry() const { return _enfVertexEntryEnfVertexMap; }
 
 //   TODO GROUPS
 //   const TEnfVertexGroupNameMap _GetEnforcedVertexGroupNameMap() const { return _enfVertexGroupNameMap; }
@@ -273,7 +432,7 @@ public:
    * \brief Internal enforced vertices
    */
   void SetInternalEnforcedVertexAllFaces(bool toEnforceInternalVertices);
-  const bool _GetInternalEnforcedVertexAllFaces() const { return _enforcedInternalVerticesAllFaces; }
+  bool _GetInternalEnforcedVertexAllFaces() const { return _enforcedInternalVerticesAllFaces; }
   static bool GetInternalEnforcedVertexAllFaces( const BLSURFPlugin_Hypothesis* hyp );
   void SetInternalEnforcedVertexAllFacesGroup(TEnfGroupName theGroupName);
   const TEnfGroupName _GetInternalEnforcedVertexAllFacesGroup() const { return _enforcedInternalVerticesAllFacesGroup; }
@@ -286,24 +445,55 @@ public:
 //  void SetInternalEnforcedVertex(TEntry theFaceEntry, bool toEnforceInternalVertices, TEnfGroupName theGroupName);
 //  bool GetInternalEnforcedVertex(const TEntry& theFaceEntry);
 
-  static Topology        GetDefaultTopology();
-  static PhysicalMesh    GetDefaultPhysicalMesh();
-  static double          GetDefaultPhySize();
-  static double          GetDefaultMaxSize();
-  static double          GetDefaultMinSize();
-  static GeometricMesh   GetDefaultGeometricMesh();
-  static double          GetDefaultAngleMeshS();
-  static double          GetDefaultAngleMeshC() { return GetDefaultAngleMeshS(); }
-  static double          GetDefaultGradation();
-  static bool            GetDefaultQuadAllowed();
-  static bool            GetDefaultDecimesh();
-  static int             GetDefaultVerbosity() { return 10; }
+  static PhysicalMesh    GetDefaultPhysicalMesh() { return PhysicalGlobalSize; }
+  static GeometricMesh   GetDefaultGeometricMesh() { return GeometricalGlobalSize; }
+  static double          GetDefaultPhySize(double diagonal, double bbSegmentation);
+  static double          GetDefaultPhySize() { return undefinedDouble(); }
+  static bool            GetDefaultPhySizeRel() { return false; }
+  static double          GetDefaultMinSize(double diagonal);
+  static double          GetDefaultMinSize() { return undefinedDouble(); }
+  static bool            GetDefaultMinSizeRel() { return false; }
+  static double          GetDefaultMaxSize(double diagonal);
+  static double          GetDefaultMaxSize() { return undefinedDouble(); }
+  static bool            GetDefaultMaxSizeRel() { return false; }
+  static bool            GetDefaultUseGradation() { return true; }
+  static double          GetDefaultGradation() { return 1.3; }
+  static bool            GetDefaultUseVolumeGradation() { return false; }
+  static double          GetDefaultVolumeGradation() { return 2; }
+  static ElementType     GetDefaultElementType() { return Triangles; }
+  static double          GetDefaultAngleMesh() { return 8.0; }
+  static bool            GetDefaultUseSurfaceProximity() { return false; }
+  static int             GetDefaultNbSurfaceProximityLayers() { return 1; }
+  static double          GetDefaultSurfaceProximityRatio() { return 1.; }
+  static bool            GetDefaultUseVolumeProximity() { return false; }
+  static int             GetDefaultNbVolumeProximityLayers() { return 1; }
+  static double          GetDefaultVolumeProximityRatio() { return 1.; }
+
+  static double          GetDefaultChordalError(double diagonal);
+  static double          GetDefaultChordalError() { return undefinedDouble(); }
+  static bool            GetDefaultAnisotropic() { return false; }
+  static double          GetDefaultAnisotropicRatio() { return 0.0; }
+  static bool            GetDefaultRemoveTinyEdges() { return false; }
+  static double          GetDefaultTinyEdgeLength(double diagonal);
+  static double          GetDefaultTinyEdgeLength() { return undefinedDouble(); }
+  static bool            GetDefaultOptimiseTinyEdges() { return false; }
+  static double          GetDefaultTinyEdgeOptimisationLength(double diagonal);
+  static double          GetDefaultTinyEdgeOptimisationLength() { return undefinedDouble(); }
+  static bool            GetDefaultCorrectSurfaceIntersection() { return true; }
+  static double          GetDefaultCorrectSurfaceIntersectionMaxCost() { return 15.; }
+  static bool            GetDefaultBadElementRemoval() { return false; }
+  static double          GetDefaultBadElementAspectRatio() {return 1000.0; }
+  static bool            GetDefaultOptimizeMesh() { return true; }
+  static bool            GetDefaultQuadraticMesh() { return false; }
+
+  static int             GetDefaultVerbosity() { return 3; }
+  static Topology        GetDefaultTopology() { return FromCAD; }
   // PreCAD
   static bool            GetDefaultPreCADMergeEdges() { return false; }
-  static bool            GetDefaultPreCADRemoveNanoEdges() { return false; }
+  static bool            GetDefaultPreCADRemoveDuplicateCADFaces() { return false; }
+  static bool            GetDefaultPreCADProcess3DTopology() { return false; }
   static bool            GetDefaultPreCADDiscardInput() { return false; }
-  static double          GetDefaultPreCADEpsNano();
-  
+
   static TSizeMap        GetDefaultSizeMap() { return TSizeMap();}
   static TAttractorMap   GetDefaultAttractorMap() { return TAttractorMap(); }
 
@@ -315,28 +505,67 @@ public:
   static TEnfVertexEntryEnfVertexMap      GetDefaultEnfVertexEntryEnfVertexMap() { return TEnfVertexEntryEnfVertexMap(); }
   static TGroupNameNodeIDMap              GetDefaultGroupNameNodeIDMap() { return TGroupNameNodeIDMap(); }
 
-  static bool            GetDefaultInternalEnforcedVertex();
+  static bool            GetDefaultInternalEnforcedVertex() { return false; }
 
   /* TODO GROUPS
   static TGroupNameEnfVertexListMap GetDefaultGroupNameEnfVertexListMap() { return TGroupNameEnfVertexListMap(); }
   static TEnfVertexGroupNameMap     GetDefaultEnfVertexGroupNameMap() { return TEnfVertexGroupNameMap(); }
   */
 
+//  const TPreCadPeriodicityEntriesVector _GetPreCadFacesPeriodicityEntries() const { return _preCadFacesPeriodicityEntriesVector; }
+
+  static TPreCadPeriodicityVector GetDefaultPreCadFacesPeriodicityVector() { return TPreCadPeriodicityVector(); }
+  const TPreCadPeriodicityVector&  _GetPreCadFacesPeriodicityVector() const { return _preCadFacesPeriodicityVector; }
+  static TPreCadPeriodicityVector GetPreCadFacesPeriodicityVector(const BLSURFPlugin_Hypothesis* hyp);
+
+  static TPreCadPeriodicityVector GetDefaultPreCadEdgesPeriodicityVector() { return TPreCadPeriodicityVector(); }
+  const TPreCadPeriodicityVector&  _GetPreCadEdgesPeriodicityVector() const { return _preCadEdgesPeriodicityVector; }
+  static TPreCadPeriodicityVector GetPreCadEdgesPeriodicityVector(const BLSURFPlugin_Hypothesis* hyp);
+
+  static TFacesPeriodicityVector GetDefaultFacesPeriodicityVector() { return TFacesPeriodicityVector(); }
+  const TFacesPeriodicityVector&  _GetFacesPeriodicityVector() const { return _facesPeriodicityVector; }
+  static TFacesPeriodicityVector GetFacesPeriodicityVector(const BLSURFPlugin_Hypothesis* hyp);
+
+  static TEdgesPeriodicityVector GetDefaultEdgesPeriodicityVector() { return TEdgesPeriodicityVector(); }
+  const TEdgesPeriodicityVector&  _GetEdgesPeriodicityVector() const { return _edgesPeriodicityVector; }
+  static TEdgesPeriodicityVector GetEdgesPeriodicityVector(const BLSURFPlugin_Hypothesis* hyp);
+
+  static TVerticesPeriodicityVector GetDefaultVerticesPeriodicityVector() { return TVerticesPeriodicityVector(); }
+  const TVerticesPeriodicityVector&  _GetVerticesPeriodicityVector() const { return _verticesPeriodicityVector; }
+  static TVerticesPeriodicityVector GetVerticesPeriodicityVector(const BLSURFPlugin_Hypothesis* hyp);
+
+  void ClearPreCadPeriodicityVectors();
+
+  void AddPreCadFacesPeriodicity(TEntry theFace1Entry, TEntry theFace2Entry,
+      std::vector<std::string> &theSourceVerticesEntries, std::vector<std::string> &theTargetVerticesEntries);
+  void AddPreCadEdgesPeriodicity(TEntry theEdge1Entry, TEntry theEdge2Entry,
+      std::vector<std::string> &theSourceVerticesEntries, std::vector<std::string> &theTargetVerticesEntries);
+
   static double undefinedDouble() { return -1.0; }
 
   typedef std::map< std::string, std::string > TOptionValues;
   typedef std::set< std::string >              TOptionNames;
 
   void SetOptionValue(const std::string& optionName,
-                      const std::string& optionValue) throw (std::invalid_argument);
+                      const std::string& optionValue);
   void SetPreCADOptionValue(const std::string& optionName,
-                            const std::string& optionValue) throw (std::invalid_argument);
-  std::string GetOptionValue(const std::string& optionName) throw (std::invalid_argument);
-  std::string GetPreCADOptionValue(const std::string& optionName) throw (std::invalid_argument);
+                            const std::string& optionValue);
+  std::string GetOptionValue(const std::string& optionName, bool* isDefault=0) const;
+  std::string GetPreCADOptionValue(const std::string& optionName, bool* isDefault=0) const;
   void ClearOption(const std::string& optionName);
   void ClearPreCADOption(const std::string& optionName);
-  const TOptionValues& GetOptionValues() const { return _option2value; }
-  const TOptionValues& GetPreCADOptionValues() const { return _preCADoption2value; }
+  TOptionValues        GetOptionValues()       const;
+  TOptionValues        GetPreCADOptionValues() const;
+  const TOptionValues& GetCustomOptionValues() const { return _customOption2value; }
+
+  void AddOption(const std::string& optionName, const std::string& optionValue);
+  void AddPreCADOption(const std::string& optionName, const std::string& optionValue);
+  std::string GetOption(const std::string& optionName) const;
+  std::string GetPreCADOption(const std::string& optionName) const;
+
+  static bool  ToBool(const std::string& str, bool* isOk=0);
+  static double ToDbl(const std::string& str, bool* isOk=0);
+  static int    ToInt(const std::string& str, bool* isOk=0);
 
   /*!
     * Sets the file for export resulting mesh in GMF format
@@ -344,7 +573,7 @@ public:
 //   void SetGMFFile(const std::string& theFileName, bool isBinary);
   void SetGMFFile(const std::string& theFileName);
   std::string GetGMFFile() const { return _GMFFileName; }
-  static std::string GetDefaultGMFFile();
+  static std::string GetDefaultGMFFile() { return "";}
 //   bool GetGMFFileMode() const { return _GMFFileMode; }
   
   // Persistence
@@ -369,34 +598,60 @@ public:
 
 
 private:
-  Topology        _topology;
   PhysicalMesh    _physicalMesh;
-  double          _phySize, _phyMin, _phyMax;
   GeometricMesh   _geometricMesh;
-  double          _angleMeshS, _angleMeshC, _hgeoMin, _hgeoMax;
+  double          _phySize;
+  bool            _phySizeRel;
+  double          _minSize, _maxSize;
+  bool            _minSizeRel, _maxSizeRel;
+  bool            _useGradation;
   double          _gradation;
-  bool            _quadAllowed;
-  bool            _decimesh;
+  bool            _useVolumeGradation;
+  double          _volumeGradation;
+  ElementType     _elementType;
+  double          _angleMesh;
+  double          _chordalError;
+  bool            _anisotropic;
+  double          _anisotropicRatio;
+  bool            _removeTinyEdges;
+  double          _tinyEdgeLength;
+  bool            _optimiseTinyEdges;
+  double          _tinyEdgeOptimisationLength;
+  bool            _correctSurfaceIntersec;
+  double          _corrSurfaceIntersCost;
+  bool            _badElementRemoval;
+  double          _badElementAspectRatio;
+  bool            _optimizeMesh;
+  bool            _quadraticMesh;
   int             _verb;
-  
+  Topology        _topology;
+  bool            _useSurfaceProximity;
+  int             _nbSurfaceProximityLayers;
+  double          _surfaceProximityRatio;
+  bool            _useVolumeProximity;
+  int             _nbVolumeProximityLayers;
+  double          _volumeProximityRatio;
+
   bool            _preCADMergeEdges;
-  bool            _preCADRemoveNanoEdges;
+  bool            _preCADRemoveDuplicateCADFaces;
+  bool            _preCADProcess3DTopology;
   bool            _preCADDiscardInput;
   double          _preCADEpsNano;
-  
-  TOptionValues   _option2value, _preCADoption2value;
-  TOptionNames    _doubleOptions, _charOptions, _preCADdoubleOptions, _preCADcharOptions;
+
+  TOptionValues   _option2value, _preCADoption2value, _customOption2value; // user defined values
+  TOptionValues   _defaultOptionValues;               // default values
+  TOptionNames    _doubleOptions, _charOptions, _boolOptions; // to find a type of option
+  TOptionNames    _preCADdoubleOptions, _preCADcharOptions;
+
   TSizeMap        _sizeMap;
   TSizeMap        _attractors;
   TAttractorMap   _classAttractors;
-  TSizeMap        _attEntry;
-  TParamsMap      _attParams;
 
-  TFaceEntryEnfVertexListMap  _faceEntryEnfVertexListMap;
-  TEnfVertexList              _enfVertexList;
+  TFaceEntryEnfVertexListMap      _faceEntryEnfVertexListMap;
+  TEnfVertexList                  _enfVertexList;
   // maps to get "manual" enf vertex (through their coordinates)
-  TFaceEntryCoordsListMap     _faceEntryCoordsListMap;
-  TCoordsEnfVertexMap         _coordsEnfVertexMap;
+  TFaceEntryCoordsListMap         _faceEntryCoordsListMap;
+  TCoordsEnfVertexMap             _coordsEnfVertexMap;
   // maps to get "geom" enf vertex (through their geom entries)
   TFaceEntryEnfVertexEntryListMap _faceEntryEnfVertexEntryListMap;
   TEnfVertexEntryEnfVertexMap     _enfVertexEntryEnfVertexMap;
@@ -407,6 +662,40 @@ private:
   bool            _enforcedInternalVerticesAllFaces;
   TEnfGroupName   _enforcedInternalVerticesAllFacesGroup;
   
+  TPreCadPeriodicityVector _preCadFacesPeriodicityVector;
+  TPreCadPeriodicityVector _preCadEdgesPeriodicityVector;
+
+  TFacesPeriodicityVector    _facesPeriodicityVector;
+  TEdgesPeriodicityVector    _edgesPeriodicityVector;
+  TVerticesPeriodicityVector _verticesPeriodicityVector;
+
+  THyperPatchList        _hyperPatchList;
+  THyperPatchEntriesList _hyperPatchEntriesList;
+
+  // Called by SaveTo to store content of _preCadFacesPeriodicityVector and _preCadEdgesPeriodicityVector
+  void SavePreCADPeriodicity(std::ostream & save, const char* shapeType);
+
+  // Called by LoadFrom to fill _preCadFacesPeriodicityVector and _preCadEdgesPeriodicityVector
+  void LoadPreCADPeriodicity(std::istream & load, const char* shapeType);
+
+  // Called by LoadFrom to fill _facesPeriodicityVector
+  void LoadFacesPeriodicity(std::istream & load);
+
+  // Called by LoadFrom to fill _edgesPeriodicityVector
+  void LoadEdgesPeriodicity(std::istream & load);
+
+  // Called by LoadFrom to fill _verticesPeriodicityVector
+  void LoadVerticesPeriodicity(std::istream & load);
+
+  // Called by SaveTo to store content of _facesPeriodicityVector
+  void SaveFacesPeriodicity(std::ostream & save);
+
+  // Called by SaveTo to store content of _edgesPeriodicityVector
+  void SaveEdgesPeriodicity(std::ostream & save);
+
+  // Called by SaveTo to store content of _verticesPeriodicityVector
+  void SaveVerticesPeriodicity(std::ostream & save);
+
   std::string     _GMFFileName;
 //   bool            _GMFFileMode;