Corrections for example

This commit is contained in:
Yoann Audouin 2022-04-04 16:35:06 +02:00
parent 820782127b
commit 8628ca77d6
13 changed files with 41 additions and 48 deletions

View File

@ -33,10 +33,8 @@ model.end()
### ###
### SHAPERSTUDY component ### SHAPERSTUDY component
### ###
#import pdb; pdb.set_trace()
model.publishToShaperStudy() model.publishToShaperStudy()
import SHAPERSTUDY import SHAPERSTUDY
#import pdb; pdb.set_trace()
Box_1_1, = SHAPERSTUDY.shape(model.featureStringId(Box_1)) Box_1_1, = SHAPERSTUDY.shape(model.featureStringId(Box_1))
### ###
### SMESH component ### SMESH component

View File

@ -27,19 +27,19 @@ Max_Element_Volume_1 = Tetrahedron.MaxElementVolume(40000)
# create sub-mesh and assign algorithms on Face_1 # create sub-mesh and assign algorithms on Face_1
Regular_1D_1 = Mesh_1.Segment(geom=Face_1) Regular_1D_1 = Mesh_1.Segment(geom=Face_1)
Nb_Segments_2 = Regular_1D_1.NumberOfSegments(4) Nb_Segments_2 = Regular_1D_1.NumberOfSegments(4)
MEFISTO_2D_1 = Mesh_1.Triangle(algo=smeshBuilder.MEFISTO,geom=Face_1) MEFISTO_2D_1 = Mesh_1.Triangle(algo=smeshBuilder.NETGEN_2D,geom=Face_1)
SubMesh_1 = MEFISTO_2D_1.GetSubMesh() SubMesh_1 = MEFISTO_2D_1.GetSubMesh()
# create sub-mesh and assign algorithms on Face_2 # create sub-mesh and assign algorithms on Face_2
Regular_1D_2 = Mesh_1.Segment(geom=Face_2) Regular_1D_2 = Mesh_1.Segment(geom=Face_2)
Nb_Segments_3 = Regular_1D_2.NumberOfSegments(8) Nb_Segments_3 = Regular_1D_2.NumberOfSegments(8)
MEFISTO_2D_2 = Mesh_1.Triangle(algo=smeshBuilder.MEFISTO,geom=Face_2) MEFISTO_2D_2 = Mesh_1.Triangle(algo=smeshBuilder.NETGEN_2D,geom=Face_2)
SubMesh_2 = MEFISTO_2D_2.GetSubMesh() SubMesh_2 = MEFISTO_2D_2.GetSubMesh()
# create sub-mesh and assign algorithms on Face_3 # create sub-mesh and assign algorithms on Face_3
Regular_1D_3 = Mesh_1.Segment(geom=Face_3) Regular_1D_3 = Mesh_1.Segment(geom=Face_3)
Nb_Segments_4 = Regular_1D_3.NumberOfSegments(12) Nb_Segments_4 = Regular_1D_3.NumberOfSegments(12)
MEFISTO_2D_3 = Mesh_1.Triangle(algo=smeshBuilder.MEFISTO,geom=Face_3) MEFISTO_2D_3 = Mesh_1.Triangle(algo=smeshBuilder.NETGEN_2D,geom=Face_3)
SubMesh_3 = MEFISTO_2D_3.GetSubMesh() SubMesh_3 = MEFISTO_2D_3.GetSubMesh()
# check existing sub-mesh priority order # check existing sub-mesh priority order

View File

