2015-07-09 14:41:53 +05:00
|
|
|
# Split bi-quadratic to linear
|
|
|
|
|
|
|
|
import salome
|
2021-08-12 14:38:10 +05:00
|
|
|
salome.salome_init_without_session()
|
2015-07-09 14:41:53 +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()
|
2015-07-09 14:41:53 +05:00
|
|
|
|
|
|
|
# make a shape consisting of two quadranges
|
2022-04-11 18:28:01 +05:00
|
|
|
OY = geom_builder.MakeVectorDXDYDZ(0, 1, 0)
|
|
|
|
OY1 = geom_builder.MakeTranslation( OY, 1, 0, 0 )
|
|
|
|
OY2 = geom_builder.MakeTranslation( OY, 2, 0, 0 )
|
|
|
|
q1 = geom_builder.MakeQuad2Edges( OY, OY1 )
|
|
|
|
q2 = geom_builder.MakeQuad2Edges( OY1, OY2 )
|
2015-07-09 14:41:53 +05:00
|
|
|
|
2022-04-11 18:28:01 +05:00
|
|
|
shape = geom_builder.Partition( [q1,q2], theName='shape' )
|
|
|
|
ff = geom_builder.SubShapeAll( shape, geom_builder.ShapeType["FACE"], theName="quad" )
|
2015-07-09 14:41:53 +05:00
|
|
|
|
|
|
|
# mesh one quadrange with quadrangless and the other with triangles
|
2022-04-11 18:28:01 +05:00
|
|
|
mesh = smesh_builder.Mesh( shape )
|
2015-07-09 14:41:53 +05:00
|
|
|
mesh.Segment().NumberOfSegments(1)
|
|
|
|
mesh.Quadrangle()
|
|
|
|
mesh.Triangle( ff[1] )
|
2023-02-21 18:59:44 +05:00
|
|
|
if not mesh.Compute(): raise Exception("Error when computing Mesh")
|
2015-07-09 14:41:53 +05:00
|
|
|
|
|
|
|
# make group of quadrangles and extrude them into a hexahedron
|
|
|
|
quadGroup = mesh.Group( ff[0], "quads")
|
|
|
|
mesh.ExtrusionSweepObject2D( quadGroup, [0,0,1], 1 )
|
|
|
|
|
|
|
|
# make the mesh bi-quadratic
|
|
|
|
mesh.ConvertToQuadratic( theToBiQuad=True )
|
|
|
|
|
|
|
|
# split all elements into linear ones
|
|
|
|
mesh.SplitBiQuadraticIntoLinear()
|