Vaspackt, A Vector and Streamline Package for Triangular Meshes


David J. Kennison
NCAR, P.O. Box 3000, Boulder, Colorado 80307-3000
email: kennison@ucar.edu

Table of Contents

Note: The mnemonic "DI" appearing occasionally throughout this document stands for "Deferred Implementation" and serves as a link to an explanatory note.


INTRODUCTION

This document describes an NCAR Graphics package called VASPACKT that allows a user to construct, from data on a triangular mesh, plots showing simple vectors, curly vectors, and streamlines. VASPACKT provides a sort of tool kit of FORTRAN subroutines that can be called in various combinations to draw different kinds of plots.

This section is intended to give an overall view of VASPACKT and selected aspects of its design; it covers some details, but, in general, one should refer to the sections "SUBROUTINES" and "PARAMETERS" for detailed descriptions of subroutines and parameters mentioned. (Parameters are mentioned by name; all the names are of the form 'XXX', where XXX is a three-character mnemonic.) The section "ERROR HANDLING" describes error messages written by VASPACKT. The section "EXAMPLES" describes the examples available for VASPACKT.

It is assumed that the reader is familiar with NCAR Graphics in general and has some knowledge of the packages AREAS, EZMAP, and perhaps TDPACK.

The design of VASPACKT is similar to that of an earlier NCAR Graphics Package, called CONPACKT, which allows a user to construct, from data on a triangular mesh, plots showing simple contours and filled contour bands.


Deferred Implementation Note

A few things described in this document have not yet been implemented: In each case, the author awaits user input as to how the above features ought to work and to what degree each is useful.

To warn the user of unimplemented features, sections describing them are marked with a "DI" that serves as a link to this note.


Triangular Mesh Structure

Note: See the CONPACKT example "ctex01" (both the code and the first frame that it produces) for help in understanding the structure of a triangular mesh.

To represent a triangular mesh requires three singly-dimensioned arrays: RPNT defines points, IEDG defines edges (each of which consists of two connected points), and ITRI defines triangles (each of which consists of three connected edges). The elements of each array form "nodes" having nominal lengths as follows:

      PARAMETER (LOPN=6)  !  length of a point node
      PARAMETER (LOEN=4)  !  length of an edge node
      PARAMETER (LOTN=5)  !  length of a triangle node
    
(In some cases, additional elements may be used in some types of nodes, but these are the basic ones that must be present.)

The six elements of a point node are reals, as follows:

  1. the X coordinate of the point;
  2. the Y coordinate of the point;
  3. the Z coordinate of the point;
  4. the X component of the flow field at the point;
  5. the Y component of the flow field at the point;
  6. the Z component of the flow field at the point.
It is the responsibility of the user to ensure that the X, Y, and Z components of the flow field form a vector which is tangent to the surface represented by the triangular mesh.

The four elements of an edge node are integers, as follows:

  1. the base index, in RPNT, of the node defining point 1 of the edge;
  2. the base index, in RPNT, of the node defining point 2 of the edge;
  3. the base index, in ITRI, of the node defining the triangle to the left of the edge, plus the index (1, 2, or 3) of the edge within that triangle node (-1 if there is no triangle to the left);
  4. the base index, in ITRI, of the node defining the triangle to the right of the edge, plus the index (1, 2, or 3) of the edge within that triangle node (-1 if there is no triangle to the right);
The "left" and "right" sides of an edge are defined as they would be by an observer standing on the front side of the surface defined by the triangular mesh, at point 1, and looking toward point 2, of the edge. It is possible, if there are "holes" in the mesh, that there will be no triangle on the left or on the right of an edge, but there must be a triangle on one side or the other.

The five elements of a triangle node are integers, as follows:

  1. the base index, in IEDG, of the node defining edge 1 of the triangle;
  2. the base index, in IEDG, of the node defining edge 2 of the triangle;
  3. the base index, in IEDG, of the node defining edge 3 of the triangle;
  4. a flag set non-zero to block use of the triangle, effectively removing it from the mesh. For simple purposes, the values 0 and 1 suffice; however, see the routines VTTDBF and VTTDBM and the internal parameters 'TBA' and 'TBX' for a description of a scheme allowing one to selectively block triangles by using different bits of this flag;
  5. a flag used by the algorithms that draw simple vectors, curly vectors, and streamlines.
The edges pointed to by a particular triangle node must be given in counter-clockwise order, as viewed from the chosen "front" side of the mesh. In fact, it is the ordering of the nodes that defines which side is the "front" and which side is the "back". In the case of a sphere, one would probably use the outside of the sphere as the "front". In the case of a Moebius strip (which I have experimented with a bit), there is a problem with this - you either have to have a seam across the strip or go around it twice to avoid having a seam - but that's probably not a case of great practical interest ... :-)

The "base index" of a point node, an edge node, or a triangle node is always a non-negative multiple of the length of the node, to which can be added an offset to get the index of a particular element of the node. For example, if IPTT is the base index of a triangle of interest, ITRI(IPTT+1) is its first element, which is the base index of the triangle's first edge. Thus, IEDG(ITRI(IPTT+1)+2) is the second element of the triangle's first edge; that is to say, it is the base index of the second point of the first edge of the triangle with base index IPTT. In a similar fashion, it may be seen that RPNT(IEDG(ITRI(IPTT+1)+2)+3) is the third (Z) coordinate of the second point of the first edge of the triangle with base index IPTT.

It is the pointers from the edge nodes back to the triangle nodes that allow VASPACKT to navigate the mesh, moving from triangle to triangle as it follows a streamline. These pointers are a little tricky to define: if IPTE is the base index of an edge node and IEDG(IPTE+3) is zero or more, saying that there is a triangle to the left of the edge, then IEDG(IPTE+3) is the actual index of that element of the triangle node that points to the edge node; that is, ITRI(IEDG(IPTE+3))=IPTE. The base index of the triangle node defining that triangle is IPTT, where IPTT=LOTN*((IEDG(IPTE+3)-1)/LOTN), and the index of the pointer to the edge within the triangle node is IPTI=IEDG(IPTE+3)-IPTT, so that ITRI(IPTT+IPTI)=IPTE. Similar comments apply to element 4 of an edge node, which points into the triangle node defining the triangle to the right of the edge.

For some types of triangular mesh, the maximum number of points, edges, and triangles can be computed easily:

Once we know, at most, how many points, edges, and triangles we're going to have, we can set parameters defining the space to be reserved for the triangular mesh:

      PARAMETER (MPNT=MNOP*LOPN)  !  space for points
      PARAMETER (MEDG=MNOE*LOEN)  !  space for edges
      PARAMETER (MTRI=MNOT*LOTN)  !  space for triangles
    
Then, we can declare the arrays to hold the point nodes, edge nodes, and triangle nodes defining the triangular mesh:

      DIMENSION RPNT(MPNT),IEDG(MEDG),ITRI(MTRI)
    
In all of the examples, code like that above (throughout the section) will be found.


Types of Triangular Meshes

Descriptions of all the types of triangular meshes that the author has encountered are to be found in the programmer document for CONPACKT, in the section titled "Types of Triangular Meshes". Each of the examples described there could quite easily be turned into an example for VASPACKT by replacing all code involving calls to routines with names of the form CTxxxx by code involving calls to routines with names of the form VTxxxx, and, of course, supplying vector field data instead of simple field data.


Mathematical and Programmatic Considerations

The packages "Vectors" and "Streamlines" work from a rectangular array of data; when that rectangular array is mapped in some manner (for example, onto the surface of a globe), they depend heavily on the use of inverse mapping functions, allowing vectors and streamlines to be generated, positioned, and sized in NDC space, within the plotter frame. Since VASPACKT works from a triangular mesh, the use of inverse mapping functions is, in general, not possible; therefore, vectors and streamlines are generated, positioned, and sized entirely on the surface of the triangular mesh and then projected into a viewing plane and from there into NDC space solely for drawing. As a result, if you are accustomed to using the other packages, you will find the parameter interface for VASPACKT somewhat different. I expended a considerable amount of time and effort in an attempt to more closely match the interfaces of "Vectors" and "Streamlines", some of the resulting code is still in place, and it is possible that the interface may expand during a future enhancement, but the interface as it stands is the natural one, given the way the underlying algorithms work.

The vectors defining the flow field are specified at the vertices of the triangular mesh; at each vertex, X, Y, and Z components are given. Each vector does not, in general, lie in the plane of any of the triangles that meet at its vertex; neither do interpolated vectors in the interiors of triangles. But, in order to trace streamlines through the interiors of triangles, we must be able to project the interpolated vectors at interior points into vectors that do lie in the planes of the triangles, which is tricky. What one is tempted to do is project each interpolated vector into the plane of its triangle using projection lines perpendicular to that plane. Unfortunately, doing that leads to troubling discontinuities at the boundaries of adjoining triangles: it is possible, for example, to have interpolated vectors that seem to imply outward flow from each of a pair of adjoining triangles into the other and this can send the code that traces the streamlines into an infinite loop. Instead, the interpolated vectors are projected into the planes of individual triangles using projection lines radiating from a center point, whose coordinates are given by 'PCX', 'PCY', and 'PCZ'. Doing this ensures continuity of the flow field across the boundaries of adjoining triangles in the principal case of interest: a triangular mesh representing a sphere centered at ('PCX','PCY','PCZ'). In fact, it works in any situation in which the "back" side of each triangle is visible from the point ('PCX','PCY','PCZ') and is not obscured by any other triangle; however, it does not work for completely arbitrary meshes, such as the mushroom-shaped blobs shown in the CONPACKT example "cttd01". This is indeed unfortunate, but, as of this writing, I have not been able to find a better projection method.

