-// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2021 CEA/DEN, EDF R&D, 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, int studyId,
- SMESH_Gen * gen)
- : SMESH_Hypothesis(hypId, studyId, gen),
- _maxSize (GetDefaultMaxSize()),
- _minSize (0),
- _growthRate (GetDefaultGrowthRate()),
- _nbSegPerEdge (GetDefaultNbSegPerEdge()),
- _nbSegPerRadius (GetDefaultNbSegPerRadius()),
- _fineness (GetDefaultFineness()),
- _secondOrder (GetDefaultSecondOrder()),
- _optimize (GetDefaultOptimize()),
- _localSize (GetDefaultLocalSize()),
- _quadAllowed (GetDefaultQuadAllowed()),
- _surfaceCurvature(GetDefaultSurfaceCurvature()),
- _fuseEdges (GetDefaultFuseEdges())
+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()),
+ _nbSegPerRadius (GetDefaultNbSegPerRadius()),
+ _nbSegPerEdge (GetDefaultNbSegPerEdge()),
+ _chordalErrorEnabled(GetDefaultChordalError() > 0),
+ _chordalError (GetDefaultChordalError() ),
+ _optimize (GetDefaultOptimize()),
+ _nbSurfOptSteps (GetDefaultNbSurfOptSteps()),
+ _nbVolOptSteps (GetDefaultNbVolOptSteps()),
+ _elemSizeWeight (GetDefaultElemSizeWeight()),
+ _worstElemMeasure (GetDefaultWorstElemMeasure()),
+ _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::SetChordalErrorEnabled(bool theVal)
+{
+ if (theVal != _chordalErrorEnabled)
+ {
+ _chordalErrorEnabled = theVal;
+ NotifySubMeshesHypothesisModification();
+ }
+}
+
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+void NETGENPlugin_Hypothesis::SetChordalError(double theVal)
+{
+ if (theVal != _chordalError)
+ {
+ _chordalError = theVal;
+ NotifySubMeshesHypothesisModification();
+ }
+}
+
//=============================================================================
/*!
*
*
*/
//=============================================================================
-void NETGENPlugin_Hypothesis::SetQuadAllowed(bool theVal)
+void NETGENPlugin_Hypothesis::SetMeshSizeFile(const std::string& fileName)
{
- if (theVal != _quadAllowed)
+ if ( fileName != _meshSizeFile )
{
- _quadAllowed = theVal;
+ _meshSizeFile = fileName;
NotifySubMeshesHypothesisModification();
}
}
*
*/
//=============================================================================
-bool NETGENPlugin_Hypothesis::GetDefaultQuadAllowed()
+void NETGENPlugin_Hypothesis::SetQuadAllowed(bool theVal)
{
- return false;
+ if (theVal != _quadAllowed)
+ {
+ _quadAllowed = theVal;
+ NotifySubMeshesHypothesisModification();
+ }
}
//=============================================================================
}
}
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-bool NETGENPlugin_Hypothesis::GetDefaultSurfaceCurvature()
-{
- return true;
-}
-
//=============================================================================
/*!
*
}
}
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-bool NETGENPlugin_Hypothesis::GetDefaultFuseEdges()
+//=======================================================================
+//function : SetNbSurfOptSteps
+//purpose :
+//=======================================================================
+
+void NETGENPlugin_Hypothesis::SetNbSurfOptSteps( int theVal )
{
- return true; // false; -- for SALOME_TESTS/Grids/smesh/3D_mesh_NETGEN_05/F6
+ 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 )
+{
+ if (theVal != _checkOverlapping )
+ {
+ _checkOverlapping = theVal;
+ NotifySubMeshesHypothesisModification();
+ }
+}
+
+//=======================================================================
+//function : SetCheckChartBoundary
+//purpose :
+//=======================================================================
+
+void NETGENPlugin_Hypothesis::SetCheckChartBoundary( bool theVal )
+{
+ if (theVal != _checkChartBoundary)
+ {
+ _checkChartBoundary = theVal;
+ NotifySubMeshesHypothesisModification();
+ }
}
//=============================================================================
if (it_sm != _localSize.end()) {
save << " " << "__LOCALSIZE_BEGIN__";
for ( ; it_sm != _localSize.end(); ++it_sm ) {
- save << " " << it_sm->first
- << " " << it_sm->second << "%#"; // "%#" is a mark of value end
+ save << " " << it_sm->first
+ << " " << it_sm->second << "%#"; // "%#" is a mark of value end
}
save << " " << "__LOCALSIZE_END__";
}
save << " " << _surfaceCurvature;
save << " " << _fuseEdges;
+ save << " " << _meshSizeFile.size() << " " << _meshSizeFile;
+
+ 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;
}
if ( !hasLocalSize && !option_or_sm.empty() )
_minSize = atof( option_or_sm.c_str() );
+ else
+ load >> _minSize;
- isOK = static_cast<bool>( load >> _quadAllowed );
- if ( !isOK )
+ isOK = static_cast<bool>( load >> is );
+ if ( isOK )
+ _quadAllowed = (bool) is;
+ else
_quadAllowed = GetDefaultQuadAllowed();
- isOK = static_cast<bool>( load >> _surfaceCurvature );
- if ( !isOK )
+ isOK = static_cast<bool>( load >> is );
+ if ( isOK )
+ _surfaceCurvature = (bool) is;
+ else
_surfaceCurvature = GetDefaultSurfaceCurvature();
- isOK = static_cast<bool>( load >> _fuseEdges );
- if ( !isOK )
+ isOK = static_cast<bool>( load >> is );
+ if ( isOK )
+ _fuseEdges = (bool) is;
+ else
_fuseEdges = GetDefaultFuseEdges();
- return load;
-}
+ isOK = static_cast<bool>( load >> is >> std::ws ); // size of meshSizeFile
+ if ( isOK && is > 0 )
+ {
+ _meshSizeFile.resize( is );
+ load.get( &_meshSizeFile[0], is+1 );
+ }
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-ostream & operator <<(ostream & save, NETGENPlugin_Hypothesis & hyp)
-{
- return hyp.SaveTo( save );
-}
+ isOK = static_cast<bool>(load >> val);
+ if (isOK)
+ _chordalError = val;
+ else
+ load.clear(ios::badbit | load.rdstate());
+ _chordalErrorEnabled = ( _chordalError > 0 );
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-istream & operator >>(istream & load, NETGENPlugin_Hypothesis & hyp)
-{
- return hyp.LoadFrom( load );
-}
+ // added for option set completion
+
+ 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;
-}
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-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;
}