OMFget_array


Synopsis


       INTEGER FUNCTION OMFget_array (object_id,
      . type,
      . array_ptr,
      . ndims,
      . dims,
      . mode)
#include <avs/omf.inc>
       INTEGER object_id(OIDSIZ)
       INTEGER type, ndims, mode
       INTEGER dims(ndims)
       INTEGER array_ptr

Description

For a complete description of this function, see .

Arguments

object_id

The id of an object, expressed as an integer.

type

An integer code specifying the array's data type. Valid types predefined in the include file omf.inc are:

Code

 

Array data type

 

OM_TYPE_INT

Integer

OM_TYPE_FLOAT

Single-precision floating point

OM_TYPE_DOUBLE

Double-precision floating point

OM_TYPE_UNSET

Not set (for example, data type is prim)

 

array_ptr

The memory location of the returned array, expressed as an integer. A local memory location can be passed by using the ARRFretptr function. A NULL pointer is passed by setting the address to 0; AVS/Express returns a memory location of its choosing.

ndims

The number of dimensions in the array, expressed as an integer.

dims

An array of ndim integer values specifying the dimensions of the array. The constant OM_ARRAY_MAXDIM defined in the include file omf.inc specifies the maximum number of dimensions allowed by AVS/Express.

mode

The mode in which to retrieve the the value for the array. The following constants are predefined in the include file omf.inc :

•      OM_GET_ARRAY_RD

•      OM_GET_ARRAY_RD_COPY

•      OM_GET_ARRAY_RW

•      OM_GET_ARRAY_WR

Returned value

The status code (see ).

Example 1


C set the array value of object array
#include <avs/omf.inc>
       INTEGER array_id(OIDSIZ)
       INTEGER type, iaddr, offset, ndims
       INTEGER dims(OM_ARRAY_MAXDIM)
       REAL base(1)
       ...
C  the AVS/Express specification will be: float array[300][3];
C  this maps to REAL array(3,300) in FORTRAN
       type = OM_TYPE_FLOAT
       iaddr = 0 ndims = 2 dims(1) = 3 dims(2) = 300
C
       IF (OMFget_array(array_id,
      . type,
      . iaddr,
      . ndims,
      . dims,
      . OM_GET_ARRAY_WR) .NE. 1) THEN
       PRINT*,'Error getting array value of object array'
       ...
       ENDIF
C
C  continue only when successfully retrieved the array
       offset = ARRFoffset(iaddr,base,DTYPE_FLOAT)
C
C  set the values of the array
       ...
       CALL ARRFfree(iaddr)

Example 2


C return the array value of object array into a static location
#include <avs/omf.inc>
       INTEGER array_id(OIDSIZ)
       INTEGER type, iaddr, size, ndims
       INTEGER dims(OM_ARRAY_MAXDIM)
       REAL larray(1000)
       ...
C check for sufficient size
       IF OMFget_array_size(array_id,size) .NE. 1)
      . PRINT*,'Error getting array size'
       IF (size .LT. 1000) PRINT*,'Not enough space in local array'
C
       iaddr = ARRFretptr(larray)
       type = OM_TYPE_FLOAT
       ndims = 0
       IF (OMFget_array(array_id,
      . type,
      . iaddr,
      . ndims,
      . dims,
      . OM_GET_ARRAY_RD) .NE. 1)
      . PRINT*,'Error getting array value of object array'
C

See also

Related module:

•      OMFset_array