@ -15,7 +15,7 @@ from salome.smesh import smeshBuilder
smesh = smeshBuilder.New() smesh = smeshBuilder.New()
# geometry # geometry
O = geompy.MakeVertex(0, 0, 0) O = geompy.MakeVertex(0, 0, 0)
OX = geompy.MakeVectorDXDYDZ(1, 0, 0) OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
@ -44,8 +44,8 @@ vec2 = geompy.MakeVector(Vertex_5, Vertex_6)
Mesh_1 = smesh.Mesh(Partition_1) Mesh_1 = smesh.Mesh(Partition_1)
Regular_1D = Mesh_1.Segment() Regular_1D = Mesh_1.Segment()
Nb_Segments_1 = Regular_1D.NumberOfSegments(15) Nb_Segments_1 = Regular_1D.NumberOfSegments(15)
MEFISTO_2D = Mesh_1.Triangle(algo=smeshBuilder.MEFISTO) NETGEN_2D = Mesh_1.Triangle(algo=smeshBuilder.NETGEN_2D)
Length_From_Edges_2D = MEFISTO_2D.LengthFromEdges() Length_From_Edges_2D = NETGEN_2D.LengthFromEdges()
ALGO3D = Mesh_1.Tetrahedron() ALGO3D = Mesh_1.Tetrahedron()
isDone = Mesh_1.Compute() isDone = Mesh_1.Compute()

View File

@ -19,9 +19,9 @@ idbox = geompy.addToStudy(box, "box")
mesh = smesh.Mesh(box, "Mesh_free_nodes") mesh = smesh.Mesh(box, "Mesh_free_nodes")
algo = mesh.Segment() algo = mesh.Segment()
algo.NumberOfSegments(10) algo.NumberOfSegments(10)
algo = mesh.Triangle(smeshBuilder.MEFISTO) algo = mesh.Triangle(smeshBuilder.NETGEN_2D)
algo.MaxElementArea(150.) algo.MaxElementArea(150.)
mesh.Compute() mesh.Compute()
# Remove some elements to obtain free nodes # Remove some elements to obtain free nodes
# Criterion : AREA < 80. # Criterion : AREA < 80.

View File

@ -63,7 +63,7 @@ Mesh_1 = smesh.Mesh(Box_1_1)
Regular_1D = Mesh_1.Segment() Regular_1D = Mesh_1.Segment()
Local_Length_1 = Regular_1D.LocalLength(5) Local_Length_1 = Regular_1D.LocalLength(5)
MEFISTO_2D = Mesh_1.Triangle(algo=smeshBuilder.MEFISTO) NETGEN_2D = Mesh_1.Triangle(algo=smeshBuilder.NETGEN_2D)
ok = Mesh_1.Compute() ok = Mesh_1.Compute()

View File

@ -50,7 +50,9 @@ SET(BAD_TESTS
blocFissure_04_without_session.py blocFissure_04_without_session.py
blocFissure_05_without_session.py blocFissure_05_without_session.py
blocFissure_06_without_session.py blocFissure_06_without_session.py
blocFissure_07_without_session.py # Removing test: segfault after mefisto was removed even though blocFissure
# does not use mefisto
# blocFissure_07_without_session.py
) )
IF(NOT WIN32) IF(NOT WIN32)

View File

