FLDget_cell_data_minmax,FLDset_cell_data_minmax,FLDcopy_cell_data_minmax


Synopsis

get/set/copy the min and max data values in a Cell_Data cell_set Data_Array component


int FLDget_cell_data_minmax (
           OMobj_id cell_set,
           int comp,
           char *min,
           char *max);

int FLDset_cell_data_minmax (
           OMobj_id cell_set,
           int comp,
           char *min,
           char *max,
           int dtype);

int FLDcopy_cell_minmax (
           OMobj_id in_cell_set,
           OMobj_id out_cell_set,
           int in_comp,
           int out_comp);

Description

These routines set, get, and copy the minimum and maximum data values within one component of a Cell_Data cell_set Data_Array.

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_cell_data_minmax returns the values of these functions. If the data in the values array changes, the value of the function automatically changes.

FLDset_cell_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_cell_minmax.

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

Note: At present, there is no FLDreset_cell_minmax routine to "undo" the effect of a FLDset_cell_data_minmax or FLDcopy_cell_minmax, returning control of the min and max values to the function.

Why would you not want min and max to default 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 Cell_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_cell_data_minmax can replace the function definition for min/max with specific values that will remain the constant across the slices.

•      A Cell_Data version of the clamp module, if it existed, could use FLDcopy_node_minmax. Clamp alters the values in the input 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 could use FLDcopy_cell_minmax to copy the input field's range to the output field.

Parameters

OMobj_id cell_set

The OMobj_id of a Cell_Data cell_set array element, such as that produced by the FLDget_cell_set routine.

int comp

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

void *min
void *max

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

In FLDget_cell_data_minmax, pointers to a variable of unknown type in which the min/max values will be returned. You are responsible for managing this memory.

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_cell_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_cell_data_minmax cannot change a previously-set data type.

OMobj_id in_cell_set
OMobj_id out_cell_set

In FLDcopy_cell_minmax only. Each is the OMobj_id of a Cell_Data cell_set array element that contains a cell_data Data_Array.

int in_comp
int out_comp

FLDcopy_cell_minmax only. These are integers that define which Data_Array cell_data component min/max to copy from (in_comp) and to (out_comp).

Example

modules/cellnode.c

Related routines