Table of Contents

28. Triangular Mesh Generation - TriMesh

The TriMesh module provides for the automatic generation of linear, parabolic or cubic triangular elements given a boundary mesh of linear, parabolic or cubic line segments. By default, the mesh generation procedure is guaranteed to not alter the boundary mesh in any way. The node numbering of the boundary mesh is preserved in the node numbering and connectivity of the resultant triangle mesh. The input boundary mesh is checked for closure.

The functions associated with a TriMesh object are the following.

Instance a TriMesh object using vis_TriMeshBegin. Once a TriMesh object is instanced, define the number of nodes and lines which define the boundary mesh as well as the order of the lines (linear, parabolic or cubic) using vis_TriMeshDef. The boundary mesh is then input as a set of nodes in space and a set of line connectivities. The nodes are defined using vis_TriMeshSetNode, the line connectivities are defined using vis_TriMeshSetLine. By default, the connectivity of the lines is such that the normal to the line is pointed out of the area. The input segments must form closed loops. Loops will either mark the boundaries of area or the boundaries of holes depending upon the connectivities. A special case exists for loops consisting of two "back-to-back" segments. These special loops are considered to be line constraints. The node connectivity and normal conventions for input boundary lines is illustrated in Figure 26-1. For linear input lines only two nodes are input, for parabolic lines three nodes are input and for cubic lines four nodes are input.


Figure 26-1, Input Linear and Parabolic Boundary Line Connectivity
The function vis_TriMeshSetNodeAssoc is used to set associations at nodes. The function vis_TriMeshSetLineAssoc is used to set associations at input lines which, depending upon the type of association which is set, will generate associations at generated triangles and triangle edges. These associations are useful for tagging triangles generated with an enclosed boundary, etc.

The function vis_TriMeshSetParami is used to set integer parameters which affect the mesh generation process. By default, all input nodes must be connected to input boundary lines. If unconnected nodes are to be inserted in the interior then the user must call vis_TriMeshSetParami to enable parameter type TRIMESH_UNCONNECT. It is possible to specify parabolic or cubic triangles to be produced if the input lines are linear. By default the output triangles are the same order as the input lines. Also the sense of the normals of the input lines may be changed so that normals are expected to point into the area. An option exists to generate a mesh with no obtuse triangles.

The function vis_TriMeshSetParamd is used to set real double precision parameters which control the quality and size of the generated triangles. A global target edge length for interior elements may be prescribed. Specific, location dependent, sizes may be set at input nodes using vis_TriMeshSetNodeSizing and at input lines and regions bound by input lines using vis_TriMeshSetLineSizing. The specified growth rate is used to regulate the element size transition rate between the location dependent sizing and the overall target edge length. Note that the element size at any point in the mesh is taken to be the minimum of all user sizing input. Finally the function vis_TriMeshGenerate generates the nodes and finite elements and enters them into a Connect object. The mesh generation process may fail due to errors in the boundary lines or failure of the triangulation procedure. Use vis_TriMeshGetInteger to query for detailed information concerning errors in the boundary lines, etc.

An existing mesh may be refined using vis_TriMeshRefine. Mesh refinement is performed on the mesh resulting from the call to vis_TriMeshGenerate or the last previous call to vis_TriMeshRefine. A State object of element edge length is input and the mesh is refined to satisfy the new element edge lengths. Only mesh refinement is performed, all previously existing nodes are retained in the refined mesh. By default the previous node locations are unchanged. If an element size is set to zero, the element will not be refined.

By default, all input boundary lines may be subdivided during mesh generation or refinement. Use vis_TriMeshSetLineStat to control subdivision of input lines.

Mesh refinement is supported both for meshes generated with vis_TriMeshGenerate or for orphan meshes. In the case of orphan meshes, in addition to specifying the line discretized boundary and its associations, the orphan mesh is specified by entering each original element with vis_TriMeshSetElem.

The function vis_TriMeshWrite is provided to write a complete description of the defined input meshing parameters to a file. The primary use of this file is to encapsulate cases in which the TriMesh module fails in some respect. This output file can then be made available to Visual Kinematics for failure diagnosis of TriMesh meshing algorithms.

The TriMesh module provides for a callback function to be specified which is called intermittently during the mesh generation process in vis_TriMeshGenerate or vis_TriMeshRefine. The primary purpose of this function is to allow the user to interrupt or interrogate the on-going mesh generation process for any reason. If mesh generation is to be terminated, call vis_TriMeshAbort. This call will set an internal flag which will cause vis_TriMeshGenerate or vis_TriMeshRefine to terminate the mesh generation process and return. Set callback functions using vis_TriMeshSetFunction.

