22357: EDF NETGENPLUGIN: NETGEN options

This commit is contained in:
eap 2013-12-06 10:45:56 +00:00
parent ce25c56124
commit 7e2367deb5
13 changed files with 123 additions and 109 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB

View File

@ -10,8 +10,8 @@ hypotheses and algorithms (2D and 1D for meshing 3D objects and 1D for
meshing 2D objects). meshing 2D objects).
\image html netgen2d3d.png \image html netgen2d3d.png
<center><em>Dialog boxes of <b>Netgen 1D-2D</b> and <b>Netgen <center><em>Hypothesis dialog boxes of <b>Netgen 1D-2D</b> and <b>Netgen
1D-2D-3D</b> algorithms </em></center> 1D-2D-3D</b> algorithms are same</em></center>
<br> <br>
\image html netgen2d3d_only.png \image html netgen2d3d_only.png
@ -24,26 +24,35 @@ algorithms </em></center>
- <b>Min Size</b> - minimum linear dimensions for mesh cells. It is - <b>Min Size</b> - minimum linear dimensions for mesh cells. It is
ignored if it is more than <b>Max Size</b>. ignored if it is more than <b>Max Size</b>.
- <b>Second Order</b> - if this box is checked in, the algorithm will - <b>Second Order</b> - if this box is checked in, the algorithm will
create second order nodes on the mesh, which will then become quadratic. create second order mesh.
- <b>Fineness</b> - ranging from Very Coarse to Very Fine allows to set the - <b>Fineness</b> - ranging from <em>Very Coarse</em> to <em>Very Fine</em>
level of meshing detalization using the three parameters below. You allows to set the level of meshing detalization using the three
can select Custom to define them manually. parameters below. You can select \a Custom to define them manually.
- <b>Growth rate</b> - allows to define how much the linear dimensions of - <b>Growth rate</b> - allows to define how much the linear dimensions of
two adjacent cells can differ (i.e. 0.3 means 30%). two adjacent cells can differ (i.e. 0.3 means 30%).
- <b>Nb. Segs per Edge</b> and <b>Nb Segs per Radius</b> - allows to define the - <b>Nb. Segs per Edge</b> - allows to define the minimum number of
minimum number of mesh segments in which edges and radiuses will be mesh segments in which edges will be split. This parameter is used
split. only if <b>Limit Size by Surface Curvature</b> is checked.
- <b>Allow Quadrangles</b> - allows to use quadrangle elements in a - <b>Nb Segs per Radius</b> - allows to define the size of
triangle 2D mesh. This checkbox is not present in Netgen 3D parameters mesh segments and mesh faces in which curved edges and surfaces will
because currently building a tetrahedral mesh with quadrangle faces is be split. This parameter is used only if <b>Limit Size by Surface
not possible. Curvature</b> is checked.
- <b>Set size by Surface Curvature</b> - if this box is checked in, then - <b>Limit Size by Surface Curvature</b> - if this box is checked in,
prevents creation of meshes of desired coarseness else mesher defines then size of mesh segments and mesh faces on curved edges and surfaces
density of 1D and 2D mesh depending on curvature of faces and edges. is defined using value of <b>Nb Segs per Radius</b> parameter, and
- <b>Fuse consignment Edges and Vertices</b> - prevents to merging of number of segments on straight edges is defined by values of
nodes of edges which are coincident geometrically but are different topologically. <b>Nb. Segs per Edge</b> parameter. If this box is not checked in,
- <b>Optimize</b> - if this box is checked in, the algorithm will try to then size of elements is defined by three parameters only:
create regular (possessing even sides) elements. <b>Max Size</b>, <b>Min Size</b> and <b>Growth rate</b>.
- <b>Allow Quadrangles</b> - if this box is checked in, the mesher
tries to generate quadrangle 2D mesh. Triangle elements are created
where quadrangles are not possible.
- <b>Optimize</b> - if this box is checked in, the algorithm will modify
initially created mesh in order to improve quality of elements. Optimization
process is rather time consuming comparing to creation of initial mesh.
- <b>Fuse Coincident Nodes on Edges and Vertices</b> - allows merging
mesh nodes on vertices and edges which are geometrically coincident
but are topologically different.
\image html netgen3d_local_size.png \image html netgen3d_local_size.png
@ -71,14 +80,12 @@ consists of setting required \b length of segments.
\b 2D group allows defining the size of 2D elements \b 2D group allows defining the size of 2D elements
- <b>Length from edges</b> if checked in, hypothesis forces building of - <b>Length from edges</b> if checked in, hypothesis forces building of
2D mesh segments having a length calculated as an average edge length 2D mesh elements having a length calculated as an average edge length
for a given wire, else for a given wire, else
- <b>Max. Element Area</b> specifies expected maximum element area for - <b>Max. Element Area</b> specifies expected maximum element area for
each 2d element. each 2d element.
- <b>Allow Quadrangles</b> - allows to use quadrangle elements in a - <b>Allow Quadrangles</b> - allows to generate quadrangle elements
triangle 2D mesh. This checkbox is not present in Netgen 3D simple parameters wherever possible.
because currently building a tetrahedral mesh with quadrangle faces is
not possible.
\b 3D groups allows defining the size of 3D elements. \b 3D groups allows defining the size of 3D elements.
- <b>Length from faces</b> if checked in, the area of sides of - <b>Length from faces</b> if checked in, the area of sides of
@ -94,13 +101,9 @@ edge. This parameter is used only to define the local element size
(size at the given point), so local sizes of adjacent edges influence (size at the given point), so local sizes of adjacent edges influence
each other. each other.
- NETGEN additionally restricts the element size according to edge curvature. - NETGEN additionally restricts the element size according to edge curvature.
- The local size of edges influences the size of close triangles. - The local size of segments influences the size of close triangles.
- The order of elements and their size in the 1D mesh generated by - The order of elements and their size in the 1D mesh generated by
NETGEN differ from those in the 1D mesh generated by Regular_1D NETGEN differ from those in the 1D mesh generated by Regular_1D
algorithm, resulting in different 2D and 3D meshes. algorithm, resulting in different 2D and 3D meshes.
\note In the case where two points are geometrically confounded, a single node is generated.
*/ */

