-// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2023 CEA, EDF, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//=============================================================================
/*!
- *
+ *
*/
//=============================================================================
-NETGENPlugin_Hypothesis::NETGENPlugin_Hypothesis (int hypId,
- SMESH_Gen * gen)
+NETGENPlugin_Hypothesis::NETGENPlugin_Hypothesis (int hypId, SMESH_Gen * gen)
: SMESH_Hypothesis(hypId, gen),
+ _fineness (GetDefaultFineness()),
+ _secondOrder (GetDefaultSecondOrder()),
+ _quadAllowed (GetDefaultQuadAllowed()),
_maxSize (GetDefaultMaxSize()),
_minSize (0),
_growthRate (GetDefaultGrowthRate()),
- _nbSegPerEdge (GetDefaultNbSegPerEdge()),
_nbSegPerRadius (GetDefaultNbSegPerRadius()),
- _fineness (GetDefaultFineness()),
+ _nbSegPerEdge (GetDefaultNbSegPerEdge()),
_chordalErrorEnabled(GetDefaultChordalError() > 0),
_chordalError (GetDefaultChordalError() ),
- _secondOrder (GetDefaultSecondOrder()),
_optimize (GetDefaultOptimize()),
- _localSize (GetDefaultLocalSize()),
- _quadAllowed (GetDefaultQuadAllowed()),
+ _nbSurfOptSteps (GetDefaultNbSurfOptSteps()),
+ _nbVolOptSteps (GetDefaultNbVolOptSteps()),
+ _elemSizeWeight (GetDefaultElemSizeWeight()),
+ _worstElemMeasure (GetDefaultWorstElemMeasure()),
+ _nbThreads (GetDefaultNbThreads()),
_surfaceCurvature (GetDefaultSurfaceCurvature()),
+ _useDelauney (GetDefaultUseDelauney()),
+ _checkOverlapping (GetDefaultCheckOverlapping()),
+ _checkChartBoundary (GetDefaultCheckChartBoundary()),
_fuseEdges (GetDefaultFuseEdges())
{
_name = "NETGEN_Parameters";
_param_algo_dim = 3;
- _localSize.clear();
}
//=============================================================================
/*!
- *
+ *
*/
//=============================================================================
void NETGENPlugin_Hypothesis::SetMaxSize(double theSize)
//=============================================================================
/*!
- *
+ *
*/
//=============================================================================
void NETGENPlugin_Hypothesis::SetMinSize(double theSize)
//=============================================================================
/*!
- *
+ *
*/
//=============================================================================
void NETGENPlugin_Hypothesis::SetSecondOrder(bool theVal)
//=============================================================================
/*!
- *
+ *
*/
//=============================================================================
void NETGENPlugin_Hypothesis::SetOptimize(bool theVal)
//=============================================================================
/*!
- *
+ *
*/
//=============================================================================
void NETGENPlugin_Hypothesis::SetFineness(Fineness theFineness)
//=============================================================================
/*!
- *
+ *
*/
//=============================================================================
void NETGENPlugin_Hypothesis::SetGrowthRate(double theRate)
//=============================================================================
/*!
- *
+ *
*/
//=============================================================================
void NETGENPlugin_Hypothesis::SetNbSegPerEdge(double theVal)
//=============================================================================
/*!
- *
+ *
*/
//=============================================================================
void NETGENPlugin_Hypothesis::SetNbSegPerRadius(double theVal)
//=============================================================================
/*!
- *
+ *
*/
//=============================================================================
void NETGENPlugin_Hypothesis::SetChordalErrorEnabled(bool theVal)
//=============================================================================
/*!
- *
+ *
*/
//=============================================================================
void NETGENPlugin_Hypothesis::SetChordalError(double theVal)
//=============================================================================
/*!
- *
+ *
*/
//=============================================================================
void NETGENPlugin_Hypothesis::SetLocalSizeOnEntry(const std::string& entry, double localSize)
//=============================================================================
/*!
- *
+ *
*/
//=============================================================================
void NETGENPlugin_Hypothesis::UnsetLocalSizeOnEntry(const std::string& entry)
//=============================================================================
/*!
- *
+ *
*/
//=============================================================================
void NETGENPlugin_Hypothesis::SetMeshSizeFile(const std::string& fileName)
//=============================================================================
/*!
- *
+ *
*/
//=============================================================================
void NETGENPlugin_Hypothesis::SetQuadAllowed(bool theVal)
//=============================================================================
/*!
- *
- */
-//=============================================================================
-bool NETGENPlugin_Hypothesis::GetDefaultQuadAllowed()
-{
- return false;
-}
-
-//=============================================================================
-/*!
- *
+ *
*/
//=============================================================================
void NETGENPlugin_Hypothesis::SetSurfaceCurvature(bool theVal)
}
}
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-bool NETGENPlugin_Hypothesis::GetDefaultSurfaceCurvature()
-{
- return true;
-}
-
//=============================================================================
/*!
*
}
}
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-bool NETGENPlugin_Hypothesis::GetDefaultFuseEdges()
+//=======================================================================
+//function : SetNbSurfOptSteps
+//purpose :
+//=======================================================================
+
+void NETGENPlugin_Hypothesis::SetNbSurfOptSteps( int theVal )
+{
+ if (theVal != _nbSurfOptSteps)
+ {
+ _nbSurfOptSteps = theVal;
+ NotifySubMeshesHypothesisModification();
+ }
+}
+
+//=======================================================================
+//function : SetNbVolOptSteps
+//purpose :
+//=======================================================================
+
+void NETGENPlugin_Hypothesis::SetNbVolOptSteps( int theVal )
+{
+ if (theVal != _nbVolOptSteps)
+ {
+ _nbVolOptSteps = theVal;
+ NotifySubMeshesHypothesisModification();
+ }
+}
+
+//=======================================================================
+//function : SetElemSizeWeight
+//purpose :
+//=======================================================================
+
+void NETGENPlugin_Hypothesis::SetElemSizeWeight( double theVal )
+{
+ if (theVal != _elemSizeWeight)
+ {
+ _elemSizeWeight = theVal;
+ NotifySubMeshesHypothesisModification();
+ }
+}
+
+//=======================================================================
+//function : SetWorstElemMeasure
+//purpose :
+//=======================================================================
+
+void NETGENPlugin_Hypothesis::SetWorstElemMeasure( int theVal )
+{
+ if (theVal != _worstElemMeasure)
+ {
+ _worstElemMeasure = theVal;
+ NotifySubMeshesHypothesisModification();
+ }
+}
+
+//=======================================================================
+//function : SetUseDelauney
+//purpose :
+//=======================================================================
+
+void NETGENPlugin_Hypothesis::SetUseDelauney( bool theVal )
+{
+ if (theVal != _useDelauney )
+ {
+ _useDelauney = theVal;
+ NotifySubMeshesHypothesisModification();
+ }
+}
+
+//=======================================================================
+//function : SetCheckOverlapping
+//purpose :
+//=======================================================================
+
+void NETGENPlugin_Hypothesis::SetCheckOverlapping( bool theVal )
{
- return true; // false; -- for SALOME_TESTS/Grids/smesh/3D_mesh_NETGEN_05/F6
+ if (theVal != _checkOverlapping )
+ {
+ _checkOverlapping = theVal;
+ NotifySubMeshesHypothesisModification();
+ }
+}
+
+//=======================================================================
+//function : SetCheckChartBoundary
+//purpose :
+//=======================================================================
+
+void NETGENPlugin_Hypothesis::SetCheckChartBoundary( bool theVal )
+{
+ if (theVal != _checkChartBoundary)
+ {
+ _checkChartBoundary = theVal;
+ NotifySubMeshesHypothesisModification();
+ }
+}
+
+//=======================================================================
+//function : SetNbThreads
+//purpose :
+//=======================================================================
+
+void NETGENPlugin_Hypothesis::SetNbThreads( int theVal )
+{
+ if (theVal != _nbThreads)
+ {
+ _nbThreads = theVal;
+ NotifySubMeshesHypothesisModification();
+ }
}
//=============================================================================
save << " " << ( _chordalErrorEnabled ? _chordalError : 0. );
+
+ // added for option set completion
+
+ save << " " << _nbSurfOptSteps;
+ save << " " << _nbVolOptSteps;
+ save << " " << _elemSizeWeight;
+ save << " " << _worstElemMeasure;
+
+ save << " " << _useDelauney;
+ save << " " << _checkOverlapping;
+ save << " " << _checkChartBoundary;
+
return save;
}
//=============================================================================
/*!
- *
+ *
*/
//=============================================================================
istream & NETGENPlugin_Hypothesis::LoadFrom(istream & load)
load.clear(ios::badbit | load.rdstate());
_chordalErrorEnabled = ( _chordalError > 0 );
- return load;
-}
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-ostream & operator <<(ostream & save, NETGENPlugin_Hypothesis & hyp)
-{
- return hyp.SaveTo( save );
-}
+ // added for option set completion
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-istream & operator >>(istream & load, NETGENPlugin_Hypothesis & hyp)
-{
- return hyp.LoadFrom( load );
-}
+ isOK = static_cast<bool>( load >> is );
+ if ( isOK )
+ _nbSurfOptSteps = is;
+
+ isOK = static_cast<bool>( load >> is );
+ if ( isOK )
+ _nbVolOptSteps = is;
+
+ isOK = static_cast<bool>( load >> val );
+ if ( isOK )
+ _elemSizeWeight = val;
+ isOK = static_cast<bool>( load >> is );
+ if ( isOK )
+ _worstElemMeasure = is;
+
+ isOK = static_cast<bool>( load >> is );
+ if ( isOK )
+ _useDelauney = (bool) is;
+
+ isOK = static_cast<bool>( load >> is );
+ if ( isOK )
+ _checkOverlapping = (bool) is;
+
+ isOK = static_cast<bool>( load >> is );
+ if ( isOK )
+ _checkChartBoundary = (bool) is;
+
+ return load;
+}
//================================================================================
/*!
* \retval bool - always false
*/
//================================================================================
-bool NETGENPlugin_Hypothesis::SetParametersByMesh(const SMESH_Mesh* theMesh,
- const TopoDS_Shape& theShape)
+bool NETGENPlugin_Hypothesis::SetParametersByMesh(const SMESH_Mesh* /*theMesh*/,
+ const TopoDS_Shape& /*theShape*/)
{
return false;
}
else if ( theMesh && theMesh->HasShapeToMesh() )
_minSize = NETGENPlugin_Mesher::GetDefaultMinSize( theMesh->GetShapeToMesh(), _maxSize );
- return _nbSegPerEdge && _maxSize > 0;
-}
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-double NETGENPlugin_Hypothesis::GetDefaultMaxSize()
-{
- return 1000;
-}
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-NETGENPlugin_Hypothesis::Fineness NETGENPlugin_Hypothesis::GetDefaultFineness()
-{
- return Moderate;
-}
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-double NETGENPlugin_Hypothesis::GetDefaultGrowthRate()
-{
- return 0.3;
-}
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-double NETGENPlugin_Hypothesis::GetDefaultNbSegPerEdge()
-{
- return 1;
-}
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-double NETGENPlugin_Hypothesis::GetDefaultNbSegPerRadius()
-{
- return 2;
-}
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-double NETGENPlugin_Hypothesis::GetDefaultChordalError()
-{
- return -1; // disabled by default
-}
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-bool NETGENPlugin_Hypothesis::GetDefaultSecondOrder()
-{
- return false;
-}
+ if ( dflts._way == SMESH_Hypothesis::BY_AVERAGE_LENGTH )
+ {
+ _minSize = dflts._elemLength / 100.;
+ _nbSegPerEdge = 1;
+ _chordalError = dflts._elemLength / 2.;
+ _chordalErrorEnabled = true;
+ _quadAllowed = dflts._quadDominated;
+ }
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-bool NETGENPlugin_Hypothesis::GetDefaultOptimize()
-{
- return true;
+ return _nbSegPerEdge && _maxSize > 0;
}