[Top] [Prev] [Next] [Bottom]
VSfdefine/vsffdef
Exampleintn VSfdefine(int32 vdata_id, char *fieldname, int32 data_type, int32 order)
Purpose
|
Defines a new field for in a vdata.
|
Return value
|
Returns SUCCEED (or 0) if successful and FAIL (or -1) otherwise.
|
Description
|
VSfdefine is only used to define fields in a new vdata; it does not set the format of a vdata. Note that defining a field using VSfdefine does not prepare the storage format of the vdata. Once the fields have been defined, the routine VSsetfields must be used to set the format. VSfdefine may only be used with a new empty vdata. Once there is data in a vdata, definitions of fields in the vdata may not be modified or deleted.
|
|
A field is defined by its name (fieldname), its type (data_type) and its order (order). The name of the field is any sequence of characters. By convention, this is usually mnemonic, e.g. "PRESSURE". The type of a field specifies whether a field is float, integer, etc. Thus, data_type may be one of the following:
|
|
8-bit character DFNT_CHAR8 4
|
|
32-bit float DFNT_FLOAT32 5
|
|
64-bit float DFNT_FLOAT64 6
|
|
8-bit signed int DFNT_INT8 20
|
|
8-bit unsigned int DFNT_UINT8 21
|
|
16-bit signed int DFNT_INT16 22
|
|
16-bit unsigned int DFNT_UINT16 23
|
|
32-bit signed int DFNT_INT32 24
|
|
32-bit unsigned int DFNT_UINT32 25
|
|
The order of a field is the number of components in that field. Single variables like time or pressure have an order of 1. Compound variables have an order greater than 1. For example, the variable VELOCITY has an order of 3, as velocity has three components.
|
Example
|
The following two calls to VSfdefine define two fields in the newly-created vdata. The first field, named VEL, is a three-component float-valued field, while the second field, named PRESSURE, is a single-component float32-valued field.
|
Vdata = (int32) VSattach(hdf_file, -1, "w");
VSfdefine(Vdata, "VEL", DFNT_FLOAT32, 3);
VSfdefine(Vdata, "PRESSURE", DFNT_FLOAT32, 1);
[Top] [Prev] [Next] [Bottom]
hdfhelp@ncsa.uiuc.edu
HDF User's Reference Manual, Draft 06/09/97, NCSA HDF
Development Group.