2013-02-12 20:37:44 +06:00
|
|
|
# Defining Meshing Algorithms
|
|
|
|
|
2013-04-04 13:08:19 +06:00
|
|
|
import salome
|
2021-08-12 14:38:10 +05:00
|
|
|
salome.salome_init_without_session()
|
2013-04-04 13:08:19 +06:00
|
|
|
|
2022-04-11 18:28:01 +05:00
|
|
|
from salome.geom import geomBuilder
|
2013-04-04 13:08:19 +06:00
|
|
|
from salome.smesh import smeshBuilder
|
2022-04-11 18:28:01 +05:00
|
|
|
|
|
|
|
geom_builder = geomBuilder.New()
|
|
|
|
smesh_builder = smeshBuilder.New()
|
2013-02-12 20:37:44 +06:00
|
|
|
|
|
|
|
# create a box
|
2022-04-11 18:28:01 +05:00
|
|
|
box = geom_builder.MakeBoxDXDYDZ(10., 10., 10.)
|
|
|
|
geom_builder.addToStudy(box, "Box")
|
2013-02-12 20:37:44 +06:00
|
|
|
|
2016-03-21 17:03:25 +05:00
|
|
|
# Create a hexahedral mesh on the box
|
2022-04-11 18:28:01 +05:00
|
|
|
hexa = smesh_builder.Mesh(box, "Box : hexahedrical mesh")
|
2013-02-12 20:37:44 +06:00
|
|
|
|
|
|
|
# create a Regular 1D algorithm for edges
|
|
|
|
algo1D = hexa.Segment()
|
|
|
|
|
|
|
|
# create a quadrangle 2D algorithm for faces
|
|
|
|
algo2D = hexa.Quadrangle()
|
|
|
|
|
|
|
|
# create a hexahedron 3D algorithm for solids
|
|
|
|
algo3D = hexa.Hexahedron()
|
|
|
|
|
|
|
|
# define hypotheses
|
|
|
|
algo1D.Arithmetic1D(1, 4)
|
|
|
|
|
|
|
|
# compute the mesh
|
2023-02-21 18:59:44 +05:00
|
|
|
if not hexa.Compute(): raise Exception("Error when computing Mesh")
|
2013-02-12 20:37:44 +06:00
|
|
|
|
|
|
|
# 2. Create a tetrahedral mesh on the box
|
2022-04-11 18:28:01 +05:00
|
|
|
tetra = smesh_builder.Mesh(box, "Box : tetrahedrical mesh")
|
2013-02-12 20:37:44 +06:00
|
|
|
|
2022-04-15 20:49:22 +05:00
|
|
|
# create a 1D algorithm for edges
|
2013-02-12 20:37:44 +06:00
|
|
|
algo1D = tetra.Segment()
|
|
|
|
|
2022-04-15 20:49:22 +05:00
|
|
|
# create a 2D algorithm for faces
|
2013-02-12 20:37:44 +06:00
|
|
|
algo2D = tetra.Triangle()
|
|
|
|
|
|
|
|
# create a 3D algorithm for solids
|
|
|
|
algo3D = tetra.Tetrahedron()
|
|
|
|
|
|
|
|
# define hypotheses
|
|
|
|
algo1D.Arithmetic1D(1, 4)
|
|
|
|
algo2D.LengthFromEdges()
|
|
|
|
|
|
|
|
# compute the mesh
|
2023-02-21 18:59:44 +05:00
|
|
|
if not tetra.Compute(): raise Exception("Error when computing Mesh")
|