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 );
row++;
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 )
{
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;
}
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 )
{
}
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 )
{
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;
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);
{
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;
protected slots:
virtual void onFinenessChanged();
+ virtual void onSurfaceCurvatureChanged();
virtual void onAddLocalSizeOnVertex();
virtual void onAddLocalSizeOnEdge();
virtual void onAddLocalSizeOnFace();
SMESHGUI_SpinBox* myNbSegPerEdge;
SMESHGUI_SpinBox* myNbSegPerRadius;
QCheckBox* myAllowQuadrangles;
+ QCheckBox* mySurfaceCurvature;
+ QCheckBox* myFuseEdges;
bool myIs2D;
bool myIsONLY;
<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>
<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>
<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>
<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>
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
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)
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;
*
*/
//=============================================================================
+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;
}
save << " " << _minSize;
save << " " << _quadAllowed;
+ save << " " << _surfaceCurvature;
+ save << " " << _fuseEdges;
return save;
}
if ( !isOK )
_quadAllowed = GetDefaultQuadAllowed();
+ isOK = ( load >> _surfaceCurvature );
+ if ( !isOK )
+ _surfaceCurvature = GetDefaultSurfaceCurvature();
+
+ isOK = ( load >> _fuseEdges );
+ if ( !isOK )
+ _fuseEdges = GetDefaultFuseEdges();
+
return load;
}
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();
static bool GetDefaultSecondOrder();
static bool GetDefaultOptimize();
static bool GetDefaultQuadAllowed();
+ static bool GetDefaultSurfaceCurvature();
+ static bool GetDefaultFuseEdges();
// Persistence
virtual ostream & SaveTo(ostream & save);
bool _optimize;
TLocalSize _localSize;
bool _quadAllowed;
+ bool _surfaceCurvature;
+ bool _fuseEdges;
};
#endif
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
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();
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;
//extern void OCCSetLocalMeshSize(OCCGeometry & geom, Mesh & mesh);
extern MeshingParameters mparam;
extern volatile multithreadt multithread;
+ extern bool merge_solids;
}
#include <vector>
else
mparams.quad = NETGENPlugin_Hypothesis_2D::GetDefaultQuadAllowed() ? 1 : 0;
_fineness = NETGENPlugin_Hypothesis::GetDefaultFineness();
+ mparams.uselocalh = NETGENPlugin_Hypothesis::GetDefaultSurfaceCurvature();
+ netgen::merge_solids = NETGENPlugin_Hypothesis::GetDefaultFuseEdges();
}
//=============================================================================
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();
" 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();