@ -1,4 +1,4 @@
.. _additional_hypo_page: .. _additional_hypo_page:
********************* *********************
Additional Hypotheses Additional Hypotheses
@ -9,10 +9,10 @@ Additional Hypotheses
An **Additional Hypothesis** can be defined in the same way as any main hypothesis in :ref:`Create Mesh <create_mesh_anchor>` or :ref:`Create Sub-Mesh <constructing_submeshes_page>` dialog. An **Additional Hypothesis** can be defined in the same way as any main hypothesis in :ref:`Create Mesh <create_mesh_anchor>` or :ref:`Create Sub-Mesh <constructing_submeshes_page>` dialog.
The following additional hypothesis are available: The following additional hypothesis are available:
* :ref:`propagation_anchor` and :ref:`propagofdistribution_anchor` hypotheses are useful for creation of quadrangle and hexahedral meshes. * :ref:`propagation_anchor` and :ref:`propagofdistribution_anchor` hypotheses are useful for creation of quadrangle and hexahedral meshes.
* :ref:`Viscous Layers <viscous_layers_anchor>` and :ref:`Viscous Layers 2D <viscous_layers_anchor>` hypotheses allow creation of layers of highly stretched elements near mesh boundary, which is beneficial for high quality viscous computations. * :ref:`Viscous Layers <viscous_layers_anchor>` and :ref:`Viscous Layers 2D <viscous_layers_anchor>` hypotheses allow creation of layers of highly stretched elements near mesh boundary, which is beneficial for high quality viscous computations.
* :ref:`quadratic_mesh_anchor` hypothesis allows generation of second order meshes. * :ref:`quadratic_mesh_anchor` hypothesis allows generation of second order meshes.
* :ref:`quadrangle_preference_anchor` hypothesis enables generation of quadrangles. * :ref:`quadrangle_preference_anchor` hypothesis enables generation of quadrangles.
@ -31,8 +31,8 @@ parameters will be propagated via opposite sides of quadrangles to the
whole geometry, and this propagation stops at an edge with other local whole geometry, and this propagation stops at an edge with other local
meshing parameters. meshing parameters.
This hypothesis can be taken into account by This hypothesis can be taken into account by
:ref:`Wire Discretization <a1d_algos_anchor>` and :ref:`Wire Discretization <a1d_algos_anchor>` and
:ref:`Composite Side Discretization <a1d_algos_anchor>` algorithms. :ref:`Composite Side Discretization <a1d_algos_anchor>` algorithms.
**See Also** a sample TUI Script of a :ref:`Propagation hypothesis <tui_propagation>` operation **See Also** a sample TUI Script of a :ref:`Propagation hypothesis <tui_propagation>` operation
@ -48,9 +48,9 @@ propagation are defined on an edge of a quadrangular face, the
opposite edge will have the same number of nodes and the same opposite edge will have the same number of nodes and the same
relations between segment lengths, unless another hypothesis relations between segment lengths, unless another hypothesis
has been locally defined on the opposite edge. has been locally defined on the opposite edge.
This hypothesis can be taken into account by This hypothesis can be taken into account by
:ref:`Wire Discretization <a1d_algos_anchor>` and :ref:`Wire Discretization <a1d_algos_anchor>` and
:ref:`Composite Side Discretization <a1d_algos_anchor>` algorithms. :ref:`Composite Side Discretization <a1d_algos_anchor>` algorithms.
**See Also** a sample TUI Script of a :ref:`Propagation hypothesis <tui_propagation>` operation **See Also** a sample TUI Script of a :ref:`Propagation hypothesis <tui_propagation>` operation
@ -63,7 +63,7 @@ Viscous Layers and Viscous Layers 2D
**Viscous Layers** and **Viscous Layers 2D** additional **Viscous Layers** and **Viscous Layers 2D** additional
hypotheses can be used by several 3D algorithms, for example hypotheses can be used by several 3D algorithms, for example
Hexahedron(i,j,k), or 2D algorithms, for example Triangle Hexahedron(i,j,k), or 2D algorithms, for example Triangle
(MEFISTO), correspondingly. These hypotheses allow creation of layers (NETGEN2D), correspondingly. These hypotheses allow creation of layers
of highly stretched elements, prisms in 3D and quadrilaterals in 2D, of highly stretched elements, prisms in 3D and quadrilaterals in 2D,
near mesh boundary, which is beneficial for high quality viscous near mesh boundary, which is beneficial for high quality viscous
computations. computations.
@ -73,7 +73,7 @@ computations.
.. image:: ../images/viscous_layers_2d_hyp.png .. image:: ../images/viscous_layers_2d_hyp.png
:align: center :align: center
* **Name** - allows to define the name of the hypothesis. * **Name** - allows to define the name of the hypothesis.
* **Total thickness** - gives the total thickness of element layers. * **Total thickness** - gives the total thickness of element layers.
@ -83,18 +83,18 @@ computations.
* **Surface offset + smooth** method extrudes nodes along the normal to the underlying geometrical surface. Smoothing of the internal surface of element layers is possible to avoid creation of invalid prisms. * **Surface offset + smooth** method extrudes nodes along the normal to the underlying geometrical surface. Smoothing of the internal surface of element layers is possible to avoid creation of invalid prisms.
* **Face offset** method extrudes nodes along the average normal of surrounding mesh faces to the intersection with a neighbor mesh face translated along its own normal by the thickness of layers. The thickness of layers can be limited to avoid creation of invalid prisms. * **Face offset** method extrudes nodes along the average normal of surrounding mesh faces to the intersection with a neighbor mesh face translated along its own normal by the thickness of layers. The thickness of layers can be limited to avoid creation of invalid prisms.
* **Node offset** method extrudes nodes along the average normal of surrounding mesh faces by the thickness of layers. The thickness of layers can be limited to avoid creation of invalid prisms. * **Node offset** method extrudes nodes along the average normal of surrounding mesh faces by the thickness of layers. The thickness of layers can be limited to avoid creation of invalid prisms.
.. image:: ../images/viscous_layers_extrusion_method.png .. image:: ../images/viscous_layers_extrusion_method.png
:align: center :align: center
.. centered:: .. centered::
Prisms created by the tree extrusion methods at the same other parameters Prisms created by the tree extrusion methods at the same other parameters
* **Specified Faces/Edges are** - defines how the shapes specified by the next parameter are used. * **Specified Faces/Edges are** - defines how the shapes specified by the next parameter are used.
* **Faces/Edges with/without layers** - defines geometrical faces or edges on which element layers either should be or should not be constructed, depending on the value of the previous parameter (**Specified Faces/Edges are**). Faces (or edges) can be selected either in the Object Browser or in the VTK Viewer. **Add** button becomes active as soon as a suitable sub-shape is selected. * **Faces/Edges with/without layers** - defines geometrical faces or edges on which element layers either should be or should not be constructed, depending on the value of the previous parameter (**Specified Faces/Edges are**). Faces (or edges) can be selected either in the Object Browser or in the VTK Viewer. **Add** button becomes active as soon as a suitable sub-shape is selected.
.. note:: .. note::
A mesh shown in the 3D Viewer can prevent selection of faces and edges, just hide the mesh to avoid this. If a face, which should be selected, is hidden by other faces, consider creating a group of faces to be selected in the Geometry module. To avoid a long wait when a geometry with many faces (or edges) is displayed, the number of faces (edges) shown at a time is limited by the value of :ref:`Sub-shapes preview chunk size <chunk_size_pref>` preference (in Preferences/Mesh/General tab). A mesh shown in the 3D Viewer can prevent selection of faces and edges, just hide the mesh to avoid this. If a face, which should be selected, is hidden by other faces, consider creating a group of faces to be selected in the Geometry module. To avoid a long wait when a geometry with many faces (or edges) is displayed, the number of faces (edges) shown at a time is limited by the value of :ref:`Sub-shapes preview chunk size <chunk_size_pref>` preference (in Preferences/Mesh/General tab).
@ -110,7 +110,7 @@ computations.
* **Create groups from layers** - activates creation of a group containing elements of the layers. * **Create groups from layers** - activates creation of a group containing elements of the layers.
.. image:: ../images/viscous_layers_on_submesh.png .. image:: ../images/viscous_layers_on_submesh.png
:align: center :align: center
.. centered:: .. centered::
@ -146,9 +146,9 @@ Quadratic Mesh hypothesis allows to build a quadratic mesh (in which
links between element nodes are not straight but curved lines due to links between element nodes are not straight but curved lines due to
presence of an additional mid-side node). presence of an additional mid-side node).
This 1D hypothesis can be taken into account by This 1D hypothesis can be taken into account by
:ref:`Wire Discretization <a1d_algos_anchor>` and :ref:`Wire Discretization <a1d_algos_anchor>` and
:ref:`Composite Side Discretization <a1d_algos_anchor>` algorithms. To create a quadratic mes assign this hypothesis at :ref:`Composite Side Discretization <a1d_algos_anchor>` algorithms. To create a quadratic mes assign this hypothesis at
:ref:`mesh construction <constructing_meshes_page>`. :ref:`mesh construction <constructing_meshes_page>`.
See :ref:`adding_quadratic_elements_page` for more information about quadratic meshes. See :ref:`adding_quadratic_elements_page` for more information about quadratic meshes.

