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);
FLDget_node_data_units gets the units string within the Data_Array of one component of a Node_Data.
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");
}
...