Linear interpolation is used to estimate flow field components in the interior of each triangle from user-defined components at the vertices. A possible future enhancement would be to provide optional non-linear interpolation methods which may provide more meaningful results on relatively sparse meshes. For the moment, if you have such a mesh, you will have to use some other package to interpolate to a denser mesh.

Streamlines are traced in a somewhat simplistic fashion, by taking tiny steps in the local interpolated direction of the flow field. Thus, there is cumulative error along each streamline: for example, if the flow field should bend smoothly in one direction, the traced streamline will not bend quite as much as it should. There are ways to compensate for this, but the use of such methods will have to be reserved for future enhancements. Meanwhile, one can make the code trace streamlines more accurately by decreasing the step size ('SLP').


Routines Which May Be Called

The following routines are meant to facilitate the process of creating a triangular mesh of data:

Once a triangular mesh has been defined, the code to draw a vector or streamline plot will probably begin with several calls to set internal parameters affecting the behavior of the routines called after that. All the internal parameters have default values; only those which are to have values different from the default need to be set. Routines which may be called to set the values of parameters are as follows:

In general, once a parameter is given a value by a call to one of these routines, it retains that value until a similar call resets it. Thus, many of the parameter-setting calls need to be done only once and do not need to be repeated for each new vector or streamline plot.

After all required parameters have been set, the process of drawing a vector or streamline plot begins with a call to an initialization routine:

After VTMESH has been called, various other routines may be called:

Four routines may be called when 'MAP' is set to 2, which says that the 3D package TDPACK is being used to project the triangular mesh into the plane.

Finally, to advance the frame, the user must call the SPPS routine FRAME; VASPACKT won't do it.

At any time, it is possible to retrieve the value of an internal parameter by calling one of the three following routines:

Several routines in VASPACKT are not called by the user, but by VASPACKT itself. The default versions of these routines, in all cases but one, do nothing; the routines exist simply to be replaced by the user. These routines are as follows:

Two additional routines are provided for use in error-recovery situations:


Coordinate Systems

The mapping of vectors and streamlines into the plotter frame depends on three things:

By default, to describe lines and other objects on a plot, VASPACKT generates X, Y, and Z coordinates representing points on the triangles defined by the data of the triangular mesh and then discards the Z coordinate, using only the X and Y coordinates as the user coordinates in calls to NCAR Graphics routines.

If 'MAP' is given a positive non-zero value, each triplet of X, Y, and Z coordinates is mapped, prior to use, by a statement of the form

      CALL VTMXYZ (IMAP,XINP,YINP,ZINP,XOTP,YOTP)
    
IMAP is the value of 'MAP'; XINP, YINP, and ZINP are the unmapped (input) 3D coordinates; and XOTP and YOTP are the mapped (output) 2D coordinates to be used as "user coordinates".

