Salome HOME
proposal for plugin merge
[plugins/ghs3dplugin.git] / src / GHS3DPlugin / GHS3DPlugin_Hypothesis.hxx
index c023b51726a8295601f55c65a749e3bdf4d96440..97e0162e71ba4b6a2b45614e725358e956ea3559 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2021  CEA/DEN, EDF R&D
+// Copyright (C) 2004-2022  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
@@ -183,6 +183,36 @@ public:
    */
   void SetVerboseLevel(short level);
   short GetVerboseLevel() const;
+  /*!
+   * Implemented algorithms to be executed [0,1]
+   *  0 - MGTetra-HPC
+   *  1 - MGTetra
+   */
+  enum ImplementedAlgorithms { MGTetraHPC = 0,  MGTetra };
+  void SetAlgorithm(ImplementedAlgorithms algoId);
+  ImplementedAlgorithms GetAlgorithm() const;
+  /*!
+   * Set Get for flag to use pthread parallel version of the algorithm
+   */
+  void SetUseNumOfThreads(bool setUseOfThreads);
+  bool GetUseNumOfThreads() const;
+   /*!
+   * Set Get num of threads to be used by MGTetra algorithms
+   */
+  void SetNumOfThreads(short numOfThreads);
+  short GetNumOfThreads() const;
+  /*!
+  * Set Get pthread mode used for MGTetra
+  */
+  enum PThreadMode { PThreadNone = 0, PThreadAggressive,  Safe };
+  void SetPthreadMode(PThreadMode pthreadMode );
+  PThreadMode GetPthreadMode() const;
+  /*!
+  * Set Get paralle mode used for MGTetra HPC
+  */
+  enum ParallelMode { ParallelNone = 0, ReproducibleGivenMaxNumThreads, Reproducible, ParallelAggressive };
+  void SetParallelMode(ParallelMode parallelMode );
+  ParallelMode GetParallelMode() const;
   /*!
    * To create new nodes
    */
@@ -240,16 +270,18 @@ public:
   void ClearOption(const std::string& optionName);
   TOptionValues        GetOptionValues()       const;
   const TOptionValues& GetCustomOptionValues() const { return _customOption2value; }
-  //static inline const char* NoValue() { return "_"; }
+  /*!
+   * \brief To set the advanced options in the execution command line
+   */
+  void SetAdvancedOptionsInCommandLine( std::string & cmd, bool isMGTetra ) const;
   
+  //static inline const char* NoValue() { return "_"; }  
 //   struct TEnforcedEdge {
 //     long ID;
 //     long node1;
 //     long node2;
 //     std::string groupName;
 //   };
-  
-
   /*!
    * \brief Return command to run MG-Tetra mesher excluding file prefix (-f)
    */
@@ -260,6 +292,10 @@ public:
    * \brief Return a unique file name
    */
   static std::string GetFileName(const GHS3DPlugin_Hypothesis* hyp);
+  /*!
+   * \brief Return a unique file name for MGTetraHPC will have a GHS3D prefix
+   */
+  static std::string GetFileNameHPC(const GHS3DPlugin_Hypothesis* hyp);
   /*!
    * \brief Return the name of executable
    */
@@ -284,7 +320,7 @@ public:
    * To set enforced elements
    */
   bool SetEnforcedMesh(SMESH_Mesh& theMesh, SMESH::ElementType elementType, std::string name, std::string entry, std::string groupName = "");
-  bool SetEnforcedGroup(const SMESHDS_Mesh* theMeshDS, SMESH::long_array_var theIDs, SMESH::ElementType elementType, std::string name, std::string entry, std::string groupName = "");
+  bool SetEnforcedGroup(const SMESHDS_Mesh* theMeshDS, SMESH::smIdType_array_var theIDs, SMESH::ElementType elementType, std::string name, std::string entry, std::string groupName = "");
   bool SetEnforcedElements(TIDSortedElemSet theElemSet, SMESH::ElementType elementType, std::string groupName = "");
   const TGHS3DEnforcedMeshList _GetEnforcedMeshes() const { return _enfMeshList; }
   const TEntryGHS3DEnforcedMeshListMap _GetEnforcedMeshesByEntry() const { return _entryEnfMeshMap; }
@@ -331,6 +367,8 @@ public:
   static inline double DefaultGradation() { return 1.05; }
   static bool   DefaultUseVolumeProximity() { return false; }
   static int    DefaultNbVolumeProximityLayers() { return 2; }
+  static short  DefaultAlgorithm() { return MGTetra; }
+  static short  DefaultNumOfThreads() { return 4; }
    
   void SetMinMaxSizeDefault( double theMinSize, double theMaxSize )
   { myMinSizeDefault = theMinSize; myMaxSizeDefault = theMaxSize; }
@@ -377,10 +415,16 @@ protected:
   double      myMinSize, myMinSizeDefault;
   double      myMaxSize, myMaxSizeDefault;
   //std::string myTextOption;
+  short       myAlgorithm;  //member used to pivot between MG-Tetra and MG-Tetra
+  bool        myUseNumOfThreads;
+  short       myNumOfThreads;
+  short       myPthreadModeMG;
+  short       myPthreadModeMGHPC;
   
   TOptionValues _option2value, _customOption2value;         // user defined values
   TOptionValues _defaultOptionValues;                       // default values
-  TOptionNames  _doubleOptions, _charOptions, _boolOptions; // to find a type of option
+  TOptionNames  _doubleOptions, _charOptions, _boolOptions; // to find a type of option  
+  std::vector<std::string>  _commonMGTetraAdvancedOptions;  // common advanced options for MGTetra and MGTetraHPC
 
   TGHS3DEnforcedVertexList         _enfVertexList;
   TGHS3DEnforcedVertexCoordsValues _enfVertexCoordsSizeList;