Salome HOME
Merge changes from 'master' branch.
[plugins/blsurfplugin.git] / src / BLSURFPlugin / BLSURFPlugin_Hypothesis.hxx
index bee70c63dfb77f85c908a3f29708b81569c79277..390b2f0fc72f54874f5d768fc59d580888cd5c34 100644 (file)
@@ -43,7 +43,7 @@
 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,
@@ -64,8 +64,15 @@ public:
     GeometricalLocalSize
   };
 
-  static const char* GetHypType() { return "MG-CADSurf 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 SetPhysicalMesh(PhysicalMesh thePhysicalMesh);
@@ -86,11 +93,18 @@ public:
   double GetMaxSize() const { return _maxSize; }
   bool IsMaxSizeRel() const { return _maxSizeRel; }
 
+  void SetUseGradation(bool toUse);
+  bool GetUseGradation() const { return _useGradation; }
   void SetGradation(double theGradation);
   double GetGradation() const { return _gradation; }
 
-  void SetQuadAllowed(bool theVal);
-  bool GetQuadAllowed() const { return _quadAllowed; }
+  void SetUseVolumeGradation(bool toUse);
+  bool GetUseVolumeGradation() const { return _useVolumeGradation; }
+  void SetVolumeGradation(double theGradation);
+  double GetVolumeGradation() const { return _volumeGradation; }
+
+  void SetElementType(ElementType theElementType);
+  ElementType GetElementType() const { return _elementType; }
 
   void SetAngleMesh(double theAngle);
   double GetAngleMesh() const { return _angleMesh; }
@@ -110,6 +124,18 @@ public:
   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; }
 
@@ -131,12 +157,59 @@ public:
   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 ) throw (std::invalid_argument);
+  int  GetMaxNumberOfPointsPerPatch();
+
+  void SetMaxNumberOfThreads( int nb ) throw (std::invalid_argument);
+  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 ) throw (std::invalid_argument);
+  double GetPeriodicTolerance();
+
+  void SetRequiredEntities( const std::string& howToTreat ) throw (std::invalid_argument);
+  std::string GetRequiredEntities();
+
+  void SetSewingTolerance( double tol ) throw (std::invalid_argument);
+  double GetSewingTolerance();
+
+  void SetTags( const std::string& howToTreat ) throw (std::invalid_argument);
+  std::string GetTags();
+
+  // Hyper-patches
+  typedef std::set< int > THyperPatchTags;
+  typedef std::vector< THyperPatchTags > THyperPatchList;
+
+  void SetHyperPatches(const THyperPatchList& hpl);
+  const THyperPatchList& GetHyperPatches() const { return _hyperPatchList; }
+  static int GetHyperPatchTag( int faceTag, const BLSURFPlugin_Hypothesis* hyp, int* iPatch=0 );
+
   void SetPreCADMergeEdges(bool theVal);
   bool GetPreCADMergeEdges() const { return _preCADMergeEdges; }
 
-  void SetPreCADRemoveTinyUVEdges(bool theVal);
-  bool GetPreCADRemoveTinyUVEdges() const { return _preCADRemoveTinyUVEdges; }
-
   void SetPreCADRemoveDuplicateCADFaces(bool theVal);
   bool GetPreCADRemoveDuplicateCADFaces() const { return _preCADRemoveDuplicateCADFaces; }
 
@@ -145,6 +218,8 @@ public:
 
   void SetPreCADDiscardInput(bool theVal);
   bool GetPreCADDiscardInput() const { return _preCADDiscardInput; }
+
+  static bool HasPreCADOptions(const BLSURFPlugin_Hypothesis* hyp);
     
   typedef std::map<std::string,std::string> TSizeMap;
 
@@ -174,7 +249,7 @@ public:
  */
   
   typedef std::multimap< std::string, BLSURFPlugin_Attractor* > TAttractorMap;
