Merge from BR_imps_2013 14/01/2014

This commit is contained in:
vsr 2014-01-15 10:08:00 +00:00
parent c32068e4d7
commit 3302782c77
18 changed files with 347 additions and 75 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,21 +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>Optimize</b> - if this box is checked in, the algorithm will try to - <b>Limit Size by Surface Curvature</b> - if this box is checked in,
create regular (possessing even sides) elements. then size of mesh segments and mesh faces on curved edges and surfaces
is defined using value of <b>Nb Segs per Radius</b> parameter, and
number of segments on straight edges is defined by values of
<b>Nb. Segs per Edge</b> parameter. If this box is not checked in,
then size of elements is defined by three parameters only:
<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
@ -66,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
@ -89,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

@ -97,6 +97,12 @@ module NETGENPlugin
void SetQuadAllowed(in boolean value); void SetQuadAllowed(in boolean value);
boolean GetQuadAllowed(); boolean GetQuadAllowed();
void SetUseSurfaceCurvature(in boolean value);
boolean GetUseSurfaceCurvature();
void SetFuseEdges(in boolean value);
boolean GetFuseEdges();
void SetLocalSizeOnShape(in GEOM::GEOM_Object GeomObj, in double localSize); void SetLocalSizeOnShape(in GEOM::GEOM_Object GeomObj, in double localSize);
void SetLocalSizeOnEntry(in string entry, in double localSize); void SetLocalSizeOnEntry(in string entry, in double localSize);

View File

@ -67,6 +67,7 @@
opt-hypos="ViscousLayers" opt-hypos="ViscousLayers"
need-geom="false" need-geom="false"
input="TRIA,QUAD" input="TRIA,QUAD"
output="TETRA,PYRAMID"
dim="3"> dim="3">
<python-wrap> <python-wrap>
<algo>NETGEN_3D=Tetrahedron()</algo> <algo>NETGEN_3D=Tetrahedron()</algo>
@ -114,6 +115,7 @@
label-id="Netgen 1D-2D-3D" label-id="Netgen 1D-2D-3D"
icon-id="mesh_algo_netgen_2d3d.png" icon-id="mesh_algo_netgen_2d3d.png"
hypos="NETGEN_Parameters, NETGEN_SimpleParameters_3D" hypos="NETGEN_Parameters, NETGEN_SimpleParameters_3D"
output="TETRA,PYRAMID"
dim="3" dim="3"
support-submeshes="true"> support-submeshes="true">
<python-wrap> <python-wrap>

View File