View File

@ -42,11 +42,11 @@ User Guide.
For instance:: For instance::
MEFISTO_2D_1 = Mesh_1.Triangle(algo=smesh.MEFISTO,geom=Face_1) NETGEN_2D_1 = Mesh_1.Triangle(algo=smesh.NETGEN_2D,geom=Face_1)
is replaced by:: is replaced by::
MEFISTO_2D_1 = Mesh_1.Triangle(algo=smeshBuilder.MEFISTO,geom=Face_1) NETGEN_2D_1 = Mesh_1.Triangle(algo=smeshBuilder.NETGEN_2D,geom=Face_1)
StdMeshers algorithms concerned are *REGULAR, PYTHON, COMPOSITE, MEFISTO, Hexa, QUADRANGLE, RADIAL_QUAD*. StdMeshers algorithms concerned are *REGULAR, PYTHON, COMPOSITE, MEFISTO, Hexa, QUADRANGLE, RADIAL_QUAD*.
@ -97,7 +97,7 @@ User Guide.
import GHS3DPlugin import GHS3DPlugin
import HexoticPLUGIN import HexoticPLUGIN
is replaced by:: is replaced by::
from salome.StdMeshers import StdMeshersBuilder from salome.StdMeshers import StdMeshersBuilder
from salome.NETGENPlugin import NETGENPluginBuilder from salome.NETGENPlugin import NETGENPluginBuilder