The following code fragment illustrates the basic framework of using the TriMesh module to generate linear triangular finite elements in an area bounded by a set of straight line segments.

                   /* declare objects */
   vis_TriMesh *trimesh;
   vis_Connect *connect;
                   /* input boundary lines */
   Vint numnode, numline;
   Vdouble xnod[][3] = { ... };
   Vint ixlin[][2] = { ... };
   Vdouble edgelength;
   Vint ierr;

                   /* create trimesh object */
   trimesh = vis_TriMeshBegin ();
   vis_TriMeshDef (trimesh,numnode,numline,2);

                   /* define nodes and lines */
   for (i = 0; i < numnode; i++) {
      vis_TriMeshSetNode (trimesh,i+1,xnod[i]);
   }
   for (i = 0; i < numline; i++) {
      vis_TriMeshSetLine (trimesh,i+1,ixlin[i]);
   }
                   /* set meshing parameters */
   vis_TriMeshSetParamd (trimesh,VIS_MESH_EDGELENGTH,edgelength);

                   /* create empty connect object to hold generated mesh */
   connect = vis_ConnectBegin ();
   vis_ConnectPre (connect,SYS_DOUBLE);
   vis_ConnectDef (connect,0,0);

                   /* generate mesh */
   vis_TriMeshGenerate (trimesh,connect);

                   /* process any errors */ 
   ierr = vis_TriMeshError (trimesh);
   if(ierr) {
      ...
   }
                   /* access generated nodes and elements from Connect */
   ...
                   /* delete objects */
   vis_ConnectEnd (connect);
   vis_TriMeshEnd (trimesh);
Table of Contents

28.1 Function Descriptions

The currently available TriMesh functions are described in detail in this section.


Table of Contents , TriMesh

NAME

*vis_TriMeshBegin - create an instance of a TriMesh object

C SPECIFICATION

vis_TriMesh *vis_TriMeshBegin ()

ARGUMENTS

None

FUNCTION RETURN VALUE

The function returns a pointer to the newly created TriMesh object. If the object creation fails, NULL is returned.

DESCRIPTION

Create an instance of an TriMesh object. Memory is allocated for the object private data and the pointer to the data is returned.

Destroy an instance of a TriMesh object using

     void vis_TriMeshEnd (vis_TriMesh *trimesh)

Return the current value of a TriMesh object error flag using

     Vint vis_TriMeshError (vis_TriMesh *trimesh)


Table of Contents , TriMesh

NAME

vis_TriMeshDef - define number of boundary nodes, lines.

C SPECIFICATION

void vis_TriMeshDef (vis_TriMesh *trimesh,
                     Vint numnode,
                     Vint numline,
                     Vint maxi)

INPUT ARGUMENTS

trimesh      Pointer to TriMesh object.
numnode      Number of nodes on input boundary mesh
numline      Number of lines on input boundary mesh
maxi         Number of nodes on line segment
             =2            Linear boundary line segments
             =3            Parabolic boundary line segments
             =4            Cubic boundary line segments

OUTPUT ARGUMENTS

None

ERRORS

VIS_ERROR_VALUE is generated if an improper maxi is input or numnode is less than or equal to zero or numline is less than zero.

DESCRIPTION

Define the number of nodes and lines which define the input boundary mesh. The number of nodes on a boundary line segment is specified by maxi. Define node coordinates using vis_TriMeshSetNode and define line connectivities which reference the input nodes using vis_TriMeshSetLine.

Inquire of defined numnode, numline and maxi as output arguments using

     void vis_TriMeshInq (vis_TriMesh *trimesh,
                          Vint *numnode,
                          Vint *numline,
                          Vint *maxi)


Table of Contents , TriMesh

NAME

vis_TriMeshAbort - set abort flag

C SPECIFICATION

void vis_TriMeshAbort (vis_TriMesh *trimesh)

INPUT ARGUMENTS

trimesh      Pointer to TriMesh object.

OUTPUT ARGUMENTS

None

DESCRIPTION

Set mesh generation abort flag. During the mesh generation process in vis_TriMeshGenerate or vis_TriMeshRefine this flag is intermittently checked. If it has been set, the mesh generation process terminates and returns. The abort flag is usually set in the user defined callback function specified by vis_TriMeshSetFunction.


Table of Contents , TriMesh

NAME

vis_TriMeshComputeArea - compute area

C SPECIFICATION

