FLDget_cell_data_ncomp
Synopsis
get/set the number of cell data components (ncell_data) in a Cell_Data cell_set
int FLDget_cell_data_ncomp (
OMobj_id cell_set,
int *ncell_comp);
int FLDset_cell_data_ncomp (
OMobj_id cell_set,
int ncell_comp);
Description
These routines get/set the number of cell data components (ncell_data) in one Cell_Data.
Parameters
OMobj_id field
The OMobj_id of a cell_set within a Cell_Data object.
int *ncell_comp
int ncell_comp
In FLDget_cell_data_ncomp, ncell_comp is a pointer to an integer in which the number of components (ncell_data) will be returned.
In FLDset_cell_data_ncomp, ncell_comp is an integer that sets the number of components (ncell_data).
Example
This example, some fragments from modules/ext_face.c shows external faces retrieving the number of components in each input field cell_set object, and setting the number of components in its output field cell_set to the same value.
-
int FUNCext_face (in, out_sets, out)
OMobj_id in, out, out_sets;
{
int cs, os, nc, nsets, ncells, nnodes, cell_nnodes, stat;
int i, dtype, veclen, ndim, size, ncomp;
int null_flag, *node_list;
int nfaces, *face_nnodes, *face_corner_nnodes, *face_node_list;
int out_nsets, out_ncells[MAX_CELL_SETS],out_cell_nnodes[MAX_CELL_SETS],
*out_cells[MAX_CELL_SETS], *out_lists[MAX_CELL_SETS],
out_list_sizes[MAX_CELL_SETS];
char *cell_data, *out_cell_data;
OMobj_id cell_set, sets_id, out_set;
char label[MAX_LABEL_SIZE], units[MAX_LABEL_SIZE];
double null_value;
if (FLDget_nnodes(in, &nnodes)!= 1) {
ERR_RETURN("cannot get nnodes");
}
if (FLDget_ncell_sets(in, &nsets)!= 1) {
ERR_RETURN("cannot get nsets");
}
sets_id = OMfind_subobj(out, OMstr_to_name("cell_set"), OM_OBJ_RW);
if (OMis_null_obj(sets_id)) {
ERR_RETURN("cannot get cell sets");
}
OMset_obj_ref(sets_id, OMnull_obj, 0);
if (FLDset_ncell_sets (out_sets, 0)!= 1) {
ERR_RETURN("Error setting ncell_sets");
}
nc=0;
for (cs=0; cs<nsets; cs++) {
if (FLDget_cell_set(in, cs, &cell_set)!= 1) {
ERR_RETURN("cannot get cell set");
}
...
if (FLDget_ncells(cell_set, &ncells)!= 1) {
ERR_RETURN("cannot get ncells");
}
if (FLDget_cell_set_nnodes(cell_set, &cell_nnodes)!= 1) {
ERR_RETURN("cannot get cell nnodes");
}
if (FLDget_node_connect(cell_set, &node_list,
&size, OM_GET_ARRAY_RD)!= 1) {
ERR_RETURN("cannot get cell connectivity");
}
if (FLDget_cell_faces(cell_set, &nfaces, &face_nnodes,
&face_corner_nnodes, &face_node_list, &size)!= 1) {
ERR_RETURN("cannot get cell nfaces");
}
if (FLDget_cell_data_ncomp (cell_set, &ncomp)!= 1) {
ncomp = 0;
}
...
/*-----------------------------------*/
/* ADD new 2D cell sets */
/*-----------------------------------*/
for (os=0; os<out_nsets; os++) {
...
if (FLDget_cell_set(out_sets, nc, &out_set)!= 1) {
ERR_RETURN("Error getting cell set");
}
...
if (ncomp) {
if (FLDset_cell_data_ncomp (out_set, ncomp)!= 1) {
ERR_RETURN("Error setting cell data ncomp");
}
...
Related routines
-
FLDget_cell_set
-
FLDset_node_data_comp
-
FLDget_node_data_ncomp