View File

@ -1539,13 +1539,6 @@ msgstr ""
msgid "for the python function that calculates the length of all segments" msgid "for the python function that calculates the length of all segments"
msgstr "" msgstr ""
# d547c98271ce4546853aef52f20e3c2e
#: StdMeshersBuilder.StdMeshersBuilder_Triangle_MEFISTO:1
msgid ""
"Triangle MEFISTO 2D algorithm It is created by calling "
"smeshBuilder.Mesh.Triangle(smeshBuilder.MEFISTO,geom=0)"
msgstr ""
# e09f098933e640e594676b483b1f314a # e09f098933e640e594676b483b1f314a
#: StdMeshersBuilder.StdMeshersBuilder_Triangle_MEFISTO.LengthFromEdges:1 #: StdMeshersBuilder.StdMeshersBuilder_Triangle_MEFISTO.LengthFromEdges:1
msgid "Defines \"LengthFromEdges\" hypothesis to build triangles" msgid "Defines \"LengthFromEdges\" hypothesis to build triangles"

View File

@ -23,7 +23,7 @@
##################################################################### #####################################################################
#Created :17/02/2005 #Created :17/02/2005
#Author :MASLOV Eugeny, KOVALTCHUK Alexey #Author :MASLOV Eugeny, KOVALTCHUK Alexey
##################################################################### #####################################################################
# #
import salome import salome
@ -41,7 +41,7 @@ import math
#Sketcher_1 creation #Sketcher_1 creation
print("Sketcher creation...") print("Sketcher creation...")
Sketcher_1 = geompy.MakeSketcher("Sketcher:F 100 -57.7:TT 100 57.7:TT 0 115.47:TT -100 57.7:TT -100 -57.7:TT 0 -115.47:WW") Sketcher_1 = geompy.MakeSketcher("Sketcher:F 100 -57.7:TT 100 57.7:TT 0 115.47:TT -100 57.7:TT -100 -57.7:TT 0 -115.47:WW")
geompy.addToStudy(Sketcher_1, "Sketcher_1") geompy.addToStudy(Sketcher_1, "Sketcher_1")
Face_1 = geompy.MakeFace(Sketcher_1, 1) Face_1 = geompy.MakeFace(Sketcher_1, 1)
geompy.addToStudy(Face_1, "Face_1") geompy.addToStudy(Face_1, "Face_1")
@ -58,7 +58,7 @@ geompy.addToStudy(Prism_1, "Prism_1")
#Sketcher_2 creation #Sketcher_2 creation
print("Sketcher creation...") print("Sketcher creation...")
Sketcher_2 = geompy.MakeSketcher("Sketcher:F 50 0:TT 80 0:TT 112 13:TT 112 48:TT 80 63:TT 80 90:TT 50 90:WW", [0,0,0, 1,0,0, 0,1,0]) Sketcher_2 = geompy.MakeSketcher("Sketcher:F 50 0:TT 80 0:TT 112 13:TT 112 48:TT 80 63:TT 80 90:TT 50 90:WW", [0,0,0, 1,0,0, 0,1,0])
geompy.addToStudy(Sketcher_2, "Sketcher_2") geompy.addToStudy(Sketcher_2, "Sketcher_2")
Face_2 = geompy.MakeFace(Sketcher_2, 1) Face_2 = geompy.MakeFace(Sketcher_2, 1)
geompy.addToStudy(Face_2, "Face_2") geompy.addToStudy(Face_2, "Face_2")
@ -129,7 +129,7 @@ smesh.SetName(hAvLength, "AverageLength_"+str(theAverageLength))
print("-------------------------- MaxElementArea") print("-------------------------- MaxElementArea")
theMaxElementArea = 20 theMaxElementArea = 20
algoMef = mesh.Triangle(smeshBuilder.MEFISTO) algoMef = mesh.Triangle(smeshBuilder.NETGEN_2D)
hArea = algoMef.MaxElementArea( theMaxElementArea ) hArea = algoMef.MaxElementArea( theMaxElementArea )
print(hArea.GetName()) print(hArea.GetName())
print(hArea.GetId()) print(hArea.GetId())