void vis_TriMeshComputeArea (vis_TriMesh *trimesh,
                             Vdouble *area)

INPUT ARGUMENTS

trimesh      Pointer to TriMesh object.

OUTPUT ARGUMENTS

area         Computed area

DESCRIPTION

Compute area enclosed by input boundary.


Table of Contents , TriMesh

NAME

vis_TriMeshGenerate - generate finite element mesh

C SPECIFICATION

void vis_TriMeshGenerate (vis_TriMesh *trimesh,
                          vis_Connect *connect)

INPUT ARGUMENTS

trimesh      Pointer to TriMesh object.
connect      Pointer to Connect object to receive generated mesh

OUTPUT ARGUMENTS

None

ERRORS

VIS_ERROR_OPERATION is generated if mesh generation fails due to errors detected in the boundary lines. VIS_ERROR_COMPUTE is generated if mesh generation fails during triangulation.

DESCRIPTION

Generate interior nodes and triangle elements. The generated nodes and elements are appended to any existing nodes and elements in the input Connect object. The input boundary lines are checked for free ends, connectivity consistency, enclosing negative or zero area, etc. Use vis_TriMeshGetInteger is query for detailed information about the mesh generation process including errors.


Table of Contents , TriMesh

NAME

vis_TriMeshGetConnect - get internal Connect object

C SPECIFICATION

void vis_TriMeshGetConnect (vis_TriMesh *trimesh,
                            vis_Connect **connect)

INPUT ARGUMENTS

trimesh      Pointer to TriMesh object.

OUTPUT ARGUMENTS

connect      Pointer to Connect object.

DESCRIPTION

Get the internal Connect object which contains the user input nodes and lines. The Connect object must not be changed by the user.


Table of Contents , TriMesh

NAME

vis_TriMeshGetInteger - get integer mesh generation information

C SPECIFICATION

void vis_TriMeshGetInteger (vis_TriMesh *trimesh,
                            Vint type,
                            Vint iparam[])

INPUT ARGUMENTS

trimesh      Pointer to TriMesh object.
type         Type of integer information to query
             =TRIMESH_NUMNONMAN      Number of non-manifold lines
             =TRIMESH_NONMAN         Non-manifold lines
             =TRIMESH_NUMEXNODE      Number of nodes outside domain
             =TRIMESH_EXNODE         Nodes outside domain
             =TRIMESH_NUMINCONS      Number of inconsistent lines
             =TRIMESH_INCONS         Inconsistent lines
             =TRIMESH_NUMINTERSECT   Number of intersecting lines
             =TRIMESH_INTERSECT      Intersecting lines
             =TRIMESH_NUMFREEEND     Number of free end lines
             =TRIMESH_FREEEND        Free end lines
             =TRIMESH_NUMUNCONN      Number of unconnected nodes
             =TRIMESH_UNCONN         Unconnected nodes
             =VIS_MESH_PROGRESS      Current meshing progress

OUTPUT ARGUMENTS

iparam       Returned integer information

ERRORS

VIS_ERROR_ENUM is generated if an improper type is specified.

DESCRIPTION

Query for integer mesh generation information. This function is useful for determining where errors in the mesh generation procedure occurred during a call to vis_TriMeshGenerate or vis_TriMeshRefine.

Use TRIMESH_NUMFREEEND to determine the number of lines which contain a free end. The query TRIMESH_FREEEND will return the list of all free end lines detected.

Use TRIMESH_NUMEXNODE to determine the number of input nodes which lie outside the domain. The query TRIMESH_EXNODE will return the list of all nodes outside the domain.

The query type TRIMESH_NUMNONMAN returns the number of non-manifold lines detected in the input. The query TRIMESH_NONMAN will return the list of non-manifold lines detected.

The query type TRIMESH_NUMINCONS returns the number of inconsistent lines detected in the input. The query TRIMESH_INCONS will return the list of inconsistent lines detected.

Use TRIMESH_NUMINTERSECT to determine the number of intersecting input lines. The query TRIMESH_INTERSECT will return the list of all intersecting input lines.

The query type TRIMESH_NUMUNCONN returns the number of unconnected nodes detected in the input. The query TRIMESH_UNCONN will return the list of unconnected nodes detected.

The query type VIS_MESH_PROGRESS returns information about the current state of the meshing process. This function is most useful when called from the monitor function. The following four integer values are returned.

