2012-08-09 16:03:55 +06:00
|
|
|
/*!
|
|
|
|
|
|
|
|
\page tui_cartesian_algo Usage of Body Fitting algorithm
|
|
|
|
|
|
|
|
\code
|
|
|
|
from smesh import *
|
|
|
|
SetCurrentStudy(salome.myStudy)
|
|
|
|
|
|
|
|
# create a sphere
|
|
|
|
sphere = geompy.MakeSphereR( 50 )
|
|
|
|
geompy.addToStudy( sphere, "sphere" )
|
|
|
|
|
|
|
|
# create a mesh and assign a "Body Fitting" algo
|
|
|
|
mesh = Mesh( sphere )
|
|
|
|
cartAlgo = mesh.BodyFitted()
|
|
|
|
|
|
|
|
# define a cartesian grid using Coordinates
|
|
|
|
coords = range(-100,100,10)
|
|
|
|
cartHyp = cartAlgo.SetGrid( coords,coords,coords, 1000000)
|
|
|
|
|
|
|
|
# compute the mesh
|
|
|
|
mesh.Compute()
|
|
|
|
print "nb hexahedra",mesh.NbHexas()
|
|
|
|
print "nb tetrahedra",mesh.NbTetras()
|
|
|
|
print "nb polyhedra",mesh.NbPolyhedrons()
|
|
|
|
print
|
|
|
|
|
2012-10-08 17:56:59 +06:00
|
|
|
# define the grid by setting constant spacing
|
2012-08-09 16:03:55 +06:00
|
|
|
cartHyp = cartAlgo.SetGrid( "10","10","10", 1000000)
|
|
|
|
|
|
|
|
mesh.Compute()
|
|
|
|
print "nb hexahedra",mesh.NbHexas()
|
|
|
|
print "nb tetrahedra",mesh.NbTetras()
|
|
|
|
print "nb polyhedra",mesh.NbPolyhedrons()
|
|
|
|
|
|
|
|
|
2012-10-08 17:56:59 +06:00
|
|
|
# define the grid by setting different spacing in 2 sub-ranges of geometry
|
2012-08-09 16:03:55 +06:00
|
|
|
spaceFuns = ["5","10+10*t"]
|
2012-10-08 17:56:59 +06:00
|
|
|
cartAlgo.SetGrid( [spaceFuns, [0.5]], [spaceFuns, [0.5]], [spaceFuns, [0.25]], 10 )
|
2012-08-09 16:03:55 +06:00
|
|
|
|
|
|
|
mesh.Compute()
|
|
|
|
print "nb hexahedra",mesh.NbHexas()
|
|
|
|
print "nb tetrahedra",mesh.NbTetras()
|
|
|
|
print "nb polyhedra",mesh.NbPolyhedrons()
|
|
|
|
print
|
|
|
|
|
|
|
|
\endcode
|
|
|
|
|
|
|
|
*/
|