FLDget_node_data_minmax


Synopsis

get/set/copy the min and max data values within one Node_Data component


int FLDget_node_data_minmax (
OMobj_id field,
int comp,
char *min,
char *max);

int FLDset_node_data_minmax (
OMobj_id field,
int comp,
char *min,
char *max,
int dtype);

int FLDcopy_node_minmax (
OMobj_id in_field,
OMobj_id out_field,
int in_comp,
int out_comp);

int FLDreset_node_minmax (
OMobj_id in_field,
int comp);

Description

These routines set, get, and copy the min and max data values in the Data_Array for one component of a Node_Data.

By default, the min and max data values are defined as functions:

prim min = cache (min_array (magnitude(values), null_flag, null_value));
prim max = cache (max_array (magnitude(values), null_flag, null_value));

Normally, there is no need to ever actively set or copy these values.

FLDget_node_data_minmax returns the values of these functions. If the data in the values array changes, the value of the function automatically changes.

FLDset_node_data_minmax replaces the values produced by the function with the values you want to appear. To continue the effect, the downstream modules must use FLDcopy_node_minmax.

FLDcopy_node_minmax is the routine most frequently used in this set. It copies the input field's component min and max to the output field.

FLDreset_node_minmax "undoes" the effect of a FLDset_node_data_minmax or FLDcopy_node_minmax, returning control of the min and max values to the function.

There are times when you do not want the min and max data values to change even though the data in the values array has changed. Here are some examples. Both relate to the fact that colormap coloring of data in the renderer uses the min and max to scale the colormap to the data range:

•      Suppose you have time series data, with one invariant set of coordinate data but with new Node_Data for each time slice. If you let the min/max default to the function value, the colormap coloring will not be constant across an animated series of the time slices. A given red could be.5 in one slice, and -500 in the next.

FLDset_node_data_minmax can replace the function definition for min/max with specific values that will remain the constant across the slices.

•      The DVclamp module uses FLDcopy_node_minmax. Clamp alters the values in the input Node_Data by setting all values above and below a specified min and max value to the specified min and max values. Rather than letting the output field's min/max default to the function, it uses FLDcopy_node_minmax to copy the input field's range to the output field.

Parameters

OMobj_id field

The OMobj_id of a field that contains a Node_Data subobject.

int comp

An integer that specifies which component's [0-n] min and max to manipulate.

void *min
void *max

In FLDset_node_data_minmax, pointers to an input array of unknown type from which the min/max is copied.

In FLDget_node_data_minmax, pointers to an array of unknown type in which the min/max values will be returned.

Note that the pointers are declared "char *". This is so that any data type that matches the primitive type of the values array can be passed.

int dtype

FLDset_node_data_minmax only. This sets the data type of the min/max objects. Allowed values are:

Constant

 

Value

 

DTYPE_CHAR

0

DTYPE_BYTE

1

DTYPE_SHORT

2

DTYPE_INT

3

DTYPE_FLOAT

4

DTYPE_DOUBLE

5

DTYPE_UNSET

DNTYPES+1

 

You should make sure that the dtype you give actually matches the data type of the values array in this component's Data_Array. FLDset_node_data_minmax cannot change a previously-set data type.

OMobj_id in_field
OMobj_id out_field

In FLDcopy_node_minmax. Both are the OMobj_id of a field that contains Node_Data.

In FLDreset_node_minmax, the OMobj_id of the field you want to restore to automatic control of the min/max function.

int in_comp
int out_comp

FLDcopy_node_minmax only. These are integers that define which Node_Data component's Data_Array min/max to copy from (in_comp) and to (out_comp).

Example

This example, a fragment from modules/clamp.c, shows clamp either resetting the min and max according to a user-specified switch, or just copying the min and max 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");
}
}
...

This example, a fragment from modules/int_data.c, shows interpolated data using FLDget_node_data_minmax to see if its efforts to copy the min and max were successful.