TOC PREV NEXT INDEX

DVcell_data_math

Synopsis

perform arbitrary math operations on cell-based data

module DVcell_data_math {
string+IPort2 operation = "#1";
Mesh+Cell_Data+IPort2+nonotify &in1;
Mesh+Cell_Data+IPort2+nonotify &in2;
Mesh+Cell_Data+IPort2+nonotify &in3;
Mesh+Cell_Data+IPort2+nonotify &in4;
int+IPort2 data_type = 4; // 4 == DTYPE_FLOAT
int dim => in1.ncell_sets;
group+nonotify out_data[dim] {
int ncells => in1.cell_set[index_of(out_data)].ncells;
int ncell_data=1;
Data_Array cell_data[ncell_data] {
nvals => ncells;
&veclen => in1.cell_set[index_of(out_data)].cell_data[0].veclen;
&id => in1.cell_set[index_of(out_data)].cell_data[0].id;
prim values[nvals][veclen];
labels = "cell_data_math";
};
};
group+nonotify out_sets[dim] {
group &out_set => merge(out_data[index_of(out_sets)],
in1.cell_set[index_of(out_sets)]);
};
Cells+Cell_Data+write+nonotify out_cd {
*cell_set[];
ncell_sets => array_size(cell_set);
};
Mesh+OPort2+nonotify &out =>merge(out_cd, in1);
method+notify_val+notify_inst upd_data_math<status=1> =
"DVcell_data_math_update";
};

Description

DVcell_data_math performs arbitrary math operations on up to four cell-based data sets. You can use any operation or expression that can be specified in the V language to operate on the data. The expression you enter may use 1, 2, 3, and 4 to stand for the four input fields.

Input

string+IPort2 operation

The elementwise math expression to perform on the input fields' cell data set(s). Use 1 through 4 to refer to the input fields.

Mesh+Cell_Data+IPort2+nonotify &in1

One of the input fields.

Mesh+Cell_Data+IPort2+nonotify &in2

One of the input fields.

Mesh+Cell_Data+IPort2+nonotify &in3

One of the input fields.

Mesh+Cell_Data+IPort2+nonotify &in4

One of the input fields.

int+IPort2 data_type

The desired type of the output data set, as follows: 0 : char 1 : byte 2 : short 3 : int 4 : float 5 : double.

Output

Mesh+Cell_Data+OPort2+nonotify &out

The output field containing the resulting cell data set.

Example

cell_data_math macro , v/modules.v

File

v/dv.v

See also

DVdata_math

TOC PREV NEXT INDEX