FLDget_node_data_units, FLDset_node_data_units


Synopsis

get the units from within one Node_Data component


int FLDget_node_data_units (
OMobj_id field,
int comp,
char *units,
int size);

int FLDset_node_data_units (OMobj_id field,
int comp,
const char *units);

Description

FLDget_node_data_units gets the units string within the Data_Array of one component of a Node_Data.

Parameters

OMobj_id field

The OMobj_id of a field that contains a Node_Data subobject.

int comp

An integer that specifies which component's [0-n] units to get.

char *units

A character string in which the string will be returned.

intsize

An integer that sets the maximum length that the units string may have. In practice, this is always the same as the length declared for the units array. If the units string returned happens to be longer than size, it is truncated to size.

Example

This example, a fragment of modules/advect.c, shows the DVadvect module using FLDget_node_data_units to retrieve the units from the first component of the input field, setting it to " " if nothing was found, then using FLDset_node_data_comp to set the units in the output field.


int FUNCadvec (in, time, dir, out)
OMobj_id in, out;
double time;
int dir;
{
int i, cell, node, out_ncells, out_nnodes, rdir;
int data_type, size, conn_size, veclen, ncomp;
...
int comp, null_flag, nspace;
char units[MAX_NAME_SIZE], label[MAX_NAME_SIZE],
name[MAX_NAME_SIZE];
...
/**** PUT VELOCITY into DATA ***/

if (FLDset_node_data_ncomp (out, 1)!= 1) {
ERR_RETURN("Error setting nnode_data");
}
if (FLDget_node_data_units(in, 0, units, MAX_NAME_SIZE)!= 1) {
strcpy(units, "");
}
if (FLDget_node_data_label(in, 0, label, MAX_NAME_SIZE)!= 1) {
strcpy(label, "");
}
if (FLDset_node_data_comp (out, 0, veclen, label, units)!= 1) {
ERR_RETURN("Error setting node component");
}
...

Related routines