Salome HOME
Merge from V5_1_main branch 24/11/2010
[plugins/ghs3dplugin.git] / src / GHS3DPlugin_Hypothesis.hxx
index 1c59739768c7a29236797cf27d7ec38f76458a9f..28fe2bb64b201c5d9c2c4e9a175bb3870b152353 100644 (file)
@@ -1,4 +1,4 @@
-//  Copyright (C) 2004-2008  CEA/DEN, EDF R&D
+//  Copyright (C) 2004-2010  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
@@ -16,6 +16,7 @@
 //
 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
+
 //  GHS3DPlugin : C++ implementation
 // File      : GHS3DPlugin_Hypothesis.hxx
 // Created   : Wed Apr  2 12:21:17 2008
 #include "GHS3DPlugin_Defs.hxx"
 
 #include <SMESH_Hypothesis.hxx>
+#include <utilities.h>
 
-using namespace std;
+#include <stdexcept>
+#include <map>
+#include <vector>
+#include <cstdio>
 
 class GHS3DPLUGIN_EXPORT GHS3DPlugin_Hypothesis: public SMESH_Hypothesis
 {
@@ -53,16 +58,16 @@ public:
   void SetInitialMemory(short MB);
   short GetInitialMemory() const;
   /*!
-   * Optimization level: 0-none, 1-light, 2-medium, 3-strong. Default is medium
+   * Optimization level: 0-none, 1-light, 2-medium, 3-standard+, 4-strong. Default is medium
    */
-  enum OptimizationLevel { None = 0, Light, Medium, Strong };
+  enum OptimizationLevel { None = 0, Light, Medium, StandardPlus, Strong };
   void SetOptimizationLevel(OptimizationLevel level);
   OptimizationLevel GetOptimizationLevel() const;
   /*!
    * Path to working directory
    */
-  void SetWorkingDirectory(const string& path);
-  string GetWorkingDirectory() const;
+  void SetWorkingDirectory(const std::string& path);
+  std::string GetWorkingDirectory() const;
   /*!
    * To keep working files or remove them. Log file remains in case of errors anyway.
    */
@@ -91,21 +96,46 @@ public:
    */
   void SetToUseBoundaryRecoveryVersion(bool toUse);
   bool GetToUseBoundaryRecoveryVersion() const;
+  /*!
+   * Applies finite-element correction by replacing overconstrained elements where
+   * it is possible. The process is cutting first the overconstrained edges and
+   * second the overconstrained facets. This insure that no edges have two boundary
+   * vertices and that no facets have three boundary vertices.
+   */
+  void SetFEMCorrection(bool toUseFem);
+  bool GetFEMCorrection() const;
+  /*!
+   * To removes initial central point.
+   */
+  void SetToRemoveCentralPoint(bool toRemove);
+  bool GetToRemoveCentralPoint() const;
   /*!
    * To set hiden/undocumented/advanced options
    */
-  void SetTextOption(const string& option);
-  string GetTextOption() const;
+  void SetTextOption(const std::string& option);
+  std::string GetTextOption() const;
+  /*!
+   * To set an enforced vertex
+   */
+  typedef std::map<std::vector<double>,double> TEnforcedVertexValues;
+  void SetEnforcedVertex(double x, double y, double z, double size);
+  double GetEnforcedVertex(double x, double y, double z) throw (std::invalid_argument);
+  void RemoveEnforcedVertex(double x, double y, double z) throw (std::invalid_argument);
+  const TEnforcedVertexValues _GetEnforcedVertices() const { return myEnforcedVertices; }
+  void ClearEnforcedVertices();
 
   static bool   DefaultMeshHoles();
   static short  DefaultMaximumMemory();
   static short  DefaultInitialMemory();
   static short  DefaultOptimizationLevel();
-  static string DefaultWorkingDirectory();
+  static std::string DefaultWorkingDirectory();
   static bool   DefaultKeepFiles();
   static short  DefaultVerboseLevel();
   static bool   DefaultToCreateNewNodes();
   static bool   DefaultToUseBoundaryRecoveryVersion();
+  static bool   DefaultToUseFEMCorrection();
+  static bool   DefaultToRemoveCentralPoint();
+  static TEnforcedVertexValues DefaultEnforcedVertices();
 
   /*!
    * \brief Return command to run ghs3d mesher excluding file prefix (-f)
@@ -116,12 +146,16 @@ public:
    * \brief Return a unique file name
    */
   static std::string GetFileName(const GHS3DPlugin_Hypothesis* hyp);
+  /*!
+   * \brief Return the enforced vertices
+   */
+  static TEnforcedVertexValues GetEnforcedVertices(const GHS3DPlugin_Hypothesis* hyp);
 
   // Persistence
-  virtual ostream & SaveTo(ostream & save);
-  virtual istream & LoadFrom(istream & load);
-  friend GHS3DPLUGIN_EXPORT ostream & operator <<(ostream & save, GHS3DPlugin_Hypothesis & hyp);
-  friend GHS3DPLUGIN_EXPORT istream & operator >>(istream & load, GHS3DPlugin_Hypothesis & hyp);
+  virtual std::ostream & SaveTo(std::ostream & save);
+  virtual std::istream & LoadFrom(std::istream & load);
+  friend GHS3DPLUGIN_EXPORT std::ostream & operator <<(std::ostream & save, GHS3DPlugin_Hypothesis & hyp);
+  friend GHS3DPLUGIN_EXPORT std::istream & operator >>(std::istream & load, GHS3DPlugin_Hypothesis & hyp);
 
   /*!
    * \brief Does nothing
@@ -140,11 +174,14 @@ private:
   short  myInitialMemory;
   short  myOptimizationLevel;
   bool   myKeepFiles;
-  string myWorkingDirectory;
+  std::string myWorkingDirectory;
   short  myVerboseLevel;
   bool   myToCreateNewNodes;
   bool   myToUseBoundaryRecoveryVersion;
-  string myTextOption;
+  bool   myToUseFemCorrection;
+  bool   myToRemoveCentralPoint;
+  std::string myTextOption;
+  TEnforcedVertexValues myEnforcedVertices;
   
 };