# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+# examples that cant be used for testing because they use external mesher plug-ins
SET(BAD_TESTS
3dmesh.py
+ a3DmeshOnModified2Dmesh.py
creating_meshes_ex01.py
creating_meshes_ex03.py
creating_meshes_ex05.py
quality_controls_ex20.py
quality_controls_ex21.py
quality_controls_ex22.py
- viewing_meshes_ex01.py
-)
+ viewing_meshes_ex01.py
+ )
SET(GOOD_TESTS
- cartesian_algo.py
- creating_meshes_ex02.py
- creating_meshes_ex04.py
- creating_meshes_ex06.py
+ cartesian_algo.py
+ creating_meshes_ex02.py
+ creating_meshes_ex04.py
+ creating_meshes_ex06.py
creating_meshes_ex07.py
creating_meshes_ex08.py
defining_hypotheses_ex01.py
--- /dev/null
+import salome
+salome.salome_init()
+
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+# This script demonstrates generation of 3D mesh basing on a modified 2D mesh
+#
+# Purpose is to get a tetrahedral mesh in a sphere cut by a cube.
+# The requirement is to have a surface mesh on the cube comprised of
+# triangles of exactly the same size arranged in a grid pattern.
+#
+# To fulfill this requirement we mesh the box using Quadrangle (Mapping)
+# meshing algorithm, split quadrangles into triangles and then generate
+# tetrahedrons.
+
+
+# Make the geometry
+
+Box_1 = geompy.MakeBox(-100,-100,-100, 100, 100, 100)
+Sphere_1 = geompy.MakeSphereR( 300 )
+Cut_1 = geompy.MakeCut(Sphere_1, Box_1, theName="Cut_1")
+# get a spherical face
+Sph_Face = geompy.ExtractShapes( Sphere_1, geompy.ShapeType["FACE"] )[0]
+
+# get the shape Sph_Face turned into during MakeCut()
+Sph_Face = geompy.GetInPlace(Cut_1, Sph_Face, isNewImplementation=True, theName="Sphere_1")
+
+
+# 1) Define a mesh with 1D and 2D meshers
+
+import SMESH
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
+
+Mesh_1 = smesh.Mesh(Cut_1)
+
+# "global" meshers (assigned to Cut_1) that will be used for the box
+Regular_1D = Mesh_1.Segment()
+Local_Length_1 = Regular_1D.LocalLength(20)
+Quadrangle_2D = Mesh_1.Quadrangle()
+
+# a "local" mesher (assigned to a sub-mesh on Sphere_1) to mesh the sphere
+algo_2D = Mesh_1.Triangle( smeshBuilder.NETGEN_1D2D, Sph_Face )
+algo_2D.SetMaxSize( 70. )
+algo_2D.SetFineness( smeshBuilder.Moderate )
+algo_2D.SetMinSize( 7. )
+
+# 2) Compute 2D mesh
+isDone = Mesh_1.Compute()
+
+# 3) Split quadrangles into triangles
+isDone = Mesh_1.SplitQuadObject( Mesh_1, Diag13=True )
+
+# 4) Define a 3D mesher
+Mesh_1.Tetrahedron()
+
+# 5) Compute 3D mesh
+Mesh_1.Compute()
+
+if salome.sg.hasDesktop():
+ salome.sg.updateObjBrowser(1)
# Use 3D extrusion meshing algorithm
-import salome, smesh, SMESH, geompy
-
+import salome
salome.salome_init()
-smesh.SetCurrentStudy( salome.myStudy )
+
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
OX = geompy.MakeVectorDXDYDZ(1,0,0)
OY = geompy.MakeVectorDXDYDZ(0,1,0)
It is possible to \subpage constructing_meshes_page "construct meshes"
on the basis of geometrical shapes produced in the GEOM module.
-It is also possible to
-\subpage constructing_submeshes_page "construct mesh on a part of the geometrical object",
-for example, a face, with different meshing parameters or using
-another meshing algorithm.
+Construction of \subpage constructing_submeshes_page "sub-meshes"
+allows to mesh parts of the geometrical object, for example a face,
+with different meshing parameters or using another meshing algorithm
+than other parts.
+
+3D mesh can be generated basing on a 2D closed mesh.
Several created meshes can be \subpage building_compounds_page "combined into another mesh".
coordinates of the corresponding vertex.</li>
</ul>
-<br><h2>Connections</h2>
-
-Each mesh entity bounds 0 or more mesh entities of higher
-dimension. In the same way each mesh entity is bounded by 0 or more
-mesh entities of lower dimension:
-
-<ul>
-<li>A node bounds edges, faces and volumes</li>
-<li>An edge bounds faces, and volumes</li>
-<li>A face bounds volumes</li>
-<li>A volume is bounded by faces, edges and nodes</li>
-<li>A face is bounded by edges, and nodes</li>
-<li>An edge is bounded by nodes</li>
-</ul>
-
-You can notice that there are two types of connections: \b inverse and
-\b direct connections.
-
-<br><h2>Inverse connections</h2>
-
-This relationship has a particularity that the order of bounded
-entities has not a direct meaning. Also the number of bounded entities
-is not fixed.
-
-\b Example: The edges surrounding a node. The 3rd edge has no more
-sense that the 5th one.
-
-<br><h2>Direct connections</h2>
-
-This relationship has a particularity that the order of bounding
-entities is meaningful. The number of bounding entities is fixed and
-depends on the type of the entity (hexahedron, tetrahedron,?).
-
-\b Example: An edge is composed of two nodes. A face is composed of 3
-or 4 edges depending if we are dealing with triangles or quadrangles.
-
-The connections are not only restricted to entities of one dimension
-higher or lower. For example some algorithms may be interested to
-retrieve all the faces surrounding a node.
-
*/
There is also a number of more specific algorithms:
<ul>
+<li>\subpage prism_3d_algo_page "for meshing prismatic shapes"</li>
<li>\subpage projection_algos_page "for meshing by projection of another mesh"</li>
<li>\subpage import_algos_page "for meshing by importing elements from another mesh"</li>
<li>\subpage radial_prism_algo_page "for meshing geometrical objects with cavities"</li>
-<li>\subpage segments_around_vertex_algo_page "for defining the local size of elements around a certain node"</li>
-<li>\subpage prism_3d_algo_page "for meshing prismatic shapes"</li>
<li>\subpage radial_quadrangle_1D2D_algo_page "for meshing special 2d faces (circles and part of circles)"</li>
<li>\subpage use_existing_page "Use Edges to be Created Manually" and
\ref use_existing_page "Use Faces to be Created Manually" algorithms can be
used to create a 1D or a 2D mesh in a python script.</li>
+<li>\subpage segments_around_vertex_algo_page "for defining the local size of elements around a certain node"</li>
</ul>
\ref constructing_meshes_page "Constructing meshes" page describes in
<li> \ref preview_anchor "Previewing the mesh" (optional)</li>
<li> \ref submesh_order_anchor "Changing sub-mesh priority" (optional)</li>
<li> \ref compute_anchor "Computing the mesh"</li>
+ <li> \ref edit_anchor "Editing the mesh" (optional)</li>
</ul>
\anchor create_mesh_anchor
show the information box, show only if an error occurs or never.
By default, the information box is always shown after mesh computation operation.
-<br><br>
-
-
+<p><p>
+\anchor edit_anchor
+<h2>Editing the mesh</h2>
+
+It is possible to \ref modifying_meshes_page "edit the mesh" of
+lower dimension before generation of mesh of higher dimension.
+
+For example you can generate 2D mesh, modify it using e.g.
+\ref pattern_mapping_page, and then generate 3D mesh basing on the
+modified 2D mesh. The workflow is following:
+- Define 1D and 2D meshing algorithms.
+- Compute the mesh. 2D mesh is generated.
+- Apply \ref pattern_mapping_page.
+- Define 3D meshing algorithms without modifying 1D and 2D algorithms
+and hypotheses.
+- Compute the mesh. 3D mesh is generated.
+
+\note Nodes and elements added \ref adding_nodes_and_elements_page
+"manually" can't be used in this workflow because the manually created
+entities are not attached to any geometry and thus (usually) can't be
+found by a mesher paving some geometry.
+
+<b>See Also</b> a sample TUI Script demonstrates the possibility of
+\ref tui_editing_while_meshing "Intermediate edition while meshing"
*/
<li>\subpage cut_mesh_by_plane_page "Cut a tetrahedron mesh by a plane".</li>
</ul>
+It is possible to \ref edit_anchor "modify the mesh" of lower
+dimension before generation of mesh of higher dimension.
+
+<p><br></p>
+
\note It is possible to use the variables defined in the SALOME \b NoteBook
to specify the numerical parameters used for modification of any object.
-# The first line indicates the total number of pattern nodes (N).
-# The next N lines describe nodes coordinates. Each line contains 2
-node coordinates for a 2D pattern or 3 node cordinates for a 3D pattern.
+node coordinates for a 2D pattern or 3 node coordinates for a 3D pattern.
Note, that node coordinates of a 3D pattern can be defined only by relative values in range [0;1].
-# The key-points line contains the indices of the nodes to be mapped on geometrical
vertices (for a 2D pattern only). Index n refers to the node described
<br><h2>Application of pattern mapping</h2>
-<em>To apply pattern mapping to a geometrical object:</em>
+<em>To apply pattern mapping to a geometrical object or mesh elements:</em>
From the \b Modification menu choose the <b>Pattern Mapping</b> item or click
<em>"Pattern mapping"</em> button in the toolbar.
boundaries of the pattern must also be equal to the number of vertices
on internal boundaries of the face;</li>
<li> \b Vertex to which the first key-point should be mapped;</li>
+</ul>
Alternatively, it is possible to select <b>Refine selected mesh elements</b>
-checkbox and apply the pattern to
+check-box and apply the pattern to <ul>
<li> <b>Mesh Face</b> instead of a geometric Face</li>
<li> and select \b Node instead of vertex.</li>
-
-Additionally it is possible to:
-<li> <b>Reverse the order of key-points</b> By default, the vertices of
- a face are ordered counterclockwise.<li>
+</ul>
+Additionally it is possible to: <ul>
+<li> <b>Reverse the order of key-points</b>. By default, the vertices of
+ a face are ordered counterclockwise.</li>
<li> Enable to <b> Create polygons near boundary</b> </li>
-<li> and <b>Create polyhedrons near boundary</b><li>
+<li> and <b>Create polyhedrons near boundary</b></li>
</ul>
\n For a <b>3D pattern</b>
<ul>
<li> \b Pattern, which can be loaded from .smp pattern file previously
created manually or generated automatically from an existing mesh or submesh.</li>
- <li> A 3D block (Solid) object;</li>
- <li> Two vertices that specify the order of nodes in the resulting mesh.</li>
+<li> A 3D block (Solid) object.</li>
+<li> Two vertices that specify the order of nodes in the resulting
+ mesh.</li>
+</ul>
Alternatively, it is possible to select <b>Refine selected mesh elements</b>
checkbox and apply the pattern to
+<ul>
<li> One or several <b>Mesh volumes</b> instead of a geometric 3D
object</li>
<li> and select two /b Nodes instead of vertices.</li>
+</ul>
Additionally it is possible to:
+<ul>
<li> Enable to <b> Create polygons near boundary</b> </li>
-<li> and <b>Create polyhedrons near boundary</b><li>
+<li> and <b>Create polyhedrons near boundary</b></li>
</ul>
-\n Automatic Generation
+<br>
+<h3> Automatic Generation </h3>
-To generate a pattern automatically from an existing mesh or submesh,
+To generate a pattern automatically from an existing mesh or sub-mesh,
click \b New button.
The following dialog box will appear:
<h2>Change priority of submeshes in Mesh</h2>
\tui_script{creating_meshes_ex03.py}
+<br>
+\anchor tui_editing_while_meshing
+<h2>Intermediate edition while meshing</h2>
+\tui_script{a3DmeshOnModified2Dmesh.py}
+
<br>
\anchor tui_editing_mesh
<h2>Editing a mesh</h2>