Integrated in BR_imps_2013 branch: 0022357: EDF NETGENPLUGIN: NETGEN options
This commit is contained in:
parent
61fa2bb95b
commit
fd28f4083f
@ -203,13 +203,28 @@ QFrame* NETGENPluginGUI_HypothesisCreator::buildFrame()
|
||||
aGroupLayout->addWidget( myNbSegPerRadius, row, 1 );
|
||||
row++;
|
||||
}
|
||||
|
||||
myAllowQuadrangles = 0;
|
||||
mySurfaceCurvature = 0;
|
||||
myFuseEdges = 0;
|
||||
if ( myIs2D || !myIsONLY ) // issue 0021676
|
||||
{
|
||||
myAllowQuadrangles = new QCheckBox( tr( "NETGEN_ALLOW_QUADRANGLES" ), GroupC1 );
|
||||
aGroupLayout->addWidget( myAllowQuadrangles, row, 0 );
|
||||
row++;
|
||||
|
||||
mySurfaceCurvature = new QCheckBox( tr( "NETGEN_SURFACE_CURVATURE" ), GroupC1 );
|
||||
aGroupLayout->addWidget( mySurfaceCurvature, row, 0 );
|
||||
row++;
|
||||
}
|
||||
if (!myIsONLY)
|
||||
{
|
||||
myFuseEdges = new QCheckBox( tr( "NETGEN_FUSE_EDGES" ), GroupC1 );
|
||||
aGroupLayout->addWidget( myFuseEdges, row, 0 );
|
||||
row++;
|
||||
}
|
||||
|
||||
connect( mySurfaceCurvature, SIGNAL( stateChanged( int ) ), this, SLOT( onSurfaceCurvatureChanged() ) );
|
||||
|
||||
myOptimize = new QCheckBox( tr( "NETGEN_OPTIMIZE" ), GroupC1 );
|
||||
aGroupLayout->addWidget( myOptimize, row, 0 );
|
||||
@ -306,13 +321,21 @@ void NETGENPluginGUI_HypothesisCreator::retrieveParams() const
|
||||
if (myAllowQuadrangles)
|
||||
myAllowQuadrangles->setChecked( data.myAllowQuadrangles );
|
||||
|
||||
if (mySurfaceCurvature)
|
||||
mySurfaceCurvature->setChecked( data.mySurfaceCurvature );
|
||||
|
||||
if (myFuseEdges)
|
||||
myFuseEdges->setChecked( data.myFuseEdges );
|
||||
|
||||
// update widgets
|
||||
bool isCustom = (myFineness->currentIndex() == UserDefined);
|
||||
myGrowthRate->setEnabled(isCustom);
|
||||
bool isSurfaceCurvature = (mySurfaceCurvature->checkState() == Qt::Checked);
|
||||
myFineness->setEnabled(isSurfaceCurvature);
|
||||
myGrowthRate->setEnabled(isCustom && isSurfaceCurvature);
|
||||
if ( myNbSegPerEdge )
|
||||
myNbSegPerEdge->setEnabled(isCustom);
|
||||
myNbSegPerEdge->setEnabled(isCustom && isSurfaceCurvature);
|
||||
if ( myNbSegPerRadius )
|
||||
myNbSegPerRadius->setEnabled(isCustom);
|
||||
myNbSegPerRadius->setEnabled(isCustom && isSurfaceCurvature);
|
||||
|
||||
if ( myLocalSizeTable )
|
||||
{
|
||||
@ -357,6 +380,12 @@ QString NETGENPluginGUI_HypothesisCreator::storeParams() const
|
||||
if ( myIs2D && data.myAllowQuadrangles )
|
||||
valStr += "; " + tr("NETGEN_ALLOW_QUADRANGLES");
|
||||
|
||||
if ( data.mySurfaceCurvature )
|
||||
valStr += "; " + tr("NETGEN_SURFACE_CURVATURE");
|
||||
|
||||
if ( data.myFuseEdges )
|
||||
valStr += "; " + tr("NETGEN_FUSE_EDGES");
|
||||
|
||||
return valStr;
|
||||
}
|
||||
|
||||
@ -382,6 +411,8 @@ bool NETGENPluginGUI_HypothesisCreator::readParamsFromHypo( NetgenHypothesisData
|
||||
h_data.myNbSegPerRadiusVar = getVariableName("SetNbSegPerRadius");
|
||||
h_data.myMinSize = h->GetMinSize();
|
||||
h_data.myMinSizeVar = getVariableName("SetMinSize");
|
||||
h_data.mySurfaceCurvature = h->GetSurfaceCurvature();
|
||||
h_data.myFuseEdges = h->GetFuseEdges();
|
||||
|
||||
//if ( myIs2D )
|
||||
{
|
||||
@ -442,6 +473,8 @@ bool NETGENPluginGUI_HypothesisCreator::storeParamsToHypo( const NetgenHypothesi
|
||||
}
|
||||
h->SetVarParameter( h_data.myMinSizeVar.toLatin1().constData(), "SetMinSize");
|
||||
h->SetMinSize( h_data.myMinSize );
|
||||
h->SetSurfaceCurvature( h_data.mySurfaceCurvature );
|
||||
h->SetFuseEdges( h_data.myFuseEdges );
|
||||
|
||||
if ( myIs2D )
|
||||
{
|
||||
@ -506,6 +539,12 @@ bool NETGENPluginGUI_HypothesisCreator::readParamsFromWidgets( NetgenHypothesisD
|
||||
if ( myAllowQuadrangles )
|
||||
h_data.myAllowQuadrangles = myAllowQuadrangles->isChecked();
|
||||
|
||||
if ( mySurfaceCurvature )
|
||||
h_data.mySurfaceCurvature = mySurfaceCurvature->isChecked();
|
||||
|
||||
if ( myFuseEdges )
|
||||
h_data.myFuseEdges = myFuseEdges->isChecked();
|
||||
|
||||
if ( myLocalSizeTable )
|
||||
{
|
||||
NETGENPluginGUI_HypothesisCreator* that = (NETGENPluginGUI_HypothesisCreator*)this;
|
||||
@ -520,6 +559,18 @@ bool NETGENPluginGUI_HypothesisCreator::readParamsFromWidgets( NetgenHypothesisD
|
||||
return true;
|
||||
}
|
||||
|
||||
void NETGENPluginGUI_HypothesisCreator::onSurfaceCurvatureChanged()
|
||||
{
|
||||
bool isSurfaceCurvature = (mySurfaceCurvature->checkState() == Qt::Checked);
|
||||
bool isCustom = (myFineness->currentIndex() == UserDefined);
|
||||
myFineness->setEnabled(isSurfaceCurvature);
|
||||
myGrowthRate->setEnabled(isCustom && isSurfaceCurvature);
|
||||
if ( myNbSegPerEdge )
|
||||
myNbSegPerEdge->setEnabled(isCustom && isSurfaceCurvature);
|
||||
if ( myNbSegPerRadius )
|
||||
myNbSegPerRadius->setEnabled(isCustom && isSurfaceCurvature);
|
||||
}
|
||||
|
||||
void NETGENPluginGUI_HypothesisCreator::onFinenessChanged()
|
||||
{
|
||||
bool isCustom = (myFineness->currentIndex() == UserDefined);
|
||||
|
@ -46,7 +46,7 @@ typedef struct
|
||||
{
|
||||
double myMaxSize, myMinSize, myGrowthRate, myNbSegPerEdge, myNbSegPerRadius;
|
||||
int myFineness;
|
||||
bool mySecondOrder, myAllowQuadrangles, myOptimize;
|
||||
bool mySecondOrder, myAllowQuadrangles, myOptimize, mySurfaceCurvature, myFuseEdges;
|
||||
QString myName;
|
||||
QString myMaxSizeVar, myMinSizeVar, myGrowthRateVar, myNbSegPerEdgeVar, myNbSegPerRadiusVar;
|
||||
} NetgenHypothesisData;
|
||||
@ -76,6 +76,7 @@ protected:
|
||||
|
||||
protected slots:
|
||||
virtual void onFinenessChanged();
|
||||
virtual void onSurfaceCurvatureChanged();
|
||||
virtual void onAddLocalSizeOnVertex();
|
||||
virtual void onAddLocalSizeOnEdge();
|
||||
virtual void onAddLocalSizeOnFace();
|
||||
@ -100,6 +101,8 @@ private:
|
||||
SMESHGUI_SpinBox* myNbSegPerEdge;
|
||||
SMESHGUI_SpinBox* myNbSegPerRadius;
|
||||
QCheckBox* myAllowQuadrangles;
|
||||
QCheckBox* mySurfaceCurvature;
|
||||
QCheckBox* myFuseEdges;
|
||||
|
||||
bool myIs2D;
|
||||
bool myIsONLY;
|
||||
|
@ -55,6 +55,10 @@
|
||||
<source>NETGEN_FINENESS</source>
|
||||
<translation>Fineness</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>NETGEN_FUSE_EDGES</source>
|
||||
<translation>Fuse consignment Edges and Vertices</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>NETGEN_GROWTH_RATE</source>
|
||||
<translation>Growth Rate</translation>
|
||||
@ -87,6 +91,10 @@
|
||||
<source>NETGEN_SEG_PER_RADIUS</source>
|
||||
<translation>Nb. Segs per Radius</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>NETGEN_SURFACE_CURVATURE</source>
|
||||
<translation>Set size by Surface Curvature</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>NETGEN_VERYCOARSE</source>
|
||||
<translation>Very Coarse</translation>
|
||||
|
@ -55,6 +55,10 @@
|
||||
<source>NETGEN_FINENESS</source>
|
||||
<translation>Finesse</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>NETGEN_FUSE_EDGES</source>
|
||||
<translation type="unfinished">Fuse consignment Edges and Vertices</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>NETGEN_GROWTH_RATE</source>
|
||||
<translation>Taux d'accroissement</translation>
|
||||
@ -87,6 +91,10 @@
|
||||
<source>NETGEN_SEG_PER_RADIUS</source>
|
||||
<translation>Nb. segments par rayon</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>NETGEN_SURFACE_CURVATURE</source>
|
||||
<translation type="unfinished">Set size by Surface Curvature</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>NETGEN_VERYCOARSE</source>
|
||||
<translation>Très grossier</translation>
|
||||
|
@ -218,6 +218,16 @@ class NETGEN_1D2D3D_Algorithm(NETGEN_Algorithm):
|
||||
def SetQuadAllowed(self, toAllow=True):
|
||||
if self.Parameters(): self.params.SetQuadAllowed(toAllow)
|
||||
pass
|
||||
## Sets @c SurfaceCurvature flag
|
||||
# @param toAllow new value of the @c SurfaceCurvature parameter (@c True by default)
|
||||
def SetSurfaceCurvature(self, toAllow=True):
|
||||
if self.Parameters(): self.params.SetSurfaceCurvature(toAllow)
|
||||
pass
|
||||
## Sets @c FuseEdges flag
|
||||
# @param toAllow new value of the @c FuseEdges parameter (@c False by default)
|
||||
def SetFuseEdges(self, toAllow=False):
|
||||
if self.Parameters(): self.params.SetFuseEdges(toAllow)
|
||||
pass
|
||||
|
||||
## Sets number of segments overriding the value set by SetLocalLength()
|
||||
# @param theVal new value of number of segments parameter
|
||||
@ -335,6 +345,12 @@ class NETGEN_2D_Only_Algorithm(NETGEN_Algorithm):
|
||||
def LengthFromEdges(self):
|
||||
hyp = self.Hypothesis("LengthFromEdges", UseExisting=1, CompareMethod=self.CompareEqualHyp)
|
||||
return hyp
|
||||
|
||||
## Sets @c SurfaceCurvature flag
|
||||
# @param toAllow new value of the @c SurfaceCurvature parameter (@c True by default)
|
||||
def SetSurfaceCurvature(self, toAllow=True):
|
||||
if self.Parameters(): self.params.SetSurfaceCurvature(toAllow)
|
||||
pass
|
||||
|
||||
## Sets @c QuadAllowed flag.
|
||||
# @param toAllow new value of the @c QuadAllowed parameter (@c True by default)
|
||||
|
@ -43,16 +43,18 @@ using namespace std;
|
||||
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())
|
||||
_maxSize (GetDefaultMaxSize()),
|
||||
_minSize (0),
|
||||
_growthRate (GetDefaultGrowthRate()),
|
||||
_nbSegPerEdge (GetDefaultNbSegPerEdge()),
|
||||
_nbSegPerRadius (GetDefaultNbSegPerRadius()),
|
||||
_fineness (GetDefaultFineness()),
|
||||
_secondOrder (GetDefaultSecondOrder()),
|
||||
_optimize (GetDefaultOptimize()),
|
||||
_localSize (GetDefaultLocalSize()),
|
||||
_quadAllowed (GetDefaultQuadAllowed()),
|
||||
_surfaceCurvature(GetDefaultSurfaceCurvature()),
|
||||
_fuseEdges (GetDefaultFuseEdges())
|
||||
{
|
||||
_name = "NETGEN_Parameters";
|
||||
_param_algo_dim = 3;
|
||||
@ -274,6 +276,54 @@ bool NETGENPlugin_Hypothesis::GetDefaultQuadAllowed()
|
||||
*
|
||||
*/
|
||||
//=============================================================================
|
||||
void NETGENPlugin_Hypothesis::SetSurfaceCurvature(bool theVal)
|
||||
{
|
||||
if (theVal != _surfaceCurvature)
|
||||
{
|
||||
_surfaceCurvature = theVal;
|
||||
NotifySubMeshesHypothesisModification();
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
//=============================================================================
|
||||
bool NETGENPlugin_Hypothesis::GetDefaultSurfaceCurvature()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
//=============================================================================
|
||||
void NETGENPlugin_Hypothesis::SetFuseEdges(bool theVal)
|
||||
{
|
||||
if (theVal != _fuseEdges)
|
||||
{
|
||||
_fuseEdges = theVal;
|
||||
NotifySubMeshesHypothesisModification();
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
//=============================================================================
|
||||
bool NETGENPlugin_Hypothesis::GetDefaultFuseEdges()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
//=============================================================================
|
||||
ostream & NETGENPlugin_Hypothesis::SaveTo(ostream & save)
|
||||
{
|
||||
save << _maxSize << " " << _fineness;
|
||||
@ -294,6 +344,8 @@ ostream & NETGENPlugin_Hypothesis::SaveTo(ostream & save)
|
||||
}
|
||||
save << " " << _minSize;
|
||||
save << " " << _quadAllowed;
|
||||
save << " " << _surfaceCurvature;
|
||||
save << " " << _fuseEdges;
|
||||
|
||||
return save;
|
||||
}
|
||||
@ -385,6 +437,14 @@ istream & NETGENPlugin_Hypothesis::LoadFrom(istream & load)
|
||||
if ( !isOK )
|
||||
_quadAllowed = GetDefaultQuadAllowed();
|
||||
|
||||
isOK = ( load >> _surfaceCurvature );
|
||||
if ( !isOK )
|
||||
_surfaceCurvature = GetDefaultSurfaceCurvature();
|
||||
|
||||
isOK = ( load >> _fuseEdges );
|
||||
if ( !isOK )
|
||||
_fuseEdges = GetDefaultFuseEdges();
|
||||
|
||||
return load;
|
||||
}
|
||||
|
||||
|
@ -93,6 +93,12 @@ public:
|
||||
void SetQuadAllowed(bool theVal);
|
||||
bool GetQuadAllowed() const { return _quadAllowed; }
|
||||
|
||||
void SetSurfaceCurvature(bool theVal);
|
||||
bool GetSurfaceCurvature() const { return _surfaceCurvature; }
|
||||
|
||||
void SetFuseEdges(bool theVal);
|
||||
bool GetFuseEdges() const { return _fuseEdges; }
|
||||
|
||||
// the default values (taken from NETGEN 4.5 sources)
|
||||
|
||||
static double GetDefaultMaxSize();
|
||||
@ -103,6 +109,8 @@ public:
|
||||
static bool GetDefaultSecondOrder();
|
||||
static bool GetDefaultOptimize();
|
||||
static bool GetDefaultQuadAllowed();
|
||||
static bool GetDefaultSurfaceCurvature();
|
||||
static bool GetDefaultFuseEdges();
|
||||
|
||||
// Persistence
|
||||
virtual ostream & SaveTo(ostream & save);
|
||||
@ -134,6 +142,8 @@ private:
|
||||
bool _optimize;
|
||||
TLocalSize _localSize;
|
||||
bool _quadAllowed;
|
||||
bool _surfaceCurvature;
|
||||
bool _fuseEdges;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -382,6 +382,46 @@ CORBA::Boolean NETGENPlugin_Hypothesis_i::GetQuadAllowed()
|
||||
return this->GetImpl()->GetQuadAllowed();
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
void NETGENPlugin_Hypothesis_i::SetSurfaceCurvature (CORBA::Boolean theValue)
|
||||
{
|
||||
if ( NETGENPlugin_Hypothesis_i::isToSetParameter( GetSurfaceCurvature(),
|
||||
theValue,
|
||||
METH_SetSurfaceCurvature ))
|
||||
{
|
||||
this->GetImpl()->SetSurfaceCurvature(theValue);
|
||||
SMESH::TPythonDump() << _this() << ".SetSurfaceCurvature( " << theValue << " )";
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
CORBA::Boolean NETGENPlugin_Hypothesis_i::GetSurfaceCurvature()
|
||||
{
|
||||
return this->GetImpl()->GetSurfaceCurvature();
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
void NETGENPlugin_Hypothesis_i::SetFuseEdges (CORBA::Boolean theValue)
|
||||
{
|
||||
if ( NETGENPlugin_Hypothesis_i::isToSetParameter( GetFuseEdges(),
|
||||
theValue,
|
||||
METH_SetFuseEdges ))
|
||||
{
|
||||
this->GetImpl()->SetFuseEdges(theValue);
|
||||
SMESH::TPythonDump() << _this() << ".SetFuseEdges( " << theValue << " )";
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
CORBA::Boolean NETGENPlugin_Hypothesis_i::GetFuseEdges()
|
||||
{
|
||||
return this->GetImpl()->GetFuseEdges();
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* NETGENPlugin_Hypothesis_i::GetImpl
|
||||
|
@ -88,6 +88,12 @@ class NETGENPLUGIN_EXPORT NETGENPlugin_Hypothesis_i:
|
||||
void SetQuadAllowed(CORBA::Boolean theVal);
|
||||
CORBA::Boolean GetQuadAllowed();
|
||||
|
||||
void SetSurfaceCurvature(CORBA::Boolean theVal);
|
||||
CORBA::Boolean GetSurfaceCurvature();
|
||||
|
||||
void SetFuseEdges(CORBA::Boolean theVal);
|
||||
CORBA::Boolean GetFuseEdges();
|
||||
|
||||
// Get implementation
|
||||
::NETGENPlugin_Hypothesis* GetImpl();
|
||||
|
||||
@ -109,7 +115,9 @@ class NETGENPLUGIN_EXPORT NETGENPlugin_Hypothesis_i:
|
||||
METH_SetNbSegPerRadius = 128,
|
||||
METH_SetLocalSizeOnEntry = 256,
|
||||
METH_SetQuadAllowed = METH_SetLocalSizeOnEntry * 2,
|
||||
METH_LAST = METH_SetQuadAllowed
|
||||
METH_SetSurfaceCurvature = METH_SetQuadAllowed * 2,
|
||||
METH_SetFuseEdges = METH_SetSurfaceCurvature * 2,
|
||||
METH_LAST = METH_SetFuseEdges
|
||||
};
|
||||
int mySetMethodFlags;
|
||||
|
||||
|
@ -83,6 +83,7 @@ namespace netgen {
|
||||
//extern void OCCSetLocalMeshSize(OCCGeometry & geom, Mesh & mesh);
|
||||
extern MeshingParameters mparam;
|
||||
extern volatile multithreadt multithread;
|
||||
extern bool merge_solids;
|
||||
}
|
||||
|
||||
#include <vector>
|
||||
@ -200,6 +201,8 @@ void NETGENPlugin_Mesher::SetDefaultParameters()
|
||||
else
|
||||
mparams.quad = NETGENPlugin_Hypothesis_2D::GetDefaultQuadAllowed() ? 1 : 0;
|
||||
_fineness = NETGENPlugin_Hypothesis::GetDefaultFineness();
|
||||
mparams.uselocalh = NETGENPlugin_Hypothesis::GetDefaultSurfaceCurvature();
|
||||
netgen::merge_solids = NETGENPlugin_Hypothesis::GetDefaultFuseEdges();
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
@ -259,6 +262,8 @@ void NETGENPlugin_Mesher::SetParameters(const NETGENPlugin_Hypothesis* hyp)
|
||||
mparams.quad = hyp->GetQuadAllowed() ? 1 : 0;
|
||||
_optimize = hyp->GetOptimize();
|
||||
_fineness = hyp->GetFineness();
|
||||
mparams.uselocalh = hyp->GetSurfaceCurvature();
|
||||
netgen::merge_solids = hyp->GetFuseEdges();
|
||||
_simpleHyp = NULL;
|
||||
|
||||
SMESH_Gen_i* smeshGen_i = SMESH_Gen_i::GetSMESHGen();
|
||||
@ -2114,8 +2119,9 @@ bool NETGENPlugin_Mesher::Compute()
|
||||
" growth rate = " << mparams.grading << "\n"
|
||||
" elements per radius = " << mparams.curvaturesafety << "\n"
|
||||
" second order = " << mparams.secondorder << "\n"
|
||||
" quad allowed = " << mparams.quad);
|
||||
//cout << " quad allowed = " << mparams.quad<<endl;
|
||||
" quad allowed = " << mparams.quad << "\n"
|
||||
" surface curvature = " << mparams.uselocalh << "\n"
|
||||
" fuse edges = " << netgen::merge_solids);
|
||||
|
||||
SMESH_ComputeErrorPtr error = SMESH_ComputeError::New();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user