FLDFget_coord, FLDFget_sub_coord, FLDFset_coord


Synopsis

get/set the coordinate values array


INTEGER FLDFget_coord (field, coord_array, size, mode)
INTEGER field(OIDSIZ)
INTEGER coord_array
INTEGER size
INTEGER mode

INTEGER FLDFget_sub_coord (field, ndim, dims, min_rng, max_rng, coord_array)
INTEGER field(OIDSIZ)
INTEGER ndim
INTEGER dims
INTEGER min_rng
INTEGER max_rng
REAL coord_array(...)

INTEGER FLDFset_coord (field, coord_array, size, mode)
INTEGER field(OIDSIZ)
INTEGER coord_array
INTEGER size
INTEGER mode

Description

These routines set and get the coordinate values array in a mesh; the coordinate array is defined as float values[nvals][veclen]. It should be used only with the general Mesh (unstructured mesh) or with Mesh_Struct (curvilinear mesh).

FLDFget_sub_coord retrieves a subset of the values array, as would be necessary if you were, for example, cropping an irregular field.

The FLDFget_sub_coord and FLDFget_coord routines can be used for both getting and setting the values array. When setting with a "get" routine (mode = OM_GET_ARRAY_WR or OM_GET_ARRAY_RW), these routines return an integer representing a pointer to a pre-allocated array, and the developer just needs to fill in the values.

Note: These routines also get and set cylindrical and spherical coordinate arrays. Cylindrical coordinates are stored as radius, theta, z. Spherical coordinates are stored as angle, angle, radius.

Parameters

field

The integer id of a field that contains coordinates.

coord_array

In FLDFset_coord, coord_array is the address of the coordinate data array that you want to set in the Object Manager. See mode below.

In FLDFget_coord, the coord_array is filled in on return with an integer representing a pointer to the coordinate data. You must call ARRfree() on this an integer representing a pointer when you are done with it. See mode below.

In FLDFget_sub_coord, coord_array is the address of an array of floats large enough to hold the subarray; FLDFget_sub_coord copies the subarray into the specified memory. The caller must manage the memory in this case.

To access data array you will need to use ARRFoffset function described in Appendix D of Developers Reference.

size

In FLDFset_coord, an integer that sets the total number of array values (nvals * veclen) to create. A [100][3] array would have size=300.

In FLDFget_coord, an integer representing a pointer to array in which the total number of array values (nvals * veclen) in the coordinate values array will be returned.

mode

An integer constant that establishes the access mode for the array subobject. Constants for the possible values are defined in avs/om.h as follows.

For FLDFset_coord:

Mode

 

Value

 

Meaning

 

OM_SET_ARRAY_COPY

0

Copy the array into the Object Manager

OM_SET_ARRAY_FREE

1

If possible, do not copy the array. Instead, set the object's array to an integer representing a pointer to node_data. AVS/Express copies the array anyway if the function is running in an external process or if data type conversion is required.

AVS/Express manages the array and will determine when the array can be freed.

You must allocate space for the array with a call to ARRFalloc.

OM_SET_ARRAY_STATIC

2

If possible, do not copy the array. Instead, set the object's array to an integer representing a pointer to node_data. AVS/Express copies the array anyway if the function is running in an external process or if data type conversion is required.

AVS/Express does not manage the array. You must ensure that the array is valid for the life of the object or until the object replaces the array.

 

For FLDFget_coord:

Mode

 

Value

 

Meaning

 

OM_GET_ARRAY_RD

0

The program reads the array, but does not write to it.

OM_GET_ARRAY_WR

1

The program writes to the array, completely replacing it.

OM_GET_ARRAY_RW

2

The program reads from and writes to the array.

OM_GET_ARRAY_RD_COPY

3

The program requires a copy of the array for its own, private use (reading or writing).

 

FLDFget_sub_coord parameters

The following parameters are used only by FLDFget_sub_coord and allow you to place an arbitrary "offset mask" over the values array, which is stored in the Object Manager as a 1D array, so that you can extract nearly any subset of a Data_Array values array.

For examples of these three parameters in use, see the following reference. Look for the discussion and examples of the parameters of the same name for FLDFget_sub_node_data.

•      FLDFget_node_data

•      FLDFset_node_data

•      FLDFget_sub_node_data

ndim

FLDFget_sub_coord only. An integer that specifies the number of dimensions to impose upon the array. To view the array as 2D, specify ndim = 2. To view it as 3D, specify ndim = 3, etc.

dims

FLDFget_sub_coord only. The address of an integer array that contains the dimensions of the array that is being subsetted. This array should have length = ndim.

min_rng
max_rng

FLDFget_sub_coord only. Addresses of two integer arrays that hold the beginning and end indices of the subarray that is being extracted. min_rng contains the start point for each ndim. max_rng contains the end point for each ndim.

Note: Although it may not seem intuitive, the first value in each of these arrays is the rightmost index in the V specification. AVS/Express uses zero-based indexing (that is, the index of the first value in a dimension is 0).

All "extracted" data values must be logically contiguous. That is, it is possible to extract the first and second veclen subcomponents, but not the second and fourth. Similarly, it is possible to extract the 20th through 100th node data values, but not the 20th through 30th, plus the 40th through 100th.