FLDget_node_data_minmax_vec, FLDcopy_node_minmax_vec, FLDreset _node_minmax_vec
Synopsis
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);
Description
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:
FLDreset_node_minmax_vec "undoes" the effect of a FLDcopy_node_minmax_vec, returning control of the min and max values to the function.
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_vec and max_vec arrays to manipulate.
void **min
void **max
FLDget_node_data_minmax_vec only. Addresses of pointers to arrays of unknown type in which the min and max for each vector subcomponent will be returned. Call ARRfree() on these pointers when you are done using them.
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 *type
FLDget_node_data_minmax_vec only. A pointer to an integer in which the data type of the array will be returned. Allowed values (from avs/dtype.h) 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 |
int mode
FLDget_node_data_minmax_vec only. An integer used to set the mode of the min_vec and max_vec arrays when FLDget_node_data_minmax_vec is being used to create an output field. The choices are (from avs/om.h):
Mode
|
Value
|
Meaning
|
OM_GET_ARRAY_RD |
0 |
The program intends to read the array, but not write to it. |
OM_GET_ARRAY_WR |
1 |
The program intends to write to the array, completely replacing it, but not read it. |
OM_GET_ARRAY_RW |
2 |
The program intends to both read and write to the array. |
OM_GET_ARRAY_RD_
|
3 |
The program requires a copy of the array for its own, private use (reading or writing). |
OMobj_id in_field
OMobj_id out_field
In FLDcopy_node_minmax_vec. Both are the OMobj_id of a field that contains Node_Data.
In FLDreset_node_minmax_vec, the OMobj_id of the field you want to restore to automatic control of the min_vec/max_vec function.
int in_comp
int out_comp
FLDcopy_node_minmax_vec only. These are integers that define which Node_Data component's Data_Array min_vec/max_vec to copy from (in_comp) and to (out_comp).
Example
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");
}
}
...
Related routines