-// Copyright (C) 2004-2016 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
{
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;
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::set<std::string> TSetStrings;
static const char* GetHypType() { return "MG-Tetra Parameters"; }
+
+ void SetMinSize(double theMinSize);
+ double GetMinSize() const { return myMinSize; }
+
+ void SetMaxSize(double theMaxSize);
+ double GetMaxSize() const { return myMaxSize; }
+
+ void SetUseVolumeProximity( bool toUse );
+ bool GetUseVolumeProximity() const { return myUseVolumeProximity; }
+
+ void SetNbVolumeProximityLayers( int nbLayers );
+ int GetNbVolumeProximityLayers() const { return myNbVolumeProximityLayers; }
+
/*!
* To mesh "holes" in a solid or not. Default is to mesh.
*/
/*!
* Maximal size of memory to be used by the algorithm (in Megabytes)
*/
- void SetMaximumMemory(long MB);
- long 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(long MB);
- long GetInitialMemory() const;
+ void SetInitialMemory(float MB);
+ float GetInitialMemory() const;
/*!
* Optimization level: 0-none, 1-light, 2-medium, 3-standard+, 4-strong. Default is medium
*/
*/
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
*/
/*!
* 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 ;
+ double GetGradation() const;
/*!
* Print log in standard output
*/
void SetStandardOutputLog(bool logInStandardOutput);
- bool GetStandardOutputLog() const ;
+ bool GetStandardOutputLog() const;
/*!
* Remove log file on success
*/
void SetRemoveLogOnSuccess(bool removeLogOnSuccess);
- bool GetRemoveLogOnSuccess() const ;
+ bool GetRemoveLogOnSuccess() const;
+
+ typedef std::map< std::string, std::string > TOptionValues;
+ typedef std::set< std::string > TOptionNames;
+
+ void SetOptionValue(const std::string& optionName,
+ const std::string& optionValue);
+ std::string GetOptionValue(const std::string& optionName,
+ bool* isDefault=0) const;
+ bool HasOptionDefined( const std::string& optionName ) const;
+ void ClearOption(const std::string& optionName);
+ TOptionValues GetOptionValues() const;
+ const TOptionValues& GetCustomOptionValues() const { return _customOption2value; }
+
+ // bool isMGTetraHPCOptions( std::string & option ) const;
+ /*!
+ * \brief To set the advanced options in the execution command line
+ */
+ void SetAdvancedOptionsInCommandLine( std::string & cmd ) 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)
*/
static std::string CommandToRun(const GHS3DPlugin_Hypothesis* hyp,
- const bool hasShapeToMesh=true);
+ const bool hasShapeToMesh,
+ const bool forExucutable);
/*!
* \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
*/
- static std::string GetExeName();
+ static std::string GetExeName( ImplementedAlgorithms algoId );
/*!
* To set an enforced vertex
*/
bool SetEnforcedVertex(std::string aName, std::string anEntry, std::string aGroupName,
double size, double x=0.0, double y=0.0, double z=0.0, bool isCompound = false);
- 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; }
+ TGHS3DEnforcedVertex* GetEnforcedVertex(double x, double y, double z);
+ TGHS3DEnforcedVertex* GetEnforcedVertex(const std::string anEntry);
+ bool RemoveEnforcedVertex(double x=0.0, double y=0.0, double z=0.0, const std::string anEntry="" );
+ 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();
/*!
* 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; }
static bool DefaultMeshHoles();
static bool DefaultToMakeGroupsOfDomains();
- static long DefaultMaximumMemory();
- static long DefaultInitialMemory();
+ static float DefaultMaximumMemory();
+ static float DefaultInitialMemory();
static short DefaultOptimizationLevel();
static std::string DefaultWorkingDirectory();
static bool DefaultKeepFiles();
static bool DefaultToRemoveCentralPoint();
static bool DefaultStandardOutputLog();
static bool DefaultRemoveLogOnSuccess();
- static double DefaultGradation();
-
- static TGHS3DEnforcedVertex DefaultGHS3DEnforcedVertex() {return TGHS3DEnforcedVertex();}
- static TGHS3DEnforcedVertexList DefaultGHS3DEnforcedVertexList() {return TGHS3DEnforcedVertexList();}
- static TGHS3DEnforcedVertexCoordsValues DefaultGHS3DEnforcedVertexCoordsValues() {return TGHS3DEnforcedVertexCoordsValues();}
- static TGHS3DEnforcedVertexEntryValues DefaultGHS3DEnforcedVertexEntryValues() {return TGHS3DEnforcedVertexEntryValues();}
- static TCoordsGHS3DEnforcedVertexMap DefaultCoordsGHS3DEnforcedVertexMap() {return TCoordsGHS3DEnforcedVertexMap();}
- static TGeomEntryGHS3DEnforcedVertexMap DefaultGeomEntryGHS3DEnforcedVertexMap() {return TGeomEntryGHS3DEnforcedVertexMap();}
- static TGroupNameGHS3DEnforcedVertexMap DefaultGroupNameGHS3DEnforcedVertexMap() {return TGroupNameGHS3DEnforcedVertexMap();}
-
- static TGHS3DEnforcedMesh DefaultGHS3DEnforcedMesh() {return TGHS3DEnforcedMesh();}
- static TGHS3DEnforcedMeshList DefaultGHS3DEnforcedMeshList() {return TGHS3DEnforcedMeshList();}
- static TEntryGHS3DEnforcedMeshListMap DefaultEntryGHS3DEnforcedMeshListMap() {return TEntryGHS3DEnforcedMeshListMap();}
- static TIDSortedNodeGroupMap DefaultIDSortedNodeGroupMap() {return TIDSortedNodeGroupMap();}
- static TIDSortedElemGroupMap DefaultIDSortedElemGroupMap() {return TIDSortedElemGroupMap();}
- static TID2SizeMap DefaultID2SizeMap() {return TID2SizeMap();}
- static TSetStrings DefaultGroupsToRemove() {return TSetStrings();}
-
+ 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; }
+ double GetMinSizeDefault() const { return myMinSizeDefault; }
+ double GetMaxSizeDefault() const { return myMaxSizeDefault; }
+
// 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
*/
virtual bool SetParametersByDefaults(const TDefaults& dflts, const SMESH_Mesh* theMesh=0);
-private:
+ 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);
+
+protected:
- bool myToMeshHoles;
- bool myToMakeGroupsOfDomains;
- long myMaximumMemory;
- long 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;
- bool myLogInStandardOutput;
- bool myRemoveLogOnSuccess;
- std::string myTextOption;
- double myGradation;
+ short myVerboseLevel;
+ bool myToCreateNewNodes;
+ bool myToUseBoundaryRecoveryVersion;
+ bool myToUseFemCorrection;
+ bool myToRemoveCentralPoint;
+ bool myLogInStandardOutput;
+ bool myRemoveLogOnSuccess;
+ double myGradation;
+ bool myUseVolumeProximity;
+ int myNbVolumeProximityLayers;
+ 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;
- TGHS3DEnforcedVertexList _enfVertexList;
+ TOptionValues _option2value, _customOption2value; // user defined values
+ TOptionValues _defaultOptionValues; // default values
+ TOptionNames _doubleOptions, _charOptions, _boolOptions; // to find a type of option
+
+ 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;
};