View File

@ -128,7 +128,7 @@ smesh.SetName(hypNbSeg, "NumberOfSegments_" + str(numberOfSegment))
maxElementArea = 20 maxElementArea = 20
algo2 = mesh.Triangle(smeshBuilder.MEFISTO) algo2 = mesh.Triangle(smeshBuilder.NETGEN_2D)
hypArea = algo2.MaxElementArea(maxElementArea) hypArea = algo2.MaxElementArea(maxElementArea)
print(hypArea.GetName()) print(hypArea.GetName())
print(hypArea.GetId()) print(hypArea.GetId())

View File

@ -75,7 +75,7 @@ print(hyp.GetName())
print(hyp.GetId()) print(hyp.GetId())
print(hyp.GetLength()) print(hyp.GetLength())
algo_2 = mesh.Triangle(smeshBuilder.MEFISTO, box) algo_2 = mesh.Triangle(smeshBuilder.NETGEN_2D, box)
hyp = algo_2.MaxElementArea(5000) hyp = algo_2.MaxElementArea(5000)
print(hyp.GetName()) print(hyp.GetName())
print(hyp.GetId()) print(hyp.GetId())

View File

@ -55,13 +55,13 @@ algo1 = mesh.Segment()
algo1.NumberOfSegments(10) algo1.NumberOfSegments(10)
# Set 2D algorithm/hypotheses to mesh # Set 2D algorithm/hypotheses to mesh
algo2 = mesh.Triangle(smeshBuilder.MEFISTO) algo2 = mesh.Triangle(smeshBuilder.NETGEN_2D)
algo2.MaxElementArea(10) algo2.MaxElementArea(10)
# Create submesh on face # Create submesh on face
algo3 = mesh.Segment(face) algo3 = mesh.Segment(face)
algo3.NumberOfSegments(10) algo3.NumberOfSegments(10)
algo4 = mesh.Triangle(smeshBuilder.MEFISTO, face) algo4 = mesh.Triangle(smeshBuilder.NETGEN_2D, face)
algo4.MaxElementArea(100) algo4.MaxElementArea(100)
submesh = algo4.GetSubMesh() submesh = algo4.GetSubMesh()
smesh.SetName(submesh, "SubMeshFace") smesh.SetName(submesh, "SubMeshFace")