next up previous contents index
Next: Structures Up: XDR Functions Previous: Basic XDR Functions

Basic GRAPE XDR Functions

GRAPE XDR functions are provided for all basic GRAPE types (INT2/3/4, VEC2/3/4, FVEC3 and MATRIX44), they have the same format as the basic XDR functions, but they start with the prefix g_xdr instead of xdr.

For example the function for VEC3 is

bool_t g_xdr_vec3(XDR *xdrp, VEC3 vec3)
{
  return xdr_vector(xdrp, (char *)vec3, 3,
                    sizeof(double), xdr_double);
}
In this case vec3 already is a pointer (to a double array with three elements) therefore we don't have to pass a pointer to it to the function. xdr_vector is used to write/read vec3, it expects the XDR stream handle (xdrp), the base address of the array (vec3), the number of array elements (3), the size of each element (sizeof(double)) and the function to handle each element (xdr_double) as parameters.



SFB 256 Universität Bonn and IAM Universität Freiburg

Copyright © by the Sonderforschungsbereich 256 at the Institut für Angewandte Mathematik, Universität Bonn.