iparam[0]  Meshing phase
           Phase 1 - Pre-processing boundary data
           Phase 2 - Boundary recovery
           Phase 3 - Generating interior points
           Phase 4 - Mesh cleanup
           Phase 5 - Mesh quality improvement
           Phase 101 - Refine Pre-processing
           Phase 102 - Refine point insertion
           Phase 103 - Refine Mesh quality improvement
iparam[1]  Current number of nodes
iparam[2]  Current number of elements
iparam[3]  Estimate percent completion


Table of Contents , TriMesh

NAME

vis_TriMeshSetFunction - set a call back function

C SPECIFICATION

void vis_TriMeshSetFunction (vis_TriMesh *trimesh,
                             Vint funtype,
                             void (*function)(),
                             Vobject *object)

INPUT ARGUMENTS

trimesh      Pointer to TriMesh object.
funtype      Type of callback function to set
             =SYS_FUNCTION_MONITOR     Monitor callback
             =SYS_FUNCTION_SIZING      Isotropic sizing callback
             =SYS_FUNCTION_ASIZING     Anisotropic sizing callback
function     Pointer to callback function
object       Pointer to the object to be returned as function argument

OUTPUT ARGUMENTS

None

DESCRIPTION

Set callback functions. By default the callback functions are NULL. A callback is not invoked if it is NULL. If an anisotropic sizing function is set, it takes precedence over any isotropic sizing function which has been set.

The monitor callback function prototype is

     void function (vis_TriMesh *trimesh,
                    Vobject *object)
The first argument is the TriMesh object, trimesh, and the second is a user defined object, object.

The isotropic sizing callback function prototype is

     void function (vis_TriMesh *trimesh,
                    Vobject *object,
                    Vdouble x[3],
                    Vdouble *s)
The first argument is the TriMesh object, trimesh, the second is a user defined object, object, the third is the coordinate location x and the fourth is the returned size s.

The anisotropic sizing callback function prototype is

     void function (vis_TriMesh *trimesh,
                    Vobject *object,
                    Vdouble x[3],
                    Vdouble s[3][3])
The first argument is the TriMesh object, trimesh, the second is a user defined object, object, the third is the coordinate location x and the fourth is the returned anisotropic scaled orthogonal direction vectors. The first 3 components are the first size scaled direction, the next 3 components are the second size scaled direction, the next 3 components are the third size scaled direction.


Table of Contents , TriMesh

NAME

vis_TriMeshSetParami - set mesh generation parameters

C SPECIFICATION

void vis_TriMeshSetParami (vis_TriMesh *trimesh,
                           Vint ptype,
                           Vint iparam)

INPUT ARGUMENTS

trimesh      Pointer to TriMesh object.
ptype        Type of display parameter to set
             =VIS_MESH_BOUNDREFINE   Boundary refinement flag
             =VIS_MESH_DELAUNAY      Delaunay mesh flag
             =VIS_MESH_INWARD        Inward normal line flag
             =VIS_MESH_INTERREFINE   Interior refinement flag
             =VIS_MESH_MAXI          Order of generated elements
             =VIS_MESH_NONOBTUSE     Nonobtuse mesh flag
             =VIS_MESH_POINTSET      Delaunay triangulation of point set
             =VIS_MESH_SMOOTH        Smooth generated node locations
             =VIS_MESH_REFINESMOOTH  Smooth refined node locations
             =TRIMESH_BOUNDCUT       Toggle boundary cutting
             =TRIMESH_CUTFLAG        Boundary cut flag associations
             =TRIMESH_LINEFLAG       Element line flag associations
             =TRIMESH_UNCONNDECT     Toggle unconnected interior nodes
iparam       Specifies the integer value that ptype will be set to.
             =SYS_OFF                Disable
             =SYS_ON                 Enable

OUTPUT ARGUMENTS

None

ERRORS

VIS_ERROR_ENUM is generated if an improper ptype is specified. VIS_ERROR_VALUE is generated if an improper order of generated elements is specified.

DESCRIPTION

Specify mesh generation parameters. These parameters specify the order and connectivity convention to be used for the generated triangles.

The parameter VIS_MESH_MAXI sets the order of the generated triangular elements by specifying the number of nodes to generate along an edge. A value of 2 generates linear triangles, a value of 3 generates parabolic triangles and a value of 4 generates cubic triangles. By default VIS_MESH_MAXI is set to the order of the input boundary lines defined by vis_TriMeshDef.

The parameter VIS_MESH_INWARD sets the normal convention of the input lines to point into the area. By default VIS_MESH_INWARD is set to SYS_OFF, that is, the line normals are expected to point out of the area.