The default version of VTMXYZ does the following mappings (where RTOD = 57.2957795130823 (180/pi):

The subroutine VTMXYZ may be replaced by a version which does other desired mappings. If the VASPACKT routines are loaded from a binary library, this can usually be done by just compiling one's own version of the routine, so that it replaces the one from the library. The definitions of mappings 1 and 2 should not be changed.

The way in which "user coordinates" are mapped to "fractional coordinates" in the plotter frame is determined by the current definitions of the "window" in the user system and the "viewport" on the plotter frame. The window and viewport may have been defined by a call to the SPPS routine SET or by calls to GKS routines; the former will be described.

A call to the SPPS routine SET has the form

      CALL SET (XVPL,XVPR,YVPB,YVPT,XWDL,XWDR,YWDB,YWDT,LNLG)
    
All arguments are REALs except for LNLG, which is an INTEGER. The first four arguments must all be between 0 and 1, inclusive; they define a rectangular area in the fractional coordinate space of the plotter frame known as the "viewport". The next four arguments define a rectangular area in "user coordinate" space known as the "window". The final argument indicates whether the mapping of user coordinates into the viewport is to be linear or logarithmic in X and Y.

By default, VASPACKT (specifically, the routine VTMESH ) calls the SPPS routine SET. One may, by zeroing 'SET', prevent this from happening; in that case, one must do the call for oneself or depend on some other utility (such as EZMAP) to have done it.

If VASPACKT calls SET, it always uses LNLG = 1, requesting a linear-linear mapping from the window to the viewport, and it positions the viewport and window as follows: The viewport is positioned as specified by the current values of 'VPL', 'VPR', 'VPB', 'VPT', and 'VPS'. The first four of these specify the position of a "viewport area", in which the viewport is to be centered and made as large as possible; the final one says how the shape of the viewport is to be determined. By default, the position of the window in the user coordinate system is determined by computing the minimum and maximum values of X and Y over all the points of the triangular mesh. 'WDL', 'WDR', 'WDB', and 'WDT' may be used to override this default behavior and specify the exact values to be used in the SET call to define the window.

If the triangular mesh represents data on the surface of a globe of radius 1, then to map the VASPACKT output onto an EZMAP background, one need only set 'MAP' to 1 and initialize EZMAP (which results in a call to the SPPS routine SET).


The Out-of-Range Parameter and Out-of-Range Areas

The parameter 'ORV', if non-zero, specifies an "out-of-range" value. This is only of use when 'MAP' is non-zero, specifying that coordinates are to be mapped by calling the subroutine VTMXYZ. The X coordinate returned by VTMXYZ may be set equal to 'ORV' to indicate that the mapped point is outside the range in which the mapping is defined.

A possible value for 'ORV', if it is to be set non-zero, is 1.E12, which has historically been returned by the EZMAP routines MAPTRN and MAPTRA to indicate a point which is outside the area depicted by a given map projection.

The union of all points for which VTMXYZ returns the out-of-range value constitutes a set of out-of-range areas. Vectors are not placed, and curly vectors and streamlines are not traced, in out-of-range areas (indeed, they cannot be). A binary-halving technique is used to extend lines to the very edge of such areas.

When a line is traced, if two consecutive points are out of range (in range), then the entire line segment connecting those two points is assumed to be out of range (in range). If the detail of the out-of-range areas is small enough, this assumption may cause errors. Giving 'PIS' a non-zero value will cause more points to be examined along each such line segment, thus curing the problem. Alternatively, giving 'PIT' a non-zero value may cure the problem in a more efficient way.


Labels - DI

Two different types of labels may be written by calls to VASPACKT: an informational label and a zero-field label.

The appearance of these labels may be determined in detail by setting parameters:

In all of the above parameter names, a suffixed 'A' means "angle", 'B' means "box flag", 'C' means "color index", 'L' means "line width", 'S' means "size of characters", 'T' means "text of label", 'W' means "white space width", 'X' means "X coordinate", and 'Y' means "Y coordinate".

All labels are written by means of calls to the character-plotting routine PLCHHQ, in the package PLOTCHAR. The angle, in degrees, at which a label is written is determined by 'xxA'. The box flag 'xxB' determines whether or not, prior to writing the label, a box surrounding it is filled, and whether or not, after writing the label, the edge of the box is drawn. If the box is filled, it is done using the color index specified by 'LBC'; if the edge of the box is drawn, it is done using the color index, if any, chosen for the label itself, which is determined by the value of 'xxC'. The line width to be used in drawing the box is determined by 'xxL'. The size (width) of the characters is determined by 'xxS'. The text of the label is determined by 'xxT'; usually, this string may contain embedded substrings of the form '$xxx$', which are to be replaced by the value of the quantity specified by the three-character mnemonic 'xxx'. The width of the "white space" to be left around the label (which defines the dimensions of the box around it) is determined by 'xxW'.


Choosing a Scale Factor - DI

It is possible to specify a scale factor by which field values are to be divided before conversion to a character form for display as a numeric label.

The parameter 'SFS' says how the scale factor is to be chosen. If it is given a value greater than zero, that value is the desired scale factor. If 'SFS' is given a value less than or equal to zero, VASPACKT is directed to choose a scale factor to use, in one of five different ways. The parameter 'SFU' may be retrieved by the user; it specifies the scale factor which has been selected for use.

The scale factor may be displayed as a part of the informational label. This is done by embedding the substring '$SFU$' in the string defining 'ILT'.

The default value of 'SFS' is 1, which essentially specifies that no scale factor is to be used.


Zero Field Detection - DI

The routine VTMESH checks for a flow field which is essentially zero. When such a field is found, 'ZFF' is set non-zero; otherwise, 'ZFF' is zeroed. The value of 'ZFF' may be retrieved by the user.

When 'ZFF' is non-zero, a call to one of the routines VTCVDM, VTCVDR, VTSLDM, VTSLDR, VTSVDM, or VTSVDR will not cause anything to be drawn; instead, the zero-field label will be written.


Workspace Management

The workspace management scheme used in VASPACKT is the same as that used in CONPACKT, even though, at the time of writing, none of the VASPACKT routines requires more than one workspace at a time. The scheme is as follows: The user defines one workspace array of type REAL and another of type INTEGER. In the call to VTMESH that initializes the drawing of a vector or streamline plot, these arrays appear as arguments (called RWRK and IWRK), together with arguments specifying their lengths (LRWK and LIWK). In subsequent calls to other VASPACKT routines that require workspaces, the same arrays appear as arguments, but the lengths do not. The VASPACKT routines cooperate in using these arrays in such a way as not to interfere with one another. Dynamic enlargement of one workspace at the expense of another becomes possible and the probability of running out of space is reduced.

In general, it is safest not to use the workspace arrays for other purposes between one call to a VASPACKT routine and the next (unless the next is to the routine VTMESH, which initializes the workspace pointers).

It is possible to find out how much space has been used in each of the workspace arrays. The parameters 'IWU' and 'RWU' are zeroed by a call to VTMESH and are updated thereafter to reflect maximum usage of space in the arrays. Thus, one might give the arrays large dimensions, create a typical plot, retrieve the values of 'IWU' and 'RWU' to see how much space was actually used, and then reduce the dimensions to more reasonable values.

Currently, workspace usage by all routines can be predicted exactly. However, because this could potentially change in the future, there is a parameter, called 'WSO', that says what to do when a workspace overflow occurs. The four possibilities are as follows: to terminate after printing an error message, to continue running after printing an error message (this is the default), to just continue running without printing anything, or to do a recoverable-error call to SETER and then continue running without printing anything. Of course, in the latter two cases, incomplete plots may result. It is possible to find out whether or not a workspace overflow has occurred during a given call to a VASPACKT routine; this is done by retrieving 'IWU' and 'RWU' and comparing them with the dimensions of the workspace arrays IWRK and RWRK.

If "n" is the number of triangles in the triangular mesh, then

Routines not mentioned above use no workspace.


The Character-Width Multiplier - DI

The parameter 'CWM' is used as a multiplier for all character widths and similar quantities. This makes it possible to scale all such quantities up and down simultaneously. The default value of 'CWM' is 1.


Color-Setting Philosophy

A number of the VASPACKT parameters specify the color of some object The default value of each such parameter is -1, which says that the color is to be determined by the current value of one of the GKS color indices. (The polyline color index is used for lines, the text color index for labels, and the fill area color index for filling label boxes.) If the value of the VASPACKT color-setting parameter for a given object is given a value greater than or equal to zero, it specifies the color index of the color in which the object is to be drawn. Before any object is drawn, the values of the GKS color indices affected are saved; after the object is drawn, the saved values are restored.

This structure allows the use of a tiered approach to color setting. If no color setting whatsoever is done, plots are drawn entirely in the colors specified by the applicable default values of the GKS color indices. If, on the other hand, prior to calling VASPACKT, one defines the color index "IC" (see the next section, "GKS Considerations") and then uses

      CALL GSPLCI (IC)
    
to change the GKS polyline color index, then all polylines drawn by VASPACKT change color. Similarly, one may use the statement

      CALL GSTXCI (IC)
    
to change the GKS text color index and the statement

    CALL GSFACI (IC)
    
to change the GKS fill area color index; the first will cause labels drawn by VASPACKT to change color and the second will cause label boxes filled by VASPACKT to change color.

If, in addition or instead, VASPACKT color-setting parameters are given values greater than or equal to zero, the objects or classes of objects to which those parameters apply are colored accordingly; these colors are used in preference to values preset by calls to GSPLCI, GSTXCI, or GSFACI.

A final opportunity to set color is provided by the user-supplied versions of the "change" routines, with names of the form VTCHxx (DI); calls to GSPLCI, GSTXCI, and GSFACI may occur in such a routine and take precedence over color setting by any other means. Note that, if color is being set for drawing a label, then either or both of the polyline color index and the text color index may need to be set, depending on whether the labels are being drawn by calls to the GKS routine GPL (to draw polylines stroking out the characters) or by calls to the GKS routine GTX (to draw text). In particular, the routine PLCHHQ , in the package PLOTCHAR, which is called by VASPACKT to draw labels, may be directed by the user to draw high-quality characters, which are stroked; medium-quality characters, which are also stroked; or low-quality characters, which are drawn by GTX.


GKS Considerations

Certain assumptions are made by VASPACKT about the state of GKS, as follows:

(1) Like all the utilities in the NCAR graphics package, VASPACKT assumes that GKS has been opened and that the desired workstations have been opened and activated. The statement

      CALL OPNGKS
    
calls the SPPS routine OPNGKS, the GKS equivalent of which is

      CALL GOPKS (6,0)
      CALL GOPWK (1,2,1)
      CALL GACWK (1)
    
creating a single metacode workstation associated with FORTRAN unit 2.

Similarly, at the end of one's program, the workstations must be deactivated and closed and then GKS must be closed. The statement

    CALL CLSGKS
    
calls the SPPS routine CLSGKS, the GKS equivalent of which is

      CALL GDAWK (1)
      CALL GCLWK (1)
      CALL GCLKS
    
(2) It is assumed that the aspect source flags for various quantities are set to "individual". (The NCAR GKS package does this by default, but other packages may not.) To make sure that all the aspect source flags are set correctly, use the following code:

      DIMENSION IASF(13)
      ...
      DATA IASF / 13*1 /
      ...
      CALL GSASF (IASF)
    
(3) Color fill is done by VASPACKT using calls to the GKS routine GFA. To get solid fill, rather than hollow fill, one must call a GKS routine to set the "fill area interior style":

      CALL GSFAIS (1)
    
(This is because the default "fill area interior style", as mandated by the GKS standard, is "hollow", rather than "solid".)

(4) Color-setting by VASPACKT is done by executing calls to the GKS routines GSPLCI, GSTXCI, and GSFACI, with user-defined color indices as arguments. The association of these color indices with colors on the workstations must have been defined previously by the user. This should be done by calling the GKS routine GSCR. The statement

      CALL GSCR (IW,IC,RC,GC,BC)
    
defines, for workstation IW, color index IC, with RGB components RC, GC, and BC. To be consistent with the SPPS routines OPNGKS and CLSGKS, use IW = 1. The value of IC may be any non-negative integer. By default, color index 0 is associated with the color black, which is defined by (RC,GC,BC) = (0.,0.,0.) and is used as the background color, while color index 1 is associated with the color white, which is defined by (RC,GC,BC) = (1.,1.,1.).


SUBROUTINES

All of the VASPACKT routines have six-character names beginning with the letters 'VT'. The user-callable ones are described in detail below.


VTBACK (RPNT,IEDG,ITRI,RWRK,IWRK)

This routine draws a background for a vector or streamline plot.

The initial version of VTBACK does very little. User feedback will be useful in determining what this routine is eventually made to do.

Usage

The routine VTBACK may be called at any time after the initialization call to VTMESH. All it does is draw the perimeter of the current viewport; it does this by calling PERIM, in the package GRIDAL.

Arguments

All five arguments are arrays used in a previous call to one of the routines VTMESH, VTMVRW, or VTMVIW.

RPNT (REAL array, dimensioned as specified in the last call to VTMESH, input) is the user's mesh-point array.

IEDG (INTEGER array, dimensioned as specified in the last call to VTMESH, input) is the user's edge array.

ITRI (INTEGER array, dimensioned as specified in the last call to VTMESH, input) is the user's triangle array.

RWRK (REAL array, dimensioned as specified in the last call to VTMESH or VTMVRW, input/output) is the current real workspace array.

IWRK (INTEGER array, dimensioned as specified in the last call to VTMESH or VTMVIW, input/output) is the current integer workspace array.


VTCHIL (IFLG) - DI

This routine provides user control as the informational label is drawn.

Usage

The routine VTCHIL is not to be called by the user. It is called several times by VASPACKT while the informational label is positioned and drawn. The default version of VTCHIL does nothing. A user-supplied replacement may change attributes such as color and line width (by calling the SPPS routine SETUSV or the appropriate GKS routines).

The text of the label may be retrieved by means of a "CALL VTGETC ('CTM',CVAL)". The text of the label may be changed by means of a "CALL VTSETC ('CTM',CVAL)"; this should only be done during a call with IFLG = 1 or IFLG = 3, and, if it is done for one of those values, it should be done for the other.

The parameters 'LBX' and 'LBY' will have been set to the X and Y coordinates of the center point of the label, in the current user coordinate system.

Arguments

IFLG (INTEGER, input) is positive if an action is about to be taken, negative if an action has just been completed. The action in question is defined by the absolute value of IFLG, as follows:


VTCHZF (IFLG) - DI

This routine provides user control as a constant-field message is drawn.

Usage

The routine VTCHZF is not to be called by the user. It is called several times by VASPACKT while the zero-field label is positioned and drawn. The default version of VTCHZF does nothing. A user-supplied replacement may change attributes such as color and line width (by calling the SPPS routine SETUSV or the appropriate GKS routines).

The text of the label being written may be retrieved by means of a "CALL VTGETC ('CTM',CVAL)". The text of the label may be changed by means of a "CALL VTSETC ('CTM',CVAL)"; this should only be done during a call with IFLG = 1 or 3 and, if it is done for one of those two values, it should also be done for the other.

The parameters 'LBX' and 'LBY' will have been set to the X and Y coordinates of the center point of the label, in the current user coordinate system.

Arguments

IFLG (INTEGER, input) is positive if an action is about to be taken, negative if an action has just been completed. The action in question is defined by the absolute value of IFLG, as follows:


VTCVDM (RPNT,IEDG,ITRI,RWRK,IWRK,IAMA,RTPL)

VTCVDR (RPNT,IEDG,ITRI,RWRK,IWRK)

These routines are used to draw curly vectors for a velocity field defined on a triangular mesh.

Usage

Either of the routines VTCVDM and VTCVDR may be called at any time after the initialization call to VTMESH.

VTCVDM generates the vectors, masks them against a user-specified area map, and generates calls to a user-specified routine - one call for each polyline resulting from the masking process. Each such polyline lies entirely within precisely one of the areas defined by the area map. The user routine may examine the information provided by its arguments, describing the area the polyline is in, and either draw or not draw the polyline. The object of masking the curly vectors may be simply to avoid drawing them through label boxes or it may be something more complicated, like limiting the drawing of the vectors to the ocean areas on an EZMAP background.

VTCVDR generates and draws the vectors, with no masking. (Actually, it's implemented by calling VTCVDM with an argument array IAMA having its single element set to zero, which turns off masking.)

Each curly vector is just a short streamline, of a length, as measured on the surface of the triangular mesh, proportional to the magnitude of the velocity field at the center of the vector. See the descriptions of 'VFR', 'VRL', and 'VRM', which may be used to control the sizes of the vectors.

To distribute the curly vectors more or less evenly on the surface of the triangular mesh, the triangles are considered in random order. A curly vector is placed in a triangle (and centered on its center point) if and only if certain conditions are met: 1) no curly vector has previously passed through the triangle; 2) the largest angle between the velocity vectors at any pair of vertices of the triangle is less than the maximum value specified by 'AM1'; 3) two lines traced, from the starting point, in the two directions perpendicular to the velocity field, for the distance specified by 'TTL', do not cross any curly vector previously drawn; and 4) the entire curly vector can be drawn without crossing or passing too close to any curly vector previously drawn (as determined by tracing lines perpendicular to the velocity field at intervals along the curly vector and of the lengths specified by the values of 'TTS' and 'TTL') or being terminated for some other reason (like hitting an external edge of the mesh, entering a triangle containing another curly vector, or entering a triangle where the largest angle between the velocity vectors at any pair of vertices of the triangle is larger than the value specified by 'AM2').

