OMFset_array


Synopsis


       INTEGER FUNCTION OMFset_array(object_id,
      . type,
      . farray,
      . size,
      . mode)
#include <avs/omf.inc>
       INTEGER object_id(OIDSIZ)
       INTEGER type, size, mode
       DIMENSION farray(1)

 

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

 

farray

A local FORTRAN array.

size

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

mode

How AVS/Express should set the array. The following constants are predefined in the include file omf.inc :

•      OM_SET_ARRAY_COPY

•      OM_SET_ARRAY_STATIC

•      OM_SET_ARRAY_FREE

If set to OM_SET_ARRAY_STATIC, farray has to be a static array (notice that some FORTRAN compilers do not perform static memory allocation by default). If set to OM_SET_ARRAY_COPY, farray needs not to be a static array since AVS/Express creates a copy.

Returned value

The status code (see ).

Example 1

A standard application of OMFset_array:


#include <avs/omf.inc>
       INTEGER sarray_id(OIDSIZ) larray_id(OIDSIZ)
       DOUBLE PRECISION sarray(500)
       INTEGER larray(3,100)
       ...
C sarray has to be a static array to make the following work
C correctly. The call will not fail if this condition is not
C satisfied.
C
       IF (OMFset_array(sarray_id,
      . OM_TYPE_DOUBLE,
      . sarray,
      . 500,
      . OM_SET_ARRAY_STATIC) .NE. 1)
      . PRINT*,'Error setting array value of object sarray'
C
       IF (OMFset_array(larray_id,
      . OM_TYPE_INT,
      . larray,
      . 300,
      . OM_SET_ARRAY_COPY) .NE. 1)
      . PRINT*,'Error setting array value of object larray'

Example 2

The construction required to pass a memory area allocated by ARRFalloc:


#include <avs/omf.inc>
       INTEGER array_id(OIDSIZ)
       INTEGER iaddr, offset, size
DOUBLE PRECISION base(1)
       ...
       size = 300
       iaddr = ARRFalloc(0,DTYPE_DOUBLE,size,0)
       offset = ARRFoffset(iaddr,base,DTYPE_DOUBLE)
       ...
C
       IF (OMFset_array(array_id,
      . OM_TYPE_DOUBLE,
      . base(1+offset),
      . 300,
      . OM_SET_ARRAY_FREE) .NE. 1)
      . PRINT*,'Error setting array value of object array'

See also

Related module:

•      OMFget_array