2018-08-20 20:00:59 +05:00
|
|
|
# Usage of Segments around Vertex algorithm
|
|
|
|
|
|
|
|
# for meshing a box with quadrangles with refinement near vertices
|
|
|
|
|
|
|
|
import salome
|
2021-08-12 14:38:10 +05:00
|
|
|
salome.salome_init_without_session()
|
2022-04-11 18:28:01 +05:00
|
|
|
|
2018-08-20 20:00:59 +05:00
|
|
|
from salome.geom import geomBuilder
|
|
|
|
from salome.smesh import smeshBuilder
|
2022-04-11 18:28:01 +05:00
|
|
|
|
|
|
|
geom_builder = geomBuilder.New()
|
|
|
|
smesh_builder = smeshBuilder.New()
|
2018-08-20 20:00:59 +05:00
|
|
|
|
|
|
|
# create a box
|
2022-04-11 18:28:01 +05:00
|
|
|
box = geom_builder.MakeBoxDXDYDZ( 10, 10, 10 )
|
2018-08-20 20:00:59 +05:00
|
|
|
|
|
|
|
# make a mesh
|
2022-04-11 18:28:01 +05:00
|
|
|
mesh = smesh_builder.Mesh( box )
|
2018-08-20 20:00:59 +05:00
|
|
|
|
|
|
|
# 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 )
|
|
|
|
|
2023-02-21 18:59:44 +05:00
|
|
|
if not mesh.Compute(): raise Exception("Error when computing Mesh")
|