Provide missing TUI examples of some algorithms

This commit is contained in:
eap 2018-08-20 18:00:59 +03:00
parent aa8fa5eaad
commit 5c79b298da
15 changed files with 196 additions and 115 deletions

View File

@ -10,7 +10,6 @@ geompy = geomBuilder.New()
import SMESH, SALOMEDS
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New()
import salome_notebook
# create a sphere

View File

@ -0,0 +1,29 @@
# Usage of Segments around Vertex algorithm
# for meshing a box with quadrangles with refinement near vertices
import salome
salome.salome_init()
from salome.geom import geomBuilder
geompy = geomBuilder.New()
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New()
# create a box
box = geompy.MakeBoxDXDYDZ( 10, 10, 10 )
# make a mesh
mesh = smesh.Mesh( box )
# define quadrangle meshing
algo1d = mesh.Segment()
algo1d.LocalLength( 1. )
mesh.Quadrangle()
# add Hexahedron algo to assure that there are no triangles
mesh.Hexahedron()
# define refinement near vertices
algo1d.LengthNearVertex( 0.2 )
mesh.Compute()

View File

@ -0,0 +1,30 @@
# Usage of Medial Axis Projection algorithm
# for meshing a ring face with quadrangles
import salome
salome.salome_init()
from salome.geom import geomBuilder
geompy = geomBuilder.New()
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New()
# create a ring face
circleEdge1 = geompy.MakeCircleR( 3 )
circleEdge2 = geompy.MakeCircleR( 7 )
ring = geompy.MakeFaceWires( [ circleEdge1, circleEdge2 ], True, theName='Ring' )
circleLen1 = geompy.BasicProperties( circleEdge1 )[0]
circleLen2 = geompy.BasicProperties( circleEdge2 )[0]
# make a mesh
mesh = smesh.Mesh( ring )
circNbSeg = 60
algo1d = mesh.Segment()
algo1d.NumberOfSegments( circNbSeg ) # division of circle edges
algo2d = mesh.Quadrangle( smeshBuilder.QUAD_MA_PROJ )
algo2d.StartEndLength( circleLen2 / circNbSeg, circleLen1 / circNbSeg ) # radial division
mesh.Compute()

View File

@ -175,6 +175,8 @@ SET(GOOD_TESTS
use_existing_faces.py
viewing_meshes_ex02.py
split_biquad.py
quad_medial_axis_algo.py
defining_hypotheses_len_near_vertex.py
)
SET(EXAMPLES_TESTS ${BAD_TESTS} ${GOOD_TESTS} testme.py)

View File

@ -136,7 +136,7 @@ To construct a mesh:
* **Applied algorithms** folder containing the references to the algorithms chosen at the construction of the mesh.
* **SubMeshes on Face** folder containing the sub-meshes defined on geometrical faces. There also can be folders for sub-meshes on vertices, edges, wires, shells, solids and compounds.
* **Groups of Faces** folder containing the groups of mesh faces. There also can be folders for groups of nodes, edges, volumes 0D elements and balls.
There is an alternative way to assign Algorithms and Hypotheses by clicking **Assign a set of hypotheses** button and selecting among pre-defined sets of algorithms and hypotheses. In addition to the built-in sets of hypotheses, it is possible to create custom sets by editing CustomMeshers.xml file located in the home directory. CustomMeshers.xml file must describe sets of hypotheses in the same way as ${SMESH_ROOT_DIR}/share/salome/resources/smesh/StdMeshers.xml file does (sets of hypotheses are enclosed between \<hypotheses-set-group\> tags). For example:
::

View File

@ -40,3 +40,7 @@ The Medial Axis is used in two ways:
.. centered::
Mesh depends on defined sub-meshes: to the left - sub-meshes on both wires, to the right - a sub-mesh on internal wire only
**See Also** a sample TUI Script of a :ref:`tui_quad_ma_proj_algo`.

View File

@ -10,6 +10,8 @@ the local size of the segments in the neighborhood of a certain
vertex. If we assign this algorithm to a geometrical object of higher
dimension, it applies to all its vertices.
.. _note: To create 0D elements, use :ref:`adding_nodes_and_elements_page` operation.
Length of segments near vertex is defined by **Length Near Vertex** hypothesis.
This hypothesis is used by :ref:`Wire Discretization <a1d_algos_anchor>` or
:ref:`Composite Side Discretization <a1d_algos_anchor>` algorithms as
@ -20,5 +22,4 @@ segment length required by **Length Near Vertex** hypothesis.
.. image:: ../images/lengthnearvertex.png
:align: center
**See also** a sample :ref:`TUI Script <tui_segments_around_vertex>`.

View File

