Update documentation to reflect availability of MGTetra HPC optionalities.
Doc improvement. Define new Set... methods in GHS3DPluginBuilder.py
Update methods SaveTo and LoadFrom to include new hypothesis options. Solve problems observed with hdf dumped files.
Fixing issues pointed. Eliminate reference to MG_TetraHPC_API class since it is not be used. Fix typo when MGTetra HPC (parallel_mode is parallel_strategy). Reuse the same command line for MGTetra and MGTetraHPC changing the called executable depending on the user selection. Define ghs3dSetParametersDemo.py as test folling suggested instructions.
Solving more issues. Carefull var init in constructor to avoid compilation warnings. Diasable EnforcedVertice and EnforceMesh widget when MGTetraHPC is selected. Avoid ref to non initialized class member on call to CommandToRun static method.
Fixing CmakeLists in examples to properly copy the test from python example file into the SALOME_TEST_INSTALLDIR. Add missing CTestTestfileInstall.cmake file as suggested.
Set reproducible_given_max_number_of_thread as default for MGTetraHPC and safe by default for MG-Tetra.
Set Maximal number of threads to true as default on the hypothesis.
SET(SALOME_GHS3DPLUGIN_INSTALL_RES_DATA "${SALOME_INSTALL_RES}/ghs3dplugin" CACHE PATH
"Install path: SALOME GHS3DPLUGIN specific data")
+SET(SALOME_GHS3DPLUGIN_INSTALL_TESTS "${SALOME_INSTALL_BINS}/test")
+
MARK_AS_ADVANCED(SALOME_INSTALL_BINS SALOME_INSTALL_LIBS SALOME_INSTALL_IDLS SALOME_INSTALL_HEADERS)
MARK_AS_ADVANCED(SALOME_INSTALL_SCRIPT_SCRIPTS SALOME_INSTALL_SCRIPT_DATA SALOME_INSTALL_SCRIPT_PYTHON)
MARK_AS_ADVANCED(SALOME_INSTALL_APPLISKEL_SCRIPTS SALOME_INSTALL_APPLISKEL_PYTHON SALOME_INSTALL_CMAKE_LOCAL SALOME_INSTALL_RES)
MARK_AS_ADVANCED(SALOME_INSTALL_PYTHON SALOME_INSTALL_PYTHON_SHARED)
MARK_AS_ADVANCED(SALOME_INSTALL_AMCONFIG_LOCAL SALOME_INSTALL_DOC)
-MARK_AS_ADVANCED(SALOME_GHS3DPLUGIN_INSTALL_RES_DATA)
+MARK_AS_ADVANCED(SALOME_GHS3DPLUGIN_INSTALL_RES_DATA SALOME_GHS3DPLUGIN_INSTALL_TESTS)
# Accumulate environment variables for GHS3DPLUGIN module
SALOME_ACCUMULATE_ENVIRONMENT(PYTHONPATH NOCHECK ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_BINS}
#
FILE(GLOB files "${CMAKE_CURRENT_SOURCE_DIR}/*.py")
-INSTALL(FILES ${files} DESTINATION ${SALOME_INSTALL_DOC}/examples/GHS3DPLUGIN)
+INCLUDE(examples.set)
+
+SET(COMPONENT_NAME GHS3DPLUGIN)
+
+SET(TEST_INSTALL_DIRECTORY ${SALOME_GHS3DPLUGIN_INSTALL_TESTS})
+
+# make test
+SALOME_GENERATE_TESTS_ENVIRONMENT(tests_env)
+
+FOREACH(tfile ${EXAMPLE_NAMES})
+ SET(TEST_NAME ${COMPONENT_NAME}_${tfile})
+ ADD_TEST(NAME ${TEST_NAME}
+ COMMAND ${PYTHON_EXECUTABLE} -B ${CMAKE_CURRENT_SOURCE_DIR}/${tfile}.py)
+ SET_TESTS_PROPERTIES(${TEST_NAME} PROPERTIES ENVIRONMENT "${tests_env}")
+ SET_TESTS_PROPERTIES(${TEST_NAME} PROPERTIES LABELS "${COMPONENT_NAME}")
+ MESSAGE( ${SALOME_INSTALL_DOC})
+ INSTALL(FILES ${tfile}.py DESTINATION ${SALOME_INSTALL_DOC}/examples/GHS3DPLUGIN)
+ENDFOREACH()
+
+# salome test
+FOREACH(tfile ${EXAMPLE_NAMES})
+ INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${tfile}.py
+ DESTINATION ${TEST_INSTALL_DIRECTORY})
+ENDFOREACH()
+
+INSTALL(FILES CTestTestfileInstall.cmake
+ DESTINATION ${TEST_INSTALL_DIRECTORY}
+ RENAME CTestTestfile.cmake)
+
+INSTALL(FILES examples.set DESTINATION ${TEST_INSTALL_DIRECTORY})
\ No newline at end of file
--- /dev/null
+# Copyright (C) 2016-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
+# License as published by the Free Software Foundation; either
+# 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
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+INCLUDE(examples.set)
+
+SET(COMPONENT_NAME GHS3DPLUGIN)
+SET(SALOME_TEST_DRIVER "$ENV{KERNEL_ROOT_DIR}/bin/salome/appliskel/python_test_driver.py")
+SET(TIMEOUT 300)
+
+
+FOREACH(tfile ${EXAMPLE_NAMES})
+ SET(TEST_NAME ${COMPONENT_NAME}_${tfile})
+ ADD_TEST(${TEST_NAME} python ${SALOME_TEST_DRIVER} ${TIMEOUT} ${tfile}.py)
+ SET_TESTS_PROPERTIES(${TEST_NAME} PROPERTIES LABELS "${COMPONENT_NAME}")
+ENDFOREACH()
--- /dev/null
+# Copyright (C) 2016-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
+# License as published by the Free Software Foundation; either
+# 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
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+SET(EXAMPLE_NAMES
+ ghs3dSetParametersDemo
+)
\ No newline at end of file
--- /dev/null
+import unittest
+
+import salome
+salome.salome_init()
+
+from salome.geom import geomBuilder
+geompy = geomBuilder.New()
+
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New()
+
+# create a box
+box = geompy.MakeBoxDXDYDZ(200., 200., 200.)
+geompy.addToStudy(box, "box")
+
+# create a mesh on the box
+mgtetraMesh = smesh.Mesh(box,"box: MG-Tetra and NETGEN_1D_2D mesh")
+
+# create a NETGEN1D2D algorithm for faces and vertices
+NETGEN_1D_2D = mgtetraMesh.Triangle(algo=smeshBuilder.NETGEN_1D2D)
+NETGEN_2D_Parameters_1 = NETGEN_1D_2D.Parameters()
+MG_Tetra = mgtetraMesh.Tetrahedron(algo=smeshBuilder.MG_Tetra)
+MG_Tetra_Parameters_1 = MG_Tetra.Parameters()
+MG_Tetra_Parameters_1.SetAlgorithm( 1 ) # 1 MGTetra (Default) - 0 MGTetra HPC
+MG_Tetra_Parameters_1.SetUseNumOfThreads( 1 ) # 1 true - 0 false
+MG_Tetra_Parameters_1.SetNumOfThreads( 6 ) # Number of threads
+MG_Tetra_Parameters_1.SetPthreadMode( 1 ) # 0 - none, 1 - aggressive, 2 - safe
+
+# compute the mesh with MGTetra
+status = mgtetraMesh.Compute()
+assert( status )
+
+mgtetraHPCMesh = smesh.Mesh(box,"box: MG-Tetra HPC and NETGEN_1D_2D mesh")
+status = mgtetraHPCMesh.AddHypothesis(NETGEN_2D_Parameters_1)
+NETGEN_1D_2D_1 = mgtetraHPCMesh.Triangle(algo=smeshBuilder.NETGEN_1D2D)
+MG_Tetra_1 = mgtetraHPCMesh.Tetrahedron(algo=smeshBuilder.MG_Tetra)
+MG_Tetra_Parameters_2 = MG_Tetra_1.Parameters()
+MG_Tetra_Parameters_2.SetAlgorithm( 0 ) # 1 MGTetra (Default) - 0 MGTetra HPC
+MG_Tetra_Parameters_2.SetUseNumOfThreads( 1 ) # 1 true - 0 false
+MG_Tetra_Parameters_2.SetNumOfThreads( 6 ) # Number of threads
+MG_Tetra_Parameters_2.SetParallelMode( 1 ) # 0 - none, 1 - reproducible_given_max_num_of_threads, 2 - reproducible, 3 - aggressive
+
+# compute the mesh with MGTetra HPC
+status = mgtetraHPCMesh.Compute()
+assert( status )
+
+
+# End of script
+
- <b>Name</b> - allows to define the name of the hypothesis (MG-Tetra
Parameters by default).
+- <b>Algorithm Selection</b> - allows to select the version of MG-Tetra algorithm to be used.
+
- <b>Optimization level</b> - allows choosing the required
optimization level (higher level of optimization provides better mesh,
but can be time-consuming):
- medium (standard)
- - standard+
+ - standard+ (not available whem MG-Tetra HPC is selected)
- strong
- <b>Maximal size</b> - sets the maximum edge size in the generated mesh.
+- <b>Maximal number of threads</b> - define the maximal number of threads to be used by the meshing algorithm.
+ On selection of this box the Pthread mode is activated when MG-Tetra is selected and
+ Parallel mode is activated if the MG-Tetra HPC algorithm is selected.
+
+- <b>Pthread mode</b> - define the parallel strategy used by the mesher when MG-Tetra is selected.
+ - none
+ - aggresive - is faster than the sequential mode, but the quality of the resulting mesh may altered compared to the sequential mode.
+ - safe - is slower than the sequential mode, but the quality of the mesh can only improve;
+
+- <b>Paralle strategy (HPC)</b> - define the parallel strategy used by the mesher when MG-Tetra HPC is selected.
+ - none
+ - reproducible_given_max_number_of_threads
+ - reproducible
+ - aggressive
+
+
- <b>Volumic gradation</b> - Defines the volumic ratio between 2 consecutive elements.
WARNING: Changing the default value of this parameter may dramatically
decrease the quality of the resulting mesh.
\image html ghs3d_parameters_advanced.png
-\subsection advanced_meshing_options Advanced meshing options
+\subsection advanced_meshing_options Advanced meshing options for MG-Tetra algorithm
Advanced page tab expose mostly useful advanced options. Initially,
default values of the options are displayed and they are not
to a given maximum number of errors. At least 1 error is printed and
at most 100 errors are printed to prevent infinite loops.
-- <b>Maximal number of threads</b> - This allows to set the maximal
- number of threads the software can use in parallel for the
- multi-threading optimization mode.
-
- <b>No central point</b> - <b>yes</b> prevents adding an internal point at the
centre of gravity of the bounding box that MeshGems-Tetra uses by
default in order to speed up and to simplify the meshing
- <b>Optimise worst elements</b> - Applies an optimization processing
to improve the worst quality elements whenever possible.
-- <b>Mode of pthreads</b> - This option sets the optimization mode
- when using multithread capabilities. By default, this option is not
- activated which means that only a sequential optimization is
- performed.
-
- - <b>safe</b> is slower than the sequential mode, but the
- quality of the mesh can only improve;
-
- - <b>aggressive</b> - is faster than the sequential mode, but
- the quality of the resulting mesh may altered compared to the sequential mode.
-
- <b>Rectify jacobian</b> - This option activates correction of some
nodes so as to make the Jacobian of element strictly positive when
generating a quadratic mesh.
caracterizes a sliver : any tetrahedron which has at least an angle
below this value will be considered as a sliver.
+- <b>Target quality</b> - Sets the desired maximum target of worst
+ quality acceptable for the volume mesh used during optimisation
+ phase. When defined, an optimization processing is applied to
+ improve the quality until the given target is reached whenever
+ possible. By default, this option is not activated which means that
+ only the standard optimisations are performed (the quality target is
+ the target quality computed by the program).
+
+\subsection advanced_meshing_options_HPC Advanced meshing options for MG-Tetra and MG-Tetra HPC algorithms
+
+This option is common to both algorithms. When MG-Tetra HPC algorithm is selected on the General Parameters view, all advanced options
+are disabled except the follow ones:
+
- <b>Remove overconstrained tetrahedra</b> - This option can be used
to only split the tetrahadra which have at least two facets that
belong to the surface mesh. It will not split the overconstrained
- <b>only</b> means only correction is applied to an existing mesh.
-- <b>Target quality</b> - Sets the desired maximum target of worst
- quality acceptable for the volume mesh used during optimisation
- phase. When defined, an optimization processing is applied to
- improve the quality until the given target is reached whenever
- possible. By default, this option is not activated which means that
- only the standard optimisations are performed (the quality target is
- the target quality computed by the program).
-
-\subsection memory_settings Memory settings
+\subsection memory_settings Memory settings (disable when MG-Tetra HPC is selected)
- <b>Maximum memory size</b> - launches MG-Tetra software with
work space limited to the specified amount of RAM, in Mbytes. If this option is
\mainpage Introduction to MG-Tetra plug-in
MG-Tetra plug-in adds two meshing algorithm to the SALOME Mesh:
-\b MG-Tetra (former GHS3D) and <b>MG-Tetra Optimization</b>.
+<b> MG-Tetra or MG-Tetra HPC</b> (former GHS3D) and <b>MG-Tetra Optimization</b>.
-\b MG-Tetra meshing algorithm is destined for:
+<b> MG-Tetra or MG-Tetra HPC</b> meshing algorithm is destined for:
- Meshing 3D geometric entities: solids are split into tetrahedral (pyramidal) elements.
- Generating 3D meshes from 2D meshes (triangles and quadrangles), working without geometrical objects.
*/
void SetOptimizationLevel(in short level) raises (SALOME::SALOME_Exception);
short GetOptimizationLevel();
+ /*!
+ * Algorithm selection: 0-MGTetra HPC, 1-MGTetra
+ */
+ void SetAlgorithm(in short level) raises (SALOME::SALOME_Exception);
+ short GetAlgorithm();
+ /*!
+ * Set use number of threads
+ */
+ void SetUseNumOfThreads(in boolean setThread) raises (SALOME::SALOME_Exception);
+ boolean GetUseNumOfThreads();
+ /*!
+ * Set number of threads to use
+ */
+ void SetNumOfThreads(in short numThreads);
+ short GetNumOfThreads();
+ /*!
+ * PThreadMode defined for MGTetra
+ */
+ void SetPthreadMode(in short pThreadMode) raises (SALOME::SALOME_Exception);
+ short GetPthreadMode();
+ /*!
+ * ParallelMode defined for MGTetra HPC
+ */
+ void SetParallelMode(in short parallelMode) raises (SALOME::SALOME_Exception);
+ short GetParallelMode();
/*!
* Path to working directory
*/
self.Parameters().SetToRemoveCentralPoint(toRemove)
pass
+ ## To set the algorithm id
+ # @param algorithm ID 0 MGTetra HPC - 1 MGTetra
+ def SetAlgorithm(self,algoId):
+ self.Parameters().SetAlgorithm(algoId)
+ pass
+
+ ## To use parallel mode
+ # @param toUseNumOfThreads "use max number of threads" flag value
+ def SetUseNumOfThreads(self,useThreads):
+ self.Parameters().SetUseNumOfThreads(useThreads)
+ pass
+
+ ## To set the number of threads to be used
+ # @param numberOfThreads define max_num_threads for MGTetra and MGTetra HPC
+ def SetNumOfThreads(self,numThreads):
+ self.Parameters().SetNumOfThreads(numThreads)
+ pass
+
+ ## Set SetPthreadMode.
+ # @param pthreadMode for parallel algorithm in MGTetra
+ # - 0 - none
+ # - 1 - aggresive
+ # - 2 - safe
+ def SetPthreadMode(self,pthreadMode):
+ self.Parameters().SetPthreadMode(pthreadMode)
+ pass
+
+ ## Set SetParallelMode.
+ # @param parallelMode for parallel algorithm in MGTetra HPC
+ # - 0 - none
+ # - 1 - reproducible_given_max_number_of_threads
+ # - 2 - reproducible
+ # - 3 - aggressive
+ def SetPthreadMode(self,parallelMode):
+ self.Parameters().SetParallelMode(parallelMode)
+ pass
+
## To set an enforced vertex.
# @param x : x coordinate
# @param y : y coordinate
return true;
}
+
//=============================================================================
/*!
*Here we are going to use the MG-Tetra mesher with geometry
*/
//=============================================================================
-
bool GHS3DPlugin_GHS3D::Compute(SMESH_Mesh& theMesh,
const TopoDS_Shape& theShape)
{
*Here we are going to use the MG-Tetra mesher w/o geometry
*/
//=============================================================================
+
bool GHS3DPlugin_GHS3D::Compute(SMESH_Mesh& theMesh,
SMESH_MesherHelper* theHelper)
{
virtual bool CheckHypothesis(SMESH_Mesh& aMesh,
const TopoDS_Shape& aShape,
Hypothesis_Status& aStatus);
-
- virtual bool Compute(SMESH_Mesh& aMesh,
- const TopoDS_Shape& aShape);
-
virtual void CancelCompute();
bool computeCanceled() { return _computeCanceled; }
virtual bool Evaluate(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape,
MapShapeNbElems& aResMap);
+ virtual bool Compute(SMESH_Mesh& aMesh,
+ const TopoDS_Shape& aShape);
+
virtual bool Compute(SMESH_Mesh& theMesh,
- SMESH_MesherHelper* aHelper);
-
+ SMESH_MesherHelper* aHelper);
+
virtual void SubmeshRestored(SMESH_subMesh* subMesh);
virtual void SetEventListener(SMESH_subMesh* subMesh);
myGradation(DefaultGradation()),
myUseVolumeProximity(DefaultUseVolumeProximity()),
myNbVolumeProximityLayers(DefaultNbVolumeProximityLayers()),
+ myAlgorithm(DefaultAlgorithm()),
+ myNumOfThreads(DefaultNumOfThreads()),
+ myUseNumOfThreads(DefaultUseNumOfThreads()),
+ myPthreadModeMG(DefaultMyPthreadMode()),
+ myPthreadModeMGHPC(DefaultMyPthreadModeHPC()),
myMinSize(0),
myMinSizeDefault(0),
myMaxSize(0),
"" // mark of end
};
const char* intOptionNames[] = { "max_number_of_errors_printed", // 1
- "max_number_of_threads", // 4
"" // mark of end
};
const char* doubleOptionNames[] = { "target_quality", // 0
"sliver_angle", // 5
"" // mark of end
};
- const char* charOptionNames[] = { "pthreads_mode", // ""
- "boundary_regeneration", // standard
+ const char* charOptionNames[] = { "boundary_regeneration", // standard
"split_overconstrained_tetrahedra", // no
"" // mark of end
};
_defaultOptionValues["rectify_jacobian" ] = "yes";
_defaultOptionValues["jacobian_rectification_respect_input_surface_mesh"] = "yes";
_defaultOptionValues["max_number_of_errors_printed" ] = "1";
- _defaultOptionValues["max_number_of_threads" ] = "4";
_defaultOptionValues["target_quality" ] = "";//NoValue();
_defaultOptionValues["sliver_angle" ] = "5";
- _defaultOptionValues["pthreads_mode" ] = "";//NoValue();
_defaultOptionValues["boundary_regeneration" ] = "standard";
_defaultOptionValues["split_overconstrained_tetrahedra" ] = "no";
}
//=======================================================================
-//function : GetToCreateNewNodes
+//function : SetAlgorithm
+//=======================================================================
+void GHS3DPlugin_Hypothesis::SetAlgorithm(ImplementedAlgorithms algoId)
+{
+ if ( myAlgorithm != algoId ) {
+ myAlgorithm = algoId;
+ NotifySubMeshesHypothesisModification();
+ }
+}
+
+//=======================================================================
+//function : short GetAlgorithm() const;
+
+//=======================================================================
+GHS3DPlugin_Hypothesis::ImplementedAlgorithms GHS3DPlugin_Hypothesis::GetAlgorithm() const
+{
+ return (ImplementedAlgorithms) myAlgorithm;
+}
+
+//=======================================================================
+//function : SetPthreadMode
+//=======================================================================
+void GHS3DPlugin_Hypothesis::SetPthreadMode(PThreadMode pThreadsMode )
+{
+ if ( myPthreadModeMG != pThreadsMode ) {
+ myPthreadModeMG = pThreadsMode;
+ NotifySubMeshesHypothesisModification();
+ }
+}
+
+//=======================================================================
+//function : short GetPthreadMode() const;
+
+//=======================================================================
+GHS3DPlugin_Hypothesis::PThreadMode GHS3DPlugin_Hypothesis::GetPthreadMode() const
+{
+ return (PThreadMode)myPthreadModeMG;
+}
+
+//=======================================================================
+//function : SetParallelMode
+//=======================================================================
+void GHS3DPlugin_Hypothesis::SetParallelMode(ParallelMode parallelMode )
+{
+ if ( myPthreadModeMGHPC != parallelMode ) {
+ myPthreadModeMGHPC = parallelMode;
+ NotifySubMeshesHypothesisModification();
+ }
+}
+
+//=======================================================================
+//function : short GetParallelMode() const;
+
+//=======================================================================
+GHS3DPlugin_Hypothesis::ParallelMode GHS3DPlugin_Hypothesis::GetParallelMode() const
+{
+ return (ParallelMode)myPthreadModeMGHPC;
+}
+
+//=======================================================================
+//function : SetUseNumOfThreads
+//=======================================================================
+void GHS3DPlugin_Hypothesis::SetUseNumOfThreads(bool setUseOfThreads)
+{
+ if ( myUseNumOfThreads != setUseOfThreads ) {
+ myUseNumOfThreads = setUseOfThreads;
+ NotifySubMeshesHypothesisModification();
+ }
+}
+
//=======================================================================
+//function : bool GetUseNumOfThreads() const;
+//=======================================================================
+bool GHS3DPlugin_Hypothesis::GetUseNumOfThreads() const
+{
+ return myUseNumOfThreads;
+}
+
+//=======================================================================
+//function : SetNumOfThreads
+//=======================================================================
+void GHS3DPlugin_Hypothesis::SetNumOfThreads(short numOfThreads)
+{
+ if ( myNumOfThreads != numOfThreads ) {
+ myNumOfThreads = numOfThreads;
+ NotifySubMeshesHypothesisModification();
+ }
+}
+
+//=======================================================================
+//function : short GetUseNumOfThreads() const;
+
+//=======================================================================
+short GHS3DPlugin_Hypothesis::GetNumOfThreads() const
+{
+ return myNumOfThreads;
+}
+
+//=======================================================================
+//function : GetToCreateNewNodes
+//=======================================================================
bool GHS3DPlugin_Hypothesis::GetToCreateNewNodes() const
{
return myToCreateNewNodes;
for ( o2v = _customOption2value.begin(); o2v != _customOption2value.end(); ++o2v )
save << " -" << o2v->first << " -" << o2v->second;
+ // New options (issue #32737)
+ save << " " << myAlgorithm;
+ save << " " << myUseNumOfThreads;
+ save << " " << myNumOfThreads;
+ save << " " << myPthreadModeMG;
+ save << " " << myPthreadModeMGHPC;
+
return save;
}
}
}
+ isOK = static_cast<bool>(load >> i);
+ if (isOK)
+ myAlgorithm = (short) i;
+ else
+ load.clear(ios::badbit | load.rdstate());
+
+ isOK = static_cast<bool>(load >> i);
+ if (isOK)
+ myUseNumOfThreads = (short) i;
+ else
+ load.clear(ios::badbit | load.rdstate());
+
+ isOK = static_cast<bool>(load >> i);
+ if (isOK)
+ myNumOfThreads = (short) i;
+ else
+ load.clear(ios::badbit | load.rdstate());
+
+ isOK = static_cast<bool>(load >> i);
+ if (isOK)
+ myPthreadModeMG = (short) i;
+ else
+ load.clear(ios::badbit | load.rdstate());
+
+ isOK = static_cast<bool>(load >> i);
+ if (isOK)
+ myPthreadModeMGHPC = (short) i;
+ else
+ load.clear(ios::badbit | load.rdstate());
+
return load;
}
return true;
}
+void GHS3DPlugin_Hypothesis::SetAdvancedOptionsInCommandLine( std::string & cmd ) const
+{
+ std::string option, value;
+ bool isDefault;
+ const TOptionValues* options[] = { & this->_option2value, & this->_customOption2value };
+ for ( int iOp = 0; iOp < 2; ++iOp )
+ {
+ TOptionValues::const_iterator o2v = options[iOp]->begin();
+ for ( ; o2v != options[iOp]->end(); ++o2v )
+ {
+ option = o2v->first;
+ value = this->GetOptionValue( option, &isDefault );
+
+ if ( isDefault )
+ continue;
+
+ if ( value.empty() )//value == NoValue() )
+ {
+ if ( this->_defaultOptionValues.count( option ))
+ continue; // non-custom option with no value
+ //value.clear();
+ }
+
+ if ( strncmp( "no", option.c_str(), 2 ) == 0 ) // options w/o values: --no_*
+ {
+ if ( !value.empty() && ToBool( value ) == false )
+ continue;
+ value.clear();
+ }
+
+ if ( option[0] != '-' )
+ cmd += " --";
+ else
+ cmd += " ";
+ cmd += option + " " + value;
+ }
+ }
+}
+
//================================================================================
/*!
* \brief Return command to run MG-Tetra mesher excluding file prefix (-f)
*/
//================================================================================
-
std::string GHS3DPlugin_Hypothesis::CommandToRun(const GHS3DPlugin_Hypothesis* hyp,
const bool hasShapeToMesh,
const bool forExecutable)
{
- std::string cmd = GetExeName();
+ GHS3DPlugin_Hypothesis::ImplementedAlgorithms algoId = hyp ? (ImplementedAlgorithms) hyp->myAlgorithm : MGTetra;
+ std::string cmd = GetExeName( algoId );
+
// check if any option is overridden by hyp->myTextOption
bool max_memory = hyp ? !hyp->HasOptionDefined("max_memory") : true;
bool auto_memory = hyp ? !hyp->HasOptionDefined("automatic_memory") : true;
useBndRecovery = hyp->myToUseBoundaryRecoveryVersion;
// MG-Tetra needs to know amount of memory it may use (MB).
- // Default memory is defined at MG-Tetra installation but it may be not enough,
- // so allow to use about all available memory
- if ( max_memory ) {
+ // Default memory is defined at MG-Tetra installation but it may be not enough, // so allow to use about all available memory
+ if ( algoId == MGTetra && max_memory ) {
float aMaximumMemory = hyp ? hyp->myMaximumMemory : -1;
cmd += " --max_memory ";
if ( aMaximumMemory < 0 ) cmd += SMESH_Comment( int( DefaultMaximumMemory() ));
else cmd += SMESH_Comment( int( aMaximumMemory ));
}
- if ( auto_memory && !useBndRecovery ) {
+ if ( algoId == MGTetra && ( auto_memory && !useBndRecovery ) ) {
float aInitialMemory = hyp ? hyp->myInitialMemory : -1;
cmd += " --automatic_memory ";
if ( aInitialMemory > 0 ) cmd += SMESH_Comment( int( aInitialMemory ));
else cmd += "100";
}
+
// component to mesh
if ( comp && !useBndRecovery ) {
// We always run MG-Tetra with "to mesh holes'==TRUE (see PAL19680)
cmd += " --optimisation_level none"; // issue 22608
}
else if ( optim_level && hyp && !useBndRecovery ) {
- if ( hyp->myOptimizationLevel >= 0 && hyp->myOptimizationLevel < 5 ) {
- const char* level[] = { "none" , "light" , "standard" , "standard+" , "strong" };
- cmd += " --optimisation_level ";
- cmd += level[ hyp->myOptimizationLevel ];
- }
+ const char* level[] = { "none" , "light" , "standard" , "standard+" , "strong" };
+ const short myOpt = hyp->myOptimizationLevel;
+
+ if ( myOpt >= 0 && myOpt < 5 && ( algoId == MGTetra || ( algoId == MGTetraHPC && myOpt != 3 ) ) ) {
+ cmd += " --optimisation_level ";
+ cmd += level[ myOpt ];
+ }
}
// to create internal nodes
cmd += " --internalpoints no";
}
- // verbose mode
- if ( verbose && hyp ) {
- cmd += " --verbose " + SMESH_Comment( hyp->myVerboseLevel );
- }
-
- // boundary recovery version
- // if ( useBndRecovery ) {
- // cmd += " -C";
- // }
-
- // to use FEM correction
- // if ( fem && hyp && hyp->myToUseFemCorrection) {
- // cmd += " -FEM";
- // }
-
- // to remove initial central point.
- if ( rem && hyp && hyp->myToRemoveCentralPoint ) {
- if ( forExecutable )
- cmd += " --no_initial_central_point";
- else
- cmd += " --centralpoint no";
- }
+ if ( hyp )
+ {
+ // verbose mode
+ if ( verbose ) {
+ cmd += " --verbose " + SMESH_Comment( hyp->myVerboseLevel );
+ }
- // options as text
- // if ( hyp && !hyp->myTextOption.empty() ) {
- // cmd += " " + hyp->myTextOption;
- // }
+ // to remove initial central point.
+ if ( rem && hyp->myToRemoveCentralPoint ) {
+ if ( forExecutable )
+ cmd += " --no_initial_central_point";
+ else
+ cmd += " --centralpoint no";
+ }
- // min/max size
- if ( hyp )
- {
if ( hyp->GetMinSize() > 0 )
cmd += " --min_size " + SMESH_Comment( hyp->GetMinSize() );
+
if ( hyp->GetMaxSize() > 0 )
cmd += " --max_size " + SMESH_Comment( hyp->GetMaxSize() );
- }
- // to define volumic gradation.
- if ( gra && hyp )
- {
- cmd += " --gradation " + SMESH_Comment( hyp->myGradation );
- }
+ // to define volumic gradation.
+ if ( gra )
+ cmd += " --gradation " + SMESH_Comment( hyp->myGradation );
+
+ if ( hyp->GetUseNumOfThreads() )
+ {
+ cmd += " --max_number_of_threads " + SMESH_Comment( hyp->GetNumOfThreads() );
+ const char* pthreadMode[] = { "none" , "aggressive" , "safe" };
+ const char* parallelMode[] = { "none", "reproducible_given_max_number_of_threads", "reproducible", "aggressive" };
+
+ if ( algoId == MGTetra && hyp->myPthreadModeMG >= 1 && hyp->myPthreadModeMG < 3 ) {
+ cmd += " --pthreads_mode ";
+ cmd += pthreadMode[ hyp->myPthreadModeMG ];
+ }
+ else if ( algoId == MGTetraHPC && hyp->myPthreadModeMGHPC >= 1 && hyp->myPthreadModeMGHPC < 4 )
+ {
+ cmd += " --parallel_strategy ";
+ cmd += parallelMode[ hyp->myPthreadModeMGHPC ];
+ }
+ }
- if ( hyp )
- {
// proximity
if ( hyp->GetUseVolumeProximity() )
{
cmd += " --volume_proximity_layers " + SMESH_Comment( hyp->GetNbVolumeProximityLayers() );
}
-
- std::string option, value;
- bool isDefault;
- const TOptionValues* options[] = { & hyp->_option2value, & hyp->_customOption2value };
- for ( int iOp = 0; iOp < 2; ++iOp )
- {
- TOptionValues::const_iterator o2v = options[iOp]->begin();
- for ( ; o2v != options[iOp]->end(); ++o2v )
- {
- option = o2v->first;
- value = hyp->GetOptionValue( option, &isDefault );
-
- if ( isDefault )
- continue;
- if ( value.empty() )//value == NoValue() )
- {
- if ( hyp->_defaultOptionValues.count( option ))
- continue; // non-custom option with no value
- //value.clear();
- }
- if ( strncmp( "no", option.c_str(), 2 ) == 0 ) // options w/o values: --no_*
- {
- if ( !value.empty() && ToBool( value ) == false )
- continue;
- value.clear();
- }
- if ( option[0] != '-' )
- cmd += " --";
- else
- cmd += " ";
- cmd += option + " " + value;
- }
- }
+
+ hyp->SetAdvancedOptionsInCommandLine( cmd );
}
#ifdef WIN32
cmd += " < NUL";
#endif
-
return cmd;
}
//================================================================================
/*!
- * \brief Return a unique file name
+ * \brief Return a unique file name for MGTetra
*/
//================================================================================
return aGenericName.ToCString();
}
+//================================================================================
+/*!
+ * \brief Return a unique file name when running MGTetra HPC
+ */
+//================================================================================
+
+std::string GHS3DPlugin_Hypothesis::GetFileNameHPC(const GHS3DPlugin_Hypothesis* hyp)
+{
+ std::string aTmpDir = hyp ? hyp->GetWorkingDirectory() : DefaultWorkingDirectory();
+ if ( !SMESH_File( aTmpDir ).exists() )
+ aTmpDir = Kernel_Utils::GetTmpDirByPath( aTmpDir );
+
+ const char lastChar = *aTmpDir.rbegin();
+#ifdef WIN32
+ if(lastChar != '\\') aTmpDir+='\\';
+#else
+ if(lastChar != '/') aTmpDir+='/';
+#endif
+
+ TCollection_AsciiString aGenericName = (char*)aTmpDir.c_str();
+ aGenericName += "MGTETRAHPC_";
+ aGenericName += getpid();
+ aGenericName += "_";
+ aGenericName += Abs((Standard_Integer)(long) aGenericName.ToCString());
+
+ return aGenericName.ToCString();
+}
+
//================================================================================
/*
* Return the name of executable
*/
//================================================================================
-std::string GHS3DPlugin_Hypothesis::GetExeName()
+std::string GHS3DPlugin_Hypothesis::GetExeName( ImplementedAlgorithms algoId )
{
- return "mg-tetra.exe";
+ switch ( algoId )
+ {
+ case MGTetra:
+ return "mg-tetra.exe";
+ case MGTetraHPC:
+ return "mg-tetra_hpc.exe";
+ default:
+ throw( "Undefined algorithm id: ");
+ }
}
//================================================================================
*/
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 SetAdvancedOption(const std::string& option);
- std::string GetAdvancedOption() const;
+ std::string GetAdvancedOption() const;
/*!
* To define the volumic gradation
*/
void ClearOption(const std::string& optionName);
TOptionValues GetOptionValues() const;
const TOptionValues& GetCustomOptionValues() const { return _customOption2value; }
- //static inline const char* NoValue() { return "_"; }
+
+ // 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)
*/
* \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
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; }
+ static bool DefaultUseNumOfThreads() { return true; }
+ static short DefaultMyPthreadMode() { return 2; } //reproducible_given_max_of_threads
+ static short DefaultMyPthreadModeHPC() { return 1; } // safe
void SetMinMaxSizeDefault( double theMinSize, double theMaxSize )
{ myMinSizeDefault = theMinSize; myMaxSizeDefault = theMaxSize; }
double myGradation;
bool myUseVolumeProximity;
int myNbVolumeProximityLayers;
+ short myAlgorithm; //member used to pivot between MG-Tetra and MG-Tetra
+ short myNumOfThreads;
+ bool myUseNumOfThreads;
+ short myPthreadModeMG;
+ short myPthreadModeMGHPC;
double myMinSize, myMinSizeDefault;
double myMaxSize, myMaxSizeDefault;
//std::string myTextOption;
+
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
TGHS3DEnforcedVertexList _enfVertexList;
TGHS3DEnforcedVertexCoordsValues _enfVertexCoordsSizeList;
(::GHS3DPlugin_Hypothesis::OptimizationLevel) level;
if ( l < ::GHS3DPlugin_Hypothesis::None ||
l > ::GHS3DPlugin_Hypothesis::Strong )
- THROW_SALOME_CORBA_EXCEPTION( "Invalid optimization level",SALOME::BAD_PARAM );
+ THROW_SALOME_CORBA_EXCEPTION( "Invalid optimization level", SALOME::BAD_PARAM );
ASSERT(myBaseImpl);
this->GetImpl()->SetOptimizationLevel(l);
return this->GetImpl()->GetOptimizationLevel();
}
+//=======================================================================
+//function : SetAlgorithm
+//=======================================================================
+void GHS3DPlugin_Hypothesis_i::SetAlgorithm(CORBA::Short algoId)
+{
+ ::GHS3DPlugin_Hypothesis::ImplementedAlgorithms algo =
+ (::GHS3DPlugin_Hypothesis::ImplementedAlgorithms) algoId;
+ if ( algo != ::GHS3DPlugin_Hypothesis::MGTetra && algo != ::GHS3DPlugin_Hypothesis::MGTetraHPC )
+ THROW_SALOME_CORBA_EXCEPTION( "Invalid algorithm type", SALOME::BAD_PARAM );
+
+ ASSERT(myBaseImpl);
+ this->GetImpl()->SetAlgorithm(algo);
+ SMESH::TPythonDump() << _this() << ".SetAlgorithm( " << algoId << " )";
+}
+
+//=======================================================================
+//function : GetAlgorithm
+//=======================================================================
+CORBA::Short GHS3DPlugin_Hypothesis_i::GetAlgorithm()
+{
+ ASSERT(myBaseImpl);
+ return this->GetImpl()->GetAlgorithm();
+}
+
+//=======================================================================
+//function : SetUseNumOfThreads
+//=======================================================================
+void GHS3DPlugin_Hypothesis_i::SetUseNumOfThreads(CORBA::Boolean setThread)
+{
+ ASSERT(myBaseImpl);
+ this->GetImpl()->SetUseNumOfThreads(setThread);
+ SMESH::TPythonDump() << _this() << ".SetUseNumOfThreads( " << setThread << " )";
+}
+
+//=======================================================================
+//function : GetUseNumOfThreads
+//=======================================================================
+CORBA::Boolean GHS3DPlugin_Hypothesis_i::GetUseNumOfThreads()
+{
+ ASSERT(myBaseImpl);
+ return this->GetImpl()->GetUseNumOfThreads();
+}
+
+//=======================================================================
+//function : SetNumOfThreads
+//=======================================================================
+void GHS3DPlugin_Hypothesis_i::SetNumOfThreads(CORBA::Short numOfThreads)
+{
+ ASSERT(myBaseImpl);
+ this->GetImpl()->SetNumOfThreads(numOfThreads);
+ SMESH::TPythonDump() << _this() << ".SetNumOfThreads( " << numOfThreads << " )";
+}
+
+//=======================================================================
+//function : GetNumOfThreads
+//=======================================================================
+CORBA::Short GHS3DPlugin_Hypothesis_i::GetNumOfThreads()
+{
+ ASSERT(myBaseImpl);
+ return this->GetImpl()->GetNumOfThreads();
+}
+
+//=======================================================================
+//function : SetNumOfThreads
+//=======================================================================
+void GHS3DPlugin_Hypothesis_i::SetPthreadMode(CORBA::Short pThreadMode)
+{
+ ::GHS3DPlugin_Hypothesis::PThreadMode mode =
+ (::GHS3DPlugin_Hypothesis::PThreadMode) pThreadMode;
+
+ if ( mode < ::GHS3DPlugin_Hypothesis::PThreadNone ||
+ mode > ::GHS3DPlugin_Hypothesis::Safe )
+ THROW_SALOME_CORBA_EXCEPTION( "Invalid pthreadMode type", SALOME::BAD_PARAM );
+
+
+ ASSERT(myBaseImpl);
+ this->GetImpl()->SetPthreadMode(mode);
+ SMESH::TPythonDump() << _this() << ".SetPthreadMode( " << pThreadMode << " )";
+}
+
+//=======================================================================
+//function : GetNumOfThreads
+//=======================================================================
+CORBA::Short GHS3DPlugin_Hypothesis_i::GetPthreadMode()
+{
+ ASSERT(myBaseImpl);
+ return this->GetImpl()->GetPthreadMode();
+}
+
+//=======================================================================
+//function : SetNumOfThreads
+//=======================================================================
+void GHS3DPlugin_Hypothesis_i::SetParallelMode(CORBA::Short parallelMode)
+{
+ ::GHS3DPlugin_Hypothesis::ParallelMode mode =
+ (::GHS3DPlugin_Hypothesis::ParallelMode) parallelMode;
+
+ if ( mode < ::GHS3DPlugin_Hypothesis::ParallelNone ||
+ mode > ::GHS3DPlugin_Hypothesis::ParallelAggressive )
+ THROW_SALOME_CORBA_EXCEPTION( "Invalid parallelMode type", SALOME::BAD_PARAM );
+
+ ASSERT(myBaseImpl);
+ this->GetImpl()->SetParallelMode(mode);
+ SMESH::TPythonDump() << _this() << ".SetParallelMode( " << parallelMode << " )";
+}
+
+//=======================================================================
+//function : GetNumOfThreads
+//=======================================================================
+CORBA::Short GHS3DPlugin_Hypothesis_i::GetParallelMode()
+{
+ ASSERT(myBaseImpl);
+ return this->GetImpl()->GetParallelMode();
+}
+
//=======================================================================
//function : SetWorkingDirectory
//=======================================================================
*/
void SetOptimizationLevel(CORBA::Short level);
CORBA::Short GetOptimizationLevel();
+ /*!
+ * Algorithm Id: 0-MGTetra HPC, 1-MGTetra
+ */
+ void SetAlgorithm(CORBA::Short algoId);
+ CORBA::Short GetAlgorithm();
+ /*!
+ * Flag for set get optional use parallelism in MGTetra
+ */
+ void SetUseNumOfThreads(CORBA::Boolean useThreads);
+ CORBA::Boolean GetUseNumOfThreads();
+ /*!
+ * Get set number of threads to use on the parallel MGTetra algorithm
+ */
+ void SetNumOfThreads(CORBA::Short numThreads);
+ CORBA::Short GetNumOfThreads();
+ /*!
+ * For MGTetra
+ * PthreadMode: 0-PThreadNone, 1-PThreadAggressive, 2-Safe
+ */
+ void SetPthreadMode(CORBA::Short pThreadMode);
+ CORBA::Short GetPthreadMode();
+ /*!
+ * For MGTetra HPC
+ * SetParallelMode level: 0-ParallelNone, 1-ReproducibleGivenMaxNumThreads, 2-Reproducible, 3-ParallelAggressive
+ */
+ void SetParallelMode(CORBA::Short parallelMode);
+ CORBA::Short GetParallelMode();
/*!
* Path to working directory
*/
std::string GHS3DPlugin_OptimizerHypothesis::CommandToRun(const GHS3DPlugin_OptimizerHypothesis* hyp)
{
- SMESH_Comment cmd( GetExeName() );
+ SMESH_Comment cmd( GetExeName( (ImplementedAlgorithms) 1 ) );
cmd << " --max_memory "
<< (( hyp && hyp->myMaximumMemory > 0 ) ? hyp->myMaximumMemory : DefaultMaximumMemory());
myOptionTable->blockSignals( false );
}
}
+
+void GHS3DPluginGUI_AdvWidget::EnableAdvancedOptions( bool isMGTetra )
+{
+ int iRow = 0, nbRows = myOptionTable->topLevelItemCount();
+ // hard coded: register all possible options here
+ std::vector<std::string>_commonOptions = { "split_overconstrained_tetrahedra" };
+ std::vector<std::string>::iterator tk;
+ for ( ; iRow < nbRows; ++iRow )
+ {
+ // Have to allow advanced option for MGTetra HPC to work
+ tk = std::find( _commonOptions.begin(),
+ _commonOptions.end(),
+ myOptionTable->topLevelItem( iRow )->data( NAME_COL, PARAM_NAME ).toString().toStdString()
+ );
+
+ if ( tk == _commonOptions.end() )
+ myOptionTable->topLevelItem( iRow )->setDisabled( !isMGTetra );
+
+ }
+}
\ No newline at end of file
void AddOption( const char* name_value_type, bool isCustom = false );
void GetOptionAndValue( QTreeWidgetItem * tblRow, QString& option, QString& value, bool& dflt );
-
+ void EnableAdvancedOptions( bool isMGTetra );
public slots:
void itemChanged(QTreeWidgetItem * tblRow, int column);
#include <QCheckBox>
#include <QComboBox>
+#include <QButtonGroup>
#include <QFileInfo>
#include <QFrame>
#include <QGridLayout>
#include <QLineEdit>
#include <QPalette>
#include <QPushButton>
+#include <QRadioButton>
#include <QSpinBox>
+#include <QtWidgets>
#include <QTabWidget>
#include <QTableWidget>
#include <QTableWidgetItem>
myMaxSizeCheck(0),
myMinSizeSpin(0),
myMaxSizeSpin(0),
+ myNumOfThreadsCheck(0),
+ myNumOfThreadsSpin(0),
myGradationCheck(0),
myGradationSpin(0),
myUseProximityGroup(0),
myPThreadsModeCombo(0),
myNumberOfThreadsSpin(0),
mySmoothOffSliversCheck(0),
- myCreateNewNodesCheck(0)
+ myCreateNewNodesCheck(0),
+ myPthreadMode(0),
+ myParallelMode(0)
{
GeomToolSelected = NULL;
GeomToolSelected = getGeomSelectionTool();
return ( hypType() == GHS3DPlugin_OptimizerHypothesis::GetHypType() );
}
+void GHS3DPluginGUI_HypothesisCreator::onRadioButtonSelect()
+{
+ onNumOfThreadsCheck();
+
+ // Disable selection of standart+
+ QStandardItemModel * model = qobject_cast<QStandardItemModel*>(myOptimizationLevelCombo->model());
+ if(!model) return;
+ QStandardItem * item = model->item( GHS3DPlugin_Hypothesis::StandardPlus );
+ if(!item) return;
+
+ if ( myRadioBottomGroup->checkedId() == GHS3DPlugin_Hypothesis::MGTetra )
+ {
+ // Enable selection of stadart+
+ item->setEnabled(true);
+ // Set possibility to check memory options again.
+ myAdvWidget->maxMemoryCheck ->setEnabled( true );
+ myAdvWidget->initialMemoryCheck ->setEnabled( true );
+
+ myAdvWidget->EnableAdvancedOptions( true );
+ myEnfGroup->setEnabled( true );
+ myEnfMeshGroup->setEnabled( true );
+ }
+ else if ( myRadioBottomGroup->checkedId() == GHS3DPlugin_Hypothesis::MGTetraHPC )
+ {
+ // Disable selection of stadart+
+ item->setEnabled(false);
+ // Set to false memory checks and disable checkbox
+ myAdvWidget->maxMemoryCheck ->setChecked( false );
+ myAdvWidget->initialMemoryCheck ->setChecked( false );
+ myAdvWidget->maxMemoryCheck ->setEnabled( false );
+ myAdvWidget->initialMemoryCheck ->setEnabled( false );
+ myAdvWidget->EnableAdvancedOptions( false );
+ myEnfGroup->setEnabled( false );
+ myEnfMeshGroup->setEnabled( false );
+ }
+
+}
+
+void GHS3DPluginGUI_HypothesisCreator::onNumOfThreadsCheck()
+{
+ if ( myRadioBottomGroup->checkedId() == GHS3DPlugin_Hypothesis::MGTetra )
+ {
+ if ( myNumOfThreadsCheck->isChecked() )
+ myPthreadMode->setEnabled( true );
+ else
+ myPthreadMode->setEnabled( false );
+
+ myParallelMode->setEnabled( false );
+ }
+ else if ( myRadioBottomGroup->checkedId() == GHS3DPlugin_Hypothesis::MGTetraHPC )
+ {
+ if ( myNumOfThreadsCheck->isChecked() )
+ myParallelMode->setEnabled( true );
+ else
+ myParallelMode->setEnabled( false );
+
+ myPthreadMode->setEnabled( false );
+ }
+ else
+ {
+
+ }
+}
+
QFrame* GHS3DPluginGUI_HypothesisCreator::buildFrame()
{
QFrame* fr = new QFrame( 0 );
}
else
{
+ // Algorithm selection
+ QGroupBox* radioBottomGroup = new QGroupBox( tr("GHS3D_ALGO_SELECTION"), myStdGroup );
+ myRadioBottomGroup = new QButtonGroup( radioBottomGroup );
+
+ QRadioButton * GM_MSH = new QRadioButton(tr("GHS3D_ALGO_MGTETRA"), radioBottomGroup );
+ QRadioButton * GM_MSH_HPC = new QRadioButton(tr("GHS3D_ALGO_MGTETRAHPC"), radioBottomGroup );
+
+ myRadioBottomGroup->addButton( GM_MSH, 1 );
+ myRadioBottomGroup->addButton( GM_MSH_HPC, 0 );
+ GM_MSH->setChecked( true );
+
+ QGridLayout* radioBottomLayout = new QGridLayout( radioBottomGroup );
+ radioBottomLayout->setSpacing( 4 );
+ radioBottomLayout->setMargin( 11 );
+ radioBottomLayout->addWidget( GM_MSH, 0, 0, 1, 1 );
+ radioBottomLayout->addWidget( GM_MSH_HPC, 0, 1, 1, 1 );
+
// Main parameters
+ QGroupBox* mainGroup = new QGroupBox( tr("GHS3D_MAIN_PARAMS"), myStdGroup );
+ QLabel* optimizatiolLevelLbl = new QLabel( tr( "GHS3D_OPTIMIZATIOL_LEVEL" ), mainGroup );
+ QLabel* pthreadModeLbl = new QLabel( tr( "GHS3D_PTHREAD_MODE" ), mainGroup );
+ QLabel* parallelStrat = new QLabel( tr( "GHS3D_PARALLE_STRAT" ), mainGroup );
+
+ myOptimizationLevelCombo = new QComboBox( mainGroup );
+ myMinSizeCheck = new QCheckBox( tr("GHS3D_MIN_SIZE"), mainGroup );
+ myMaxSizeCheck = new QCheckBox( tr("GHS3D_MAX_SIZE"), mainGroup );
+ myNumOfThreadsCheck = new QCheckBox( tr("GHS3D_THREADS_SIZE"), mainGroup );
+ myPthreadMode = new QComboBox( mainGroup );
+ myParallelMode = new QComboBox( mainGroup );
+
+ myMinSizeSpin = new SMESHGUI_SpinBox( mainGroup );
+ myMaxSizeSpin = new SMESHGUI_SpinBox( mainGroup );
+ myNumOfThreadsSpin = new SalomeApp_IntSpinBox( 1, 128, 1, mainGroup );
- QGroupBox* mainGroup = new QGroupBox( tr("GHS3D_MAIN_PARAMS"), myStdGroup );
- QLabel* optimizatiolLevelLbl = new QLabel( tr( "GHS3D_OPTIMIZATIOL_LEVEL" ), mainGroup );
- myOptimizationLevelCombo = new QComboBox( mainGroup );
- myMinSizeCheck = new QCheckBox( tr("GHS3D_MIN_SIZE"), mainGroup );
- myMaxSizeCheck = new QCheckBox( tr("GHS3D_MAX_SIZE"), mainGroup );
- myMinSizeSpin = new SMESHGUI_SpinBox( mainGroup );
- myMaxSizeSpin = new SMESHGUI_SpinBox( mainGroup );
myMinSizeCheck->setChecked( false );
myMaxSizeCheck->setChecked( false );
+ myNumOfThreadsCheck->setChecked( false );
+
myMinSizeSpin->RangeStepAndValidator(0, COORD_MAX, 10.0, "length_precision");
myMaxSizeSpin->RangeStepAndValidator(0, COORD_MAX, 10.0, "length_precision");
- myMinSizeSpin->setEnabled( false );
- myMaxSizeSpin->setEnabled( false );
- connect( myMinSizeCheck, SIGNAL( toggled(bool)), myMinSizeSpin, SLOT( setEnabled(bool)));
- connect( myMaxSizeCheck, SIGNAL( toggled(bool)), myMaxSizeSpin, SLOT( setEnabled(bool)));
+ myNumOfThreadsSpin->setValue( 4 );
+
+ myMinSizeSpin ->setEnabled( false );
+ myMaxSizeSpin ->setEnabled( false );
+ myNumOfThreadsSpin->setEnabled(false);
+ myPthreadMode ->setEnabled( false );
+ myParallelMode->setEnabled( false );
+
+ // ACTIONS ON BUTTOMS
+ connect( myMinSizeCheck, SIGNAL( toggled(bool)), myMinSizeSpin, SLOT( setEnabled(bool)));
+ connect( myMaxSizeCheck, SIGNAL( toggled(bool)), myMaxSizeSpin, SLOT( setEnabled(bool)));
+ connect( myNumOfThreadsCheck, SIGNAL( toggled(bool)), myNumOfThreadsSpin, SLOT( setEnabled(bool)));
+ connect( myNumOfThreadsCheck, SIGNAL( toggled(bool)), this, SLOT( onNumOfThreadsCheck() ));
+ connect( myNumOfThreadsCheck, SIGNAL( toggled(bool)), this, SLOT( onNumOfThreadsCheck() ));
+ connect( GM_MSH, SIGNAL( toggled( bool )),this, SLOT( onRadioButtonSelect() ));
QGridLayout* mainLayout = new QGridLayout( mainGroup );
- mainLayout->setSpacing( 6 );
+ mainLayout->setSpacing( 12 );
mainLayout->setMargin( 11 );
mainLayout->addWidget( optimizatiolLevelLbl, 0, 0, 1, 1 );
mainLayout->addWidget( myOptimizationLevelCombo, 0, 1, 1, 1 );
mainLayout->addWidget( myMinSizeSpin, 1, 1, 1, 1 );
mainLayout->addWidget( myMaxSizeCheck, 2, 0, 1, 1 );
mainLayout->addWidget( myMaxSizeSpin, 2, 1, 1, 1 );
-
+ mainLayout->addWidget( myNumOfThreadsCheck, 3, 0, 1, 1 );
+ mainLayout->addWidget( myNumOfThreadsSpin, 3, 1, 1, 1 );
+ mainLayout->addWidget( pthreadModeLbl, 4, 0, 1, 1 );
+ mainLayout->addWidget( myPthreadMode, 4, 1, 1, 1 );
+ mainLayout->addWidget( parallelStrat, 5, 0, 1, 1 );
+ mainLayout->addWidget( myParallelMode, 5, 1, 1, 1 );
+
// Volume proximity
QGroupBox* proxyGroup = new QGroupBox( tr("GHS3D_VOLUME_PROXIMITY"), myStdGroup );
otherLayout->addWidget( myToMeshHolesCheck, 0, 0 );
otherLayout->addWidget( myToMakeGroupsOfDomains, 1, 0 );
+ aStdLayout->addWidget( radioBottomGroup,row++, 0, 1, 2 );
+ aStdLayout->addWidget( mainGroup, row++, 0, 1, 2 );
+ aStdLayout->addWidget( proxyGroup, row++, 0, 1, 2 );
+ aStdLayout->addWidget( otherGroup, row++, 0, 1, 2 );
- aStdLayout->addWidget( mainGroup, row++, 0, 1, 2 );
- aStdLayout->addWidget( proxyGroup, row++, 0, 1, 2 );
- aStdLayout->addWidget( otherGroup, row++, 0, 1, 2 );
+ myPthreadMode->addItems( QStringList() << tr( "MODE_NONE" ) << tr( "MODE_AGGRESSIVE" ) << tr( "MODE_SAFE" ) );
+ myParallelMode->addItems( QStringList() << tr( "MODE_NONE" ) << tr( "MODE_REPRODUCIBLE_GIVEN_MAX_THREADS" ) << tr( "MODE_REPRODUCIBLE" ) << tr( "MODE_AGGRESSIVE" ) );
}
aStdLayout->setRowStretch( row, 10 );
QGridLayout* anEnfLayout = new QGridLayout(myEnfGroup);
myEnforcedTableWidget = new QTableWidget(myEnfGroup);
- myEnforcedTableWidget ->setMinimumWidth(300);
+ myEnforcedTableWidget->setMinimumWidth(300);
myEnforcedTableWidget->setRowCount( 0 );
myEnforcedTableWidget->setColumnCount( ENF_VER_NB_COLUMNS );
myEnforcedTableWidget->setSortingEnabled(true);
}
myToMeshHolesCheck ->setChecked ( data.myToMeshHoles );
myToMakeGroupsOfDomains ->setChecked ( data.myToMakeGroupsOfDomains );
- myOptimizationLevelCombo ->setCurrentIndex( data.myOptimizationLevel );
+
+ if ( data.myAlgorithm == GHS3DPlugin_Hypothesis::MGTetraHPC && data.myOptimizationLevel == GHS3DPlugin_Hypothesis::StandardPlus /*not implemented by MGTetraHPC*/ )
+ myOptimizationLevelCombo ->setCurrentIndex( GHS3DPlugin_Hypothesis::None );
+ else
+ myOptimizationLevelCombo ->setCurrentIndex( data.myOptimizationLevel );
+
if ( myOptimizationCombo ) // optimizer
{
myOptimizationCombo ->setCurrentIndex( data.myOptimization );
}
else
{
- myMinSizeSpin->setValue( data.myMinSize );
- myMinSizeCheck->setChecked( data.myUseMinSize );
- myMaxSizeSpin->setValue( data.myMaxSize );
- myMaxSizeCheck->setChecked( data.myUseMaxSize );
- myGradationCheck->setChecked( data.myUseGradation );
- myGradationSpin->setValue( data.myUseGradation ? data.myGradation : GHS3DPlugin_Hypothesis::DefaultGradation() );
- myUseProximityGroup->setChecked( data.myUseProximity );
- myNbProximityLayers->setValue( data.myNbProximityLayers );
+ myRadioBottomGroup ->button( data.myAlgorithm )->setChecked( true );
+ myMinSizeSpin ->setValue( data.myMinSize );
+ myMinSizeCheck ->setChecked( data.myUseMinSize );
+ myMaxSizeSpin ->setValue( data.myMaxSize );
+ myMaxSizeCheck ->setChecked( data.myUseMaxSize );
+ myGradationCheck ->setChecked( data.myUseGradation );
+ myGradationSpin ->setValue( data.myUseGradation ? data.myGradation : GHS3DPlugin_Hypothesis::DefaultGradation() );
+ myUseProximityGroup ->setChecked( data.myUseProximity );
+ myNbProximityLayers ->setValue( data.myNbProximityLayers );
+ myNumOfThreadsCheck ->setChecked( data.myUseNumOfThreads );
+ myNumOfThreadsSpin ->setValue( data.myNumOfThreads );
+ myPthreadMode ->setCurrentIndex( data.myPthreadMode );
+ myParallelMode ->setCurrentIndex( data.myParallelMode );
}
myAdvWidget->maxMemoryCheck ->setChecked ( data.myMaximumMemory > 0 );
myAdvWidget->maxMemorySpin ->setValue
myAdvWidget->AddOption( that->myCustomOptions[i].in() );
}
myAdvWidget->myOptionTable->resizeColumnToContents( OPTION_NAME_COLUMN );
-
+ myAdvWidget->EnableAdvancedOptions( data.myAlgorithm == GHS3DPlugin_Hypothesis::MGTetra );
TEnfVertexList::const_iterator it;
int rowCount = 0;
h_data.myNumberOfThreads = 1;
h_data.mySmoothOffSlivers = 1;
}
+ h_data.myAlgorithm = h->GetAlgorithm();
h_data.myOptimizationLevel = h->GetOptimizationLevel();
h_data.myMinSize = h->GetMinSize();
h_data.myMaxSize = h->GetMaxSize();
//h_data.myTextOption = h->GetAdvancedOption();
h_data.myLogInStandardOutput = h->GetStandardOutputLog();
h_data.myRemoveLogOnSuccess = h->GetRemoveLogOnSuccess();
+ h_data.myUseNumOfThreads = h->GetUseNumOfThreads();
+ h_data.myNumOfThreads = h->GetNumOfThreads();
+ h_data.myPthreadMode = h->GetPthreadMode();
+ h_data.myParallelMode = h->GetParallelMode();
GHS3DPluginGUI_HypothesisCreator* that = (GHS3DPluginGUI_HypothesisCreator*)this;
that->myOptions = h->GetOptionValues();
if( isCreation() )
SMESH::SetName( SMESH::FindSObject( h ), h_data.myName.toLatin1().constData() );
+ if ( opt->_is_nil() )
+ {
+ h->SetAlgorithm ((CORBA::Short) h_data.myAlgorithm );
+ h->SetUseNumOfThreads ( h_data.myUseNumOfThreads );
+ h->SetNumOfThreads ( (CORBA::Short) h_data.myNumOfThreads );
+ h->SetPthreadMode ( (CORBA::Short) h_data.myPthreadMode );
+ h->SetParallelMode ( (CORBA::Short) h_data.myParallelMode );
+ h->SetGradation ( h_data.myGradation );
+ h->SetToMeshHoles ( h_data.myToMeshHoles );
+ h->SetToMakeGroupsOfDomains ( h_data.myToMakeGroupsOfDomains );
+ h->SetVolumeProximity ( h_data.myUseProximity );
+ h->SetNbVolumeProximityLayers ((CORBA::Short) h_data.myNbProximityLayers );
+ }
+
+ // Common existing options optimization a MGTetra && MGTetraHPC
h->SetOptimizationLevel ((CORBA::Short) h_data.myOptimizationLevel );
h->SetMinSize ( h_data.myUseMinSize ? h_data.myMinSize : 0 );
h->SetMaxSize ( h_data.myUseMaxSize ? h_data.myMaxSize : 0 );
h->SetMinMaxSizeDefault ( this->myMinSizeDefault, this->myMaxSizeDefault );
- h->SetGradation ( h_data.myGradation );
- h->SetVolumeProximity ( h_data.myUseProximity );
- h->SetNbVolumeProximityLayers ((CORBA::Short) h_data.myNbProximityLayers );
- h->SetToMeshHoles ( h_data.myToMeshHoles );
- h->SetToMakeGroupsOfDomains ( h_data.myToMakeGroupsOfDomains );
h->SetMaximumMemory ( h_data.myMaximumMemory );
h->SetInitialMemory ( h_data.myInitialMemory );
- h->SetInitialMemory ( h_data.myInitialMemory );
h->SetKeepFiles ( h_data.myKeepFiles );
h->SetWorkingDirectory ( h_data.myWorkingDir.toLatin1().constData() );
h->SetVerboseLevel ( h_data.myVerboseLevel );
//h->SetFEMCorrection ( h_data.myFEMCorrection );
h->SetStandardOutputLog ( h_data.myLogInStandardOutput );
h->SetRemoveLogOnSuccess ( h_data.myRemoveLogOnSuccess );
+
if ( !opt->_is_nil() )
{
h_data.myNbProximityLayers = myNbProximityLayers->value();
h_data.myToMeshHoles = myToMeshHolesCheck->isChecked();
h_data.myToMakeGroupsOfDomains = myToMakeGroupsOfDomains->isChecked();
+ h_data.myAlgorithm = myRadioBottomGroup->checkedId();
+ h_data.myUseNumOfThreads = myNumOfThreadsCheck->isChecked();
+ h_data.myNumOfThreads = myNumOfThreadsSpin->value();
+ h_data.myPthreadMode = myPthreadMode->currentIndex();
+ h_data.myParallelMode = myParallelMode->currentIndex();
}
h_data.myMaximumMemory = float( myAdvWidget->maxMemoryCheck->isChecked() ? myAdvWidget->maxMemorySpin->value() : -1 );
h_data.myInitialMemory = float( myAdvWidget->initialMemoryCheck->isChecked() ? myAdvWidget->initialMemorySpin->value() : -1 );
#include CORBA_SERVER_HEADER(SMESH_Mesh)
class QWidget;
+class QButtonGroup;
class QComboBox;
class QCheckBox;
class QLineEdit;
short myVerboseLevel;
TEnfVertexList myEnforcedVertices;
TEnfMeshList myEnforcedMeshes;
+ short myAlgorithm, myNumOfThreads, myPthreadMode, myParallelMode;
+ bool myUseNumOfThreads;
int myOptimization, mySplitOverConstrained, myPThreadsMode, myNumberOfThreads;
bool mySmoothOffSlivers;
void onRemoveEnforcedMesh();
//void synchronizeEnforcedMesh();
void checkEnfMeshIsDefined();
+ void onRadioButtonSelect();
+ void onNumOfThreadsCheck();
signals:
void vertexDefined(bool);
QCheckBox* myMaxSizeCheck;
SMESHGUI_SpinBox* myMinSizeSpin;
SMESHGUI_SpinBox* myMaxSizeSpin;
+ QCheckBox* myNumOfThreadsCheck;
+ SalomeApp_IntSpinBox* myNumOfThreadsSpin;
mutable double myMinSizeDefault, myMaxSizeDefault;
// proximity
QCheckBox* myGradationCheck;
SalomeApp_IntSpinBox* myNumberOfThreadsSpin;
QCheckBox* mySmoothOffSliversCheck;
QCheckBox* myCreateNewNodesCheck;
+ QComboBox* myPthreadMode;
+ QComboBox* myParallelMode;
+ QButtonGroup* myRadioBottomGroup;
QWidget* myAdvGroup;
GHS3DPluginGUI_AdvWidget* myAdvWidget;
<translation>Light</translation>
</message>
<message>
- <source>LEVEL_MEDIUM</source>
- <translation>Medium (standard)</translation>
+ <source>LEVEL_MEDIUM</source>
+ <translation>Medium (standard)</translation>
+ </message>
+ <message>
+ <source>GHS3D_PTHREAD_MODE</source>
+ <translation>Pthread Mode</translation>
+ </message>
+ <message>
+ <source>GHS3D_PARALLE_STRAT</source>
+ <translation>Parallel Strategy (HPC)</translation>
+ </message>
+ <message>
+ <source>MODE_NONE</source>
+ <translation>None</translation>
+ </message>
+ <message>
+ <source>MODE_AGGRESSIVE</source>
+ <translation>Aggressive</translation>
+ </message>
+ <message>
+ <source>MODE_SAFE</source>
+ <translation>Safe</translation>
+ </message>
+ <message>
+ <source>MODE_REPRODUCIBLE</source>
+ <translation>Reproducible</translation>
+ </message>
+ <message>
+ <source>MODE_REPRODUCIBLE_GIVEN_MAX_THREADS</source>
+ <translation>Reproducible Given Max Number of Threads</translation>
+ </message>
+ <message>
+ <source>GHS3D_ALGO_SELECTION</source>
+ <translation>Algorithm selection</translation>
+ </message>
+ <message>
+ <source>GHS3D_ALGO_MGTETRA</source>
+ <translation>MG-Tetra</translation>
+ </message>
+ <message>
+ <source>GHS3D_ALGO_MGTETRAHPC</source>
+ <translation>MG-Tetra HPC</translation>
+ </message>
+ <message>
+ <source>GHS3D_THREADS_SIZE</source>
+ <translation>Maximal number of threads</translation>
</message>
<message>
<source>LEVEL_STANDARDPLUS</source>
<source>LEVEL_MEDIUM</source>
<translation>Moyen (standard)</translation>
</message>
+ <message>
+ <source>GHS3D_PTHREAD_MODE</source>
+ <translation>Mode Pthread</translation>
+ </message>
+ <message>
+ <source>GHS3D_PARALLE_STRAT</source>
+ <translation>Statégie Parallèle(HPC)</translation>
+ </message>
+ <message>
+ <source>MODE_NONE</source>
+ <translation>Zéro</translation>
+ </message>
+ <message>
+ <source>MODE_AGGRESSIVE</source>
+ <translation>Agressif</translation>
+ </message>
+ <message>
+ <source>MODE_SAFE</source>
+ <translation>Sûr</translation>
+ </message>
+ <message>
+ <source>MODE_REPRODUCIBLE</source>
+ <translation>Reproductible</translation>
+ </message>
+ <message>
+ <source>MODE_REPRODUCIBLE_GIVEN_MAX_THREADS</source>
+ <translation>Reproductible étant donné le nombre max de threads</translation>
+ </message>
+ <message>
+ <source>GHS3D_ALGO_SELECTION</source>
+ <translation>Sélection d'algorithme</translation>
+ </message>
+ <message>
+ <source>GHS3D_ALGO_MGTETRA</source>
+ <translation>MG-Tetra</translation>
+ </message>
+ <message>
+ <source>GHS3D_ALGO_MGTETRAHPC</source>
+ <translation>MG-Tetra HPC</translation>
+ </message>
+ <message>
+ <source>GHS3D_THREADS_SIZE</source>
+ <translation>Nombre max de threads</translation>
+ </message>
<message>
<source>LEVEL_STANDARDPLUS</source>
<translation>Standard+</translation>