tesselate% cat run.scr
#
set LAGRIT_X = lagrit_lin_o
rm *outx3dgen
$LAGRIT_X < demo_pset.lgi
mv outx3dgen demo_pset.outx3dgen
Click on image to enlarge.
Gallery written: Thu Jun 21 13:22:47 2007
01_pintersect |
01_pnot |
01_pregion |
01_prtp |
01_prtz |
01_punion |
01_pxyz |
append_all |
tesselate% cat ../demo_pset.lgi
* Define variables that will be used in point distribution.
* These define the min/max extents of the box.
*
define / XMIN / 0.0
define / XMAX / 1.0
define / YMIN / 0.0
define / YMAX / 1.0
define / ZMIN / 0.0
define / ZMAX / 1.0
*
define / CMO_NAME / cmo_hex
*
* Build a hex mesh
*
define / NX / 21
define / NY / 21
define / NZ / 21
cmo / create / CMO_NAME / / / hex
createpts / brick / xyz / NX NY NZ / XMIN YMIN ZMIN / XMAX YMAX ZMAX / 1 1 1
cmo / setatt / CMO_NAME / imt / 1 0 0 / 1
cmo / setatt / CMO_NAME / itp / 1 0 0 / 0
cmo / setatt / CMO_NAME / itetclr / 1 0 0 / 1
cmo / status
resetpts / itp
*
* Convert hex to 5 6 24 tets
*
hextotet / 5 / cmo_tet5 / cmo_hex
hextotet / 6 / cmo_tet6 / cmo_hex
hextotet / 24 / cmo_tet24/ cmo_hex
*
* Convert hex to tet using Delaunay connect routine
*
cmo / create / cmo_tet / / / tet
copypts / cmo_tet / cmo_hex
connect
resetpts / itp
*
dump / gmv / hex.gmv / cmo_hex
dump / gmv / tet05.gmv / cmo_tet5
dump / gmv / tet06.gmv / cmo_tet6
dump / gmv / tet24.gmv / cmo_tet24
dump / gmv / tet_connect.gmv / cmo_tet
*
* Translate the mesh objects in space so that
* when they are added together, they do not sit
* on top of one another.
*
define / OFFSET / 1.5
cmo / select / cmo_tet5
trans / 1 0 0 / 0.0 0.0 0.0 / OFFSET 0. 0.0
cmo / select / cmo_tet6
trans / 1 0 0 / 0.0 0.0 0.0 / OFFSET OFFSET 0.0
cmo / select / cmo_tet24
trans / 1 0 0 / 0.0 0.0 0.0 / 0.0 OFFSET 0.0
cmo / select / cmo_tet
trans / 1 0 0 / 0.0 0.0 0.0 / OFFSET OFFSET OFFSET
*
* Append all the mesh objects into a single mesh object.
*
addmesh / append / cmo_all / cmo_hex / cmo_tet5
addmesh / append / cmo_all / cmo_all / cmo_tet6
addmesh / append / cmo_all / cmo_all / cmo_tet24
addmesh / append / cmo_all / cmo_all / cmo_tet
dump / gmv / tet_all.gmv / cmo_all
*
* Now use some of the pset commands to identify point sets.
*
cmo / select / cmo_tet24
*
* Move cmo_tet24 back to it original, pre-translated position.
*
trans / 1 0 0 / original
*
* Identify points using Cartesian, x,y,z min/max box
*
pset / pset_xyz / geom / xyz / 1 0 0 / 0.4 0.3 0.2 / 1.0 1.0 1.0
*
* Identify points using Cylindrical, R, Theta, Z min/max
*
pset / pset_rtz / geom / rtz / 1 0 0 / 0. 0.0 0. / .5 270. .5
*
* Identify points using Spherical, R, Theta, Phi min/max
*
pset / pset_rtp / geom / rtp / 1 0 0 / 0. 0.0 0. / 1.0 270. 90.
*
* Add some new node attributes and color them with the pset's
*
cmo / addatt / cmo_tet24 / pxyz / vdouble / scalar / nnodes
cmo / addatt / cmo_tet24 / prtz / vdouble / scalar / nnodes
cmo / addatt / cmo_tet24 / prtp / vdouble / scalar / nnodes
cmo / setatt / cmo_tet24 / pxyz / pset get pset_xyz / 2.0
cmo / setatt / cmo_tet24 / prtz / pset get pset_rtz / 2.0
cmo / setatt / cmo_tet24 / prtp / pset get pset_rtp / 2.0
*
* Define some pset's with the Boolians,
* Union (OR), Intersection (AND), Compliment (NOT)
*
pset / pset_union / union / pset_xyz pset_rtp
pset / pset_inter / inter / pset_xyz pset_rtp
pset / pset_not / not / pset_rtp pset_xyz
cmo / addatt / cmo_tet24 / punion / vdouble / scalar / nnodes
cmo / addatt / cmo_tet24 / pinter / vdouble / scalar / nnodes
cmo / addatt / cmo_tet24 / pnot / vdouble / scalar / nnodes
cmo / setatt / cmo_tet24 / punion / pset get pset_union / 2.0
cmo / setatt / cmo_tet24 / pinter / pset get pset_inter / 2.0
cmo / setatt / cmo_tet24 / pnot / pset get pset_not / 2.0
dump / gmv / tets_pset.gmv / cmo_tet24
*
* Create some surfaces for use in the region commands.
*
*
* Define parameter to be used later.
*
define/NX/50
define/NY/50
define/MIN/0.0
define/MAX/10.0
*
* Create the quad surfaces
*
cmo/create/cmo_1///quad
quadxy NX NY/MIN MIN 0./MAX MIN 0./MAX MAX 0./MIN MAX 0.
rzbrick/xyz/NX,NY,1/1,0,0/connect
*
* Copy the quad surface into another mesh object
*
cmo/copy/cmo_2/cmo_1
*
cmo / setatt / cmo_1 / itetclr / 1 0 0 / 1
cmo / setatt / cmo_2 / itetclr / 1 0 0 / 2
*
* Use the math command to set the z coordinates to:
*
* cmo_1 z(i)=sin(y(i))
* cmo_2 z(i)=sin(x(i))
*
math/sin/cmo_1/zic/1,0,0/cmo_1/yic
cmo / select / cmo_1
scale / 1 0 0 / relative / xyz / 0.1 0.1 0.2
trans / 1 0 0 / 0. 0. 0. / 0. 0. 0.25
math/sin/cmo_2/zic/1,0,0/cmo_2/xic
cmo / select / cmo_2
scale / 1 0 0 / relative / xyz / 0.1 0.1 0.2
trans / 1 0 0 / 0. 0. 0. / 0. 0. 0.75
cmo / printatt / cmo_1 / -xyz- / minmax
cmo / printatt / cmo_2 / -xyz- / minmax
cmo/setatt/cmo_1/ipolydat/no
cmo/setatt/cmo_2/ipolydat/no
dump / gmv / z_sin_y.gmv / cmo_1
dump / gmv / z_sin_x.gmv / cmo_2
addmesh / merge / cmo_tmp / cmo_1 / cmo_2
dump / gmv / z_sin_x_y.gmv / cmo_tmp
cmo / delete / cmo_tmp
*
* Now use the surfaces to define regions.
*
cmo / select / cmo_tet24
surface / surf1 / reflect / sheet / cmo_1
surface / surf2 / reflect / sheet / cmo_2
region / reg_1 / le surf1
region / reg_2 / gt surf1 and le surf2
region / reg_3 / gt surf2
pset / pset_r1 / region reg_1
pset / pset_r2 / region reg_2
pset / pset_r3 / region reg_3
cmo / addatt / cmo_tet24 / pregion / vdouble / scalar / nnodes
cmo / setatt / cmo_tet24 / pregion / pset get pset_r1 / 1.0
cmo / setatt / cmo_tet24 / pregion / pset get pset_r2 / 2.0
cmo / setatt / cmo_tet24 / pregion / pset get pset_r3 / 3.0
dump / gmv / region.gmv / cmo_tet24
finish
tesselate%