@ -89,7 +89,7 @@ NETGENPluginGUI_HypothesisCreator::NETGENPluginGUI_HypothesisCreator( const QStr
{ {
myGeomSelectionTools = NULL; myGeomSelectionTools = NULL;
myLocalSizeMap.clear(); myLocalSizeMap.clear();
myIs2D = ( theHypType.startsWith("NETGEN_Parameters_2D")); myIs2D = ( theHypType.startsWith("NETGEN_Parameters_2D"));
myIsONLY = ( theHypType == "NETGEN_Parameters_2D_ONLY" || myIsONLY = ( theHypType == "NETGEN_Parameters_2D_ONLY" ||
theHypType == "NETGEN_Parameters_3D"); theHypType == "NETGEN_Parameters_3D");
} }
@ -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 );
@ -203,19 +204,35 @@ QFrame* NETGENPluginGUI_HypothesisCreator::buildFrame()
aGroupLayout->addWidget( myNbSegPerRadius, row, 1 ); aGroupLayout->addWidget( myNbSegPerRadius, row, 1 );
row++; row++;
} }
mySurfaceCurvature = 0;
if ( myIs2D || !myIsONLY )
{
mySurfaceCurvature = new QCheckBox( tr( "NETGEN_SURFACE_CURVATURE" ), GroupC1 );
aGroupLayout->addWidget( mySurfaceCurvature, row, 0, 1, 2 );
connect( mySurfaceCurvature, SIGNAL( stateChanged( int ) ), this, SLOT( onSurfaceCurvatureChanged() ) );
row++;
}
myAllowQuadrangles = 0; myAllowQuadrangles = 0;
if ( myIs2D || !myIsONLY ) // issue 0021676 if ( myIs2D || !myIsONLY ) // disable only for NETGEN 3D
{ {
myAllowQuadrangles = new QCheckBox( tr( "NETGEN_ALLOW_QUADRANGLES" ), GroupC1 ); myAllowQuadrangles = new QCheckBox( tr( "NETGEN_ALLOW_QUADRANGLES" ), GroupC1 );
aGroupLayout->addWidget( myAllowQuadrangles, row, 0 ); aGroupLayout->addWidget( myAllowQuadrangles, row, 0, 1, 2 );
row++; row++;
} }
myOptimize = new QCheckBox( tr( "NETGEN_OPTIMIZE" ), GroupC1 ); myOptimize = new QCheckBox( tr( "NETGEN_OPTIMIZE" ), GroupC1 );
aGroupLayout->addWidget( myOptimize, row, 0 ); aGroupLayout->addWidget( myOptimize, row, 0, 1, 2 );
row++; row++;
connect( myFineness, SIGNAL( activated( int ) ), this, SLOT( onFinenessChanged() ) ); myFuseEdges = 0;
if (!myIsONLY)
{
myFuseEdges = new QCheckBox( tr( "NETGEN_FUSE_EDGES" ), GroupC1 );
aGroupLayout->addWidget( myFuseEdges, row, 0, 1, 2 );
row++;
}
myLocalSizeTable = 0; myLocalSizeTable = 0;
if ( !myIsONLY ) if ( !myIsONLY )
@ -306,13 +323,21 @@ void NETGENPluginGUI_HypothesisCreator::retrieveParams() const
if (myAllowQuadrangles) if (myAllowQuadrangles)
myAllowQuadrangles->setChecked( data.myAllowQuadrangles ); myAllowQuadrangles->setChecked( data.myAllowQuadrangles );
if (mySurfaceCurvature)
mySurfaceCurvature->setChecked( data.mySurfaceCurvature );
if (myFuseEdges)
myFuseEdges->setChecked( data.myFuseEdges );
// update widgets // update widgets
bool isCustom = (myFineness->currentIndex() == UserDefined); bool isCustom = (myFineness->currentIndex() == UserDefined);
myGrowthRate->setEnabled(isCustom); bool isSurfaceCurvature = (mySurfaceCurvature ? mySurfaceCurvature->checkState() == Qt::Checked : true);
myFineness->setEnabled(isSurfaceCurvature);
myGrowthRate->setEnabled(isCustom && isSurfaceCurvature);
if ( myNbSegPerEdge ) if ( myNbSegPerEdge )
myNbSegPerEdge->setEnabled(isCustom); myNbSegPerEdge->setEnabled(isCustom && isSurfaceCurvature);
if ( myNbSegPerRadius ) if ( myNbSegPerRadius )
myNbSegPerRadius->setEnabled(isCustom); myNbSegPerRadius->setEnabled(isCustom && isSurfaceCurvature);
if ( myLocalSizeTable ) if ( myLocalSizeTable )
{ {
@ -357,6 +382,12 @@ QString NETGENPluginGUI_HypothesisCreator::storeParams() const
if ( myIs2D && data.myAllowQuadrangles ) if ( myIs2D && data.myAllowQuadrangles )
valStr += "; " + tr("NETGEN_ALLOW_QUADRANGLES"); valStr += "; " + tr("NETGEN_ALLOW_QUADRANGLES");
if ( data.mySurfaceCurvature )
valStr += "; " + tr("NETGEN_SURFACE_CURVATURE");
if ( data.myFuseEdges )
valStr += "; " + tr("NETGEN_FUSE_EDGES");
return valStr; return valStr;
} }
@ -382,6 +413,8 @@ 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->GetUseSurfaceCurvature();
h_data.myFuseEdges = h->GetFuseEdges();
//if ( myIs2D ) //if ( myIs2D )
{ {
@ -425,23 +458,25 @@ bool NETGENPluginGUI_HypothesisCreator::storeParamsToHypo( const NetgenHypothesi
if( isCreation() ) if( isCreation() )
SMESH::SetName( SMESH::FindSObject( h ), h_data.myName.toLatin1().data() ); SMESH::SetName( SMESH::FindSObject( h ), h_data.myName.toLatin1().data() );
h->SetVarParameter( h_data.myMaxSizeVar.toLatin1().constData(), "SetMaxSize"); h->SetVarParameter( h_data.myMaxSizeVar.toLatin1().constData(), "SetMaxSize");
h->SetMaxSize( h_data.myMaxSize ); h->SetMaxSize ( h_data.myMaxSize );
h->SetSecondOrder( h_data.mySecondOrder ); h->SetSecondOrder ( h_data.mySecondOrder );
h->SetOptimize( h_data.myOptimize ); h->SetOptimize ( h_data.myOptimize );
int fineness = h_data.myFineness; int fineness = h_data.myFineness;
h->SetFineness( fineness ); h->SetFineness ( fineness );
if( fineness==UserDefined ) if( fineness==UserDefined )
{ {
h->SetVarParameter( h_data.myGrowthRateVar.toLatin1().constData(), "SetGrowthRate"); h->SetVarParameter ( h_data.myGrowthRateVar.toLatin1().constData(), "SetGrowthRate");
h->SetGrowthRate( h_data.myGrowthRate ); h->SetGrowthRate ( h_data.myGrowthRate );
h->SetVarParameter( h_data.myNbSegPerEdgeVar.toLatin1().constData(), "SetNbSegPerEdge"); h->SetVarParameter ( h_data.myNbSegPerEdgeVar.toLatin1().constData(), "SetNbSegPerEdge");
h->SetNbSegPerEdge( h_data.myNbSegPerEdge ); h->SetNbSegPerEdge ( h_data.myNbSegPerEdge );
h->SetVarParameter( h_data.myNbSegPerRadiusVar.toLatin1().constData(), "SetNbSegPerRadius"); h->SetVarParameter ( h_data.myNbSegPerRadiusVar.toLatin1().constData(), "SetNbSegPerRadius");
h->SetNbSegPerRadius( h_data.myNbSegPerRadius ); h->SetNbSegPerRadius( h_data.myNbSegPerRadius );
} }
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->SetUseSurfaceCurvature( h_data.mySurfaceCurvature );
h->SetFuseEdges ( h_data.myFuseEdges );
//if ( myIs2D ) //if ( myIs2D )
{ {
@ -507,6 +542,12 @@ bool NETGENPluginGUI_HypothesisCreator::readParamsFromWidgets( NetgenHypothesisD
if ( myAllowQuadrangles ) if ( myAllowQuadrangles )
h_data.myAllowQuadrangles = myAllowQuadrangles->isChecked(); h_data.myAllowQuadrangles = myAllowQuadrangles->isChecked();
if ( mySurfaceCurvature )
h_data.mySurfaceCurvature = mySurfaceCurvature->isChecked();
if ( myFuseEdges )
h_data.myFuseEdges = myFuseEdges->isChecked();
if ( myLocalSizeTable ) if ( myLocalSizeTable )
{ {
NETGENPluginGUI_HypothesisCreator* that = (NETGENPluginGUI_HypothesisCreator*)this; NETGENPluginGUI_HypothesisCreator* that = (NETGENPluginGUI_HypothesisCreator*)this;
@ -521,6 +562,17 @@ bool NETGENPluginGUI_HypothesisCreator::readParamsFromWidgets( NetgenHypothesisD
return true; return true;
} }
void NETGENPluginGUI_HypothesisCreator::onSurfaceCurvatureChanged()
{
bool isSurfaceCurvature = (mySurfaceCurvature ? mySurfaceCurvature->isChecked() : true);
bool isCustom = (myFineness->currentIndex() == UserDefined);
myGrowthRate->setEnabled(isCustom);
if ( myNbSegPerEdge )
myNbSegPerEdge->setEnabled(isCustom && isSurfaceCurvature);
if ( myNbSegPerRadius )
myNbSegPerRadius->setEnabled(isCustom && isSurfaceCurvature);
}
void NETGENPluginGUI_HypothesisCreator::onFinenessChanged() void NETGENPluginGUI_HypothesisCreator::onFinenessChanged()
{ {
bool isCustom = (myFineness->currentIndex() == UserDefined); bool isCustom = (myFineness->currentIndex() == UserDefined);

View File

@ -46,7 +46,7 @@ typedef struct
{ {
double myMaxSize, myMinSize, myGrowthRate, myNbSegPerEdge, myNbSegPerRadius; double myMaxSize, myMinSize, myGrowthRate, myNbSegPerEdge, myNbSegPerRadius;
int myFineness; int myFineness;
bool mySecondOrder, myAllowQuadrangles, myOptimize; bool mySecondOrder, myAllowQuadrangles, myOptimize, mySurfaceCurvature, myFuseEdges;
QString myName; QString myName;
QString myMaxSizeVar, myMinSizeVar, myGrowthRateVar, myNbSegPerEdgeVar, myNbSegPerRadiusVar; QString myMaxSizeVar, myMinSizeVar, myGrowthRateVar, myNbSegPerEdgeVar, myNbSegPerRadiusVar;
} NetgenHypothesisData; } NetgenHypothesisData;
@ -76,6 +76,7 @@ protected:
protected slots: protected slots:
virtual void onFinenessChanged(); virtual void onFinenessChanged();
virtual void onSurfaceCurvatureChanged();
virtual void onAddLocalSizeOnVertex(); virtual void onAddLocalSizeOnVertex();
virtual void onAddLocalSizeOnEdge(); virtual void onAddLocalSizeOnEdge();
virtual void onAddLocalSizeOnFace(); virtual void onAddLocalSizeOnFace();
@ -100,6 +101,8 @@ private:
SMESHGUI_SpinBox* myNbSegPerEdge; SMESHGUI_SpinBox* myNbSegPerEdge;
SMESHGUI_SpinBox* myNbSegPerRadius; SMESHGUI_SpinBox* myNbSegPerRadius;
QCheckBox* myAllowQuadrangles; QCheckBox* myAllowQuadrangles;
QCheckBox* mySurfaceCurvature;
QCheckBox* myFuseEdges;
bool myIs2D; bool myIs2D;
bool myIsONLY; bool myIsONLY;

View File

@ -55,6 +55,10 @@
<source>NETGEN_FINENESS</source> <source>NETGEN_FINENESS</source>
<translation>Fineness</translation> <translation>Fineness</translation>
</message> </message>
<message>
<source>NETGEN_FUSE_EDGES</source>
<translation>Fuse Coincident Nodes on Edges and Vertices</translation>
</message>
<message> <message>
<source>NETGEN_GROWTH_RATE</source> <source>NETGEN_GROWTH_RATE</source>
<translation>Growth Rate</translation> <translation>Growth Rate</translation>
@ -87,6 +91,10 @@
<source>NETGEN_SEG_PER_RADIUS</source> <source>NETGEN_SEG_PER_RADIUS</source>
<translation>Nb. Segs per Radius</translation> <translation>Nb. Segs per Radius</translation>
</message> </message>
<message>
<source>NETGEN_SURFACE_CURVATURE</source>
<translation>Limit Size by Surface Curvature</translation>
</message>
<message> <message>
<source>NETGEN_VERYCOARSE</source> <source>NETGEN_VERYCOARSE</source>
<translation>Very Coarse</translation> <translation>Very Coarse</translation>

View File

@ -55,6 +55,10 @@
<source>NETGEN_FINENESS</source> <source>NETGEN_FINENESS</source>
<translation>Finesse</translation> <translation>Finesse</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>Taux d&apos;accroissement</translation> <translation>Taux d&apos;accroissement</translation>
@ -87,6 +91,10 @@
<source>NETGEN_SEG_PER_RADIUS</source> <source>NETGEN_SEG_PER_RADIUS</source>
<translation>Nb. segments par rayon</translation> <translation>Nb. segments par rayon</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>Très grossier</translation> <translation>Très grossier</translation>

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

@ -1012,3 +1012,38 @@ diff -Naur netgen-4.9.13_orig/nglib/nglib.h netgen-4.9.13_new/nglib/nglib.h
#define DLL_HEADER __declspec(dllexport) #define DLL_HEADER __declspec(dllexport)
#else #else
#define DLL_HEADER __declspec(dllimport) #define DLL_HEADER __declspec(dllimport)
}
diff -Naur netgen-4.9.13_orig/libsrc/occ/occgenmesh.cpp /netgen-4.9.13_new/libsrc/occ/occgenmesh.cpp
--- netgen-4.9.13_orig/libsrc/occ/occgenmesh.cpp 2013-12-04 14:39:45.000000000 +0400
+++ netgen-4.9.13_new/libsrc/occ/occgenmesh.cpp 2013-12-04 15:20:24.000000000 +0400
@@ -564,17 +564,20 @@
bool exists = 0;
int j;
for (j = first_ep; j <= mesh.GetNP(); j++)
+ {
+ if (!merge_solids && mesh.Point(j).GetLayer() != geomedgenr ) continue; // to support SALOME fuse edges
if ((mesh.Point(j)-Point<3>(mp[i-1])).Length() < eps)
{
exists = 1;
break;
}
+ }
if (exists)
pnums[i] = j;
else
{
- mesh.AddPoint (mp[i-1]);
+ mesh.AddPoint (mp[i-1], geomedgenr); // to support SALOME fuse edges
(*testout) << "add meshpoint " << mp[i-1] << endl;
pnums[i] = mesh.GetNP();
}
@@ -658,6 +661,8 @@
// (*testout) << "edge " << mesh.LineSegment(i).edgenr << " face " << mesh.LineSegment(i).si
// << " p1 " << mesh.LineSegment(i)[0] << " p2 " << mesh.LineSegment(i)[1] << endl;
// exit(10);
+ for (int j = 1; j <= mesh.GetNP(); j++) // to support SALOME fuse edges: set level to zero
+ mesh.Point(j) = MeshPoint( (Point<3>&) mesh.Point(j) );
mesh.CalcSurfacesOfNode();
multithread.task = savetask;

View File

@ -218,6 +218,16 @@ 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 UseSurfaceCurvature flag
# @param toUse new value of the @c UseSurfaceCurvature parameter (@c True by default)
def SetUseSurfaceCurvature(self, toUse=True):
if self.Parameters(): self.params.SetUseSurfaceCurvature(toUse)
pass
## Sets @c FuseEdges flag
# @param toFuse new value of the @c FuseEdges parameter (@c False by default)
def SetFuseEdges(self, toFuse=False):
if self.Parameters(): self.params.SetFuseEdges(toFuse)
pass
## Sets number of segments overriding the value set by SetLocalLength() ## Sets number of segments overriding the value set by SetLocalLength()
# @param theVal new value of number of segments parameter # @param theVal new value of number of segments parameter
@ -335,6 +345,12 @@ class NETGEN_2D_Only_Algorithm(NETGEN_Algorithm):
def LengthFromEdges(self): def LengthFromEdges(self):
hyp = self.Hypothesis("LengthFromEdges", UseExisting=1, CompareMethod=self.CompareEqualHyp) hyp = self.Hypothesis("LengthFromEdges", UseExisting=1, CompareMethod=self.CompareEqualHyp)
return hyp 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. ## Sets @c QuadAllowed flag.
# @param toAllow new value of the @c QuadAllowed parameter (@c True by default) # @param toAllow new value of the @c QuadAllowed parameter (@c True by default)

View File

@ -43,16 +43,18 @@ using namespace std;
NETGENPlugin_Hypothesis::NETGENPlugin_Hypothesis (int hypId, int studyId, NETGENPlugin_Hypothesis::NETGENPlugin_Hypothesis (int hypId, int studyId,
SMESH_Gen * gen) SMESH_Gen * gen)
: SMESH_Hypothesis(hypId, studyId, gen), : SMESH_Hypothesis(hypId, studyId, gen),
_maxSize (GetDefaultMaxSize()), _maxSize (GetDefaultMaxSize()),
_minSize (0), _minSize (0),
_growthRate (GetDefaultGrowthRate()), _growthRate (GetDefaultGrowthRate()),
_nbSegPerEdge (GetDefaultNbSegPerEdge()), _nbSegPerEdge (GetDefaultNbSegPerEdge()),
_nbSegPerRadius(GetDefaultNbSegPerRadius()), _nbSegPerRadius (GetDefaultNbSegPerRadius()),
_fineness (GetDefaultFineness()), _fineness (GetDefaultFineness()),
_secondOrder (GetDefaultSecondOrder()), _secondOrder (GetDefaultSecondOrder()),
_optimize (GetDefaultOptimize()), _optimize (GetDefaultOptimize()),
_localSize (GetDefaultLocalSize()), _localSize (GetDefaultLocalSize()),
_quadAllowed (GetDefaultQuadAllowed()) _quadAllowed (GetDefaultQuadAllowed()),
_surfaceCurvature(GetDefaultSurfaceCurvature()),
_fuseEdges (GetDefaultFuseEdges())
{ {
_name = "NETGEN_Parameters"; _name = "NETGEN_Parameters";
_param_algo_dim = 3; _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) ostream & NETGENPlugin_Hypothesis::SaveTo(ostream & save)
{ {
save << _maxSize << " " << _fineness; save << _maxSize << " " << _fineness;
@ -294,6 +344,8 @@ ostream & NETGENPlugin_Hypothesis::SaveTo(ostream & save)
} }
save << " " << _minSize; save << " " << _minSize;
save << " " << _quadAllowed; save << " " << _quadAllowed;
save << " " << _surfaceCurvature;
save << " " << _fuseEdges;
return save; return save;
} }
@ -385,6 +437,14 @@ istream & NETGENPlugin_Hypothesis::LoadFrom(istream & load)
if ( !isOK ) if ( !isOK )
_quadAllowed = GetDefaultQuadAllowed(); _quadAllowed = GetDefaultQuadAllowed();
isOK = ( load >> _surfaceCurvature );
if ( !isOK )
_surfaceCurvature = GetDefaultSurfaceCurvature();
isOK = ( load >> _fuseEdges );
if ( !isOK )
_fuseEdges = GetDefaultFuseEdges();
return load; return load;
} }

View File

@ -93,6 +93,12 @@ public:
void SetQuadAllowed(bool theVal); void SetQuadAllowed(bool theVal);
bool GetQuadAllowed() const { return _quadAllowed; } 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) // the default values (taken from NETGEN 4.5 sources)
static double GetDefaultMaxSize(); static double GetDefaultMaxSize();
@ -103,6 +109,8 @@ public:
static bool GetDefaultSecondOrder(); static bool GetDefaultSecondOrder();
static bool GetDefaultOptimize(); static bool GetDefaultOptimize();
static bool GetDefaultQuadAllowed(); static bool GetDefaultQuadAllowed();
static bool GetDefaultSurfaceCurvature();
static bool GetDefaultFuseEdges();
// Persistence // Persistence
virtual ostream & SaveTo(ostream & save); virtual ostream & SaveTo(ostream & save);
@ -134,6 +142,8 @@ private:
bool _optimize; bool _optimize;
TLocalSize _localSize; TLocalSize _localSize;
bool _quadAllowed; bool _quadAllowed;
bool _surfaceCurvature;
bool _fuseEdges;
}; };
#endif #endif

View File

@ -382,6 +382,46 @@ CORBA::Boolean NETGENPlugin_Hypothesis_i::GetQuadAllowed()
return this->GetImpl()->GetQuadAllowed(); return this->GetImpl()->GetQuadAllowed();
} }
//=============================================================================
void NETGENPlugin_Hypothesis_i::SetUseSurfaceCurvature (CORBA::Boolean theValue)
{
if ( NETGENPlugin_Hypothesis_i::isToSetParameter( GetUseSurfaceCurvature(),
theValue,
METH_SetSurfaceCurvature ))
{
this->GetImpl()->SetSurfaceCurvature(theValue);
SMESH::TPythonDump() << _this() << ".SetSurfaceCurvature( " << theValue << " )";
}
}
//=============================================================================
CORBA::Boolean NETGENPlugin_Hypothesis_i::GetUseSurfaceCurvature()
{
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 * NETGENPlugin_Hypothesis_i::GetImpl

View File

@ -88,6 +88,12 @@ class NETGENPLUGIN_EXPORT NETGENPlugin_Hypothesis_i:
void SetQuadAllowed(CORBA::Boolean theVal); void SetQuadAllowed(CORBA::Boolean theVal);
CORBA::Boolean GetQuadAllowed(); CORBA::Boolean GetQuadAllowed();
void SetUseSurfaceCurvature(CORBA::Boolean theVal);
CORBA::Boolean GetUseSurfaceCurvature();
void SetFuseEdges(CORBA::Boolean theVal);
CORBA::Boolean GetFuseEdges();
// Get implementation // Get implementation
::NETGENPlugin_Hypothesis* GetImpl(); ::NETGENPlugin_Hypothesis* GetImpl();
@ -109,7 +115,9 @@ class NETGENPLUGIN_EXPORT NETGENPlugin_Hypothesis_i:
METH_SetNbSegPerRadius = 128, METH_SetNbSegPerRadius = 128,
METH_SetLocalSizeOnEntry = 256, METH_SetLocalSizeOnEntry = 256,
METH_SetQuadAllowed = METH_SetLocalSizeOnEntry * 2, 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; int mySetMethodFlags;

View File

@ -83,6 +83,7 @@ namespace netgen {
//extern void OCCSetLocalMeshSize(OCCGeometry & geom, Mesh & mesh); //extern void OCCSetLocalMeshSize(OCCGeometry & geom, Mesh & mesh);
extern MeshingParameters mparam; extern MeshingParameters mparam;
extern volatile multithreadt multithread; extern volatile multithreadt multithread;
extern bool merge_solids;
} }
#include <vector> #include <vector>
@ -184,22 +185,24 @@ void NETGENPlugin_Mesher::SetDefaultParameters()
{ {
netgen::MeshingParameters& mparams = netgen::mparam; netgen::MeshingParameters& mparams = netgen::mparam;
// maximal mesh edge size // maximal mesh edge size
mparams.maxh = 0;//NETGENPlugin_Hypothesis::GetDefaultMaxSize(); mparams.maxh = 0;//NETGENPlugin_Hypothesis::GetDefaultMaxSize();
mparams.minh = 0; mparams.minh = 0;
// minimal number of segments per edge // minimal number of segments per edge
mparams.segmentsperedge = NETGENPlugin_Hypothesis::GetDefaultNbSegPerEdge(); mparams.segmentsperedge = NETGENPlugin_Hypothesis::GetDefaultNbSegPerEdge();
// rate of growth of size between elements // rate of growth of size between elements
mparams.grading = NETGENPlugin_Hypothesis::GetDefaultGrowthRate(); mparams.grading = NETGENPlugin_Hypothesis::GetDefaultGrowthRate();
// 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();
netgen::merge_solids = NETGENPlugin_Hypothesis::GetDefaultFuseEdges();
} }
//============================================================================= //=============================================================================
@ -242,23 +245,25 @@ void NETGENPlugin_Mesher::SetParameters(const NETGENPlugin_Hypothesis* hyp)
netgen::MeshingParameters& mparams = netgen::mparam; netgen::MeshingParameters& mparams = netgen::mparam;
// Initialize global NETGEN parameters: // Initialize global NETGEN parameters:
// maximal mesh segment size // maximal mesh segment size
mparams.maxh = hyp->GetMaxSize(); mparams.maxh = hyp->GetMaxSize();
// maximal mesh element linear size // maximal mesh element linear size
mparams.minh = hyp->GetMinSize(); mparams.minh = hyp->GetMinSize();
// minimal number of segments per edge // minimal number of segments per edge
mparams.segmentsperedge = hyp->GetNbSegPerEdge(); mparams.segmentsperedge = hyp->GetNbSegPerEdge();
// rate of growth of size between elements // rate of growth of size between elements
mparams.grading = hyp->GetGrowthRate(); mparams.grading = hyp->GetGrowthRate();
// safety factor for curvatures (elements per radius) // safety factor for curvatures (elements per radius)
mparams.curvaturesafety = hyp->GetNbSegPerRadius(); mparams.curvaturesafety = hyp->GetNbSegPerRadius();
// create elements of second order // create elements of second order
mparams.secondorder = hyp->GetSecondOrder() ? 1 : 0; mparams.secondorder = hyp->GetSecondOrder() ? 1 : 0;
// quad-dominated surface meshing // quad-dominated surface meshing
// only triangles are allowed for volumic mesh (before realizing IMP 0021676) // only triangles are allowed for volumic mesh (before realizing IMP 0021676)
//if (!_isVolume) //if (!_isVolume)
mparams.quad = hyp->GetQuadAllowed() ? 1 : 0; mparams.quad = hyp->GetQuadAllowed() ? 1 : 0;
_optimize = hyp->GetOptimize(); _optimize = hyp->GetOptimize();
_fineness = hyp->GetFineness(); _fineness = hyp->GetFineness();
mparams.uselocalh = hyp->GetSurfaceCurvature();
netgen::merge_solids = hyp->GetFuseEdges();
_simpleHyp = NULL; _simpleHyp = NULL;
SMESH_Gen_i* smeshGen_i = SMESH_Gen_i::GetSMESHGen(); SMESH_Gen_i* smeshGen_i = SMESH_Gen_i::GetSMESHGen();
@ -2116,8 +2121,9 @@ bool NETGENPlugin_Mesher::Compute()
" growth rate = " << mparams.grading << "\n" " growth rate = " << mparams.grading << "\n"
" elements per radius = " << mparams.curvaturesafety << "\n" " elements per radius = " << mparams.curvaturesafety << "\n"
" second order = " << mparams.secondorder << "\n" " second order = " << mparams.secondorder << "\n"
" quad allowed = " << mparams.quad); " quad allowed = " << mparams.quad << "\n"
//cout << " quad allowed = " << mparams.quad<<endl; " surface curvature = " << mparams.uselocalh << "\n"
" fuse edges = " << netgen::merge_solids);
SMESH_ComputeErrorPtr error = SMESH_ComputeError::New(); SMESH_ComputeErrorPtr error = SMESH_ComputeError::New();
@ -3610,8 +3616,9 @@ NETGENPlugin_NetgenLibWrapper::NETGENPlugin_NetgenLibWrapper()
_coutBuffer = std::cout.rdbuf(); _coutBuffer = std::cout.rdbuf();
#ifdef _DEBUG_ #ifdef _DEBUG_
cout << "NOTE: netgen output is redirected to file " << _outputFileName << endl; cout << "NOTE: netgen output is redirected to file " << _outputFileName << endl;
#endif #else
std::cout.rdbuf( netgen::mycout->rdbuf() ); std::cout.rdbuf( netgen::mycout->rdbuf() );
#endif
_ngMesh = Ng_NewMesh(); _ngMesh = Ng_NewMesh();
} }

View File

@ -283,7 +283,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();