X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FNETGENPlugin%2FNETGENPlugin_Hypothesis.cxx;h=abb5b6aacef9645611fac42ee8c775083dc665b0;hb=ac5dc648d839444366920d17980ba1690355bf25;hp=5ec88e3e4b944e08709d5823b7d318d634f66a85;hpb=9f30c086ceceef57709bc2971bd30252920faa38;p=plugins%2Fnetgenplugin.git diff --git a/src/NETGENPlugin/NETGENPlugin_Hypothesis.cxx b/src/NETGENPlugin/NETGENPlugin_Hypothesis.cxx index 5ec88e3..abb5b6a 100644 --- a/src/NETGENPlugin/NETGENPlugin_Hypothesis.cxx +++ b/src/NETGENPlugin/NETGENPlugin_Hypothesis.cxx @@ -42,19 +42,22 @@ using namespace std; //============================================================================= NETGENPlugin_Hypothesis::NETGENPlugin_Hypothesis (int hypId, SMESH_Gen * gen) + : SMESH_Hypothesis(hypId, 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()) + _maxSize (GetDefaultMaxSize()), + _minSize (0), + _growthRate (GetDefaultGrowthRate()), + _nbSegPerEdge (GetDefaultNbSegPerEdge()), + _nbSegPerRadius (GetDefaultNbSegPerRadius()), + _fineness (GetDefaultFineness()), + _chordalErrorEnabled(GetDefaultChordalError() > 0), + _chordalError (GetDefaultChordalError() ), + _secondOrder (GetDefaultSecondOrder()), + _optimize (GetDefaultOptimize()), + _localSize (GetDefaultLocalSize()), + _quadAllowed (GetDefaultQuadAllowed()), + _surfaceCurvature (GetDefaultSurfaceCurvature()), + _fuseEdges (GetDefaultFuseEdges()) { _name = "NETGEN_Parameters"; _param_algo_dim = 3; @@ -208,6 +211,34 @@ void NETGENPlugin_Hypothesis::SetNbSegPerRadius(double theVal) } } +//============================================================================= +/*! + * + */ +//============================================================================= +void NETGENPlugin_Hypothesis::SetChordalErrorEnabled(bool theVal) +{ + if (theVal != _chordalErrorEnabled) + { + _chordalErrorEnabled = theVal; + NotifySubMeshesHypothesisModification(); + } +} + +//============================================================================= +/*! + * + */ +//============================================================================= +void NETGENPlugin_Hypothesis::SetChordalError(double theVal) +{ + if (theVal != _chordalError) + { + _chordalError = theVal; + NotifySubMeshesHypothesisModification(); + } +} + //============================================================================= /*! * @@ -351,8 +382,8 @@ ostream & NETGENPlugin_Hypothesis::SaveTo(ostream & save) 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__"; } @@ -363,6 +394,8 @@ ostream & NETGENPlugin_Hypothesis::SaveTo(ostream & save) save << " " << _meshSizeFile.size() << " " << _meshSizeFile; + save << " " << ( _chordalErrorEnabled ? _chordalError : 0. ); + return save; } @@ -476,12 +509,19 @@ istream & NETGENPlugin_Hypothesis::LoadFrom(istream & load) load.get( &_meshSizeFile[0], is+1 ); } + isOK = static_cast(load >> val); + if (isOK) + _chordalError = val; + else + load.clear(ios::badbit | load.rdstate()); + _chordalErrorEnabled = ( _chordalError > 0 ); + return load; } //============================================================================= /*! - * + * */ //============================================================================= ostream & operator <<(ostream & save, NETGENPlugin_Hypothesis & hyp) @@ -491,7 +531,7 @@ ostream & operator <<(ostream & save, NETGENPlugin_Hypothesis & hyp) //============================================================================= /*! - * + * */ //============================================================================= istream & operator >>(istream & load, NETGENPlugin_Hypothesis & hyp) @@ -584,6 +624,15 @@ double NETGENPlugin_Hypothesis::GetDefaultNbSegPerRadius() { return 2; } +//============================================================================= +/*! + * + */ +//============================================================================= +double NETGENPlugin_Hypothesis::GetDefaultChordalError() +{ + return -1; // disabled by default +} //============================================================================= /*!