-  typedef std::map< std::string, std::vector<double> > TParamsMap; //TODO à finir 
+  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);
@@ -342,7 +417,7 @@ public:
 //  bool GetInternalEnforcedVertex(const TEntry& theFaceEntry);
 
   static PhysicalMesh    GetDefaultPhysicalMesh() { return PhysicalGlobalSize; }
-  static GeometricMesh   GetDefaultGeometricMesh() { return DefaultGeom; }
+  static GeometricMesh   GetDefaultGeometricMesh() { return GeometricalGlobalSize; }
   static double          GetDefaultPhySize(double diagonal, double bbSegmentation);
   static double          GetDefaultPhySize() { return undefinedDouble(); }
   static bool            GetDefaultPhySizeRel() { return false; }
@@ -352,9 +427,12 @@ public:
   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            GetDefaultQuadAllowed() { return false; }
-  static double          GetDefaultAngleMesh() { return 22.0; }
+  static bool            GetDefaultUseVolumeGradation() { return false; }
+  static double          GetDefaultVolumeGradation() { return 2; }
+  static ElementType     GetDefaultElementType() { return Triangles; }
+  static double          GetDefaultAngleMesh() { return 8.0; }
   
   static double          GetDefaultChordalError(double diagonal);
   static double          GetDefaultChordalError() { return undefinedDouble(); }
@@ -363,6 +441,11 @@ public:
   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; }
@@ -372,7 +455,6 @@ public:
   static Topology        GetDefaultTopology() { return FromCAD; }
   // PreCAD
   static bool            GetDefaultPreCADMergeEdges() { return false; }
-  static bool            GetDefaultPreCADRemoveTinyUVEdges() { return false; }
   static bool            GetDefaultPreCADRemoveDuplicateCADFaces() { return false; }
   static bool            GetDefaultPreCADProcess3DTopology() { return false; }
   static bool            GetDefaultPreCADDiscardInput() { return false; }
@@ -433,19 +515,22 @@ public:
                       const std::string& optionValue) throw (std::invalid_argument);
   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);
+  std::string GetOptionValue(const std::string& optionName, bool* isDefault=0) const throw (std::invalid_argument);
+  std::string GetPreCADOptionValue(const std::string& optionName, bool* isDefault=0) const throw (std::invalid_argument);
   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; }
-  const TOptionValues& GetCustomPreCADOptionValues() const { return _customPreCADOption2value; }
 
   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);
-  std::string GetPreCADOption(const std::string& optionName);
+  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) throw (std::invalid_argument);
+  static double ToDbl(const std::string& str, bool* isOk=0) throw (std::invalid_argument);
+  static int    ToInt(const std::string& str, bool* isOk=0) throw (std::invalid_argument);
 
   /*!
     * Sets the file for export resulting mesh in GMF format
@@ -484,14 +569,21 @@ private:
   bool            _phySizeRel;
   double          _minSize, _maxSize;
   bool            _minSizeRel, _maxSizeRel;
+  bool            _useGradation;
   double          _gradation;
-  bool            _quadAllowed;
+  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;
@@ -500,27 +592,27 @@ private:
   Topology        _topology;
   
   bool            _preCADMergeEdges;
-  bool            _preCADRemoveTinyUVEdges;
   bool            _preCADRemoveDuplicateCADFaces;
   bool            _preCADProcess3DTopology;
   bool            _preCADDiscardInput;
   double          _preCADEpsNano;
   
-  TOptionValues   _option2value, _preCADoption2value;
-  TOptionValues   _customOption2value, _customPreCADOption2value;
-  TOptionNames    _doubleOptions, _charOptions;
+  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;
@@ -538,6 +630,8 @@ private:
   TEdgesPeriodicityVector _edgesPeriodicityVector;
   TVerticesPeriodicityVector _verticesPeriodicityVector;
 
+  THyperPatchList _hyperPatchList;
+
   // Called by SaveTo to store content of _preCadFacesPeriodicityVector and _preCadEdgesPeriodicityVector
   void SavePreCADPeriodicity(std::ostream & save, const char* shapeType);