FLDset_cell_data_comp

Synopsis

set all basic characteristics of a single Cell_Data cell_set cell_data component in one call


int FLDset_cell_data_comp (
OMobj_id cell_set,
int comp,
int veclen,
const char *label,
const char *units);

Description

FLDset_cell_data_comp sets all the basic characteristics of a single Cell_Data cell_set cell_data Data_Array component in one call, except the actual data. You use it to quickly establish the structure of an output Cell_Data cell_set cell_data component.

Parameters

OMobj_id field

The OMobj_id of a cell_set within a Cell_Data that contains a cell_data Data_Array of components.

int comp

An integer that specifies which component's [0-n] characteristics are being set.

int veclen

An integer that specifies the veclen (number of subcomponents) in this component.

const char *label

A character string from which the label for this component will be copied.

const char *units

A character string from which the units for this component will be copied.

Returned value

A pointer to the array, or NULL if ARRalloc failed.

Examples

This example, a fragment from modules/rd_ucd.c, shows Read_UCD setting the description of its output field.

MODread_ucd (filename, out)
OMobj_id out;
char *filename;
{
FILE *pf;
...
float *node_data[256], *cell_data[256], *coord;
int nnodes, ncells, nnode_data, ncell_data, idum, veclen[256];
int ncell_sets;
int size, type, cs, nc, i, j, k;
int cell_nnodes;

char cell_type[256], label[256], units[256];
OMobj_id cell_set;
...
/*** READ CELL INFO ***/

if (fscanf (pf, "%d\n", &ncell_sets)!= 1) {
ERR_RETURN("Error reading ncell_sets");
}
if (FLDset_ncell_sets (out, ncell_sets)!= 1) {
ERR_RETURN("Error setting ncell_sets");
}

for (cs=0; cs<ncell_sets; cs++) {
...
if ((fscanf(pf, "%d\n", &ncell_data) == 1) && ncell_data!= 0) {
if (FLDset_cell_data_ncomp (cell_set, ncell_data)!= 1) {
ERR_RETURN("Error setting ncell_data");
}

for (i=0; i< ncell_data; i++) {
if (fscanf (pf, "%d%s%s\n", veclen+i, label, units)
!= 3) {
ERR_RETURN("Error reading cell data header");
}
if (FLDset_cell_data_comp (out, i, veclen[i],label,units)
!= 1) {
ERR_RETURN("Error setting cell component");
}
if (FLDget_cell_data(out, i, &type,
(char **)&(cell_data[i]), &size,
OM_GET_ARRAY_WR)!= 1) {
ERR_RETURN("Error setting cell data");
}
}

Files

v/fld.v.

See Also

FLDget_cell_data_ncomp
FLDget_ncell_sets
FLDget_cell_data