@ -104,10 +104,6 @@ the following links:
tui_measurements
tui_work_on_objects_from_gui
tui_notebook_smesh
tui_cartesian_algo
tui_use_existing_faces
tui_prism_3d_algo
tui_generate_flat_elements
.. toctree::
:hidden:

View File

@ -1,13 +0,0 @@
.. _tui_cartesian_algo:
Usage of Body Fitting algorithm
###############################
.. literalinclude:: ../../../examples/cartesian_algo.py
:linenos:
:language: python
:download:`Download this script <../../../examples/cartesian_algo.py>`

View File

@ -10,7 +10,7 @@ and hypotheses.
* Wire discretisation 1D algorithm
* :ref:`tui_1d_adaptive` hypothesis
* :ref:`rithmetic Progression <tui_1d_arithmetic>` hypothesis
* :ref:`Arithmetic Progression <tui_1d_arithmetic>` hypothesis
* :ref:`Geometric Progression <tui_1d_arithmetic>` hypothesis
* :ref:`Deflection and Number of Segments <tui_deflection_1d>` hypotheses
* :ref:`Start and End Length <tui_start_and_end_length>` hypothesis
@ -24,20 +24,23 @@ and hypotheses.
* :ref:`tui_max_element_area` hypothesis
* :ref:`tui_length_from_edges` hypothesis
* Quadrangle: Mapping 2D algorithm
* :ref:`Quadrangle Parameters <tui_quadrangle_parameters>` hypothesis
* :ref:`Radial Quadrangle 1D-2D <tui_radial_quadrangle>` algorithm
* NETGEN 3D algorithm
* :ref:`tui_max_element_volume` hypothesis
* :ref:`Viscous layers <tui_viscous_layers>` hypotheses
* :ref:`tui_projection`
* :ref:`Radial Quadrangle 1D-2D <tui_radial_quadrangle>` algorithm
* Quadrangle: Mapping 2D algorithm
* :ref:`Quadrangle Parameters <tui_quadrangle_parameters>` hypothesis
* :ref:`tui_radial_prism`
* :ref:`Extrusion 3D <tui_prism_3d_algo>` algorithm
* :ref:`Radial Prism <tui_radial_prism>` algorithm
* :ref:`Body Fitting <tui_cartesian_algo>` algorithm
* :ref:`Import 1D-2D Elements from Another Mesh <tui_import>` algorithm
* :ref:`Use Faces to be Created Manually <tui_use_existing_faces>` algorithm
* :ref:`Segments around Vertex <tui_segments_around_vertex>` algorithm
@ -262,3 +265,76 @@ Radial Prism example
:language: python
:download:`Download this script <../../../examples/radial_prism_3d_algo.py>`
.. _tui_cartesian_algo:
Usage of Body Fitting algorithm
###############################
.. literalinclude:: ../../../examples/cartesian_algo.py
:linenos:
:language: python
:download:`Download this script <../../../examples/cartesian_algo.py>`
.. _tui_use_existing_faces:
Usage of "Use Faces to be Created Manually" algorithm
#####################################################
This sample demonstrates how to use **Use Faces to be Created Manually** algorithm,
which is actually just a stub allowing to use your own 2D algorithm
implemented in Python.
.. literalinclude:: ../../../examples/use_existing_faces.py
:linenos:
:language: python
:download:`Download this script <../../../examples/use_existing_faces.py>`
Resulting mesh:
.. image:: ../images/use_existing_face_sample_mesh.png
:align: center
.. _tui_prism_3d_algo:
Usage of Extrusion 3D meshing algorithm
########################################
.. literalinclude:: ../../../examples/prism_3d_algo.py
:linenos:
:language: python
:download:`Download this script <../../../examples/prism_3d_algo.py>`
The result geometry and mesh is shown below
.. image:: ../images/prism_tui_sample.png
:align: center
.. _tui_quad_ma_proj_algo:
Usage of Medial Axis Projection algorithm
#########################################
.. literalinclude:: ../../../examples/quad_medial_axis_algo.py
:linenos:
:language: python
:download:`Download this script <../../../examples/quad_medial_axis_algo.py>`
.. _tui_segments_around_vertex:
Usage of Segments around Vertex algorithm
#########################################
.. literalinclude:: ../../../examples/defining_hypotheses_len_near_vertex.py
:linenos:
:language: python
:download:`Download this script <../../../examples/defining_hypotheses_len_near_vertex.py>`

View File