View File

@ -98,8 +98,8 @@ module NETGENPlugin
void SetQuadAllowed(in boolean value); void SetQuadAllowed(in boolean value);
boolean GetQuadAllowed(); boolean GetQuadAllowed();
void SetSurfaceCurvature(in boolean value); void SetUseSurfaceCurvature(in boolean value);
boolean GetSurfaceCurvature(); boolean GetUseSurfaceCurvature();
void SetFuseEdges(in boolean value); void SetFuseEdges(in boolean value);
boolean GetFuseEdges(); boolean GetFuseEdges();

View File

@ -166,7 +166,7 @@ QFrame* NETGENPluginGUI_HypothesisCreator::buildFrame()
if ( !myIsONLY ) if ( !myIsONLY )
{ {
mySecondOrder = new QCheckBox( tr( "NETGEN_SECOND_ORDER" ), GroupC1 ); mySecondOrder = new QCheckBox( tr( "NETGEN_SECOND_ORDER" ), GroupC1 );
aGroupLayout->addWidget( mySecondOrder, row, 0 ); aGroupLayout->addWidget( mySecondOrder, row, 0, 1, 2 );
row++; row++;
} }
@ -177,6 +177,7 @@ QFrame* NETGENPluginGUI_HypothesisCreator::buildFrame()
tr( "NETGEN_FINE" ) << tr( "NETGEN_VERYFINE" ) << tr( "NETGEN_CUSTOM" ); tr( "NETGEN_FINE" ) << tr( "NETGEN_VERYFINE" ) << tr( "NETGEN_CUSTOM" );
myFineness->addItems( types ); myFineness->addItems( types );
aGroupLayout->addWidget( myFineness, row, 1 ); aGroupLayout->addWidget( myFineness, row, 1 );
connect( myFineness, SIGNAL( activated( int ) ), this, SLOT( onFinenessChanged() ) );
row++; row++;
aGroupLayout->addWidget( new QLabel( tr( "NETGEN_GROWTH_RATE" ), GroupC1 ), row, 0 ); aGroupLayout->addWidget( new QLabel( tr( "NETGEN_GROWTH_RATE" ), GroupC1 ), row, 0 );
@ -204,34 +205,35 @@ QFrame* NETGENPluginGUI_HypothesisCreator::buildFrame()
row++; row++;
} }
myAllowQuadrangles = 0;
mySurfaceCurvature = 0; mySurfaceCurvature = 0;
myFuseEdges = 0; if ( myIs2D || !myIsONLY )
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 ); mySurfaceCurvature = new QCheckBox( tr( "NETGEN_SURFACE_CURVATURE" ), GroupC1 );
aGroupLayout->addWidget( mySurfaceCurvature, row, 0 ); aGroupLayout->addWidget( mySurfaceCurvature, row, 0, 1, 2 );
connect( mySurfaceCurvature, SIGNAL( stateChanged( int ) ), this, SLOT( onSurfaceCurvatureChanged() ) );
row++; row++;
} }
myAllowQuadrangles = 0;
if ( myIs2D || !myIsONLY ) // disable only for NETGEN 3D
{
myAllowQuadrangles = new QCheckBox( tr( "NETGEN_ALLOW_QUADRANGLES" ), GroupC1 );
aGroupLayout->addWidget( myAllowQuadrangles, row, 0, 1, 2 );
row++;
}
myOptimize = new QCheckBox( tr( "NETGEN_OPTIMIZE" ), GroupC1 );
aGroupLayout->addWidget( myOptimize, row, 0, 1, 2 );
row++;
myFuseEdges = 0;
if (!myIsONLY) if (!myIsONLY)
{ {
myFuseEdges = new QCheckBox( tr( "NETGEN_FUSE_EDGES" ), GroupC1 ); myFuseEdges = new QCheckBox( tr( "NETGEN_FUSE_EDGES" ), GroupC1 );
aGroupLayout->addWidget( myFuseEdges, row, 0 ); aGroupLayout->addWidget( myFuseEdges, row, 0, 1, 2 );
row++; row++;
} }
connect( mySurfaceCurvature, SIGNAL( stateChanged( int ) ), this, SLOT( onSurfaceCurvatureChanged() ) );
myOptimize = new QCheckBox( tr( "NETGEN_OPTIMIZE" ), GroupC1 );
aGroupLayout->addWidget( myOptimize, row, 0 );
row++;
connect( myFineness, SIGNAL( activated( int ) ), this, SLOT( onFinenessChanged() ) );
myLocalSizeTable = 0; myLocalSizeTable = 0;
if ( !myIsONLY ) if ( !myIsONLY )
{ {
@ -411,7 +413,7 @@ bool NETGENPluginGUI_HypothesisCreator::readParamsFromHypo( NetgenHypothesisData
h_data.myNbSegPerRadiusVar = getVariableName("SetNbSegPerRadius"); h_data.myNbSegPerRadiusVar = getVariableName("SetNbSegPerRadius");
h_data.myMinSize = h->GetMinSize(); h_data.myMinSize = h->GetMinSize();
h_data.myMinSizeVar = getVariableName("SetMinSize"); h_data.myMinSizeVar = getVariableName("SetMinSize");
h_data.mySurfaceCurvature = h->GetSurfaceCurvature(); h_data.mySurfaceCurvature = h->GetUseSurfaceCurvature();
h_data.myFuseEdges = h->GetFuseEdges(); h_data.myFuseEdges = h->GetFuseEdges();
//if ( myIs2D ) //if ( myIs2D )
@ -473,16 +475,17 @@ bool NETGENPluginGUI_HypothesisCreator::storeParamsToHypo( const NetgenHypothesi
} }
h->SetVarParameter ( h_data.myMinSizeVar.toLatin1().constData(), "SetMinSize"); h->SetVarParameter ( h_data.myMinSizeVar.toLatin1().constData(), "SetMinSize");
h->SetMinSize ( h_data.myMinSize ); h->SetMinSize ( h_data.myMinSize );
h->SetSurfaceCurvature( h_data.mySurfaceCurvature ); h->SetUseSurfaceCurvature( h_data.mySurfaceCurvature );
h->SetFuseEdges ( h_data.myFuseEdges ); h->SetFuseEdges ( h_data.myFuseEdges );
if ( myIs2D ) //if ( myIs2D )
{ {
NETGENPlugin::NETGENPlugin_Hypothesis_2D_var h_2d = // NETGENPlugin::NETGENPlugin_Hypothesis_2D_var h_2d =
NETGENPlugin::NETGENPlugin_Hypothesis_2D::_narrow( h ); // NETGENPlugin::NETGENPlugin_Hypothesis_2D::_narrow( h );
if ( !h_2d->_is_nil() ) // if ( !h_2d->_is_nil() )
h_2d->SetQuadAllowed( h_data.myAllowQuadrangles ); // h_2d->SetQuadAllowed( h_data.myAllowQuadrangles );
h->SetQuadAllowed( h_data.myAllowQuadrangles );
} }
QMapIterator<QString,QString> i(myLocalSizeMap); QMapIterator<QString,QString> i(myLocalSizeMap);
@ -561,10 +564,9 @@ bool NETGENPluginGUI_HypothesisCreator::readParamsFromWidgets( NetgenHypothesisD
void NETGENPluginGUI_HypothesisCreator::onSurfaceCurvatureChanged() void NETGENPluginGUI_HypothesisCreator::onSurfaceCurvatureChanged()
{ {
bool isSurfaceCurvature = (mySurfaceCurvature ? mySurfaceCurvature->checkState() == Qt::Checked : true); bool isSurfaceCurvature = (mySurfaceCurvature ? mySurfaceCurvature->isChecked() : true);
bool isCustom = (myFineness->currentIndex() == UserDefined); bool isCustom = (myFineness->currentIndex() == UserDefined);
myFineness->setEnabled(isSurfaceCurvature); myGrowthRate->setEnabled(isCustom);
myGrowthRate->setEnabled(isCustom && isSurfaceCurvature);
if ( myNbSegPerEdge ) if ( myNbSegPerEdge )
myNbSegPerEdge->setEnabled(isCustom && isSurfaceCurvature); myNbSegPerEdge->setEnabled(isCustom && isSurfaceCurvature);
if ( myNbSegPerRadius ) if ( myNbSegPerRadius )

View File

@ -57,7 +57,7 @@
</message> </message>
<message> <message>
<source>NETGEN_FUSE_EDGES</source> <source>NETGEN_FUSE_EDGES</source>
<translation>Fuse consignment Edges and Vertices</translation> <translation>Fuse Coincident Nodes on Edges and Vertices</translation>
</message> </message>
<message> <message>
<source>NETGEN_GROWTH_RATE</source> <source>NETGEN_GROWTH_RATE</source>
@ -93,7 +93,7 @@
</message> </message>
<message> <message>
<source>NETGEN_SURFACE_CURVATURE</source> <source>NETGEN_SURFACE_CURVATURE</source>
<translation>Set size by Surface Curvature</translation> <translation>Limit Size by Surface Curvature</translation>
</message> </message>
<message> <message>
<source>NETGEN_VERYCOARSE</source> <source>NETGEN_VERYCOARSE</source>

View File

@ -57,7 +57,7 @@
</message> </message>
<message> <message>
<source>NETGEN_FUSE_EDGES</source> <source>NETGEN_FUSE_EDGES</source>
<translation type="unfinished">Fuse consignment Edges and Vertices</translation> <translation type="unfinished">Fuse Coincident Nodes on Edges and Vertices</translation>
</message> </message>
<message> <message>
<source>NETGEN_GROWTH_RATE</source> <source>NETGEN_GROWTH_RATE</source>
@ -93,7 +93,7 @@
</message> </message>
<message> <message>
<source>NETGEN_SURFACE_CURVATURE</source> <source>NETGEN_SURFACE_CURVATURE</source>
<translation type="unfinished">Set size by Surface Curvature</translation> <translation type="unfinished">Limit Size by Surface Curvature</translation>
</message> </message>
<message> <message>
<source>NETGEN_VERYCOARSE</source> <source>NETGEN_VERYCOARSE</source>

View File

@ -55,6 +55,10 @@
<source>NETGEN_FINENESS</source> <source>NETGEN_FINENESS</source>
<translation></translation> <translation></translation>
</message> </message>
<message>
<source>NETGEN_FUSE_EDGES</source>
<translation type="unfinished">Fuse Coincident Nodes on Edges and Vertices</translation>
</message>
<message> <message>
<source>NETGEN_GROWTH_RATE</source> <source>NETGEN_GROWTH_RATE</source>
<translation></translation> <translation></translation>
@ -87,6 +91,10 @@
<source>NETGEN_SEG_PER_RADIUS</source> <source>NETGEN_SEG_PER_RADIUS</source>
<translation></translation> <translation></translation>
</message> </message>
<message>
<source>NETGEN_SURFACE_CURVATURE</source>
<translation type="unfinished">Limit Size by Surface Curvature</translation>
</message>
<message> <message>
<source>NETGEN_VERYCOARSE</source> <source>NETGEN_VERYCOARSE</source>
<translation></translation> <translation></translation>

View File

@ -218,15 +218,15 @@ class NETGEN_1D2D3D_Algorithm(NETGEN_Algorithm):
def SetQuadAllowed(self, toAllow=True): def SetQuadAllowed(self, toAllow=True):
if self.Parameters(): self.params.SetQuadAllowed(toAllow) if self.Parameters(): self.params.SetQuadAllowed(toAllow)
pass pass
## Sets @c SurfaceCurvature flag ## Sets @c UseSurfaceCurvature flag
# @param toAllow new value of the @c SurfaceCurvature parameter (@c True by default) # @param toUse new value of the @c UseSurfaceCurvature parameter (@c True by default)
def SetSurfaceCurvature(self, toAllow=True): def SetUseSurfaceCurvature(self, toUse=True):
if self.Parameters(): self.params.SetSurfaceCurvature(toAllow) if self.Parameters(): self.params.SetUseSurfaceCurvature(toUse)
pass pass
## Sets @c FuseEdges flag ## Sets @c FuseEdges flag
# @param toAllow new value of the @c FuseEdges parameter (@c False by default) # @param toFuse new value of the @c FuseEdges parameter (@c False by default)
def SetFuseEdges(self, toAllow=False): def SetFuseEdges(self, toFuse=False):
if self.Parameters(): self.params.SetFuseEdges(toAllow) if self.Parameters(): self.params.SetFuseEdges(toFuse)
pass pass
## Sets number of segments overriding the value set by SetLocalLength() ## Sets number of segments overriding the value set by SetLocalLength()

View File

@ -384,9 +384,9 @@ CORBA::Boolean NETGENPlugin_Hypothesis_i::GetQuadAllowed()
//============================================================================= //=============================================================================
void NETGENPlugin_Hypothesis_i::SetSurfaceCurvature (CORBA::Boolean theValue) void NETGENPlugin_Hypothesis_i::SetUseSurfaceCurvature (CORBA::Boolean theValue)
{ {
if ( NETGENPlugin_Hypothesis_i::isToSetParameter( GetSurfaceCurvature(), if ( NETGENPlugin_Hypothesis_i::isToSetParameter( GetUseSurfaceCurvature(),
theValue, theValue,
METH_SetSurfaceCurvature )) METH_SetSurfaceCurvature ))
{ {
@ -397,7 +397,7 @@ void NETGENPlugin_Hypothesis_i::SetSurfaceCurvature (CORBA::Boolean theValue)
//============================================================================= //=============================================================================
CORBA::Boolean NETGENPlugin_Hypothesis_i::GetSurfaceCurvature() CORBA::Boolean NETGENPlugin_Hypothesis_i::GetUseSurfaceCurvature()
{ {
return this->GetImpl()->GetSurfaceCurvature(); return this->GetImpl()->GetSurfaceCurvature();
} }

View File

@ -88,8 +88,8 @@ class NETGENPLUGIN_EXPORT NETGENPlugin_Hypothesis_i:
void SetQuadAllowed(CORBA::Boolean theVal); void SetQuadAllowed(CORBA::Boolean theVal);
CORBA::Boolean GetQuadAllowed(); CORBA::Boolean GetQuadAllowed();
void SetSurfaceCurvature(CORBA::Boolean theVal); void SetUseSurfaceCurvature(CORBA::Boolean theVal);
CORBA::Boolean GetSurfaceCurvature(); CORBA::Boolean GetUseSurfaceCurvature();
void SetFuseEdges(CORBA::Boolean theVal); void SetFuseEdges(CORBA::Boolean theVal);
CORBA::Boolean GetFuseEdges(); CORBA::Boolean GetFuseEdges();

View File

@ -194,12 +194,12 @@ void NETGENPlugin_Mesher::SetDefaultParameters()
// safety factor for curvatures (elements per radius) // safety factor for curvatures (elements per radius)
mparams.curvaturesafety = NETGENPlugin_Hypothesis::GetDefaultNbSegPerRadius(); mparams.curvaturesafety = NETGENPlugin_Hypothesis::GetDefaultNbSegPerRadius();
// create elements of second order // create elements of second order
mparams.secondorder = NETGENPlugin_Hypothesis::GetDefaultSecondOrder() ? 1 : 0; mparams.secondorder = NETGENPlugin_Hypothesis::GetDefaultSecondOrder();
// quad-dominated surface meshing // quad-dominated surface meshing
if (_isVolume) if (_isVolume)
mparams.quad = 0; mparams.quad = 0;
else else
mparams.quad = NETGENPlugin_Hypothesis_2D::GetDefaultQuadAllowed() ? 1 : 0; mparams.quad = NETGENPlugin_Hypothesis_2D::GetDefaultQuadAllowed();
_fineness = NETGENPlugin_Hypothesis::GetDefaultFineness(); _fineness = NETGENPlugin_Hypothesis::GetDefaultFineness();
mparams.uselocalh = NETGENPlugin_Hypothesis::GetDefaultSurfaceCurvature(); mparams.uselocalh = NETGENPlugin_Hypothesis::GetDefaultSurfaceCurvature();
netgen::merge_solids = NETGENPlugin_Hypothesis::GetDefaultFuseEdges(); netgen::merge_solids = NETGENPlugin_Hypothesis::GetDefaultFuseEdges();

View File

@ -266,7 +266,8 @@ bool NETGENPlugin_NETGEN_2D_ONLY::Compute(SMESH_Mesh& aMesh,
// MESHCONST_ANALYSE step may lead to a failure, so we make an attempt // MESHCONST_ANALYSE step may lead to a failure, so we make an attempt
// w/o MESHCONST_ANALYSE at the second loop // w/o MESHCONST_ANALYSE at the second loop
int err = 1; int err = 1;
for ( int iLoop = 0; iLoop < 2; iLoop++ ) int iLoop = netgen::mparam.uselocalh ? 0 : 1; // uselocalh depends on
for ( ; iLoop < 2; iLoop++ )
{ {
bool isMESHCONST_ANALYSE = false; bool isMESHCONST_ANALYSE = false;
InitComputeError(); InitComputeError();