No curly vector will be placed in any triangle of the mesh that is blocked, as specified by the current values of the blocking masks 'TBA' and 'TBX' and the blocking flag for the triangle.

See the example "vtex02".

Arguments

The first five arguments are arrays used in a previous call to one of the routines VTMESH, VTMVRW, or VTMVIW.

RPNT (REAL array, dimensioned as specified in the last call to VTMESH, input) is the user's mesh-point array.

IEDG (INTEGER array, dimensioned as specified in the last call to VTMESH, input) is the user's edge array.

ITRI (INTEGER array, dimensioned as specified in the last call to VTMESH, input) is the user's triangle array.

RWRK (REAL array, dimensioned as specified in the last call to VTMESH or VTMVRW, input/output) is the current real workspace array.

IWRK (INTEGER array, dimensioned as specified in the last call to VTMESH or VTMVIW, input/output) is the current integer workspace array.

IAMA (INTEGER array, dimensioned as specified in a call to ARINAM, in the package AREAS, input/output) is an array containing an area map which is to be used to mask the curly vectors as they are drawn. If no masking is desired, use an array with its first element zeroed.

RTPL (EXTERNAL subroutine) is the user subroutine which is to process the polylines which result from masking the curly vectors against the area map. It must be declared EXTERNAL in the routine which calls VTCVDM. It will be called repeatedly and must have the following form:

      SUBROUTINE RTPL (XCS,YCS,NCS,IAI,IAG,NAI)
      DIMENSION XCS(*),YCS(*),IAI(*),IAG(*)
      ...
      (CODE TO PROCESS POLYLINE DEFINED BY ARGUMENTS)
      ...
      RETURN
      END
      
The real arrays XCS and YCS hold the X and Y coordinates of NCS points defining a polyline which is to be considered for drawing. For each I greater than or equal to 1 and less than or equal to NAI, IAI(I) is the area identifier for the area in which the polyline lies, relative to the edge group IAG(I). The X and Y coordinates are all normalized device coordinates and it may be assumed that the appropriate SET call has been done. If it is decided to draw the line, it may be done with a call to the SPPS routine CURVE, to the DASHCHAR routine CURVED, to the DASHPACK routine DPCURV, or to the GKS routine GPL.

If the only object of using VTCVDM is to avoid drawing curly vectors through areas having negative area identifiers, then the routine VTDRPL may be used for RTPL. In the routine that calls VTCVDM, insert the declaration

      EXTERNAL VTDRPL
      
and then use VTDRPL for the last argument.

For more information, see the description of the argument LPR of the AREAS subroutine ARDRLN.


VTDRPL (XCS,YCS,NCS,IAI,IAG,NAI)

This routine provides a useful polyline-drawer for other routines.

Usage

If one of the routines VTCVDM, VTSLDM, or VTSVDM is called, and the only object of using it, instead of VTCVDR, VTSLDR, or VTSVDR is to avoid drawing the lines through areas identified by an area map as having negative area identifiers, then, in the routine containing the call, put the declaration

      EXTERNAL VTDRPL
      
and, in the call, use VTDRPL for the argument RTPL. Each time VTDRPL is called, it draws the polyline defined by its first three arguments if, and only if, none of the area identifiers defined by the other three arguments is negative.

Arguments

XCS (a REAL array of dimension at least NCS, input) is an array containing the X coordinates of NCS points defining a polyline.

YCS (a REAL array of dimension at least NCS, input) is an array containing the Y coordinates of NCS points defining a polyline.

NCS (INTEGER, input) is the number of points defining the polyline.

IAI (an INTEGER array of dimension at least NAI, input) is an array of area identifiers for the area in which the polyline lies. For each I from 1 to NAI, IAI(I) is the area identifier of the area with respect to the edge group IAG(I).

IAG (an INTEGER array of dimension at least NAI, input) is an array of group identifiers. See the description of IAI, above.

NAI (INTEGER, input) is the number of area identifiers in the array IAI and the number of group identifiers in the array IAG.


VTGETC (PNAM,CVAL)

This routine is used to get the current value of a parameter of type CHARACTER.

Usage

Use the statement

      CALL VTGETC (PNAM,CVAL)
      
at any time to retrieve in CVAL the current character value of the parameter whose name is PNAM. If that parameter is an array, the array element specified by the current value of 'PAI' will be the one retrieved.

Arguments

PNAM (CHARACTER, input) is the name of a parameter whose character value is to be retrieved. Only the first three characters of PNAM are examined. It is recommended that the rest of the character string be used to improve the readability of the code. For example, instead of just 'CTM', use 'CTM - CHARACTER TEMPORARY'.

CVAL (CHARACTER, output) is a variable in which the value of the parameter specified by PNAM is to be returned.


VTGETI (PNAM,IVAL)

This routine is used to get the current integer value of a parameter.

Usage

Use the statement

      CALL VTGETI (PNAM,IVAL)
      
at any time to retrieve in IVAL the current integer value of the parameter whose name is PNAM. If that parameter is an array, the array element specified by the current value of 'PAI' will be the one retrieved.

Arguments

PNAM (CHARACTER, input) is the name of a parameter whose integer value is to be retrieved. Only the first three characters of PNAM are examined. It is recommended that the rest of the character string be used to improve the readability of the code. For example, instead of just 'SVT', use 'SVT - SIMPLE VECTOR THINNING FLAG'.

IVAL (INTEGER, output) is a variable in which the value of the parameter specified by PNAM is to be returned. If the parameter is of type INTEGER and has the value "i", then IVAL = i; if the parameter is of type REAL and has the value "r", then IVAL = INT(r).


VTGETR (PNAM,RVAL)

This routine is used to get the current real value of a parameter.

Usage

Use the statement

      CALL VTGETR (PNAM,RVAL)
      
at any time to retrieve in RVAL the current real value of the parameter whose name is PNAM. If that parameter is an array, the array element specified by the current value of 'PAI' will be the one retrieved.

Arguments

PNAM (CHARACTER, input) is the name of a parameter whose real value is to be retrieved. Only the first three characters of PNAM are examined. It is recommended that the rest of the character string be used to improve the readability of the code. For example, instead of just 'AHL', use 'AHL - ARROWHEAD LENGTH'.

RVAL (REAL, output) is a variable in which the value of the parameter specified by PNAM is to be returned. If the parameter is of type INTEGER and has the value "i", then RVAL = REAL(i); if the parameter is of type REAL and has the value "r", then RVAL = r.


VTMESH (RPNT,NPNT,LOPN, ... )

(The remaining arguments are IEDG, NEDG, LOEN, ITRI, NTRI, LOTN, RWRK, LRWK, IWRK, and LIWK.)

Initializes the drawing of simple vectors, curly vectors, and/or streamlines on a triangular mesh. VTMESH ignores triangles of the triangular mesh that are blocked by the user, as specified by the low-order bits of the blocking masks 'TBA' and 'TBX' and the blocking flag for each triangle.

Usage

The routine VTMESH is called to initialize the process of drawing a plot showing simple vectors, curly vectors, and/or streamlines, using a triangular array of data. The arguments define the data arrays, a real workspace array, and an integer workspace array.

When VTMESH is called: The dimensions of all the arrays are transferred to variables in COMMON, so that those dimensions may be omitted from calls to other VASPACKT routines. Some needed constants that cannot be set in DATA statements (because their values may be different on different machines) are computed. The internal pointers used to manage workspace usage are initialized. The average length of the edges in the mesh ('AEL') is computed. The ranges of the X, Y, and Z coordinates of the points in the mesh ('XMN', 'XMX', 'YMN', 'YMX', 'ZMN', and 'ZMX') and the ranges of the flow field magnitudes 'DMN' and 'DMX') are determined. The parameter 'ZFF' is set appropriately. The ranges of the 2D coordinates of the mapped points of the mesh in the drawing plane are determined. If VASPACKT is to call the SPPS routine SET, appropriate arguments are determined and SET is called; otherwise, GETSET is called to retrieve the arguments from the user's call to SET. Numeric-label quantities that depend on the range of values in the flow field are initialized (see 'NEL', 'NET', 'NEU', 'NLS', 'NLS', 'NOF', and 'NSD'. A scale factor may be chosen (see 'SFS' and 'SFU').

Arguments

RPNT (REAL array, dimensioned greater than or equal to NPNT x LOPN, input) is the user's mesh-point array.

