mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-02-15 10:03:08 +05:00
0021336: EDF 1717 SMESH: New algorithm "body fitting" cartesian unstructured
This commit is contained in:
parent
8b41ed2e6f
commit
adefda0404
BIN
doc/salome/gui/SMESH/images/cartesian3D_hyp.png
Normal file
BIN
doc/salome/gui/SMESH/images/cartesian3D_hyp.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 34 KiB |
BIN
doc/salome/gui/SMESH/images/cartesian3D_sphere.png
Normal file
BIN
doc/salome/gui/SMESH/images/cartesian3D_sphere.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
@ -23,10 +23,8 @@ shape of a mesh.</li>
|
|||||||
<ul>
|
<ul>
|
||||||
<li>Triangle meshing algorithms (Mefisto, Netgen 1D-2D and BLSUFR ) - Faces
|
<li>Triangle meshing algorithms (Mefisto, Netgen 1D-2D and BLSUFR ) - Faces
|
||||||
are split into triangular elements.</li>
|
are split into triangular elements.</li>
|
||||||
<li>Quadrangle meshing algorithm (Mapping) - Faces are split into
|
<li>Quadrangle meshing algorithm (Mapping) - quadrilateral Faces are split into
|
||||||
quadrangular elements.</li>
|
quadrangular elements.</li>
|
||||||
<li>Radial quadrangle 1D2D algorithm - Faces (circles or part of circles)
|
|
||||||
are split into triangular and quadrangle elements.</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
\image html image123.gif "Example of a triangular 2D mesh"
|
\image html image123.gif "Example of a triangular 2D mesh"
|
||||||
@ -36,10 +34,14 @@ are split into triangular and quadrangle elements.</li>
|
|||||||
<li>For meshing of 3D entities (<b>volume objects</b>):</li>
|
<li>For meshing of 3D entities (<b>volume objects</b>):</li>
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<li>Hexahedron meshing algorithm (i,j,k) - Volumes are split into
|
<li>Hexahedron meshing algorithm (i,j,k) - 6-sided Volumes are split into
|
||||||
hexahedral (cubic) elements.</li>
|
hexahedral (cubic) elements.</li>
|
||||||
<li>Tetrahedron (Netgen and GHS3D) meshing algorithms - Volumes are split into
|
<li>Tetrahedron (Netgen and GHS3D) meshing algorithms - Volumes are split into
|
||||||
tetrahedral (pyramidal) elements.</li>
|
tetrahedral (pyramidal) elements.</li>
|
||||||
|
<li>\subpage cartesian_algo_page</li>
|
||||||
|
internal part of Volumes are split into hexahedral elements forming a
|
||||||
|
Cartesian grid; polyhedra and other types of elements are gerenated
|
||||||
|
where the geometrical boundary intersects Cartesian cells.</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
\image html image125.gif "Example of a tetrahedral 3D mesh"
|
\image html image125.gif "Example of a tetrahedral 3D mesh"
|
||||||
|
75
doc/salome/gui/SMESH/input/cartesian_algo.doc
Normal file
75
doc/salome/gui/SMESH/input/cartesian_algo.doc
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
/*!
|
||||||
|
|
||||||
|
\page cartesian_algo_page Body Fitting 3D meshing algorithm
|
||||||
|
|
||||||
|
Body Fitting algorithm generates hexahedrones of a Cartesian grid in
|
||||||
|
the internal part of geometry and polyhedra and other types of
|
||||||
|
elements at intersection of Cartesian cells with the geometrical
|
||||||
|
boundary.
|
||||||
|
|
||||||
|
\image html cartesian3D_sphere.png "A shpere meshed by Body Fitting algorithm"
|
||||||
|
|
||||||
|
Algorithm of meshing is following.
|
||||||
|
<ol>
|
||||||
|
<li> Lines of a Cartesian structured grid defined by
|
||||||
|
\ref cartesian_hyp_anchor "Body Fitting Parameters" hypothesis are
|
||||||
|
intersected with the geometry boundary, thus nodes laying on the
|
||||||
|
boundary are found. This step also allows finding out for each node of
|
||||||
|
the Cartesian grid if it is inside or outside the geometry. </li>
|
||||||
|
<li> For each cell of the grid, check how many of it's nodes are outside
|
||||||
|
of the geometry boundary. Depending on a result of this check
|
||||||
|
<ul>
|
||||||
|
<li> skip a cell, if all it's nodes are outside </li>
|
||||||
|
<li> skip a cell, if it is too small according to <b> Size
|
||||||
|
Threshold </b> paremeter</li>
|
||||||
|
<li> add a hexahedron in the mesh, if all nodes are inside </li>
|
||||||
|
<li> add a polyhedron or a cell of other type in the mesh, if some
|
||||||
|
nodes are inside and some outside </li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ol>
|
||||||
|
To apply this algorithm, when you define your mesh, select <b>Body
|
||||||
|
Fitting</b> in the list of 3D algorithms and click <em>"Add
|
||||||
|
Hypothesis"</em> button and <em>"Body Fitting Parameters"</em>" menu
|
||||||
|
item. Dialog of <b> Body Fitting Parameters
|
||||||
|
hypothesis</b> will appear.
|
||||||
|
|
||||||
|
<br>
|
||||||
|
\anchor cartesian_hyp_anchor
|
||||||
|
<h2>Body Fitting Parameters hypothesis</h2>
|
||||||
|
|
||||||
|
\image html cartesian3D_hyp.png "Body Fitting Parameters hypothesis dialog"
|
||||||
|
|
||||||
|
This dialog lets you define
|
||||||
|
<ul>
|
||||||
|
<li>\b Name of the algorithm </li>
|
||||||
|
<li> Minimal size of a cell truncated be the geometry boundary. If
|
||||||
|
size of a truncated grid cell is \b Threshold times less than a
|
||||||
|
initial cell size, then a mesh element is not created. </li>
|
||||||
|
<li> Cartesian structured grid. Each grid axis is defined
|
||||||
|
individually. <b> Definition mode </b> chooses a way of grid
|
||||||
|
definition: <ul>
|
||||||
|
<li> You can specify \b Coordinates of grid nodes. \b Insert button
|
||||||
|
inserts a node at distance \b Step (negative or positive) from a
|
||||||
|
selected node. \b Delete botton removes a selected node. Double
|
||||||
|
click on a coordinate in the list enables its edition. A grid
|
||||||
|
defined by \b Coordinates should enclose the geometry, else the
|
||||||
|
algorithm will fail. </li>
|
||||||
|
<li> You can define \b Spacing of a grid as an algebraic formular
|
||||||
|
<em>f(t)</em> where \a t is a position along a grid axiz
|
||||||
|
normalized at [0.0,1.0]. The whole range of geometry can be
|
||||||
|
divided into sub-ranges with their own spacing formulars to apply;
|
||||||
|
\a t varies between 0.0 and 1.0 within each sub-range. \b Insert button
|
||||||
|
divides a selected range into two ones. \b Delete button adds a
|
||||||
|
selected sub-range to a previous one. Double click on a range in
|
||||||
|
the list enables edition of its right boundary. Double click on a
|
||||||
|
function in the list enables its edition.
|
||||||
|
</li> </ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
<b>See Also</b> a sample TUI Script of a
|
||||||
|
\ref tui_cartesian_algo "Usage of Body Fitting algorithm".
|
||||||
|
|
||||||
|
*/
|
49
doc/salome/gui/SMESH/input/tui_cartesian_algo.doc
Normal file
49
doc/salome/gui/SMESH/input/tui_cartesian_algo.doc
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
/*!
|
||||||
|
|
||||||
|
\page tui_cartesian_algo Usage of Body Fitting algorithm
|
||||||
|
|
||||||
|
\code
|
||||||
|
from smesh import *
|
||||||
|
SetCurrentStudy(salome.myStudy)
|
||||||
|
|
||||||
|
# create a sphere
|
||||||
|
sphere = geompy.MakeSphereR( 50 )
|
||||||
|
geompy.addToStudy( sphere, "sphere" )
|
||||||
|
|
||||||
|
# create a mesh and assign a "Body Fitting" algo
|
||||||
|
mesh = Mesh( sphere )
|
||||||
|
cartAlgo = mesh.BodyFitted()
|
||||||
|
|
||||||
|
# define a cartesian grid using Coordinates
|
||||||
|
coords = range(-100,100,10)
|
||||||
|
cartHyp = cartAlgo.SetGrid( coords,coords,coords, 1000000)
|
||||||
|
|
||||||
|
# compute the mesh
|
||||||
|
mesh.Compute()
|
||||||
|
print "nb hexahedra",mesh.NbHexas()
|
||||||
|
print "nb tetrahedra",mesh.NbTetras()
|
||||||
|
print "nb polyhedra",mesh.NbPolyhedrons()
|
||||||
|
print
|
||||||
|
|
||||||
|
# define the grid by sitting constant spacing
|
||||||
|
cartHyp = cartAlgo.SetGrid( "10","10","10", 1000000)
|
||||||
|
|
||||||
|
mesh.Compute()
|
||||||
|
print "nb hexahedra",mesh.NbHexas()
|
||||||
|
print "nb tetrahedra",mesh.NbTetras()
|
||||||
|
print "nb polyhedra",mesh.NbPolyhedrons()
|
||||||
|
|
||||||
|
|
||||||
|
# define the grid by sitting different spacing in 2 sub-ranges of geometry
|
||||||
|
spaceFuns = ["5","10+10*t"]
|
||||||
|
cartAlgo.SetGrid( [spaceFuns, [0.5]], [spaceFuns, [0.5]], [spaceFuns, [0.25]], 2 )
|
||||||
|
|
||||||
|
mesh.Compute()
|
||||||
|
print "nb hexahedra",mesh.NbHexas()
|
||||||
|
print "nb tetrahedra",mesh.NbTetras()
|
||||||
|
print "nb polyhedra",mesh.NbPolyhedrons()
|
||||||
|
print
|
||||||
|
|
||||||
|
\endcode
|
||||||
|
|
||||||
|
*/
|
@ -1665,6 +1665,16 @@ Handle(_pyHypothesis) _pyHypothesis::NewHypothesis( const Handle(_pyCommand)& th
|
|||||||
hyp = new _pyLayerDistributionHypo( theCreationCmd, "Get3DHypothesis" );
|
hyp = new _pyLayerDistributionHypo( theCreationCmd, "Get3DHypothesis" );
|
||||||
hyp->SetConvMethodAndType( "LayerDistribution", "RadialPrism_3D");
|
hyp->SetConvMethodAndType( "LayerDistribution", "RadialPrism_3D");
|
||||||
}
|
}
|
||||||
|
// Cartesian 3D ---------
|
||||||
|
else if ( hypType == "Cartesian_3D" ) {
|
||||||
|
algo->SetConvMethodAndType( "BodyFitted", hypType.ToCString());
|
||||||
|
}
|
||||||
|
else if ( hypType == "CartesianParameters3D" ) {
|
||||||
|
hyp = new _pyComplexParamHypo( theCreationCmd );
|
||||||
|
hyp->SetConvMethodAndType( "SetGrid", "Cartesian_3D");
|
||||||
|
for ( int iArg = 0; iArg < 4; ++iArg )
|
||||||
|
hyp->myArgs.Append("[]");
|
||||||
|
}
|
||||||
|
|
||||||
return algo->IsValid() ? algo : hyp;
|
return algo->IsValid() ? algo : hyp;
|
||||||
}
|
}
|
||||||
@ -1835,12 +1845,44 @@ void _pyHypothesis::Assign( const Handle(_pyHypothesis)& theOther,
|
|||||||
//================================================================================
|
//================================================================================
|
||||||
/*!
|
/*!
|
||||||
* \brief Remember hypothesis parameter values
|
* \brief Remember hypothesis parameter values
|
||||||
* \param theCommand - The called hypothesis method
|
* \param theCommand - The called hypothesis method
|
||||||
*/
|
*/
|
||||||
//================================================================================
|
//================================================================================
|
||||||
|
|
||||||
void _pyComplexParamHypo::Process( const Handle(_pyCommand)& theCommand)
|
void _pyComplexParamHypo::Process( const Handle(_pyCommand)& theCommand)
|
||||||
{
|
{
|
||||||
|
if ( GetAlgoType() == "Cartesian_3D" )
|
||||||
|
{
|
||||||
|
// CartesianParameters3D hyp
|
||||||
|
|
||||||
|
if ( theCommand->GetMethod() == "SetSizeThreshold" )
|
||||||
|
{
|
||||||
|
myArgs( 4 ) = theCommand->GetArg( 1 );
|
||||||
|
myArgCommands.push_back( theCommand );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ( theCommand->GetMethod() == "SetGrid" ||
|
||||||
|
theCommand->GetMethod() == "SetGridSpacing" )
|
||||||
|
{
|
||||||
|
TCollection_AsciiString axis = theCommand->GetArg( theCommand->GetNbArgs() );
|
||||||
|
int iArg = 1 + ( axis.Value(1) - '0' );
|
||||||
|
if ( theCommand->GetMethod() == "SetGrid" )
|
||||||
|
{
|
||||||
|
myArgs( iArg ) = theCommand->GetArg( 1 );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
myArgs( iArg ) = "[ ";
|
||||||
|
myArgs( iArg ) += theCommand->GetArg( 1 );
|
||||||
|
myArgs( iArg ) += ", ";
|
||||||
|
myArgs( iArg ) += theCommand->GetArg( 2 );
|
||||||
|
myArgs( iArg ) += "]";
|
||||||
|
}
|
||||||
|
myArgCommands.push_back( theCommand );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if( theCommand->GetMethod() == "SetLength" )
|
if( theCommand->GetMethod() == "SetLength" )
|
||||||
{
|
{
|
||||||
// NOW it becomes OBSOLETE
|
// NOW it becomes OBSOLETE
|
||||||
|
Loading…
Reference in New Issue
Block a user