COMPUTE

This command contains modules that compute various attributes and functions based on one or more
mesh objects. This operation will (often) result in new attributes being added to the mesh objects. The
action of the command will be controled by the keyword in the second argument position.

distance_field - keyword for distance field calculation. Determine the minimum distance from any node in
mo_source to every node in mo_sink and place the result in the node based floating point attribute,
distance_field_attribute in mo_sink. The computation is accelerated by using the kdtree search
algorithm.

signed_distance_field - keyword for signed distance field calculation. Determine the minimum distance
from any node in mo_source to every node in mo_sink and place the result in the node based floating
point attribute, distance_field_attribute in mo_sink. The computation is accelerated by using the
kdtree search algorithm. Using this option the mo_source MUST be either a triangle or quad surface
mesh object. If the surfaces form a topologically closed volume then positive, 'above' distance is in the
direction of the surface normal vector. Negative is 'below' the surface. If the surface is not a closed
volume, then the assumptions described in the surface command are used to determine what is above
and what is below the surface.

linear_transform - keyword for an extrapolation from an attribute value in a surface onto every node of
a 3D mesh. Given a 3D mesh and a 2D surface, this command will extrapolate a scalar value from that surface
onto every point of the mesh. This can be used to (for example):

• Propogate head values from a surface onto all nodes of a mesh.
• Expand a mesh to fit a surface, by propogating the appropriate spatial coordinate.
• Compute the depth relative to a topographic surface to each node of a mesh.

This is highly dependant on the spatial relation between the mesh and the surface - values from the
surface are extrapolated "downward" into the mesh in the direction specified in the command. The
direction specified in the command must be one of [zpos|zneg|ypos|yneg|xpos|xneg]. For example,
specifing zpos will result in the upper (positive
z-axis) side of the mesh having attribute values conforming exactly to those on the surface, while the
lower side of the mesh will have whatever attribute values it had previous, with all nodes in between
having attribute values distributed linearly between the two extremes. If a direction is not specified,
it will default to zpos. If an attribute is not specified, it will default to the spatial attribute appropriate
to the chosen direction (i.e. if the direction is yneg, the attribute will default to yic, the y-coordinate of
each node.) The attribute chosen must already exist in both the surface and main meshes.

Other places to look for modules that compute some standard mesh attributes include, quality, which will
compute aspect ratio and volume, cmo/addatt, which will compute normal vectors, dihedral angles, solid
angles, meadian points, Voronoi points and more. User functions can be computed with the math module.

FORMAT:
compute/distance_field/mo_sink/mo_source/distance_field_attribute
compute/signed_distance_field/mo_sink/mo_source/distance_field_attribute

compute/linear_transform/mo_main/mo_surface/[direction/att_name]
EXAMPLES:

compute / distance_field / mo_sink / mo_src / dfield

compute / signed_distance_field / mo_sink / mo_src / dfield

compute / linear_transform / mo_sink / mo_surf
(will expand top of mesh to look like the surface)

compute / linear_transform / mo_sink / mo_surf / zpos / water_head_value

 `cmo / create / cmo_srccreatepts/rtz/1,91,1/3.,0.,0./3.,270.,0./1,1,1/ cmo / create / cmo_snkcreatepts / xyz / 30 30 1 / -5. -5. -5. / 5. 5. 5. / 1 1 1compute / distance_field / cmo_snk / cmo_src / dfieldfinish`

 `** Create some of the necessary parts*cmo / create / mo_tetcreatepts/random/rtp/.1/1,0,0/1,180,360////.02connectresetpts / itp** Extract the external surface*extract / surfmesh / 1 0 0 / mo_tri / mo_tet / externaldump / gmv / tri_surf.gmv / mo_tricmo / delete / mo_tetcmo / printatt / mo_tri / -xyz- / minmaxcmo / create / mo_pts** Create an xyz node distribution and connect the nodes.*createpts / xyz / 31 31 31 / -1 -1 -1 / 1 1 1 / 1 1 1connectresetpts / itp** Compute the signed distance field*compute / signed_distance_field / mo_pts / mo_tri / dfield1addmesh / append / mo_all / mo_pts / mo_tridump / gmv / signed_dfield1.gmv / mo_all** Do the same thing but use a surface of quads that make* two nested spheres.*cmo / create / mo_hex / / / hexcreatepts/sphere/8/5/5000/1.0,0.5/0.,0.,0./1,0,0.0/ filter / 1 0 0resetpts / itpextract / surfmesh / 1 0 0 / mo_quad / mo_hex / externaldump / gmv / quad_surf.gmv / mo_quad** Compute the signed distance field*compute / signed_distance_field / mo_pts / mo_quad / dfield2addmesh / append / mo_all2 / mo_pts / mo_quaddump / gmv / signed_dfield2.gmv / mo_all2cmo / statusqualitycmo / printatt / mo_pts / -all- / minmaxfinish`
 `infile buildsurf.lgi* Expand the cubical mesh such that its top (positive z-axis) looks like the sinusoidal* surface denoted by zhighcompute / linear_transform / cube / zhighfinish`