The parameter VIS_MESH_BOUNDREFINE enables the refinement of the boundary. By default VIS_MESH_BOUNDREFINE is set to SYS_ON.

The parameter VIS_MESH_INTERREFINE enables the refinement of the interior. By default VIS_MESH_INTERREFINE is set to SYS_ON.

The parameter VIS_MESH_DELAUNAY requests that the final mesh satisfy the Delaunay criterion. By default VIS_MESH_DELAUNAY is set to SYS_OFF.

The parameter VIS_MESH_NONOBTUSE requests that the final mesh contain no obtuse triangles. By default VIS_MESH_NONOBTUSE is set to SYS_OFF.

The parameter VIS_MESH_POINTSET requests a Delaunay triangulation of the input points. The mesh boundary is the convex hull of the point set. By default VIS_MESH_POINTSET is set to SYS_OFF.

The parameter VIS_MESH_SMOOTH enables node location smoothing during vis_TriMeshGenerate. By default VIS_MESH_SMOOTH is set to SYS_OFF.

The parameter VIS_MESH_REFINESMOOTH enables node location smoothing during vis_TriMeshRefine. By default VIS_MESH_REFINESMOOTH is set to SYS_OFF.

The parameter TRIMESH_BOUNDCUT enables the generation of rectilinear boundary lines in the interior. The generated boundary lines will connect input boundary lines which are nearly parallel to one another. The generated boundary lines will always connect an input node to a point on an opposing parallel boundary line. The point on the opposing boundary line may be an existing node or a generated point. The deviation from parallel in degrees is specified using vis_TriMeshSetParamd with parameter TRIMESH_CUTANGLE. Use the parameter TRIMESH_CUTMINEDGELENGTH to inhibit cuts which produce small edges. By default TRIMESH_BOUNDCUT is set to SYS_OFF.

The parameters TRIMESH_CUTFLAG and TRIMESH_LINEFLAG enable generation of specified element associations which flag the edges of each triangle which lie on a rectilinear boundary cut or boundary line respectively. The value of these parameters is an association type and must be zero or one of VIS_MISCID0 through VIS_MISCID8. The value of each parameter may be the same association value, in which case the association will flag both hard edges and boundary lines. A value of zero disables the association generation. By default TRIMESH_CUTFLAG and TRIMESH_LINEFLAG are set to zero.

By default, all input nodes must be connected to input lines. If unconnected nodes are to be inserted in the interior then parameter TRIMESH_UNCONNECT must be enabled. By default TRIMESH_UNCONNECT is set to SYS_OFF.

Inquire of defined integer parameters as output arguments using

     void vis_TriMeshGetParami (vis_TriMesh *trimesh,
                                Vint ptype,
                                Vint *iparam)


Table of Contents , TriMesh

NAME

vis_TriMeshSetParamd - set mesh generation parameters

C SPECIFICATION

void vis_TriMeshSetParamd (vis_TriMesh *trimesh,
                           Vint ptype,
                           Vdouble dparam)

INPUT ARGUMENTS

trimesh      Pointer to TriMesh object.
ptype        Type of display parameter to set
             =VIS_MESH_EDGELENGTH     Target edge length
             =VIS_MESH_GROWTHRATE     Maximum growth rate
             =VIS_MESH_MAXEDGELENGTH  Maximum edge length
             =TRIMESH_CUTANGLE        Deviation from parallel angle
             =TRIMESH_CUTMINEDGELENGTH Minimum edge length generated
dparam       Specifies the value that ptype will be set to.

OUTPUT ARGUMENTS

None

ERRORS

VIS_ERROR_ENUM is generated if an improper ptype is specified. VIS_ERROR_VALUE is generated if an improper target edge length is specified.

DESCRIPTION

Specify mesh generation parameters. These parameters are used to control the quality and size of the generated triangles.

The parameter VIS_MESH_EDGELENGTH specifies a target edge length of generated triangles. The edge length constraint may not be satisfied for triangles generated near the boundary mesh due to boundary mesh sizing. By default VIS_MESH_EDGELENGTH is set to 0. and is ignored.

The parameter VIS_MESH_GROWTHRATE specifies a maximum growth rate. The growth rate governs the rate at which the size of adjacent elements can grow. The ratio of edge lengths of unconstrained adjacent elements will not exceed the specified growth rate. The growth rate must be greateer than 1.001. By default VIS_MESH_GROWTHRATE is set to 2.0

