get/copy/reset the min_vec and max_vec within one Node_Data component
int FLDget_node_data_minmax_vec (
OMobj_id field,
int comp,
char **min,
char **max,
int *type,
int mode);
int FLDcopy_node_minmax_vec (
OMobj_id in_field,
OMobj_id out_field,
int in_comp,
int out_comp);
int FLDreset_node_minmax_vec (
OMobj_id in_field,
int comp);
These routines get, copy, or reset the min_vec and max_vec data arrays within one Node_Data Data_Array component.
By default, the min_vec and max_vec data values are defined as functions:
prim min_vec[veclen] = cache (min_array (values, null_flag, null_value));
prim max_vec[veclen] = cache (max_array (values, null_flag, null_value));
Normally, there is no need to ever actively set or copy these values.
FLDget_node_data_minmax_vec returns the values of these functions. If the data in the values array changes, the value of the function automatically changes.
FLDcopy_node_minmax_vec is the routine most frequently used in this set. It copies the input field's component min_vec and max_vec to the output field. For a discussion on why this might be desirable:
See FLDget_node_data_minmax
FLDreset_node_minmax_vec "undoes" the effect of a FLDcopy_node_minmax_vec, returning control of the min and max values to the function.
The program intends to write to the array, completely replacing it, but not read it. |
||
The program requires a copy of the array for its own, private use (reading or writing). |
OMobj_id in_field
OMobj_id out_field
This example, a fragment from modules/clamp.c, shows clamp either resetting the min_vec and max_vec according to a user-specified switch, or just copying the min_vec and max_vec from the input to the output field. The component is 0 because clamp outputs only one component.
int FUNCclamp (in, comp, below, min_val, above, max_val, reset, out)
OMobj_id in, out;
int comp;
int below, above, reset;
double min_val, max_val;
{
...
if (reset) {
if (FLDreset_node_minmax(out, 0)!= 1) {
ERR_RETURN("Error resetting node minmax");
}
if (FLDreset_node_minmax_vec(out, 0)!= 1) {
ERR_RETURN("Error resetting node minmax");
}
}
else {
if (FLDcopy_node_minmax(in, out, 0, 0)!= 1) {
ERR_RETURN("Error copying node minmax");
}
if (FLDcopy_node_minmax_vec(in, out, 0, 0)!= 1) {
ERR_RETURN("Error copying node minmax");
}
}
...