Synopsis
Contains coordinate information for structured fields.
Grid Grid_Struct {
int ndim; /* number of dimensions */
int dims[ndim]; /* dimensions */
nnodes => prod(dims); /* number of nodes */
int npoints; /* number of points, defining grid */
float points[npoints][nspace]; /* points (extents) defining
grid */
int grid_type;
Description
Grid_Struct tailors the definition of Grid to structured mesh fields. As is, this definition will fully specify an irregular field's Grid. This definition may be further tailored by Grid_Unif and Grid_Rect.
Subobjects
ndim
An integer that specifies how many dimensions the numeric data has.
ndim is often confused with nspace. ndim refers the dimensions of the array holding the numeric data. nspace refers to the number of coordinates associated with each node, that is, the dimensionality of the space in which the data exists.
See FLDget_ndim
dims[ndim]
An array ndim long. This array holds the number of data values in each dimension. For example, a 30 x 25 x 100 3D irregular field would have dimensions dims[0] = 30, dims[1] = 25, and dims[2] = 100.
nnodes = prod(dims)
A function that sets the number of nodes equal to the product of its dimensions.
npoints
An integer that specifies how many points define the extents of the field in space.
points[npoints][nspace]
An array that specifies the extents of the field in space. This "points array" only has meaning with Grid_Unif and Grid_Rect fields. Irregular fields have explicit coordinates and their extents are defined by the min_vec/max_vec function in the Grid's Data_Array. The Grid_Unif and Grid_Rect groups will set this array.
Uniform and rectilinear fields' coordinates are implicit in the data array indexing: if the field is 64 x 64 x 64, then node [32, 32, 32] is located at 32 X, 32 Y, and 32 Z in space.
Extents and the field's coordinates are normally the same. But you can use extents independent of coordinates to locate the implicit coordinates in space. For example:
You have a series of MRI scan images of a cranium. There are 30 slices recorded 2mm apart of 128 x 128 pixel images. If you displayed them in a viewer, they might portray the cranium as a "squashed" oblate spheroid because the scale of the Z axis slices is so different from the XY axis images. If you explicitly set the points array's Z extents, you can "spread out" the slices to where they equal the original distance.
You have a 2D field that goes from 0 to 128 in both X and Y. You then crop the field in half in both X and Y, keeping the upper right quadrant. Now its dimensions are 0 to 64. However, in order to keep the field's original location in a viewer window, its extents must now be 64 to 128 in both X and Y.
grid_type
An integer that sets a numeric flag indicating what type of structured grid is present. This will be set for the Grid_Unif and Grid_Rect groups.
Files
v/fld.v
See also
Not applicable.