The parameter VIS_MESH_MAXEDGELENGTH specifies a maximum edge length of generated triangles. The maximum edge length is strictly enforced. By default VIS_MESH_MAXEDGELENGTH is set to 0. and is ignored.

The parameter TRIMESH_CUTANGLE specifies a deviation from parallel in degrees for use with the rectilinear boundary cut option enabled using vis_TriMeshSetParami with parameter TRIMESH_BOUNDCUT. By default TRIMESH_CUTANGLE is set to 2. degrees.

The parameter TRIMESH_CUTMINEDGELENGTH specifies a minimum edge length which will be generated along an existing edge by a point introduced by a boundary cut. By default TRIMESH_CUTMINEDGELENGTH is set to 0.

Inquire of defined double precision parameters as output arguments using

     void vis_TriMeshGetParamd (vis_TriMesh *trimesh,
                                Vint ptype,
                                Vdouble *dparam)


Table of Contents , TriMesh

NAME

vis_TriMeshSetNode - define a node

C SPECIFICATION

void vis_TriMeshSetNode (vis_TriMesh *trimesh,
                         Vint id,
                         Vdouble x[3])

INPUT ARGUMENTS

trimesh      Pointer to TriMesh object.
id           Node id
x            Node coordinate location

OUTPUT ARGUMENTS

None

ERRORS

VIS_ERROR_VALUE is generated if an improper id is specified.

DESCRIPTION

Set a node location. The node id must be in the interval 1 <= id <= numnode where numnode is defined by vis_TriMeshDef. The node location is projected to the x,y plane, the x[2] entry is ignored. Input boundary lines are defined using vis_TriMeshSetLine.


Table of Contents , TriMesh

NAME

vis_TriMeshSetNodeAssoc - define a node association

C SPECIFICATION

void vis_TriMeshSetNodeAssoc (vis_TriMesh *trimesh,
                              Vint type,
                              Vint id,
                              Vint aid)

INPUT ARGUMENTS

trimesh      Pointer to TriMesh object.
type         Type of association
id           Node id
aid          Association value

OUTPUT ARGUMENTS

None

ERRORS

VIS_ERROR_VALUE is generated if an improper id is specified.

DESCRIPTION

Set a node association. The association will be propagated to the node in the generated mesh. This function may be called any number of times for a particular node and association type, all association values are accumulated.


Table of Contents , TriMesh

NAME

vis_TriMeshSetNodeSizing - set node sizing

C SPECIFICATION

void vis_TriMeshSetNodeSizing (vis_TriMesh *trimesh,
                               Vint id,
                               Vdouble h)

INPUT ARGUMENTS

trimesh      Pointer to TriMesh object.
id           Node id
h            Sizing.

OUTPUT ARGUMENTS

None

ERRORS

VIS_ERROR_VALUE is generated if an improper id is specified.

DESCRIPTION

Set element size to be enforced at a node.


Table of Contents , TriMesh

NAME

vis_TriMeshRefine - refine a triangle mesh

C SPECIFICATION

void vis_TriMeshRefine (vis_TriMesh *trimesh,
                        vis_State *state,
                        vis_Connect *connect)

INPUT ARGUMENTS

trimesh      Pointer to TriMesh object.
state        Pointer to State object of element edge length
connect      Pointer to Connect object to receive refined mesh

OUTPUT ARGUMENTS

None

ERRORS

VIS_ERROR_OPERATION is generated if TriMesh has not been used to generate the original mesh or an orphan mesh is to be refined and vis_TriMeshSetElem has not been called. VIS_ERROR_OPERATION is generated if the input State object is not an element scalar state with the proper number of element entities. VIS_ERROR_OPERATION is generated if the mesh generation fails.

DESCRIPTION

Refine a previously generated or refined mesh. The input State object must be an element scalar state of target element edge lengths. The number of elements in State must be exactly equal to the number of elements resulting from the last call to vis_TriMeshGenerate or vis_TriMeshRefine. If an element edge length is zero, it is ignored. The refinement process does not coarsen the mesh, all previously existing element corner nodes are preserved and by default their coordinate locations are unaltered. Use vis_TriMeshSetParami with parameter VIS_MESH_REFINESMOOTH to control smoothing node locations.

If an orphan mesh is to be refined - i.e., a mesh not generated with TriMeshGenerate, use vis_TriMeshSetElem to set the initial triangle mesh. The boundary of the orphan mesh must be specified with vis_TriMeshSetLine and, if needed, vis_TriMeshSetLineAssoc, etc.

The generated nodes and elements are appended to any existing nodes and elements in the input Connect object. Use vis_TriMeshGetInteger is query for detailed information about the mesh generation process including errors.