NPNT (INTEGER, input) is the number of elements in RPNT (that is, the number of points in the triangular mesh, times LOPN).

LOPN (INTEGER, input) is the length of a point node.

IEDG (INTEGER array, dimensioned greater than or equal to NEDG x LOEN, input) is the user's edge array.

NEDG (INTEGER, input) is the number of elements in IEDG (that is, the number of edges of the triangular mesh, times LOEN).

LOEN (INTEGER, input) is the length of an edge node.

ITRI (INTEGER array, dimensioned greater than or equal to NTRI x LOTN, input) is the user's triangle array.

NTRI (INTEGER, input) is the number of elements in ITRI (that is, the number of triangles of the triangular mesh, times LOTN).

LOTN (INTEGER, input) is the length of a triangle node.

RWRK (REAL array, dimensioned LRWK, input/output) is the real work array.

LRWK (INTEGER, input) is the length of RWRK.

IWRK (INTEGER array, dimensioned LIWK, input/output) is the integer work array.

LIWK (INTEGER, input) is the length of IWRK.


VTMVIW (IWKO,IWKN,LWKN)

This routine is called to move what VASPACKT has in the current integer workspace array to a new array.

Usage

When, in the execution of a VASPACKT routine, the amount of space left in the integer workspace array is found to be insufficient, if 'WSO' has the value 3, the error-handling routine SETER is called with an appropriate error message. If, in addition, the user has turned recovery mode on, execution continues and, eventually, control is returned to the user. At that point, the user should detect the fact that an error has occurred. If he/she chooses to try to recover from the error, VTMVIW may be of use: it may be called to move everything from the current integer workspace array to a new (and presumably bigger) one, after which it may be possible to resume execution.

Arguments

IWKO (an input array of type INTEGER, dimensioned as specified in a previous call to VTMESH or VTMVIW) is the current ("old") integer workspace array.

IWKN (an output array of type INTEGER, dimensioned LWKN) is the array which is to become the new integer workspace array.

LWKN (INTEGER, input) is the dimension of the array IWKN.


VTMVRW (RWKO,RWKN,LWKN)

This routine is called to move what VASPACKT has in the current real workspace array to a new array.

Usage

When, in the execution of a VASPACKT routine, the amount of space left in the real workspace array is found to be insufficient, if 'WSO' has the value 3, the error-handling routine SETER is called with an appropriate error message. If, in addition, the user has turned recovery mode on, execution continues and, eventually, control is returned to the user. At that point, the user should detect the fact that an error has occurred. If he/she chooses to try to recover from the error, VTMVRW may be of use: it may be called to move everything from the current real workspace array to a new (and presumably bigger) one, after which it may be possible to resume execution.

Arguments

RWKO (an input array of type REAL, dimensioned as specified in a previous call to VTMESH or VTMVRW) is the current ("old") real workspace array.

RWKN (an output array of type REAL, dimensioned LWKN) is the array which is to become the new real workspace array.

LWKN (INTEGER, input) is the dimension of the array RWKN.


VTMXYZ (IMAP,XINP,YINP,ZINP,XOTP,YOTP)

This routine defines mappings from the 3D coordinate system of the triangular mesh to the 2D "user" coordinate system in which the mapped vectors and streamlines are being drawn.

Usage

VTMXYZ is not to be called by the user. It is called by various VASPACKT routines when 'MAP' is non-zero. A user may supply his or her own version of the routine in order to define other mappings.

The first argument in a call to VTMXYZ will always be positive; the call is intended to map the X, Y, and Z coordinates of a point from the 3D space in which the triangular mesh is defined to X and Y "user" coordinates in the 2D space of the drawing plane.

(Note, however, that, if the same routine is being used as a replacement for both VTMXYZ and the analogous CONPACKT routine CTMXYZ, then negative values of the first argument can occur and one should review the discussion of that routine.)

The default version of VTMXYZ is as follows:

      SUBROUTINE VTMXYZ (IMAP,XINP,YINP,ZINP,XOTP,YOTP)
        DATA RTOD / 57.2957795130823 /  !  (radians to degrees)
        IF (IMAP.EQ.1) THEN
          RLAT=RTOD*ASIN(ZINP/SQRT(XINP*XINP+YINP*YINP+ZINP*ZINP))
          IF (XINP.EQ.0..AND.YINP.EQ.0.)
            RLON=0.
          ELSE
            RLON=RTOD*ATAN2(YINP,XINP)
          END IF
          CALL MAPTRA (RLAT,RLON,XOTP,YOTP)
        ELSE IF (IMAP.EQ.-1) THEN
          CALL MAPTRI (XINP,YINP,XOTP,YOTP)
        ELSE IF (IMAP.EQ.2) THEN
          CALL TDPRPT (XINP,YINP,ZINP,XOTP,YOTP)
        ELSE
          XOTP=XINP
          YOTP=YINP
        END IF
        RETURN
      END
      
When VTMXYZ is called with IMAP = 1, the incoming X, Y and Z coordinates are assumed to represent points on the surface of a sphere of radius 1; from these, it computes values of latitude and longitude and calls the EZMAP routine MAPTRA to find the X and Y coordinates on the map of the projection of the specified point on the globe; those coordinates are returned as the outgoing X and Y coordinates.

When IMAP = -1 (which can only happen if the call comes from the package CONPACKT), the incoming X and Y coordinates are assumed to be the X and Y coordinates of a projected point on the map; the EZMAP routine MAPTRI is called to find the latitude and longitude of the original point on the globe and those values are returned as the outgoing X and Y coordinates. If the point is off the map (as, for example, when an orthographic projection is used and the point is outside the circle of radius 1 into which the visible hemisphere of the earth is mapped by that projection), then MAPTRI will return the value 1.E12 (which should be declared the "out-of-range" value, 'ORV', for VASPACKT).

When VTMXYZ is called with IMAP = 2, the incoming X, Y, and Z coordinates are assumed to represent points on an arbitrary mesh in 3-space; these are projected to an image plane by calling the routine TDPRPT, in the 3D package TDPACK.

Note that calling VTMXYZ with IMAP = -2 does not use TDPACK; furthermore, when 'MAP' is given the value 2, 'ORV' should not be set non-zero; there is no "out-of-range" value.

If IMAP is anything else, the input X and Y coordinates are simply returned as the output X and Y coordinates.

If VTMXYZ is changed to do a new mapping for a particular value of 'MAP', it must be made to respond properly to a first argument with value +'MAP' or -'MAP' .

Arguments

IMAP (INTEGER, input) is greater than zero if the object of the call is to do a forward mapping and less than zero if the object of the call is to check the "out-of-range" status of a point in the user coordinate system. The absolute value of IMAP will be equal to the current value of 'MAP', identifying the mapping to be used.

XINP (REAL, input) is used in one of two ways:

YINP (REAL, input) is used in one of two ways:

ZINP (REAL, input) is only used when IMAP is greater than zero, in which case it is the Z coordinate of a point on the triangular mesh. When IMAP is less than zero, ZINP is ignored.

XOTP (REAL, output) and YOTP (REAL, output) are used in one of two ways:

To reiterate: if the point (XINP,YINP) cannot be mapped for any reason, some recognizable impossible value should be returned for both of XOTP and YOTP and 'ORV' should be given that value, thereby allowing VASPACKT routines that call VTMXYZ to determine whether or not a point being mapped is visible or not. The value used for this purpose by the EZMAP routines MAPTRA and MAPTRI is 1.E12.


VTRSET

Resets all parameters to their initial default values.

Usage

Use "CALL VTRSET" to reset all parameters to their default values.

Arguments

None.


VTSETC (WHCH,CVAL)

This routine is called to set the value of a parameter of type CHARACTER.

Usage

Use the statement

      CALL VTSETC (PNAM,CVAL)
      
to give the parameter whose name is PNAM the character value CVAL. If that parameter is an array, the element specified by the current value of 'PAI' will be the one changed.

Arguments

PNAM (CHARACTER, input) is the name of a parameter to be given a character value. Only the first three characters of PNAM are examined. It is recommended that the rest of the character string be used to improve the readability of the code. For example, instead of 'CTM', use 'CTM - CHARACTER TEMPORARY'.

CVAL (CHARACTER, input) is a character constant or variable, the value of which is to be given to the parameter specified by PNAM.


VTSETI (WHCH,IVAL)

This routine is called to give a new integer value to a parameter.

Usage

Use the statement

      CALL VTSETI (PNAM,IVAL)
      
to give the parameter whose name is PNAM the integer value IVAL. If that parameter is an array, the element specified by the current value of 'PAI' will be the one changed.

Arguments

PNAM (CHARACTER, input) is the name of a parameter to be given an integer value. Only the first three characters of PNAM are examined. It is recommended that the rest of the character string be used to improve the readability of the code. For example, instead of 'SVT', use 'SVT - SIMPLE VECTOR THINNING FLAG'.

IVAL (INTEGER, input) is an expression, the value of which is to be given to the parameter specified by PNAM. If the parameter is of type INTEGER, it is given the value IVAL; if the parameter is of type REAL, it is given the value REAL(IVAL).


VTSETR (WHCH,RVAL)

This routine is called to give a new real value to a parameter.

Usage

Use the statement

      CALL VTSETR (PNAM,RVAL)
      
to give the parameter whose name is PNAM the real value RVAL. If that parameter is an array, the element specified by the current value of 'PAI' will be the one changed.

Arguments

PNAM (CHARACTER, input) is the name of a parameter to be given a real value. Only the first three characters of PNAM are examined. It is recommended that the rest of the character string be used to improve the readability of the code. For example, instead of 'AHL', use 'AHL - ARROWHEAD LENGTH'.

