--- /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
+
if ( verbose ) cmd = cmd + " --verbose " + SMESH_Comment( _hyp->GetVerboseLevel() );
if ( proximity ) cmd = cmd + " --volume_proximity_layers " + SMESH_Comment( _hyp->GetNbVolumeProximityLayers() );
- _hyp->SetAdvancedOptionsInCommandLine( _AdvOptions, false );
+ _hyp->SetAdvancedOptionsInCommandLine( _AdvOptions );
cmd = cmd + " " + _AdvOptions.c_str();
cmd = cmd + " --out=" + GHS3DPRL_Out_Mesh;
cmd = cmd + " 1>" + logFileName;
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, bool isMGTetra ) const
+void GHS3DPlugin_Hypothesis::SetAdvancedOptionsInCommandLine( std::string & cmd ) const
{
std::string option, value;
bool isDefault;
cmd += " --volume_proximity_layers " + SMESH_Comment( hyp->GetNbVolumeProximityLayers() );
}
- hyp->SetAdvancedOptionsInCommandLine( cmd, true );
+ hyp->SetAdvancedOptionsInCommandLine( cmd );
}
#ifdef WIN32
cmd += " < NUL";
#endif
-
return cmd;
}
* 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
*/
TOptionValues GetOptionValues() const;
const TOptionValues& GetCustomOptionValues() const { return _customOption2value; }
- bool isMGTetraHPCOptions( std::string & option ) const;
+ // bool isMGTetraHPCOptions( std::string & option ) const;
/*!
* \brief To set the advanced options in the execution command line
*/
- void SetAdvancedOptionsInCommandLine( std::string & cmd, bool isMGTetra ) const;
+ void SetAdvancedOptionsInCommandLine( std::string & cmd ) const;
//static inline const char* NoValue() { return "_"; }
// struct TEnforcedEdge {
(::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);
//=======================================================================
void GHS3DPlugin_Hypothesis_i::SetAlgorithm(CORBA::Short algoId)
{
- ::GHS3DPlugin_Hypothesis::ImplementedAlgorithms algo = (::GHS3DPlugin_Hypothesis::ImplementedAlgorithms) 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 << " )";
//=======================================================================
void GHS3DPlugin_Hypothesis_i::SetPthreadMode(CORBA::Short pThreadMode)
{
- ::GHS3DPlugin_Hypothesis::PThreadMode mode = (::GHS3DPlugin_Hypothesis::PThreadMode) 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 << " )";
//=======================================================================
void GHS3DPlugin_Hypothesis_i::SetParallelMode(CORBA::Short parallelMode)
{
- ::GHS3DPlugin_Hypothesis::ParallelMode mode = (::GHS3DPlugin_Hypothesis::ParallelMode) 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 << " )";