Salome HOME
Merge branch 'V9_2_BR'
[plugins/ghs3dplugin.git] / src / GHS3DPlugin / GHS3DPlugin_Hypothesis.hxx
index f3b202890534dcc0578e6aab88c864be91f6bcc5..601581f365d03f2e617e41acf73852f69d8204ec 100644 (file)
@@ -1,9 +1,9 @@
-// Copyright (C) 2004-2013  CEA/DEN, EDF R&D
+// Copyright (C) 2004-2016  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
@@ -44,7 +44,7 @@ class GHS3DPLUGIN_EXPORT GHS3DPlugin_Hypothesis: public SMESH_Hypothesis
 {
 public:
 
-  GHS3DPlugin_Hypothesis(int hypId, int studyId, SMESH_Gen * gen);
+  GHS3DPlugin_Hypothesis(int hypId, SMESH_Gen * gen);
 
   typedef std::map<std::vector<double>,double> TGHS3DEnforcedVertexCoordsValues;
   typedef std::map<std::string,double> TGHS3DEnforcedVertexEntryValues;
@@ -111,14 +111,14 @@ public:
 
   struct TIDMeshIDCompare {
     bool operator () (const SMDS_MeshElement* e1, const SMDS_MeshElement* e2) const
-    { return e1->getMeshId() == e2->getMeshId() ? e1->GetID() < e2->GetID() : e1->getMeshId() < e2->getMeshId() ; }
+    { return e1->GetMesh() == e2->GetMesh() ? e1->GetID() < e2->GetID() : e1->GetMesh() < e2->GetMesh() ; }
   };
   
   typedef std::map<const SMDS_MeshElement*, std::string, TIDMeshIDCompare > TIDSortedElemGroupMap;
   typedef std::map<const SMDS_MeshNode*, std::string, TIDMeshIDCompare > TIDSortedNodeGroupMap;
   typedef std::set<std::string> TSetStrings;
 
-  static const char* GetHypType() { return "GHS3D_Parameters"; }
+  static const char* GetHypType() { return "MG-Tetra Parameters"; }
   /*!
    * To mesh "holes" in a solid or not. Default is to mesh.
    */
@@ -134,14 +134,14 @@ public:
   /*!
    * Maximal size of memory to be used by the algorithm (in Megabytes)
    */
-  void SetMaximumMemory(short MB);
-  short GetMaximumMemory() const;
+  void SetMaximumMemory(float MB);
+  float GetMaximumMemory() const;
   /*!
    * Initial size of memory to be used by the algorithm (in Megabytes) in
    * automatic memory adjustment mode. Default is zero
    */
-  void SetInitialMemory(short MB);
-  short GetInitialMemory() const;
+  void SetInitialMemory(float MB);
+  float GetInitialMemory() const;
   /*!
    * Optimization level: 0-none, 1-light, 2-medium, 3-standard+, 4-strong. Default is medium
    */
@@ -197,13 +197,23 @@ public:
   /*!
    * To set hiden/undocumented/advanced options
    */
-  void SetTextOption(const std::string& option);
-  std::string GetTextOption() const;
+  void SetAdvancedOption(const std::string& option);
+  std::string GetAdvancedOption() const;
   /*!
   * To define the volumic gradation
   */
   void SetGradation(double gradation);
   double GetGradation() const ;
+  /*!
+  * Print log in standard output
+  */
+  void SetStandardOutputLog(bool logInStandardOutput);
+  bool GetStandardOutputLog() const ;
+  /*!
+  * Remove log file on success
+  */
+  void SetRemoveLogOnSuccess(bool removeLogOnSuccess);
+  bool GetRemoveLogOnSuccess() const ;
     
   
 //   struct TEnforcedEdge {
@@ -215,10 +225,11 @@ public:
   
 
   /*!
-   * \brief Return command to run ghs3d mesher excluding file prefix (-f)
+   * \brief Return command to run MG-Tetra mesher excluding file prefix (-f)
    */
   static std::string CommandToRun(const GHS3DPlugin_Hypothesis* hyp,
-                                  const bool                    hasShapeToMesh=true);
+                                  const bool                    hasShapeToMesh,
+                                  const bool                    forExucutable);
   /*!
    * \brief Return a unique file name
    */
@@ -236,11 +247,11 @@ public:
   TGHS3DEnforcedVertex* GetEnforcedVertex(double x, double y, double z) throw (std::invalid_argument);
   TGHS3DEnforcedVertex* GetEnforcedVertex(const std::string anEntry) throw (std::invalid_argument);
   bool RemoveEnforcedVertex(double x=0.0, double y=0.0, double z=0.0, const std::string anEntry="" ) throw (std::invalid_argument);
