Synopsis
get/set the number of nodes (nnodes) in a Node_Data or Grid
int FLDget_nnodes (
OMobj_id field,
int *nnodes);
int FLDset_nnodes (
OMobj_id field,
int nnodes);
Description
These routines set and get the number of nodes (nnodes) in a Node_Data or Grid. Because nvals within a Data_Array is defined as nvals = nnodes, it also automatically tells you the range of the first array index in the Node_Data's or Grid's Data_Array values array.
Parameters
OMobj_id field
The OMobj_id of a field that contains a Node_Data or Grid subobject.
int *nnodes
int nnodes
In FLDget_nnodes, nnodes is a pointer to an integer in which the number of nodes will be returned.
In FLDset_nnodes, nnodes is an integer that sets the number of nodes.
Example
This example, a fragment from modules/clamp.c, shows clamp retrieving the nnodes from its input field object, and immediately setting the nnodes in its output field object to the same value.
int FUNCclamp (in, comp, below, min_val, above, max_val, out)
OMobj_id in, out;
...
{
int nnodes, size, veclen;
...
if (FLDget_nnodes(in, &nnodes)!= 1) {
ERR_RETURN("cannot get nnodes");
}
if (FLDset_nnodes (out, nnodes)!= 1) {
ERR_RETURN("Error setting nnodes");
}
...
Related routines