@ -1,47 +0,0 @@
.. _tui_generate_flat_elements_page:
**********************
Generate flat elements
**********************
.. _tui_double_nodes_on_group_boundaries:
Double nodes on groups boundaries
#################################
Double nodes on shared faces between groups of volumes and create flat elements on demand.
The list of groups must contain at least two groups. The groups have to be disjoint: no common element into two different groups.
The nodes of the internal faces at the boundaries of the groups are doubled. Optionally, the internal faces are replaced by flat elements.
Triangles are transformed into prisms, and quadrangles into hexahedrons.
The flat elements are stored in groups of volumes.
These groups are named according to the position of the group in the list:
the group j_n_p is the group of the flat elements that are built between the group \#n and the group \#p in the list.
If there is no shared faces between the group \#n and the group \#p in the list, the group j_n_p is not created.
All the flat elements are gathered into the group named "joints3D" (or "joints2D" in 2D situation).
The flat element of the multiple junctions between the simple junction are stored in a group named "jointsMultiples".
This example represents an iron cable (a thin cylinder) in a concrete bloc (a big cylinder).
The big cylinder is defined by two geometric volumes.
.. literalinclude:: ../../../examples/generate_flat_elements.py
:linenos:
:language: python
:download:`Download this script <../../../examples/generate_flat_elements.py>`
Here, the 4 groups of volumes [Solid_1_1, Solid_2_1, Solid_3_1, Solid_4_1] constitute a partition of the mesh.
The flat elements on group boundaries and on faces are built with the
2 last lines of the code above.
If the last argument (Boolean) in DoubleNodesOnGroupBoundaries is set to 1,
the flat elements are built, otherwise, there is only a duplication of the nodes.
To observe flat element groups, save the resulting mesh on a MED file and reload it.

View File

@ -313,3 +313,44 @@ Split bi-quadratic into linear
:language: python
:download:`Download this script <../../../examples/split_biquad.py>`
.. _tui_double_nodes_on_group_boundaries:
Double nodes on groups boundaries
=================================
Double nodes on shared faces between groups of volumes and create flat elements on demand.
The list of groups must contain at least two groups. The groups have to be disjoint: no common element into two different groups.
The nodes of the internal faces at the boundaries of the groups are doubled. Optionally, the internal faces are replaced by flat elements.
Triangles are transformed into prisms, and quadrangles into hexahedrons.
The flat elements are stored in groups of volumes.
These groups are named according to the position of the group in the list:
the group j_n_p is the group of the flat elements that are built between the group \#n and the group \#p in the list.
If there is no shared faces between the group \#n and the group \#p in the list, the group j_n_p is not created.
All the flat elements are gathered into the group named "joints3D" (or "joints2D" in 2D situation).
The flat element of the multiple junctions between the simple junction are stored in a group named "jointsMultiples".
This example represents an iron cable (a thin cylinder) in a concrete bloc (a big cylinder).
The big cylinder is defined by two geometric volumes.
.. literalinclude:: ../../../examples/generate_flat_elements.py
:linenos:
:language: python
:download:`Download this script <../../../examples/generate_flat_elements.py>`
Here, the 4 groups of volumes [Solid_1_1, Solid_2_1, Solid_3_1, Solid_4_1] constitute a partition of the mesh.
The flat elements on group boundaries and on faces are built with the
2 last lines of the code above.
If the last argument (Boolean) in DoubleNodesOnGroupBoundaries is set to 1,
the flat elements are built, otherwise, there is only a duplication of the nodes.
To observe flat element groups, save the resulting mesh on a MED file and reload it.

View File

@ -1,19 +0,0 @@
.. _tui_prism_3d_algo:
**********************************
Use Extrusion 3D meshing algorithm
**********************************
.. literalinclude:: ../../../examples/prism_3d_algo.py
:linenos:
:language: python
:download:`Download this script <../../../examples/prism_3d_algo.py>`
The result geometry and mesh is shown below
.. image:: ../images/prism_tui_sample.png
:align: center

View File

@ -1,20 +0,0 @@
.. _tui_use_existing_faces:
*****************************************************
Usage of "Use Faces to be Created Manually" algorithm
*****************************************************
This sample demonstrates how to use **Use Faces to be Created Manually** algorithm,
which is actually just a stub allowing to use your own 2D algorithm
implemented in Python.
.. literalinclude:: ../../../examples/use_existing_faces.py
:linenos:
:language: python
:download:`Download this script <../../../examples/use_existing_faces.py>`
Resulting mesh:
.. image:: ../images/use_existing_face_sample_mesh.png
:align: center

View File

@ -3679,7 +3679,9 @@ class Mesh(metaclass = MeshMeta):
isElem2: *True* if *id2* is element id, *False* if it is node id
Returns:
minimum distance value **GetMinDistance()**
minimum distance value
See Also:
:meth:`GetMinDistance`
"""
aMeasure = self.GetMinDistance(id1, id2, isElem1, isElem2)