-  const TGHS3DEnforcedVertexCoordsValues _GetEnforcedVerticesCoordsSize() const {return _enfVertexCoordsSizeList; }
-  const TGHS3DEnforcedVertexEntryValues  _GetEnforcedVerticesEntrySize() const {return _enfVertexEntrySizeList; }
-  const TGHS3DEnforcedVertexList         _GetEnforcedVertices() const { return _enfVertexList; }
-  const TCoordsGHS3DEnforcedVertexMap    _GetEnforcedVerticesByCoords() const { return _coordsEnfVertexMap; }
-  const TGeomEntryGHS3DEnforcedVertexMap _GetEnforcedVerticesByEntry() const { return _geomEntryEnfVertexMap; }
+  const TGHS3DEnforcedVertexCoordsValues& _GetEnforcedVerticesCoordsSize() const {return _enfVertexCoordsSizeList; }
+  const TGHS3DEnforcedVertexEntryValues & _GetEnforcedVerticesEntrySize() const {return _enfVertexEntrySizeList; }
+  const TGHS3DEnforcedVertexList        & _GetEnforcedVertices() const { return _enfVertexList; }
+  const TCoordsGHS3DEnforcedVertexMap   & _GetEnforcedVerticesByCoords() const { return _coordsEnfVertexMap; }
+  const TGeomEntryGHS3DEnforcedVertexMap& _GetEnforcedVerticesByEntry() const { return _geomEntryEnfVertexMap; }
   void ClearEnforcedVertices();
 
   /*!
@@ -279,8 +290,8 @@ public:
   
   static bool   DefaultMeshHoles();
   static bool   DefaultToMakeGroupsOfDomains();
-  static short  DefaultMaximumMemory();
-  static short  DefaultInitialMemory();
+  static float  DefaultMaximumMemory();
+  static float  DefaultInitialMemory();
   static short  DefaultOptimizationLevel();
   static std::string DefaultWorkingDirectory();
   static bool   DefaultKeepFiles();
@@ -289,6 +300,8 @@ public:
   static bool   DefaultToUseBoundaryRecoveryVersion();
   static bool   DefaultToUseFEMCorrection();
   static bool   DefaultToRemoveCentralPoint();
+  static bool   DefaultStandardOutputLog();
+  static bool   DefaultRemoveLogOnSuccess();
   static double DefaultGradation();
   
   static TGHS3DEnforcedVertex DefaultGHS3DEnforcedVertex() {return TGHS3DEnforcedVertex();}
@@ -310,8 +323,6 @@ public:
   // Persistence
   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
@@ -319,44 +330,45 @@ public:
   virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
 
   /*!
-   * \brief Does nothing
+   * \brief Sets myToMakeGroupsOfDomains depending on whether theMesh is on shape or not
    */
   virtual bool SetParametersByDefaults(const TDefaults& dflts, const SMESH_Mesh* theMesh=0);
 
-private:
+protected:
 
-  bool   myToMeshHoles;
-  bool   myToMakeGroupsOfDomains;
-  short  myMaximumMemory;
-  short  myInitialMemory;
-  short  myOptimizationLevel;
-  bool   myKeepFiles;
+  bool        myToMeshHoles;
+  bool        myToMakeGroupsOfDomains;
+  float       myMaximumMemory;
+  float       myInitialMemory;
+  short       myOptimizationLevel;
+  bool        myKeepFiles;
   std::string myWorkingDirectory;
-  short  myVerboseLevel;
-  bool   myToCreateNewNodes;
-  bool   myToUseBoundaryRecoveryVersion;
-  bool   myToUseFemCorrection;
-  bool   myToRemoveCentralPoint;
+  short       myVerboseLevel;
+  bool        myToCreateNewNodes;
+  bool        myToUseBoundaryRecoveryVersion;
+  bool        myToUseFemCorrection;
+  bool        myToRemoveCentralPoint;
+  bool        myLogInStandardOutput;
+  bool        myRemoveLogOnSuccess;
   std::string myTextOption;
-  double myGradation;
+  double      myGradation;
   
-  TGHS3DEnforcedVertexList _enfVertexList;
+  TGHS3DEnforcedVertexList         _enfVertexList;
   TGHS3DEnforcedVertexCoordsValues _enfVertexCoordsSizeList;
-  TGHS3DEnforcedVertexEntryValues _enfVertexEntrySizeList;
+  TGHS3DEnforcedVertexEntryValues  _enfVertexEntrySizeList;
   // map to get "manual" enf vertex (through the coordinates)
-  TCoordsGHS3DEnforcedVertexMap _coordsEnfVertexMap;
+  TCoordsGHS3DEnforcedVertexMap    _coordsEnfVertexMap;
   // map to get "geom" enf vertex (through the geom entries)
   TGeomEntryGHS3DEnforcedVertexMap _geomEntryEnfVertexMap;
   
   
-  TGHS3DEnforcedMeshList _enfMeshList;
+  TGHS3DEnforcedMeshList                   _enfMeshList;
   // map to get enf meshes through the entries
-  TEntryGHS3DEnforcedMeshListMap _entryEnfMeshMap;
-  TIDSortedNodeGroupMap _enfNodes;
-  TIDSortedElemGroupMap _enfEdges;
-  TIDSortedElemGroupMap _enfTriangles;
-  TID2SizeMap _nodeIDToSizeMap;
-  std::map<std::string, TIDSortedElemSet > _entryToElemsMap;
+  TEntryGHS3DEnforcedMeshListMap           _entryEnfMeshMap;
+  TIDSortedNodeGroupMap                    _enfNodes;
+  TIDSortedElemGroupMap                    _enfEdges;
+  TIDSortedElemGroupMap                    _enfTriangles;
+  TID2SizeMap                              _nodeIDToSizeMap;
   
   TSetStrings _groupsToRemove;
 };