Table of Contents , TriMesh

NAME

vis_TriMeshSetElem - set an orphan mesh for refinement

C SPECIFICATION

void vis_TriMeshSetElem (vis_TriMesh *trimesh,
                         Vint id,
                         Vint shape,
                         Vint maxi,
                         Vint ix[])

INPUT ARGUMENTS

trimesh      Pointer to TriMesh object.
id           Element index
shape        Element shape. Only SYS_SHAPETRI is supported.
maxi         Order of the elements in the initial mesh.
ix           Element connectivity

OUTPUT ARGUMENTS

NONE

ERRORS

VIS_ERROR_OPERATION is generated if TriMesh was previously used to generate a mesh. vis_TriMeshSetElem should only be used for orphan meshes. VIS_ERROR_VALUE is generated if ids are entered in a non-sequential manner. VIS_ERROR_VALUE is generated if shape is not VIS_SHAPETRI. VIS_ERROR_VALUE is generated if maxi is not equal to 0, 2, 3 or 4.

DESCRIPTION

Input elements for an orphan triangle mesh to be refined. The API has been defined in a general way to support other element shapes. However, only triangle elements, linear, parabolic or cubic, are currently supported.


Table of Contents , TriMesh

NAME

vis_TriMeshSetGeomSizing - specify sizing within geometric shape

C SPECIFICATION

void vis_TriMeshSetGeomSizing (vis_TriMesh *trimesh,
                               Vint type,
                               Vdouble xo[3],
                               Vdouble xa[3],
                               Vdouble xb[3],
                               Vdouble d[3],
                               Vdouble h)

INPUT ARGUMENTS

trimesh      Pointer to TriMesh object.
type         Geometry type
             =VIS_MESH_GEOMSPHERE       Ellipsoid
             =VIS_MESH_GEOMCYLINDER     Ellipsoidal cylinder
             =VIS_MESH_GEOMBOX          Box
xo           Coordinates of geometry origin
xa           Coordinates of point along x' axis
xb           Coordinates of point in x'y' plane
d            Half length of geometric shape along each axis
h            Sizing

OUTPUT ARGUMENTS

None

ERRORS

VIS_ERROR_ENUM is generated if an improper type is specified.

DESCRIPTION

Set element size to be enforced within a geometric shape.


Table of Contents , TriMesh

NAME

vis_TriMeshSetLine - define a boundary line

C SPECIFICATION

void vis_TriMeshSetLine (vis_TriMesh *trimesh,
                         Vint id,
                         Vint ix[])

INPUT ARGUMENTS

trimesh      Pointer to TriMesh object.
id           Line id
ix           Line connectivity

OUTPUT ARGUMENTS

None

ERRORS

VIS_ERROR_VALUE is generated if an improper id or ix is specified. VIS_ERROR_OPERATION is generated if an id is entered out of order.

DESCRIPTION

Set a boundary line connectivity. The line id must be in the interval 1 <= id <= numline where numline is defined by vis_TriMeshDef. The line connectivity, ix, must contain 2 nodes for linear boundary lines, 3 nodes for parabolic boundary lines and 4 nodes for cubic lines. By default, the connectivity of the lines is be such that the normal to the lines is pointed out of the area. The direction of the normal is determined by the right-hand rule applied to the line connectivity. The outward normal convention may be changed to an inward normal convention using vis_TriMeshSetParami. Note that all lines must be entered sequentially.


Table of Contents , TriMesh

NAME

vis_TriMeshSetLineAssoc - define a line association

C SPECIFICATION

void vis_TriMeshSetLineAssoc (vis_TriMesh *trimesh,
                              Vint type,
                              Vint id,
                              Vint enttype,
                              Vint aid)

INPUT ARGUMENTS

trimesh      Pointer to TriMesh object.
type         Type of association
id           Line id
enttype      Entity type to which association is assigned
             =SYS_EDGE     Element edge association
             =SYS_ELEM     Element association
aid          Association value

OUTPUT ARGUMENTS

None

ERRORS

VIS_ERROR_ENUM is generated if an improper type or enttype is specified. VIS_ERROR_VALUE is generated if an improper id is specified.

DESCRIPTION

Set associations to be assigned to generated triangles and triangle edges. The entity type of SYS_EDGE will propagate the association to triangle edges. The entity type of SYS_ELEM will propagate the association to all triangles adjacent to specified the line, bounded by adjacent input lines.


Table of Contents , TriMesh

NAME