RVAL (REAL, input) is an expression, the value of which is to be given to the parameter specified by PNAM. If the parameter is of type INTEGER, it is given the value INT(RVAL); if the parameter is of type REAL, it is given the value RVAL.


VTSLDM (RPNT,IEDG,ITRI,RWRK,IWRK,IAMA,RTPL)

VTSLDR (RPNT,IEDG,ITRI,RWRK,IWRK)

These routines are used to draw streamlines for a velocity field defined on a triangular mesh.

Usage

Either of the routines VTSLDM and VTSLDR may be called at any time after the initialization call to VTMESH.

VTSLDM generates the streamlines, masks them against a user-specified area map, and generates calls to a user-specified routine - one call for each polyline resulting from the masking process. Each such polyline lies entirely within precisely one of the areas defined by the area map. The user routine may examine the information provided by its arguments, describing the area the polyline is in, and either draw or not draw the polyline. The object of masking the streamlines may be simply to avoid drawing them through label boxes or it may be something more complicated, like limiting the drawing of the streamlines to the ocean areas on an EZMAP background.

VTSLDR generates and draws the streamlines, with no masking. (Actually, it's implemented by calling VTSLDM with an argument array IAMA having its single element set to zero, which turns off masking.)

The following algorithm is used to achieve a pleasing distribution of streamlines on a triangular mesh consisting of N triangles:

The net effect of this rather complicated process is to fill the surface of the triangular mesh with groups of streamlines that are positioned at approximately regular intervals, as specified by 'SLS'.

As each streamline is drawn, arrowheads are drawn at regular intervals of 'AHS' along its length. Each arrowhead is constructed by drawing two short, possibly slightly curved, lines of the length specified by 'AHL': where the two lines meet, at the streamline, the angle between them is determined by 'AHA' and each maintains a constant angle with respect to the flow field along its entire length. This technique avoids the problem of using straight arrowheads that could cross the streamline in turbulent regions, where the streamline is bending sharply.

The arrowheads on each streamline are shifted along it by a random amount that is unique to that streamline. This is meant to avoid having the arrowheads on all of the streamlines generated by a particular streamline generator line up in distracting rows. It can happen that arrowheads on closely-spaced streamlines overlap in a displeasing fashion; in some cases (as, for example, when preparing a particular plot for publication), it may be worthwhile to change the value of 'RNG', which will change the set of random numbers used.

Tracing and/or drawing of each streamline generator, each streamline, and each segment of each arrowhead is done using points that are separated on the surface of the triangular mesh by a distance specified by 'SLP'. Making 'SLP' smaller will give one streamlines that more nearly reflect the actual path of a particle in the flow field, but it will take more time to draw them and the resulting metafile will be larger.

By default, streamlines are drawn in the current foreground color. However, the color of each streamline may vary along its length, as determined by the varying value of an associated quantity chosen by the user. See the descriptions of 'CTV', 'NLV', 'CLR', and 'TVL'.

No streamline will be drawn through any triangle of the mesh that is blocked, as specified by the current values of the blocking masks 'TBA' and 'TBX' and the blocking flag for the triangle.

See the example "vtex03".

Arguments

The first five arguments are arrays used in a previous call to one of the routines VTMESH, VTMVRW, or VTMVIW.

RPNT (REAL array, dimensioned as specified in the last call to VTMESH, input) is the user's mesh-point array.

IEDG (INTEGER array, dimensioned as specified in the last call to VTMESH, input) is the user's edge array.

ITRI (INTEGER array, dimensioned as specified in the last call to VTMESH, input) is the user's triangle array.

RWRK (REAL array, dimensioned as specified in the last call to VTMESH or VTMVRW, input/output) is the current real workspace array.

IWRK (INTEGER array, dimensioned as specified in the last call to VTMESH or VTMVIW, input/output) is the current integer workspace array.

IAMA (INTEGER array, dimensioned as specified in a call to ARINAM, in the package AREAS, input/output) is an array containing an area map which is to be used to mask the streamlines as they are drawn. If no masking is desired, use an array with its first element zeroed.

RTPL (EXTERNAL subroutine) is the user subroutine which is to process the polylines which result from masking the streamlines against the area map. It must be declared EXTERNAL in the routine which calls VTCVDM. It will be called repeatedly and must have the following form:

      SUBROUTINE RTPL (XCS,YCS,NCS,IAI,IAG,NAI)
      DIMENSION XCS(*),YCS(*),IAI(*),IAG(*)
      ...
      (CODE TO PROCESS POLYLINE DEFINED BY ARGUMENTS)
      ...
      RETURN
      END
      
The real arrays XCS and YCS hold the X and Y coordinates of NCS points defining a polyline which is to be considered for drawing. For each I greater than or equal to 1 and less than or equal to NAI, IAI(I) is the area identifier for the area in which the polyline lies, relative to the edge group IAG(I). The X and Y coordinates are all normalized device coordinates and it may be assumed that the appropriate SET call has been done. If it is decided to draw the line, it may be done with a call to the SPPS routine CURVE, to the DASHCHAR routine CURVED, to the DASHPACK routine DPCURV, or to the GKS routine GPL.

If the only object of using VTSLDM is to avoid drawing curly vectors through areas having negative area identifiers, then the routine VTDRPL may be used for RTPL. In the routine that calls VTSLDM, insert the declaration

      EXTERNAL VTDRPL
      
and then use VTDRPL for the last argument.

For more information, see the description of the argument LPR of the AREAS subroutine ARDRLN.


VTSVDM (RPNT,IEDG,ITRI,RWRK,IWRK,IAMA,RTPL)

VTSVDR (RPNT,IEDG,ITRI,RWRK,IWRK)

These routines are used to draw simple vectors for a velocity field defined on a triangular mesh.

Usage

Either of the routines VTSVDM and VTSVDR may be called at any time after the initialization call to VTMESH.

VTSVDM generates the simple vectors, masks them against a user-specified area map, and generates calls to a user-specified routine - one call for each polyline resulting from the masking process. Each such polyline lies entirely within precisely one of the areas defined by the area map. The user routine may examine the information provided by its arguments, describing the area the polyline is in, and either draw or not draw the polyline. The object of masking the vectors may be simply to avoid drawing them through label boxes or it may be something more complicated, like limiting the drawing of the vectors to the ocean areas on an EZMAP background.

VTSVDR generates and draws the vectors, with no masking. (Actually, it's implemented by calling VTSVDM with an argument array IAMA having its single element set to zero, which turns off masking.)

Each simple vector is just an arrow on the triangular mesh, of a length, as measured on the surface of the mesh, proportional to the magnitude of the velocity field at the center of the vector. See the descriptions of 'VFR', 'VRL', and 'VRM', which may be used to control the sizes of the vectors.

If 'SVT' is given a zero value, a simple vector is drawn at the center of every triangle. For a typically dense mesh, this yields far too many vectors, so the default value of the parameter is non-zero, activating a culling algorithm that results in the drawing of simple vectors at the centers of a subset of the triangles. To distribute the vectors more or less evenly on the surface of the triangular mesh, the triangles are considered in random order. For more information, see the description of 'SVT'.

No vector will be placed in any triangle of the mesh that is blocked, as specified by the current values of the blocking masks 'TBA' and 'TBX' and the blocking flag for the triangle.

See the example "vtex01".

Arguments

The first five arguments are arrays used in a previous call to one of the routines VTMESH, VTMVRW, or VTMVIW.

RPNT (REAL array, dimensioned as specified in the last call to VTMESH, input) is the user's mesh-point array.

IEDG (INTEGER array, dimensioned as specified in the last call to VTMESH, input) is the user's edge array.

ITRI (INTEGER array, dimensioned as specified in the last call to VTMESH, input) is the user's triangle array.

RWRK (REAL array, dimensioned as specified in the last call to VTMESH or VTMVRW, input/output) is the current real workspace array.

IWRK (INTEGER array, dimensioned as specified in the last call to VTMESH or VTMVIW, input/output) is the current integer workspace array.

IAMA (INTEGER array, dimensioned as specified in a call to ARINAM, in the package AREAS, input/output) is an array containing an area map which is to be used to mask the simple vectors as they are drawn. If no masking is desired, use an array with its first element zeroed.

RTPL (EXTERNAL subroutine) is the user subroutine which is to process the polylines which result from masking the simple vectors against the area map. It must be declared EXTERNAL in the routine which calls VTCVDM. It will be called repeatedly and must have the following form:

      SUBROUTINE RTPL (XCS,YCS,NCS,IAI,IAG,NAI)
      DIMENSION XCS(*),YCS(*),IAI(*),IAG(*)
      ...
      (CODE TO PROCESS POLYLINE DEFINED BY ARGUMENTS)
      ...
      RETURN
      END
      
The real arrays XCS and YCS hold the X and Y coordinates of NCS points defining a polyline which is to be considered for drawing. For each I greater than or equal to 1 and less than or equal to NAI, IAI(I) is the area identifier for the area in which the polyline lies, relative to the edge group IAG(I). The X and Y coordinates are all normalized device coordinates and it may be assumed that the appropriate SET call has been done. If it is decided to draw the line, it may be done with a call to the SPPS routine CURVE, to the DASHCHAR routine CURVED, to the DASHPACK routine DPCURV, or to the GKS routine GPL.

If the only object of using VTSVDM is to avoid drawing curly vectors through areas having negative area identifiers, then the routine VTDRPL may be used for RTPL. In the routine that calls VTSVDM, insert the declaration

      EXTERNAL VTDRPL
      
and then use VTDRPL for the last argument.

For more information, see the description of the argument LPR of the AREAS subroutine ARDRLN.


VTTDBF (RPNT,IEDG,ITRI,RWRK,IWRK,IFLG,ATOL)

This routine assumes that the triangular mesh is being projected using the 3D package TDPACK. When called, it sets bits of the triangle-blocking flags for all triangles of the mesh that are not currently blocked by the user in such a way as to enable identifying those that are seen from the "wrong side", those that are seen nearly edge-on, and/or those that are partially or completely hidden by other triangles of the mesh.

Let the low-order seven bits of each triangle's blocking flag be numbered (from left to right) B6, B5, B4, B3, B2, B1, and B0; the bits are assigned as follows:

    B6 B5 B4 B3 B2 B1 B0
     \  \  \  \  \  \  \__ reserved for user blocking of triangle
      \  \  \  \  \  \____ right (or only) eye, triangle seen from the wrong side
       \  \  \  \  \______ right (or only) eye, triangle edge-on to the line of sight
        \  \  \  \________ right (or only) eye, triangle hidden by other triangles
         \  \  \__________ left eye, triangle seen from the wrong side
          \  \____________ left eye, triangle edge-on to the line of sight
           \______________ left eye, triangle hidden by other triangles
    
If the final argument (OTEP) in the last call to TDINIT (the offset to the eye position), was greater or equal to zero, then VTTDBF will set bits B3, B2, and B1 of each triangle blocking flag; if OTEP was less than zero, then VTTDBF will set bits B6, B5, and B4 of each triangle blocking flag. Bit B0 is not affected by the call, but the upper bits (B7 and above) are cleared for any triangle that is not blocked by the user.

The blocking flag allows one to maintain visibility information for all triangles of the mesh from two different viewpoints, which means that, by setting the triangle blocking mask parameters 'TBA' and 'TBX' appropriately, one can draw views from those two positions, on each view showing only the triangles visible from that viewpoint.

The argument IFLG allows the caller to say which conditions are to be tested for (as detailed below, in the section "Arguments"); when it is given the value 2 or 3, an algorithm is executed to determine which triangles are partially or completely hidden by other triangles. To run efficiently, this algorithm requires some integer workspace in IWRK; by default, it uses 2500 words, as specified by the value of 'IWB'; increasing the value of 'IWB' (and, of course, the declared length of IWRK) may make this algorithm run even faster. Some experimentation may be required to determine the optimum value to use.

Usage

The routine VTTDBF may be called at any time after the initialization call to VTMESH and the appropriate initialization calls to TDPACK.

Arguments

The first five arguments are arrays used in a previous call to one of the routines VTMESH, VTMVRW, or VTMVIW.

RPNT (REAL array, dimensioned as specified in the last call to VTMESH, input) is the user's mesh-point array.

IEDG (INTEGER array, dimensioned as specified in the last call to VTMESH, input) is the user's edge array.

ITRI (INTEGER array, dimensioned as specified in the last call to VTMESH, input) is the user's triangle array.

RWRK (REAL array, dimensioned as specified in the last call to VTMESH or VTMVRW, input/output) is the current real workspace array.

IWRK (INTEGER array, dimensioned as specified in the last call to VTMESH or VTMVIW, input/output) is the current integer workspace array.

IFLG (INTEGER, input), is an expression, the value of which must be 0, 1, 2, or 3, with meanings as follows:

ATOL (REAL, input), is an expression, the value of which is a tolerance, in degrees, for the "edge-on" tests. If ATOL is less than or equal to zero, edge-on testing is turned off; otherwise, edge-on triangles are those whose center-point normals are within ATOL degrees of being perpendicular to the line of sight to that point.


VTTDBM (IHBX,IEBX,IWBX,IUBX,IHBA,IEBA,IWBA,IUBA)

This routine assumes that the triangular mesh is being projected using the 3D package TDPACK. When called, it sets the values of 'TBA' and 'TBX', which are used as masks for the triangle blocking flags, in such a way as to achieve a particular desired effect.

Let the low-order seven bits of each triangle's blocking flag be numbered (from left to right) B6, B5, B4, B3, B2, B1, and B0; the bits are assigned as follows:

    B6 B5 B4 B3 B2 B1 B0
     \  \  \  \  \  \  \__ reserved for user blocking of triangle
      \  \  \  \  \  \____ right (or only) eye, triangle seen from the wrong side
       \  \  \  \  \______ right (or only) eye, triangle edge-on to the line of sight
        \  \  \  \________ right (or only) eye, triangle hidden by other triangles
         \  \  \__________ left eye, triangle seen from the wrong side
          \  \____________ left eye, triangle edge-on to the line of sight
           \______________ left eye, triangle hidden by other triangles
    
The user sets the B0 bits of the blocking flags directly; the routine VTTDBF is called to set the others. Subsequently, before drawing anything derived from the triangular mesh (streamlines, for example), a call to VTTDBM may be done to determine how the bits of the blocking flags are to be interpreted.

If the final argument (OTEP) in the last call to TDINIT (the offset to the eye position), was greater or equal to zero, VTTDBM will set bits B3, B2, B1, and B0 of 'TBA' and 'TBX', thus generating masks for the right (or only) eye; if OTEP was less than zero, VTTDBM will set bits B6, B5, B4, and B0 of 'TBA' and 'TBX', thus generating masks for the left eye.

Each bit of 'TBX' (an XOR mask) that is a "1" acts as a toggle for the corresponding bit of a triangle's blocking flag, reversing its meaning, while each bit of 'TBA' (an AND mask) that is a "1" acts as a selector for the corresponding bit of a triangle's blocking flag, selecting it as a meaningful bit for testing purposes.

For example, the call

C                x x x x a a a a
C                h e w u h e w u
    CALL VTTDBM (0,0,0,0,1,1,1,1)
    
says that no bits of the triangles' blocking flags are to be toggled and that all of the bits are to be capable of blocking the triangle. The effect will be to block all triangles that are hidden, edge-on, seen from the wrong side, or user-blocked.

The call

C                x x x x a a a a
C                h e w u h e w u
    CALL VTTDBM (0,0,0,0,1,1,0,1)
    
says that no bits of the triangles' blocking flags are to be toggled and that all of the bits except the "wrong-side" flag are to be capable of blocking the triangle. This allows one to (for example) draw the triangular-mesh edges, no matter which side of the mesh the triangles are seen from.

The call

C                x x x x a a a a
C                h e w u h e w u
    CALL VTTDBM (1,1,1,0,1,1,1,1)
    
says that the "hidden", "edge-on", and "wrong-side" bits of the triangles' blocking flags are to be toggled and that all of the bits in the flag are to be capable of blocking the triangle. This would allow one to use only those triangles that not blocked by the user, but are hidden, edge-on, or viewed from the wrong side. (It's not completely clear why one would want to do this, but it's possible to do it.)

Usage

The routine VTTDBF may be called at any time after the initialization call to VTMESH and the appropriate initialization calls to TDPACK.

Arguments

IHBX (INTEGER, input), is an expression, the value of which must be 0 or 1, which provides the value of bit B6 or B3 of 'TBX'. This bit toggles the value of the "hidden" bit of the triangle's blocking flag.

IEBX (INTEGER, input), is an expression, the value of which must be 0 or 1, which provides the value of bit B5 or B2 of 'TBX'. This bit toggles the value of the "edge-on" bit of the triangle's blocking flag.

IWBX (INTEGER, input), is an expression, the value of which must be 0 or 1, which provides the value of bit B4 or B1 of 'TBX'. This bit toggles the value of the "wrong-side" bit of the triangle's blocking flag.

IUBX (INTEGER, input), is an expression, the value of which must be 0 or 1, which provides the value of bit B0 of 'TBX'. This bit toggles the value of the "user" bit of the triangle's blocking flag.

IHBA (INTEGER, input), is an expression, the value of which must be 0 or 1, which provides the value of bit B6 or B3 of 'TBA'. This bit masks the value of the "hidden" bit of the triangle's blocking flag.

IEBA (INTEGER, input), is an expression, the value of which must be 0 or 1, which provides the value of bit B5 or B2 of 'TBA'. This bit masks the value of the "edge-on" bit of the triangle's blocking flag.

IWBA (INTEGER, input), is an expression, the value of which must be 0 or 1, which provides the value of bit B4 or B1 of 'TBA'. This bit masks the value of the "wrong-side" bit of the triangle's blocking flag.

IUBA (INTEGER, input), is an expression, the value of which must be 0 or 1, which provides the value of bit B0 of 'TBA'. This bit masks the value of the "user" bit of the triangle's blocking flag.


VTTDDM (RPNT,IEDG,ITRI,RWRK,IWRK,IDIA)

This routine assumes that routines from the 3D package TDPACK are being used to project the 3-dimensional triangular mesh into a 2-dimensional image space and calls TDLINE repeatedly to draw that part of the mesh which is unblocked, where the blocking is as specified by the blocking masks 'TBA' and 'TBX' and the blocking flags for the triangles.

Usage

The routine VTTDDM may be called at any time after the initialization call to VTMESH. It is given arrays defining a triangular mesh of data, a real workspace array, an integer workspace array, and a flag that can be used to suppress certain portions of the mesh.

Arguments

The first five arguments are arrays used in a previous call to one of the routines VTMESH, VTMVRW, or VTMVIW.

RPNT (REAL array, dimensioned as specified in the last call to VTMESH, input) is the user's mesh-point array.

IEDG (INTEGER array, dimensioned as specified in the last call to VTMESH, input) is the user's edge array.

ITRI (INTEGER array, dimensioned as specified in the last call to VTMESH, input) is the user's triangle array.

RWRK (REAL array, dimensioned as specified in the last call to VTMESH or VTMVRW, input/output) is the current real workspace array.

IWRK (INTEGER array, dimensioned as specified in the last call to VTMESH or VTMVIW, input/output) is the current integer workspace array.

IDIA (INTEGER, input), if non-zero, is the index of an element in each edge node that acts as a flag to indicate whether that edge is to be drawn (zero) or not (non-zero). See the example "cttd01", for the analogous CONPACKT routine CTTDDM, which uses this feature to suppress the drawing of those edges of the mesh that were diagonals of the quadrilaterals of the original mesh from which the triangular mesh was created. Note that, if this feature is used, code must be inserted to create the specified elements in the edge nodes.


VTTDFM (RPNT,IEDG,ITRI,RWRK,IWRK)

This routine assumes that routines from the 3D package TDPACK are being used to project the 3-dimensional triangular mesh into a 2-dimensional image space and uses routines from that package to fill those triangles of the mesh that are unblocked, where the blocking is as specified by the blocking masks 'TBA' and 'TBX' and the blocking flags for the triangles. The fill is done in the color specified by the last call to the GKS routine GSFACI.

Usage

The routine VTTDFM may be called at any time after the initialization call to VTMESH. It is given arrays defining a triangular mesh of data, a real workspace array, and an integer workspace array.

Arguments

All five arguments are arrays used in a previous call to one of the routines VTMESH, VTMVRW, or VTMVIW.

RPNT (REAL array, dimensioned as specified in the last call to VTMESH, input) is the user's mesh-point array.

IEDG (INTEGER array, dimensioned as specified in the last call to VTMESH, input) is the user's edge array.

ITRI (INTEGER array, dimensioned as specified in the last call to VTMESH, input) is the user's triangle array.

RWRK (REAL array, dimensioned as specified in the last call to VTMESH or VTMVRW, input/output) is the current real workspace array.

IWRK (INTEGER array, dimensioned as specified in the last call to VTMESH or VTMVIW, input/output) is the current integer workspace array.


VTTMRG (IDIM,JDIM,RLAT,RLON,RDAT, ... )

(The remaining arguments are ISCR, SVAL, RTMI, RPNT, MPNT, NPNT, LOPN, IEDG, MEDG, NEDG, LOEN, ITRI, MTRI, NTRI, and LOTN.)

The routine VTTMRG ("VaspackT, Triangular Mesh from Rectangular mesh on Globe") is intended to simplify the process of creating triangular meshes of a particular type: given arrays defining a rectangular grid of data deformed to wrap around the globe, it returns arrays defining a triangular mesh representing the data.

Usage

This routine is called using a FORTRAN statement like the following:
        CALL VTTMRG (IDIM,JDIM,            !  dimensioning information
     +               RLAT,RLON,RDAT,ISCR,  !  data arrays, scratch array
     +               SVAL,RTMI,            !  special value, index mapper
     +               RPNT,MPNT,NPNT,LOPN,  !  point node array
     +               IEDG,MEDG,NEDG,LOEN,  !  edge node array
     +               ITRI,MTRI,NTRI,LOTN)  !  triangle node array
      

Arguments

IDIM (INTEGER, input) is the first dimension of the rectangular mesh.

JDIM (INTEGER, input) is the second dimension of the rectangular mesh.

RLAT and RLON (REAL arrays, dimensioned IDIM x JDIM, input) specify the latitudes and longitudes of the node points of the rectangular mesh. The mesh is the collection of quadrilaterals defined by corner points having indices (I,J), (I+1,J), (I,J+1), and (I+1,J+1), for all pairs (I,J) such that I is between 1 and IDIM-1, inclusive, and J is between 1 and JDIM-1, inclusive. The mesh may (and, indeed, probably will) touch itself along certain "seams", but it must not overlap itself.

RDAT (REAL array, dimensioned IDIM x JDIM, input) specifies the data values at the points of the rectangular mesh.

ISCR (INTEGER array, dimensioned IDIM x JDIM x 4, scratch) is a scratch array required by VTTMRG.

SVAL (REAL, input) is a value which, if used in the array RDAT, marks that datum as "special" or "missing". If there are no such values in the array RDAT, set SVAL to some value known not to occur in it.

RTMI ("Routine To Map Indices", user subroutine, input) is a user-defined subroutine describing how the edges of the rectangular mesh, as deformed onto the surface of the globe, fit together. RTMI allows VTTMRG to create a triangular mesh that contains only as many distinct points as there were different points in the rectangular mesh and that has no "seams" where the edges of the rectangular mesh came together.

RTMI must be declared EXTERNAL in the routine that calls VTTMRG; it will be called using FORTRAN statements like this:

        CALL RTMI (IDIM,JDIM,IINI,JINI,IINO,JINO)
      
The arguments IDIM and JDIM are as defined above. The arguments IINI and JINI are input expressions of type INTEGER defining the indices of a particular point of the rectangular mesh (where IINI is between 1 and IDIM and JINI is between 1 and JDIM, inclusive). The arguments IINO and JINO are output variables of type INTEGER that receive the values to be used for the specified point of the mesh in place of IINI and JINI. In general, IINO = IINI and JINO = JINI everywhere except at points that are coincident with other points of the mesh. For example, if the rectangular mesh wraps around the globe in such a way that the entire bottom and top edges of the mesh (for J = 1 and J = JDIM, respectively) each map into a single point (typically the south pole and the north pole, respectively) and the left and right edges of the mesh (for I = 1 and I = IDIM) are coincident on the globe, then one would define RTMI as follows:

      SUBROUTINE RTMI (IDIM,JDIM,IINI,JINI,IINO,JINO)
        IF (JINI.EQ.1) THEN          !  point in first row of mesh
          IINO=1
          JINO=1
        ELSE IF (JINI.EQ.JDIM) THEN  !  point in last row of mesh
          IINO=1
          JINO=JDIM
        ELSE IF (IINI.EQ.IDIM) THEN  !  point in last column of mesh
          IINO=1
          JINO=JINI
        ELSE                         !  all other points of the mesh
          IINO=IINI
          JINO=JINI
        END IF
        RETURN
      END
      
RPNT (REAL array, dimensioned greater than or equal to MPNT x LOPN, output) receives the point array.

MPNT (INTEGER, input) is the dimension of RPNT.

NPNT (INTEGER, output) is the number of elements returned in RPNT (that is, the number of points in the triangular mesh, times LOPN).

LOPN (INTEGER, input) is the length of a point node.

IEDG (INTEGER array, dimensioned greater than or equal to MEDG x LOEN, output) receives the edge array.

MEDG (INTEGER, input) is the dimension of IEDG.

NEDG (INTEGER, output) is the number of elements returned in IEDG (that is, the number of edges of the triangular mesh, times LOEN).

LOEN (INTEGER, input) is the length of an edge node.

ITRI (INTEGER array, dimensioned greater than or equal to NTRI x LOTN, output) receives the triangle array.

MTRI (INTEGER, input) is the dimension of ITRI.

NTRI (INTEGER, output) is the number of elements returned in ITRI (that is, the number of triangles of the triangular mesh, times LOTN).

LOTN (INTEGER, input) is the length of a triangle node.


VTTMTL (NTTO,TBUF,MBUF,NBUF, ... )

VTTMTX (NTTO,TBUF,MBUF,NBUF,EPST, ... )

(In each case, the remaining arguments are IPPP, MPPP, NPPP, IPPE, MPPE, NPPE, RPNT, MPNT, NPNT, LOPN, IEDG, MEDG, NEDG, LOEN, ITRI, MTRI, NTRI, and LOTN.)

The routines VTTMTL ("VaspackT, Triangular Mesh from Triangle List") and VTTMTX (" ..., eXtended") make it relatively easy to obtain, from an collection of triangles in 3-space, a triangular mesh in the form required by VASPACKT. Of course, the collection isn't entirely arbitrary, since the triangles should fit together to form a mesh.

One need not supply information specifying which pairs of triangles adjoin; VTTMTL and VTTMTX can figure that out for themselves. However, it must be the case that, when two triangles have an edge in common, they have the entire edge in common (i.e., there must be at most one triangle to the left of each edge and at most one triangle to the right of each edge).

VTTMTL requires that the coordinates of a vertex that two triangles have in common be computed exactly the same in both triangles. Sometimes, this is a difficult thing to ensure; in such cases, one may call VTTMTX instead and provide an additional argument, EPST, that defines what it means for two coordinate values to be "identical". Note that VTTMTX is a little slower and it requires a larger scratch array IPPP for use in sorting the points (because the tree-sort nodes must contain backward pointers as well as forward pointers).

Usage

VTTMTL and VTTMTX are called using FORTRAN code something like the following. (Note that the details may change from one program to another: for example, some of the DIMENSION statements could be in a calling routine and the various parameters could be passed as arguments.)

C
C Declare the maximum number of points, edges, and triangles expected.
C
        PARAMETER (MNOP=maximum_number_of_points,MPPP=MNOP)
        PARAMETER (MNOE=maximum_number_of_edges,MPPE=MNOE)
        PARAMETER (MNOT=maximum_number_of_triangles)
C
C Declare the lengths of a point node, an edge node, and a triangle
C node, respectively.
C
        PARAMETER (LOPN=4,LOEN=5,LOTN=4)
C
C Declare the lengths of the arrays in which the triangular mesh is to
C be formed.
C
        PARAMETER (MPNT=MNOP*LOPN)  !  space for points
        PARAMETER (MEDG=MNOE*LOEN)  !  space for edges
        PARAMETER (MTRI=MNOT*LOTN)  !  space for triangles
C
C Declare the arrays to hold the point nodes, edge nodes, and triangle
C nodes of the trian