vis_TriMeshSetLineSizing - set line and region sizing

C SPECIFICATION

void vis_TriMeshSetLineSizing (vis_TriMesh *trimesh,
                               Vint id,
                               Vint entttype,
                               Vdouble h)

INPUT ARGUMENTS

trimesh      Pointer to TriMesh object.
id           Line id
enttype      Entity type to which association is assigned
             =SYS_EDGE     Edge sizing
             =SYS_ELEM     Region sizing
h            Sizing.

OUTPUT ARGUMENTS

None

ERRORS

VIS_ERROR_VALUE is generated if an improper id is specified. VIS_ERROR_ENUM is generated if an improper enttype is specified.

DESCRIPTION

Set element sizing to be enforced along an input line or a region bounded by an input line. if enttype is SYS_EDGE the specified size is applied to the input line. if enttype is SYS_ELEM the specified size is enforced within a region. The region is defined as the material bound by input lines that exists to the right of the specified line. If a size is specified on more than one line bounding a region, the minimum size is used for the region.


Table of Contents , TriMesh

NAME

vis_TriMeshSetLineDepthSizing - set sizing within a depth in a region

C SPECIFICATION

void vis_TriMeshSetLineDepthSizing (vis_TriMesh *trimesh,
                                    Vint id,
                                    Vdouble d,
                                    Vdouble h)

INPUT ARGUMENTS

trimesh      Pointer to TriMesh object.
id           Line id
d            Depth
h            Sizing

OUTPUT ARGUMENTS

None

ERRORS

VIS_ERROR_VALUE is generated if an improper id is specified. VIS_ERROR_VALUE is generated if either d or h is less than zero.

DESCRIPTION

Set element size to be enforced within a specified depth from the input boundary line.


Table of Contents , TriMesh

NAME

vis_TriMeshSetLineStat - set line status

C SPECIFICATION

void vis_TriMeshSetLineStat (vis_TriMesh *trimesh,
                             Vint id,
                             Vint stat)

INPUT ARGUMENTS

trimesh      Pointer to TriMesh object.
id           Line id
stat         Status, bitwise OR
             =VIS_MESH_BIT_GENSPLIT     Split during generation
             =VIS_MESH_BIT_REFSPLIT     Split during refinement

OUTPUT ARGUMENTS

None

ERRORS

VIS_ERROR_VALUE is generated if an improper id is specified.

DESCRIPTION

Set line status. By default, boundary lines are split during generation and refinement.


Table of Contents , TriMesh

NAME

vis_TriMeshRead - read input description from file

C SPECIFICATION

void vis_TriMeshRead (vis_TriMesh *trimesh,
                      Vint type,
                      const Vchar *path)

INPUT ARGUMENTS

trimesh      Pointer to TriMesh object.
type         File type
             =SYS_ASCII              ASCII format
             =SYS_BINARY             Binary format
path         File path

OUTPUT ARGUMENTS

None

ERRORS

SYS_ERROR_ENUM is generated if an improper type is specified. SYS_ERROR_FILE is generated if the file can not be opened. SYS_ERROR_FORMAT is generated if the file contents are not correctly formatted or if a file written by a later version of TriMesh is read.

DESCRIPTION

Read a mesh description from a file which has been previously written by vis_TriMeshWrite. The format of the file is not published and is intended for internal use only.


Table of Contents , TriMesh

NAME

vis_TriMeshWrite - write input description to file

C SPECIFICATION

void vis_TriMeshWrite (vis_TriMesh *trimesh,
                       Vint type,
                       const Vchar *path)

INPUT ARGUMENTS

trimesh      Pointer to TriMesh object.
type         File type
             =SYS_ASCII              ASCII format
             =SYS_BINARY             Binary format
path         File path

OUTPUT ARGUMENTS

None

ERRORS

SYS_ERROR_ENUM is generated if an improper type is specified. SYS_ERROR_FILE is generated if the file can not be opened. SYS_ERROR_OPERATION is generated if the input has not been defined.

DESCRIPTION

Write a mesh description to a file which has been input to TriMesh. The contents of the file is intended for internal use only. This function should be called after all input and meshing parameters have been set to ensure that an accurate input description including correct meshing parameters is written. The binary file format is preferred for accuracy and generally results in smaller file sizes. The primary use of this function is to create a file of the complete mesh description in the case that the TriMesh module fails to properly generate a mesh. This file can then be transmitted to Visual Kinematics for debugging purposes. It is suggested that a file extension of .tri be used for ASCII files and .btri be used for BINARY files.