4
DV base modules
This chapter provides an introduction and comprehensive reference material for the Data Visualization Kit base modules.
Note: Some of the modules described in this chapter are available only in the Developer Edition. Where this is the case, a line identifying this fact appears directly below the module name at the top of the page.
Base visualization objects can be viewed as special V group objects, from which an application can be built. Defined as groups, the base modules define their input and output data templates and the name of the method to call when the object is notified. For example, a V description of an isosurface group object template includes "input_field," "output_field," and "level." The description also includes the method "iso," the name of the data processing function associated with the object. Note that this group object can be used to process any field that has mesh and node data.
group DViso {
Mesh+Node_Data+Iparam &in {
xform+nonotify;
nnodes+req;
};
float+Iparam level;
Mesh+Oparam out {
&xform<weight=-1> => in.xform;
};
NParam_Data+Oparam nparam;
method+notify_val+notify_inst iso_update = "iso";
};
V provides the ability to associate the name of a data processing method ("iso" in the example above) with a callable function that gets executed when the object is notified. The set of all visualization data functions provides a powerful and extensible interface between the Object Manager and the Data Visualization Kit.
Base modules are also sometimes referred to as primitives.
When you look at the icons under Libraries.Visualization.Macros, you will also see a large number of icons with the "DVM" prefix, or no prefix at all. These are V macros that define a series of objects that are in between the low-level DV base modules, and the high-level AVS/Express macros. They define a collection of user interface macros, plus a set of parameter ports that together make it convenient to create the AVS/Express macros described in the "Macros" chapter.
The AVS/Express macros use these intermediate level DVM hierarchical macro objects to define themselves. You can use them to construct macros with your own user interface design.
These intermediate level macro objects are not documented on their own reference pages.
All base modules are defined in v/dv.v .
The mid-level DVM macros are defined in v/dv_macro.v.
Where base modules use methods, those methods are implemented as library calls in modules/*.
determine the position of a massless particle along a velocity streamline
group DVadvect {
Mesh+Node_Data+Iparam &in { /* input field */
nnodes+req;
xform+nonotify;
};
float+Iparam time; /* time step */
int+Iparam direction ; /* direction of integration */
Mesh+Node_Data+Oparam out { /* output field */
&xform<weight=-1> => in.xform;
};
method+notify_val+notify_inst upd_advect = "advect";
} ;
DVadvect takes the output of DVstream, which is a polyline Mesh with velocity Node_Data that represents the path of the velocities through a field, plus a float value that is a time along that streamline. From this, for each streamline, it calculates the position of a particle at that a given time along the streamline.
Reference to the field output of DVstream. This is a polyline unstructured Mesh that is the path of a streamline through a velocity (three object X, Y, Z vector component) field. Its Node_Data is a velocity value.
A float. Sets the time along the streamline for which the particle's position should be calculated.
An integer. If the value is not 0, the direction of integration is forward. If it is zero, the direction is backward.
The output is a new object. Its mesh is an unstructured Mesh of cell type Point. The locations of the points represent each particle's current position. Its Node_Data is the velocities at those points. The field also includes a reference to the input field's xform.
advector uses precomputed streamlines (from DVstream) as particle paths. It integrates velocity along the streamlines to calculate the new position of the particles at each time step.
The streamlines are originally calculated using the Runge-Kutte method of specified order with adaptive time steps.
Libraries.Main.Mappers.advector
average the coordinates between two meshes
group DVaverage_coord {
Mesh+Node_Data+IPort2 &in1;
Mesh+Node_Data+IPort2 &in2;
float+IPort2 t=0.5;
Grid+Xform out_grid {
nnodes => in1.nnodes;
nspace => in1.nspace;
&xform => in1.xform;
int npoints => nnodes;
float points[nnodes][nspace];
coordinates {
values+nres => (1-t)*in1.coordinates.values + t*in2.coordinates.values ;
};
};
Mesh+Node_Data+OPort2 &out => merge(out_grid, in1);
};
DVaverage_coord takes the meshes of two input fields and produces an output field whose Grid equals:
(1-t) * in1.coordinates.values + t * in2.coordinates.values
where t is a user-settable value. Its Node_Data is that of the first input field.
References to two input fields containing any type of mesh and Node_Data. The nnodes and nspace of the two meshes should be equal.
An integer constant by which the two coordinate grids will be modified. The default is .5.
The output is a reference to a merged object that contains the new Grid, plus a reference to all the non-Grid portions of &in1.
module DVaxis {
Mesh+Iparam &in {
nnodes+req;
};
float+req+Iparam limits[2];
float+req+Iparam reference;
float+req+Iparam tick_step;
float+req+Iparam tick_y_below;
float+req+Iparam tick_y_above;
float+req+Iparam tick_z_below;
float+req+Iparam tick_z_above;
int+req+Iparam minor_ticks;
float+req+Iparam minor_scale;
int+req+Iparam ndig;
float+req+Iparam y_anno;
float+req+Iparam z_anno;
int+write ntick;
string+write labels[ntick];
float+write xyz[ntick*3];
Mesh+Oparam out;
Mesh+Oparam out_minor {
&xform => <-.out.xform;
};
TextField out_anno {
nspace=3;
nnodes => <-.ntick;
text_values => <-.labels;
coordinates {
&values+nres => <-.<-.xyz;
};
&xform => <-.out.xform;
};
method+notify_val+notify_inst upd_axis<status=1> = "DVaxis";
};
DVaxis generates an axis line with optional tick marks. It can be transformed to any position.
A field whose extents define the size of the axis
The lower and upper limits of the axis line
The value along the axis at which the perpendicular axes will be drawn
The spacing between major tick lines
How far below the Y axis the Y-axis ticks extend
How far above the Y axis the Y-axis ticks extend
How far below the Z axis the Z-axis ticks extend
How far above the Z axis the Z-axis ticks extend
If 1, minor tick lines are drawn. If 0, no minor tick lines are drawn.
The spacing between minor tick lines
Number of digits to display on the axis labels
Offset for annotation text from the xyz positions
Offset for annotation text from the xyz positions
Label strings to be drawn at the tick positions
Output mesh describing the lines to be drawn for the major ticks
Output mesh describing the lines to be drawn for the minor ticks
Output field describing the numeric labels to be drawn along the axis
Libraries.Main.Geometries.Axis2D
Libraries.Main.Geometries.Axis3Dgenerate a bounding box of a 3D structured field
group DVbounds {
Mesh_Struct+Iparam &in {
ndim+req;
xform+nonotify;
};
int+Iparam hull;
int+Iparam edges;
int+Iparam faces;
int+Iparam imin;
int+Iparam imax;
int+Iparam jmin;
int+Iparam jmax;
int+Iparam kmin;
int+Iparam kmax;
int+Iparam data;
int+notify+IPort2 component;
Mesh+Node_Data+Oparam out {
&xform<weight=-1> => in.xform;
}; /* output field */
method+notify_val+notify_inst upd_bounds = "bounds";
} ;
DVbounds generates lines and/or surfaces that show the bounding box of a 3D structured field.
The input is a reference to a field with a structured mesh. Mesh_Struct, Mesh_Rect, and Mesh_Unif are all accepted. If you toggle the data input, then the field must also have a Node_Data, but this is not normally required.
An integer. When this is not 0, DVbounds draws a wireframe around the perimeter extents of the input mesh.
An integer. When this is not 0, the imin/imax, jmin/jmax, kmin/kmax buttons will produce a wireframe representation of the mesh grid at that plane.
An integer. When this is not 0, the imin/imax, jmin/jmax, kmin/kmax buttons will produce a solid face representing the location of that plane extent.
Integers. When they are not 0, each of these switches displays the grid (edges turned on) or plane (faces turned on) on one of the six faces of the hull. imin produces edges/faces at the i=0 plane. imax produces edges/faces at i=dims[0] - 1. jmin produces edges/faces at the j=0 plane. jmax produces edges/faces at the j=dims[1] - 1 plane. kmin/kmax control the third dimension.
An integer. When this is not 0, DVbounds will copy the selected component's Node_Data values at node points along the output mesh to the output field. Because the data is present, the bounds lines can be colored by the interpolated data values of the selected Node_Data component. Otherwise, the lines will display as white.
An integer. Sets which component's data values to copy to the output field. A Node_Data must be present in the input field.
The output is a new object. Its mesh is an unstructured Mesh with cell type Polyline (edges, first cell set) and/or Quad (faces, second cell set) representing the boundings. Its Node_Data, if present and data was selected, contains the selected component's values at nodes on the output mesh.
extract cell data labels for display in a UIradioBoxLabel
group DVcell_data_labels {
group+Iparam &in{
group+opt cell_set {
group+opt cell_data {
string+opt labels;
};
};
};
string+Oparam labels[];
int+Oparam ncomp => array_size(labels);
method+notify_val+notify_inst upd_cell_data_labels = "cell_data_labels";
};
DVcell_data_labels extracts the cell data labels from all the Data_Arrays within a Cell_Data and stores them in a string array. If there are multiple cell_sets, labels are output for all. This string array (along with the ncomp value) can be used as inputs to a UIradioBoxLabel widget so that the user can pick which component, by label, he/she wants a downstream object to work on.
A reference to a field containing Cell_Data.
An string array object. The array is as long as: (ncell_sets * ncell_data) - duplicate_labels in the input field. It contains the labels strings from each component's Data_Array. If no label was present, the string value is empty (""). If duplicate labels are found, only one is output.
An integer representing the size of the labels[] array.
Libraries.Main.Filters.extract_component
Libraries.Main.Filters.threshold
Libraries.Main.Filters.clamp
Libraries.Main.Mappers.surf_plot
and many othersperform 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;
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] {
&id => in1.cell_set[index_of(out_data)].cell_data[0].id;
&veclen => in1.cell_set[index_of(out_data)].cell_data[0].veclen;
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";
};
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.The elementwise math expression to perform on the input fields' cell data set(s). Use #1 through #4 to refer to the input fields.
The desired type of the output data set, as follows:
The output field containing the resulting cell data set.
cell_data_math macro, v/modules.v
extract all cell_names and names from the Cells in a Grid
group DVcell_data_labels {
group+Iparam &in{
group+opt cell_set {
string+opt cell_name;
string+opt labels;
};
};
string+Oparam labels[];
int+Oparam nsets => array_size(labels);
method+notify_val+notify_inst upd_cell_labels = "cell_labels";
};
DVcell_labels extracts all of the cell_names ("Tri," "Hex2," etc.) and names (user-defined strings) in all Cell_Sets in the Cells portion of a Grid. It stores them in a single string array. This string array (along with the nsets value) can be used as inputs to a UIoptionBoxLabel widget and DVselect_cells so that the user can pick which Cell_Sets, by cell_name (type) and name (user-defined label), he/she wants a downstream object to work on.
A reference to a field containing a Grid with Cells.
An string array object. The array is as long as the ncell_sets. The strings are stored: "cell_name name". If no cell_name is found, it is set to "Set". If no name is found, it is left empty.
An integer representing the length of the labels array (ncell_sets).
Libraries.Main.Filters.extract_component
Libraries.Main.Filters.threshold
Libraries.Main.Filters.clamp
Libraries.Main.Mappers.surf_plot
and many othersconvert Cell_Data to Node_Data
group DVcell_to_node {
Mesh+Cell_Data+Iparam ∈
int+Iparam comps[];
int+Iparam order;
Node_Data+Oparam out_nd {
nnodes<weight=-1> => in.nnodes;
};
Mesh+Node_Data+OPort2+nonotify &out => merge(out_nd,in);
method+notify_val+notify_inst upd_cell_to_node = "cell_to_node";
};
DVcell_to_node converts Cell_Data to Node_Data. It is necessary to visualize cell-based data when the visualization macro or base module selected does not process cell-based data.
Note: All nodes referenced by a cell with a NULL value will have their Node_Data set to NULL.
A reference to a field containing any type of Mesh and also Cell_Data.
An integer array of variable length that specifies which components (0-n) of the input Cell_Data to convert to Node_Data. As many components will be converted as the length of this array. If the Cell_Data contains multiple cell_sets, then the conversion is performed on the specified components in each cell_set.
This array is generally provided by a combination of UIoptionBoxLabel and DVcell_data_labels.
An integer that sets the order of interpolation. Allowed values are:
A node's value is computed by interpolating values using distances from the node to the adjoining cell centroids.
The output is a reference to a merged object that contains the new Node_Data, plus the existing Mesh and Cell_Data.
Libraries.Main.Filters.cell_to_node
clamp Node_Data to min/max values
group DVclamp {
Node_Data+Iparam &in { /* input field */
nnodes+req;
};
int+Iparam component; /* which component to clamp */
int+Iparam below; /* toggle to turn on lower clamping */
int+Iparam above; /* toggle to turn on upper clamping */
int+Iparam reset_minmax
float+Iparam min_value; /* lower clamping value */
float+Iparam max_value; /* upper clamping value */
Node_Data+Oparam out; /* output field */
method+notify_val+notify_inst upd_clamp = "clamp" ;
} ;
DVclamp transforms the values in one component of a Node_Data object as follows:
- If above is set, then any value above max_value is set to max_value.
- If below is set, then any value below min_value is set to min_value.
- Otherwise, the values are not changed.
If both above and below are on, then the output field's selected component values are all in this range:
min_value <= value <= max_value
Null data values are not affected.
A reference to an input field that contains a Node_Data object. The field's data components can be scalar or vector.
An integer. Selects which of the input field's components to clamp.
An integer. If value is not 0, clamps data above the max_value.
An integer. If value is not 0, clamps data below the min_value.
An integer. If the value is not 0, the field's minimum and maximum data values are reset to post-clamping values.
Floats. Establish the min and max values above and below which data is clamped to.
A new Node_Data that contains the clamped output component. It has the same data type as the input Node_Data.
combine Node_Data components from two fields into one new Node_Data
group DVcomb_comp {
Node_Data+Iparam &nd1 {
nnodes+req;
};
Node_Data+Iparam &nd2 {
nnodes+req;
};
int+Iparam comp1[];
int+Iparam comp2[];
Node_Data+Oparam out {
nnodes<weight=-1> => nd1.nnodes;
// we are only modifying the pointer value of node_data
// the '*' here prevents us from getting dependencies on
// the upstream guys.
*node_data[];
nnode_data => array_size(node_data);
};
method+notify_val upd_comb_comp = "comb_comp";
};
DVcomb_comp combines any combination of components of two Node_Data objects into one new Node_Data object with n components. The user should ensure that the nnodes of the two input Node_Datas are equal.
Reference to a Node_Data object.
Reference to a Node_Data object.
An integer array of variable length. Sets which components to take from &nd1. For example, if comp1 = {0, 3}, then the first and fourth components will be extracted.
An integer array of variable length. Sets which components to take from &nd2. For example, if comp2 = {1}, then the second component will be extracted.
This is a new Node_Data with the same number of nodes as the first input field, and n components (nnode_data), where n is the sum of the dimensions of comp1 and comp2. Its own Node_Data is a reference (*node_data) to an n object array, where the array values are references to the components in nd1 and nd2.
combine a Mesh object and a Node_Data object into a field
group DVcomb_mesh_and_data {
Mesh+IPort2 &in_mesh ;
Node_Data+nres+IPort2 &in_nd;
Mesh+Node_Data+OPort2 &out => merge(in_nd, in_mesh);
};
DVcomb_mesh_and_data takes two inputs, any Mesh and Node_Data, and combines them together to form a new field.
Many base module visualization objects input only the mesh of a field object (for example, DVmirror), and do not care if Node_Data is present or not. Other base module objects input only an object's Node_Data (for example, DVclamp), and do not care if a mesh is present. Yet one may presume that the user usually wants both the Mesh and Node_Data objects of his/her original field rejoined prior to further processing. The DVcomb_mesh_and _data base module object performs this rejoining.The actual effect of DVcomb_mesh_and_data is slightly more subtle. What actually happens is that references to the input Mesh and input Node_Data are merged. A reference object named out is defined that points to this merging. Graphically, the operation looks like the following figure (again using DVclamp as the example):
Any object referencing the out port will receive a reference to the merged in_mesh and in_node. This will in turn reference the appropriate subobject of either Mesh or New Node_Data.
The following table lists which base modules work only on the mesh or only on the Node_Data, and hence may require DVcomb_mesh_and_data:
A reference to the input Mesh.
A reference to the input Node_Data.
A reference to the object that is the merge of in_mesh and in_nd.
Libraries.Main.Filters.threshold
Libraries.Main.Filters.clamp
Libraries.Main.Mappers.scat_to_fldcombine three scalars into an RGB image
module DVcombine_rgb {
Mesh_Unif+Dim2+Byte+Space2+Node_Data+Iparam &in1;
Mesh_Unif+Dim2+Byte+Space2+Node_Data+Iparam &in2;
Mesh_Unif+Dim2+Byte+Space2+Node_Data+Iparam &in3;
Node_Data+Byte out_nd {
nnodes => in1.nnodes;
nnode_data = 1;
node_data {
veclen = 3;
id = 669;
values+nres => combine_array(in1.node_data[0].values,
in2.node_data[0].values,
in3.node_data[0].values);
};
};
Mesh_Unif+Dim2+Byte+Space2+Node_Data+OPort2 &out =>
merge(out_nd, in1, in2, in3);
};
DVcombine_rgb combines three scalar 2D, 2-space byte input fields into an RGB image. It sets the resulting vector node data set's ID to tell the renderer that it is an RGB image.
Mesh_Unif+Dim2+Byte+Space2+Node_Data. This field represents the red channel of the image.
Mesh_Unif+Dim2+Byte+Space2+Node_Data. This field represents the green channel of the image.
Mesh_Unif+Dim2+Byte+Space2+Node_Data. This field represents the blue channel of the image.
Mesh_Unif+Dim2+Byte+Space2+Node_Data+OPort2. The output vector (image) field containing the combined three scalar fields.
concatenate two transformations
group DVconcat_xform {
GDxform_templ+Iparam &xform_in1;
GDxform_templ+Iparam &xform_in2;
GDxform_templ+Oparam xform_out;
method+notify_val+notify_inst upd_concat_xform = "concat_xform";
};
DVconcat_xform concatenates the xform transformation matrix of two inputs, thus "adding" one transformation on an object to another. For example, one field may be rotated, another scaled, and the output will be rotated and scaled.
Two xform transformation matrices. These can usually be obtained from the Grid of a field.
The new, concatenated transformation matrix.
create an isovolume bounded by two isosurface (3D) or isolines (2D)
group DVcontour {
Mesh+Node_Data+Iparam &in {
xform+nonotify;
nnodes+req;
};
int+Iparam contour_comp;
int+Iparam map_comp[];
float+Iparam level_min;
float+Iparam level_max;
Mesh+Node_Data+Oparam out { /* output field */
&xform<weight=-1> => in.xform;
};
method+notify_val+notify_inst upd_contour = "contour";
};
DVcontour creates a field that is the volume bounded by two isosurfaces (if the field is 3D) or two isolines (if the field is 2D).
For example, you could set the level_min and level_max isosurfaces to be densities found just outside a bone. When combined, the isovolume produced would be the bone itself.
The isosurfaces or isolines are colored by the first map_comp selected. All of the selected map_comps are in the Node_Data of the output field.
The input is a reference to any mesh with Node_Data. A 2D mesh will produce isolines. A 3D mesh produces isosurfaces. At least one of the components must be scalar.
An integer that sets which component to isosurface/isoline. The selected component must be scalar or the message "iso: first component is not scalar" is written to stderr.
Integer array to pick which components will be written to the output field In addition, the first component in the array will be mapped onto the isosurface/isoline (for example, map pressure value onto a density isosurface). The selection does not have to be scalar. Where the isosurface/isoline does not exactly intersect a node, the data value is linearly interpolated based on the surface's distance from the adjacent nodes.
Floats. Set the minimum and maximum isosurface/isoline values, between which data will be extracted. The float data type is converted to the data type of the node data before use.
The output is a new field object that is an unstructured Mesh of cell type Tri (3D) or Line (2D) that represents the contour volume. Its Node_Data is the values within the volume. The surface values are interpolated along the isosurface/lines. The field's tranformation is a reference to the original input's transformation.
DVcontour uses the Marching Cubes algorithm to construct the isosurfaces/isolines. See W. Lorensen and H. Cline, "Marching Cubes: A High Resolution Surface Reconstruction Algorithm." Computer Graphics 21(4) (SIGGRAPH Proceedings, 1987), July, 1987, pp. 163-169.
This algorithm has a known limitation. There are cases where there are two possible paths that the isosurface could take through a cell, and only one is the correct path. If isosurface picks the wrong path, it will appear as a discontinuity in the surface such as a hole.
Libraries.Main.Mappers.contour
copy an input mesh to an output mesh
module DVcopy_mesh {
Grid+Cells+IPort2 &inMesh;
int+IPort2 trigger;
Grid+Cells+Data+Oparam outMesh;
method+notify_val update<status=1> = "DVcopy_mesh";
};
DVcopy_mesh copies an input mesh to an output mesh. Any node or cell data that is present is also copied to the output.
The input mesh to be copied to the output mesh.
A trigger that can be used to cause the module to execute.
The output mesh that is created from the input mesh.
Libraries.Main.Mappers.copy_ROI
interactively draw a polylines
group DVcreate_line {
float+Iparam &picked_xyz[3];
GDxform_templ+Iparam &picked_xform;
int+Iparam pick=1;
int+IOparam new=0;
int+nonotify new_cell=0;
Mesh+Node_Data+Oparam out {
nnodes = 0;
nspace = 3;
ncell_sets = 1;
Polyline cell_set;
};
method+notify_val upd_create_line = "create_line";
};
DVcreate_line lets the user interactively draw a polylines over an object in a viewer window.
The coordinates of the picked point. This red input port should be connected to a viewer's pick-xform output port.
The xform of the picked point. This red input port should be connected to a viewer's pick-coordinate output port.
An integer. When not 0, the user is using the left mouse button to select a series of points on the object. Lines are drawn between each point. The default is 1 (on).
An integer. When not 0, the user wants to select a new "first" point and begin drawing a new series of lines. When 0, the user is in the middle of drawing a series of lines and any left mouse button click is a line endpoint. The default is 0. This value is also passed as output.
The output is a new unstructured mesh of cell type Polyline. Each cell is one line segment in the drawing.
Libraries.Main.Mappers.draw_line
discover the type of mesh, then call the corresponding cropping base module
group DVcrop {
Mesh_Struct+Node_Data+Iparam &in {
nnodes+req;
};
int+Iparam min[in.ndim];
int+Iparam max[in.ndim];
DVcrop_struct DVcrop_struct {
&min => <-.min;
&max => <-.max;
};
DVcrop_unif DVcrop_unif {
&min => <-.min;
&max => <-.max;
};
DVcrop_rect DVcrop_rect {
&min => <-.min;
&max => <-.max;
};
DVfld_match DVfld_match {
Mesh_Struct+IPort2 &in=> <-.in;
links {
link0 => DVcrop_unif.in;
link1 => DVcrop_rect.in;
link2 => DVcrop_struct.in;
};
};
DVswitch DVswitch {
in => {DVcrop_unif.out, DVcrop_rect.out, DVcrop_struct.out};
index => DVfld_match.index;
};
olink out => DVswitch.out;
};
DVcrop is a utility base module. It discovers what type of mesh (Mesh_Struct, Mesh_Rect, or Mesh_Unif) its input field has, then passes control through DVswitch to the corresponding base module (DVcrop_struct, DVcrop_rect, or DVcrop_unif).
A reference to a field containing any type of structured mesh, plus Node_Data.
The cropping parameters. These are passed through to the selected base module.
The output is the same as the DVswitch selection.
extract a subset of a rectilinear field
group DVcrop_rect {
Mesh_Rect+Node_Data+Iparam &in {
xform_nonotify;
nnodes+req;
};
int+Iparam min[in.ndim];
int+Iparam max[in.ndim];
Mesh_Rect+Node_Data+Oparam out{
&xform<weight=-1> => in.xform;
};
method+notify_val+notify_inst upd_crop = "crop_rect";
} ;
DVcrop_rect reduces the size of a Mesh_Rect field by extracting the data within a specified range of its dimensions. The process is analogous to "cropping" a photographic image. Typical uses are to eliminate uninteresting portions of the data and to increase processing speed by reducing the amount of data.
A reference to an input that contains a Mesh_Rect and Node_Data.
Integers. These are references to 1D arrays that will hold the minimum and maximum X (Y, and Z) coordinates for the cropping operation. The arrays take their length from the ndim of the input Grid_Struct, i.e., a 1D mesh needs only 1 array element to specify X min and max coordinates, a 2D mesh needs 2 array elements for X and Y, etc.
The output field contains a new Mesh_Rect. Its points array (extents) are modified to retain the mesh's position in space.
For example, the following 1D field has a points array (extents) from 0 to 49.
You crop the field using an I min of 30 and an I max of 49. The output field has coordinate indices from 0 to 19 and a points array from 30 to 49.
The output field also contains a new Node_Data that has the data within the cropped region.
extract a subset of a structured field
group DVcrop {
Mesh_Struct+Node_Data+Iparam &in {
xform+nonotify;
nnodes+req;
};
int+Iparam min[in.ndim];
int+Iparam max[in.ndim];
Mesh_Struct+Node_Data+Oparam out{
&xform<weight=-1> => in.xform;
};
method+notify_val+notify_inst upd_crop = "crop";
} ;
DVcrop_struct reduces the size of a structured field (mesh type Mesh_Struct) by extracting the data within a specified range of its dimensions. The process is analogous to "cropping" a photographic image. Typical uses are to eliminate uninteresting portions of the data and to increase processing speed by reducing the amount of data.
A reference to an input that contains a Mesh_Struct and Node_Data. Mesh_Unif and Mesh_Rect will be accepted, but may not produce correct results. (Use DVcrop_rect and DVcrop_unif instead.)
Integers. These are references to 1D arrays that will hold the minimum and maximum X (Y, and Z) coordinates for the cropping operation. The arrays take their length from the ndim of the input Grid_Struct, i.e., a 1D mesh needs only 1 array element to specify X min and max coordinates, a 2D mesh needs 2 array elements for X and Y, etc.
The output field contains a new Mesh_Struct. The output field also contains a new Node_Data associated with the cropped region, and a reference to the input field's xform.
extract a subset of a uniform field
group DVcrop_unif {
Mesh_Unif+Node_Data+Iparam &in {
xform+nonotify;
nnodes+req;
};
int+Iparam min[in.ndim];
int+Iparam max[in.ndim];
Mesh_Unif+Node_Data+Oparam out{
&xform<weight=-1> => in.xform;
};
method+notify_val+notify_inst upd_crop = "crop_unif";
} ;
DVcrop_unif reduces the size of a Mesh_Unif field by extracting the data within a specified range of its dimensions. The process is analogous to "cropping" a photographic image. Typical uses are to eliminate uninteresting portions of the data and to increase processing speed by reducing the amount of data.
A reference to an input that contains a Mesh_Unif and Node_Data.
Integers. These are references to 1D arrays that will hold the minimum and maximum X (Y, and Z) coordinates for the cropping operation. The arrays take their length from the ndim of the input Grid_Struct, i.e., a 1D mesh needs only 1 array element to specify X min and max coordinates, a 2D mesh needs 2 array elements for X and Y, etc.
The output field contains a new Mesh_Unif. Its points array (extents) is modified to retain the mesh's position in space.
For example, the following 1D field has a points array (extents) from 0 to 49.
You crop the field using an I min of 30 and an I max of 49. The output field has a points array from 30 to 49.
The output field also contains a new Node_Data that has the data within the cropped region.
compute the curl of a vector field
group DVcurl {
Mesh+Node_Data+Iparam &in {
nnodes+req;
xform+nonotify;
coordinates.values+req;
};
int+Iparam comp;
Node_Data+write+nonotify out_nd;
Mesh+Node_Data+nonotify+OPort2 &out => merge(out_nd, in);
method+notify_val+notify_inst upd_curl = "curl";
};
DVcurl computes the curl of a vector field with any mesh type.
The input is a reference to a field with any mesh type. The Node_Data must have one or more 3-vector components.
An integer. Sets which component's curl to compute. The selected component must be a 3-vector.
This output is a new Node_Data object. It contains one 3-vector float component at each node that represents the curl.
This output is a new object that is the merge of the new out_nd Node_Data plus a reference to the original input field.
The algorithm used to compute the curl in structured meshes is a finite difference approximation based on a central difference scheme. For unstructured meshes, the function is based on the cell shape functions and their derivatives.
In both cases, where the input is the vector function
The equation used to compute the curl is:
create a volume of all cells whose node data is above or below a level value
group DVcut {
Mesh+Node_Data+Iparam &in { /* input field (to be sliced) */
xform+nonotify;
nnodes+req;
};
int+Iparam cut_comp;
int+Iparam map_comp[];
float+Iparam level;
int+Iparam above; /* toggle for specifying which side
of the plane will be removed-- */
Mesh+Node_Data+Oparam out { /* output field */
&xform<weight=-1> => in.xform;
};
method+notify_val+notify_inst upd_cut = "cut";
};
DVcut creates a volume of cells whose node data is above or below a specified level value. It is similar to DVthreshold, except that DVthreshold can only compare the data exactly at nodes, while DVcut creates an isovolume whose surface may be located between nodes. The surface may be between nodes because it is interpolated. For example, if the user specified a level value of 1.5, and one node has a value of 1.0, the adjacent node's value is 2.0, the isovolume's surface will bisect the space between the nodes.
Moreover, DVthreshold edits nodes out by setting them to NULL, while DVcut physically removes the cells from the output Node_Data and Mesh.
For example, you have a 3D uniform field that is a series of MRI scans of a cranium. You give it a level value that equals bone density. DVcut creates an unstructured mesh of all the node datas equal to bone density; effectively a mesh of the skull. If you make above = 0 (turn it off), DV cut outputs an unstructured mesh of all tissue whose node data is less than that of bone.
DVcut uses one scalar component to construct the isovolume, but outputs any combination of components from the input field. So, you may use, say, pressure to create the isovolume, but output pressure, temperature, and density.
The input is a reference to a field with any type of Mesh and Node_Data. Multiple cell sets are allowed.
An integer. Sets which component of the input field to use when constructing the isovolume. This component must be scalar.
An integer array. Each array value is the number (from 0 up) of a component to extract. For example, for an input field with two components:
(a, b, c, [e, f, g]) --> set map_comp = { 0 , 3 } --> (a, [e, f, g]) in the output field.
Note that this array is not explicitly dimensioned. It is a variable-length array that will have as many values as you assign to it with the = { n, n, n,...n} notation. The supplied AVS/Express modules that use DVcut implicitly set the dimension to 1 by specifying map_comp = {0}, i.e., the user can specify any one component to send to the output field, and the default is the first (0th) component.
A float. Set the value to use in constructing the isovolume. level is converted to the data type of the Node_Data before use.
An integer. When not equal to 0, values above level are in the output field. When equal to 0, values below or equal to level are in the output field.
The output is a new field. Its Mesh is unstructured, containing just the nodes above or below level. It may have mixed cell types and hence multiple cell sets. Its Node_Data contains the components specified by map_comp[nmap_comp] that were above or below level. It also contains a reference to the input field's xform.
The algorithm used to perform the interpolation and construct the isovolume is similar to the Marching Cubes algorithm. However, it uses pre-generated lookup tables to determine the intersection of the isosurface with the cells.
Libraries.Main.Mappers.cut
Libraries.Main.Mappers.isovolumeperform mathematical operations on fields using V expressions
group DVdata_math {
string+IPort2 operation = "#1";
Mesh+Node_Data+IPort2+nonotify &in1;
Mesh+Node_Data+IPort2+nonotify &in2;
Mesh+Node_Data+IPort2+nonotify &in3;
Mesh+Node_Data+IPort2+nonotify &in4;
int+IPort2 data_type = 4;
Node_Data+write+nonotify out_nd {
nnodes+nres => in1.nnodes;
nnode_data = 1;
!node_data[0] {
&id+nres => in1.node_data[0].id;
&veclen+nres => in1.node_data[0].veclen;
prim values[nvals][veclen];
labels+nres = "data_math";
};
};
Mesh+Node_Data+nonotify+OPort2 &out => merge(out_nd,in1);
method+notify_val+notify_inst upd_data_math = "data_math";
};
DVdata_math performs mathematical operations on one to four input fields. You supply any valid V expression and use the data_type input to set what data type you want the computation to be performed in.
A string containing any valid V mathematical expression, as described in the Developer's Reference manual. Do not enclose in quotes or terminate with ";".
sqrt( pow(#1,2) + pow(#2,2) + pow(#3,2) )
would calculate the magnitude of the 0th component of input fields 1, 2, and 3.
The input field(s) are references to fields with any type of mesh and Node_Data. You can use from 1 to 4 inputs. When typing the expression, you refer to them as #1, #2, #3, and #4.
DVdata_math uses the first (0th) component of each field. Operations between two fields require that their components be the same length (nnodes must be equal) and both components have the same veclen.
An integer to set the data type in which the computation will be performed. Each input's 0th component Node_Data is first converted to that type, the computation is performed in that type, and the output Node_Data is in that type. The choices are 0 (char), 1 (byte), 2 (short), 3 (int), 4 (float), and 5 (double). The default is 4 (float).
The output is a reference to a merged object that contains the new Node_Data that has the result of the computation. Its mesh is a reference to the input mesh of in1.
Libraries.Main.Filters.data_math
The Developer's Reference manual for discussion of V mathematical expressions.
compute the divergence of a vector field
group DVdivrg {
Mesh+Node_Data+Iparam &in { /* input field */
xform_nonotify;
nnodes+req;
coordinates.values+req;
};
int+Iparam comp;
Node_Data+write+nonotify out_nd;
Mesh+Node_Data+nonotify+OPort2 &out => merge(out_nd, in);
method+notify_val+notify_inst upd_divrg = "divrg";
};
DVdivrg computes the divergence of a vector field with any mesh type.
The input is a reference to a field with any mesh type. The Node_Data must have one or more 3-vector components.
An integer. Sets which component's divergence to compute. The selected component must be a 3-vector.
This output is a new Node_Data object. It contains one scalar float component at each node that represents the divergence.
This output is a new object that is the merge of the new out_nd Node_Data plus a reference to the original input field.
The algorithm used to compute the divergence in structured meshes is a finite difference approximation based on a central difference scheme. For unstructured meshes, the function is based on the cell shape functions and their derivatives.
In both cases, where the vector node data component is:
The equation used to compute the divergence is:
Libraries.Main.Filters.divergence
discover the type of mesh, then call the corresponding downsizing base module
group DVdownsize {
Mesh_Struct+Node_Data+Iparam &in {
nnodes+req;
};
float+Iparam factor[in.ndim];
DVdownsize_struct DVdownsize_struct {
&factor => <-.factor;
};
DVdownsize_unif DVdownsize_unif {
&factor => <-.factor;
};
DVdownsize_rect DVdownsize_rect {
&factor => <-.factor;
};
DVfld_match DVfld_match {
Mesh_Struct+IPort2 &in=> <-.in;
links {
link0 => DVdownsize_unif.in;
link1 => DVdownsize_rect.in;
link2 => DVdownsize_struct.in;
};
};
DVswitch DVswitch {
in => {DVdownsize_unif.out, DVdownsize_rect.out,
DVdownsize_struct.out};
index => DVfld_match.index;
};
olink out => DVswitch.out;
};
DVdownsize is a utility base module. It discovers what type of mesh (Mesh_Struct, Mesh_Rect, or Mesh_Unif) its input field has, then passes control through DVswitch to the corresponding base module (DVdownsize_struct, DVdownsize_rect, or DVdownsize_unif).
A reference to a field containing any type of structured mesh, plus Node_Data.
The scaling factor. This is passed through to the selected base module.
The output is the same as the DVswitch selection.
Libraries.Main.Filters.downsize
resample a rectilinear field to reduce (or increase) its size
group DVdownsize_rect {
Mesh_Rect+Node_Data+Iparam &in {
xform+nonotify;
nnodes+req;
};
float+Iparam factor[in.ndim];
Mesh_Rect+Node_Data+Oparam out{
&xform<weight=-1> => in.xform;
};
method+notify_val+notify_inst upd_downsize = "downsize";
} ;
DVdownsize_rect resamples a rectilinear field (mesh type Mesh_Rect) using a scaling factor. Where the factor is > 1, DVdownsize reduces the size of the field, saving processing time and memory by "thinning out" the data. Where factor < 1, DVdownsize_rect increases the size of the field by duplicating data.
DVdownsize_rect works like this (see the 1D example on the following page):
For each dimension i (X, Y, and Z) calculate:
- dims_out[i] = dims_in[i] / factor[i]
- Round dims_out up or down to the nearest whole integer.
Note: the two endpoints are always preserved in the output data.
Note: the extents of the input field are preserved in the output field.- Calculate the ratio of the intervals between nodes dims_in : dims_out
- For each new array index, find the nearest whole integer by rounding up or down.
- Use the node data and coordinates in the input field that are found by these index values as the node data and coordinates for the output field.
Note that, throughout the process, the actual node data values and coordinate values are irrelevant. All that is being manipulated are the indexes into these arrays.
A reference to an input field containing a Mesh_Rect and Node_Data.
A float array used as a scaling coefficient. The output field's values (and coordinates for irregular data) are:
dims_out[i] = dims_in[i] / factor [i]
where i cycles through the dims of the field, either 1D, 2D, or 3D.
The length of the factor array (1D: just X; 2D: X and Y; 3D: X, Y and Z) is taken from the ndim of the Grid_Struct. You control the factor for each dimension separately.
Note: factors < 1 will make the output field larger. For example, a factor of 0.5 will double the size of the output field.
The output is a new object that contains a new Mesh_Rect. The new Mesh_Rect's points array (extents) will occupy the same "space" as the input field's Mesh_Rect.
The output field also contains a new Node_Data object containing the data associated with the downsized region.
Libraries.Main.Filters.downsize
resample a structured field to reduce (or increase) its size
group DVdownsize {
Mesh_Struct+Node_Data+Iparam &in {
xform+nonotify;
nnodes+req;
};
float+Iparam factor[in.ndim];
Mesh_Struct+Node_Data+Oparam out{
&xform<weight=-1> => in.xform;
};
method+notify_val+notify_inst upd_downsize = "downsize";
} ;
DVdownsize_struct resamples a structured field (mesh type Mesh_Struct) using a scaling factor. Where the factor is > 1, DVdownsize_struct reduces the size of the field, saving processing time and memory by "thinning out" the data. Where factor < 1, DVdownsize_struct increases the size of the field by duplicating data.
DVdownsize_struct works like this (see the 1D example on the following page):
For each dimension i (X, Y, and Z) calculate:
- dims_out[i] = dims_in[i] / factor[i]
- Round dims_out up or down to the nearest whole integer.
Note: the two endpoints are always preserved in the output data.
Note: the extents of the input field are preserved in the output field.- Calculate the ratio of the intervals between nodes dims_in : dims_out
- For each new array index, find the nearest whole integer by rounding up or down.
- Use the node data and coordinates in the input field that are found by these index values as the node data and coordinates for the output field.
Note: Throughout the process, the actual node data values and coordinate values are irrelevant. All that is being manipulated are the indexes into these arrays.
A reference to an input field containing a Mesh_Struct and Node_Data.
A float array used as a scaling coefficient. The output field's values (and coordinates for irregular data) are:
dims_out[i] = dims_in[i] / factor [i]
where i cycles through the dims of the field, either 1D, 2D, or 3D.
The length of the factor array (1D: just X; 2D: X and Y; 3D: X, Y and Z) is taken from the ndim of the Grid_Struct. You control the factor for each dimension separately.
Note: factors < 1 will make the output field larger. For example, a factor of .5 will double the size of the output field.
The output is a new object that contains a new Mesh_Struct. The new Mesh_Struct's points array (extents) will occupy the same "space" as the input field's Mesh_Struct.
The output field also contains a new Node_Data object containing the data associated with the downsized region.
Libraries.Main.Filters.downsize
resample a uniform field to reduce (or increase) its size
group DVdownsize_unif {
Mesh_Unif+Node_Data+Iparam &in {
xform+nonotify;
nnodes+req;
};
float+Iparam factor[in.ndim];
Mesh_Unif+Node_Data+Oparam out{
&xform<weight=-1> => in.xform;
};
method+notify_val+notify_inst upd_downsize = "downsize";
} ;
DVdownsize_unif resamples a uniform field (mesh type Mesh_Unif) using a scaling factor. Where the factor is > 1, DVdownsize_unif reduces the size of the field, saving processing time and memory by "thinning out" the data. Where factor < 1, DVdownsize_unif increases the size of the field by duplicating data.
DVdownsize_unif works like this (see the 1D example on the following page):
For each dimension i (X, Y, and Z) calculate:
- dims_out[i] = dims_in[i] / factor[i]
- Round dims_out up or down to the nearest whole integer.
Note: the two endpoints are always preserved in the output data.
Note: the extents of the input field are preserved in the output field.- Calculate the ratio of the intervals between nodes dims_in : dims_out
- For each new array index, find the nearest whole integer by rounding up or down.
- Use the node data and coordinates in the input field that are found by these index values as the node data and coordinates for the output field.
Note: Throughout the process, the actual node data values and coordinate values are irrelevant. All that is being manipulated are the indexes into these arrays.
A reference to an input field containing a Mesh_Unif and Node_Data.
A float array used as a scaling coefficient. The output field's values (and coordinates for irregular data) are:
dims_out[i] = dims_in[i] / factor [i]
where i cycles through the dims of the field, either 1D, 2D, or 3D.
The length of the factor array (1D: just X; 2D: X and Y; 3D: X, Y and Z) is taken from the ndim of the Grid_Struct. You control the factor for each dimension separately.
Note: factors < 1 will make the output field larger. For example, a factor of 0.5 will double the size of the output field.
The output is a new object that contains a new Mesh_Unif. The new Mesh_Unif's points array (extents) will occupy the same "space" as the input field's Mesh_Unif.
The output field also contains a new Node_Data object containing the data associated with the downsized region.
Libraries.Main.Filters.downsize
perform 3D texture mapping on a 3D uniform field
group DVexcavate_brick3d {
Mesh_Unif+Dim3+Node_Data+Iparam &in { /* uniform input field */
xform+nonotify;
ndim+req;
};
int+Iparam x;
int+Iparam y;
int+Iparam z;
int+Iparam flip_x;
int+Iparam flip_y;
int+Iparam flip_z;
int+Iparam draw_sides;
Mesh+Node_Data+Oparam out { /* output field */
&xform<weight=-1> => in.xform;
};
method+notify_val+notify_inst upd_excavate_brick3d = "excavate_brick3d";
};
DVexcavate_brick3d is a technique for visualizing 3D uniform volume data. The volume is displayed with three slice planes: one each in X, Y, and Z. The slice planes remove a rectangular chunk of the field, revealing the structures inside.
Texture mapping is much faster than the sampling techniques used by, for example, DVslice, particularly for large datasets. The point sampling done by the texture mapping technique is always done at the resolution of the data; thus differences in data values within a small area are not obscured as they can be with DVslice.
The input is a reference to a Mesh_Unif, Dim3 field with Node_Data.
Integers. These set the X, Y, Z position of their respective slice planes.
Integers. These select whether the excavating cube should be positioned on the positive or negative axis for each of the X, Y, and Z dimensions. When the value is not 0, the cube is positioned on the negative axis.
An integer. When 0, only the excavating cube is drawn. When not 0, a texture map of the bounding faces of the volume is also drawn.
The output is a new Mesh and Node_Data. u, v, w textures are added. There is a reference to the input mesh's xform.
DVexcavate_brick3D creates its picture of the volume data using 3D texture mapping. In this method, the boundary of the volume has three values, u, v, w, associated with each of its vertices. Where the slice planes intersect this volume, u, v, w values are computed for the vertices of the resulting solid. These values are attached to the vertices of the output object. Viewers use the u, v, w information to create the texture-mapped rendering.
Libraries.Main.Mappers.excavate_brick3d
create an array of fields from a single field based on material properties of cell
setsmodule DVexplode_materials {
Mesh+Iparam &in {
nnodes+req;
xform+nonotify;
};
int+Iparam property;
int+Oparam nfld;
Cells+write+nonotify out_sets[nfld] {
*cell_set[];
ncell_sets => array_size(cell_set);
};
group out_mrgs[nfld] {
int+nres arr_ind => index_of(out_mrgs);
Mesh+Node_Data+Cell_Data+nres &out_flds =>
merge(out_sets[arr_ind],in);
};
mlink+nonotify+OPort2 out => out_mrgs.out_flds;
method+notify_val+notify_inst upd_explode_mat<status=1> =
"DVexplode_mat";
};
Each cell set in a field has an associated properties array. You may use this array to
store anything related to the cell set, but it is commonly used to store material
properties of the cells in the cell set.DVexplode_materials splits up the field into an array of fields based on the values of a particular element of the properties array. The same array index is used to look up the value in the properties array of each cell set. Each cell set with a distinct value of that property goes into a separate output field. The actual values are not significant, only whether they are equal or not. Note that this module compares floating-point numbers for equality; you are responsible for ensuring that the values in the material property array are bit-for-bit equal or not, as desired.
Mesh. This mesh is split apart into multiple meshes on the output, according to the selected property value of each cell set.
int. Which element of the property value array to use.
Number of meshes in the output array.
Mesh[]. An array of meshes, with other data merged from the input field.
transform an array of meshes away from their common center
module DVexplode_xform {
Mesh+Iparam &in[] {
nnodes+req;
};
float+Iparam x_factor;
float+Iparam y_factor;
float+Iparam z_factor;
group+write+nonotify out[array_size(in)] {
DefaultXform xform;
};
group+nonotify out_field_mrg[array_size(in)] {
int+nres arr_ind => index_of(out_field_mrg);
Mesh+nres &out_fld => merge(out[arr_ind],in[arr_ind]);
};
mlink+nonotify+OPort2 out_flds => out_field_mrg.out_fld;
method+notify_val+notify_inst upd_xform_mat<status=1> =
"DVexplode_xform";
};
DVexplode_xform transforms each mesh in an array of meshes away from their common center (measured as the average of the min and max in each dimension). The transformation matrices and transformed fields are both available as outputs.
Mesh[]. The array of input fields.
float. Scales the amount that the the fields are translated away from the center.
float. Scales the amount that the the fields are translated away from the center.
float. Scales the amount that the the fields are translated away from the center.
group[]. Contains the new transforms to be applied to each field.
Mesh[]. Contains the output fields.
extract external edges of a field to reveal inside objects
group DVext_edge {
Mesh+Iparam &in { /* input field */
xform+nonotify;
nnodes+req;
};
float+Iparam angle; /* maximum face angle */
Mesh+Node_Data+Oparam out {
&xform<weight=-1> => in.xform;
};
method+notify_val+notify_inst upd_ext_edge = "ext_edge";
} ;
DVext_edge produces a wireframe representation of the outside of an unstructured mesh. You use it when you want to see objects produced by other modules that are inside an unstructured mesh (isosurfaces, streamlines, probes, etc.) while still being able to see the enclosing skeletal shape of the mesh.
A reference to an unstructured Mesh. Structured meshes (Mesh_Struct, Mesh_Rect, etc.) will be accepted but are converted to unstructured during execution.
A float. This value controls the accuracy of the boundary representation on the base of the angle between two adjoining faces. All edges that have an angle < this value will be represented in the output field. Like all DV parameters, angle has no default. However, the angle used should be between 0.0 and 180.0.
The output is a new unstructured Mesh of the input mesh's exterior. It contains a reference to the input mesh's xform.
Libraries.Main.Mappers.external_edges
extract external faces of a field for faster rendering
group DVext_face {
Mesh+Iparam &in { /* input field */
xform+nonotify;
nnodes+req;
};
Cells+Oparam out_cells {
*cell_set[];
ncell_sets => array_size(cell_set);
};
Cells+Cell_Data+write+nonotify out_sets;
Mesh+OPort2+nonotify &out => merge(out_cells, in);
method+notify_val+notify_inst upd_face = "face";
};
DVext_face produces a mesh that represents just the exterior, visible faces of an unstructured mesh. It saves memory and greatly speeds rendering because all of the unstructured mesh's many interior, hidden nodes and cells are not represented.
A reference to an input unstructured mesh (mesh type Mesh). All other objects are ignored. Structured meshes (Mesh_Struct, Mesh_Rect, etc.) will be accepted but are converted to unstructured during execution.
An array of cell_sets whose contents are the unstructured Mesh that represents the field's external faces. This output is not normally used. Use the output below instead.
The output is a reference to a merged object that is a combination of the new unstructured Mesh of the input mesh's exterior faces, divided into cell sets, and the input field's Mesh.
Libraries.Main.Mappers.external_faces
extract one cell_data component from each Cell_Data cell_set
group DVextr_cell_comp {
Mesh+Cell_Data+Iparam ∈
int+Iparam comp;
int+nres+nonotify dim => in.ncell_sets;
group+nonotify out_data[dim] {
int+nres ncells => in.cell_set[index_of(out_data)].ncells;
int ncell_data=1;
group+nres &cell_data =>
{in.cell_set[index_of(out_data)].cell_data[comp]};
};
group+nonotify out_sets[dim] {
group+nres &out_set => merge(out_data[index_of(out_sets)],
in.cell_set[index_of(out_sets)]);
};
Cells+Cell_Data+Oparam out_cd {
*cell_set[];
ncell_sets => array_size(cell_set);
};
Mesh+Oparam &out =>merge(out_cd, in);
method+notify_val+notify_inst upd_extr_cell_comp = "extr_cell_comp";
};
DVextr_cell_comp extracts one cell_data component from each Cell_Data cell_set. If there are multiple Cell_Data cell_sets, the same component is extracted from each cell_set. DVextr_cell_comp is the cell data equivalent of DVextract_comp for node data.
Since the renderer draws just the first component it finds in each cell_set, you use DVextr_cell_comp to obtain the right component from a multi-component Cell_Data field.
A reference to a field that contains a Mesh and Cell_Data.
An integer that specifies which component (0-n) to extract. This is often obtained from a combination of a UIradioBoxLabels and the DVcell_data_labels base module.
The output is a reference to a merged object that contains the new Cell_Data, plus references to all other unchanged objects in the input Mesh.
Libraries.Main.Filters.extract_cell_component
v/modules.vextract a single data component from a field
group DVextract_comp {
int+IPort2 component = 0;
Mesh+Node_Data+IPort2 ∈
Node_Data out_nd {
nnodes => in.nnodes;
nnode_data = 1;
&node_data+nres => {in.node_data[component]};
};
Mesh+Node_Data+OPort2 &out => merge(out_nd,in);
};
DVextract_comp creates a new field object that is a reference to one component of an existing Node_Data. The component can be scalar or vector. Most modules that work on Node_Data work on just one component of Node_Data. DVextract_comp is the base module that they use to acquire this single component.
An integer. Sets which component of the input Node_Data to extract. The default is the first (0th) component.
A reference to a field containing a Mesh and Node_Data.
A reference to a merged object. That object's first member is a reference to the extracted Node_Data component. The object's second member is a reference to the remainder of the input field.
Libraries.Main.Filters.clamp
Libraries.Main.Mappers.cut
Libraries.Main.Filters.extract_scalar
and many othersextract a scalar data element from a field's vector component
func DVextr_scalar {
Node_Data+Iparam &in { /* input field */
nnodes+req;
};
int+Iparam component; /* which component to extract */
Node_Data+Oparam out; /* output field */
method+notify_val+notify_inst upd_extr_scalar = "extr_scalar";
} ;
DVextr_ scalar extracts a single scalar data element from a vector component of a field with Node_Data.
([a, b, c]) --> select second vector element --> (b)
A reference to a field with Node_Data. The Node_Data can contain only one component. (See DVextract_comp to obtain a single component.) This component can be scalar or vector.
An integer. Establishes which sub-component of the component to extract.
A new Node_Data object that contains only the extracted scalar data.
DVMextract_scalar_param, ExtractScalar
Libraries.Main.Filters.extract_scalar
extract arbitrary vector elements from Node_Data as one component
group DVextr_vector {
Node_Data+Iparam &in { /* input field */
nnodes+req;
};
int+Iparam veclen; /* length of vector to be extracted */
int+Iparam components[veclen];
int+Iparam sub_components[veclen];
Node_Data+Oparam out; /* output field */
method+notify_val+notify_inst upd_extr_vector = "extr_vector";
} ;
DVextr_vector extracts n scalar elements from the components of Node_Data and turns them into a a single component with n vector elements. For example:
(a, b, c, [d, e, f]) --> select 0 and 3 index components, select 0 and 1 index sub_components --> ([a, e])
You could use it, for example, to assemble three scalar components into one three element vector component prior to using DVadvect or DVstream.
A reference to the input field from which elements will be extracted.
An integer. Establishes how many individual scalar elements to extract overall. This will be the veclen of the output Node_Data's single component Data_Array.
An integer pointer to an array whose values specify which of &in's components will be examined for subcomponent extraction. For example:
If the user gave veclen=2, then components is an array with two indices, 0 and 1. Each array value could be 0 (a) , 1 (b) , 2 (c) , or 3 ([d, e, f]).
An integer pointer to an array of veclen whose values specify which of the component's subcomponents will be extracted in the output. For example:
If the user has given veclen=2 and components (0, 3), then sub_components is an array with two indices, 0 and 1. The first array value can only be 0 (since that component is scalar (a). The second array value could be 0 (d), 1 (e), or 2 (f).
The output is a new Node_Data object containing the extracted values. It has one component. That component's elements are the extracted values.
DVMcombine_vect_param, CombineVect
Libraries.Main.Filters.combine_vect
create a mesh without any data
module DVextract_mesh {
Mesh+IPort2 ∈
Node_Data out_nd {
nnodes => <-.in.nnodes;
nnode_data = 0;
};
Mesh+Node_Data+OPort2 &out=>merge(out_nd, in);
};
DVextract_mesh outputs the same mesh as the input, but with no node data (nnode_data=0).
Mesh+Node_Data. The output mesh is copied from this input.
Mesh+Node_Data. Contains only the mesh part of the input field.
detect the mesh type of a field
group DVfld_match {
Mesh+IPort2 ∈
int+OPort2 index=0;
group+write links {
link+OPort2 link0;
link+OPort2 link1;
link+OPort2 link2;
link+OPort2 link3;
};
method+notify_val upd_match = "fld_match";
};
DVfld_match detects the mesh type of a field. It compares the mesh type of the input field &in against a list of links to specific mesh types. It then outputs the index of the matching mesh. This index is usually used as input to DVswitch, which uses it as an index into its array of base modules to find the correct base module to use.
A reference to a field containing any type of Mesh.
Links to DVfld_match's matching choices. For example, DVcrop uses DVfld_match to discover the mesh type of its input in order to call the correct DVcrop_type base module. It defines these links as:
links {
link0 => DVcrop_unif.in;
link1 => DVcrop_rect.in;
link2 => DVcrop_struct.in;
};An integer whose value is the index of the "match" in the links object. For example, if the input field to DVcrop is Mesh_Rect, index's value is 1.
Libraries.Main.Filters.downsize
Libraries.Main.Filters.crop
Libraries.Main.Mappers.slicecreate an AVS/Express Field object of any type
group DVgen_fld {
int+Iparam fld_type;
int+Iparam ndim;
int+Iparam dims[ndim];
int+Iparam nspace;
float+Iparam extents[2][nspace];
string cell_type;
int+Iparam ndata_veclen;
int+Iparam ndata_type;
float+Iparam ndata_coeff[10];
int null_flag;
float null_value;
Field+Oparam &out; /* output field */
method+notify_val+notify_inst upd_gen_fld = "gen_fld";
};
DVgen_fld generates a Field of any type as specified by its input parameters. Its primary purpose is to create different kinds of Fields against which to test modules or macros that you are developing. The fields include dummy data that is the sum of a polynomial.
An integer that specifies the field type:
0 Field
1 Field_Struct
2 Field_Unif
3 Field_RectAn integer that specifies the ndim of a structured, uniform, or rectilinear coordinate Grid_Struct.
An integer pointer to the beginning of the dims array for a structured, uniform, or rectilinear Grid_Struct. The user does not have to specify this value.
An integer that specifies the nspace of a Grid.
A set of float parameters to set the field's points array (uniform and rectilinear fields).
A string that specifies the cell type of unstructured meshes. Allowed values are: "Point", "Line", "Polyline", "Tri", "Quad", "Tet", "Hex", or "Prism".
An integer that specifies the nnode_data value in the Node_Data object of the field (the number of Node_Data components).
An integer that specifies the primitive data type of the Node_Data's Data_Array values array. The allowed values are (from avs/dtype.h):
DTYPE_CHAR 0
DTYPE_BYTE 1
DTYPE_SHORT 2
DTYPE_INT 3
DTYPE_FLOAT 4
DTYPE_DOUBLE 5A floating-point "seed" value for the polynomial function that will generate the fictitious data in the Node_Data's Data_Array values array.
An integer. If not zero, then set the null_flag in the output field's Data_Array to "has null data."
A float. If null_flag is not zero, then set the null_value in the output field's Data_Array to this value.
Reference to the output field.
take an array of glyphs as input and output glyphs at nodes using node data as an index into the glyph array
module DVgeo_glyph { /* produces scaled, colored glyphs at nodal locations */
Mesh+Iparam &in { /* input field */
nnodes+req;
coordinates+req;
coordinates.values+req;
int+opt nnode_data;
Data_Array+opt node_data[nnode_data];
};
Mesh+Iparam &glyph[] { /* glyph geometry */
nnodes+req;
coordinates+req;
coordinates.values+req;
};
float+Iparam scale; /* scale factor applied to glyph */
float+Iparam color[3]; /* color applied to glyph */
int+Iparam normalize; /* normalize glyph index */
Mesh+Node_Data+Oparam out { /* output field */
xform+nowrite;
};
method+notify_val+notify_inst geo_glyph_update<status=1> =
"DVgeo_glyph";
};
DVgeo_glyph takes an input field and an array of glyphs, and draws one glyph at each node location of the in_field. The glyph drawn is selected by using the data at that node as an index into the glyph array.
If normalize is off, floating point values are converted to integers by truncation. If normalize is on, the data range is mapped to the number of glyphs so that each glyph represents the same fraction of the data range.
If the data is out of the bounds of the glyph array, the minimum or maximum glyph is drawn, as appropriate.
The glyphs' colors are determined by the color parameters unless the glyphs themselves provide node data for coloring, and their size is scaled by the scale parameter. Their orientation is unchanged.
Mesh. Glyphs will be placed at the nodes of this mesh.
Mesh[]. Array of geometries for the glyphs.
float. The glyphs are scaled by this amount.
float[3]. The color to be applied to each glyph.
int. If zero, the glyphs are scaled to the data value at the node. If nonzero, the glyphs are only scaled by the scale input.
Mesh+Node_Data. Contains all the glyphs as geometry data.
produce scaled, colored glyphs at single component node locations
group DVglyph {
Mesh+Node_Data+Iparam &in { /* input field */
nnodes+req;
coordinates.values+req;
};
Mesh+Iparam &glyph; /* glyph geometry */
int+Iparam vector; /* toggle to transform glyph by vector data */
int+Iparam glyph_comp; /* glyph data component */
int+Iparam map_comp; /* color glyph by data */
float+Iparam scale; /* scale factor applied to glyph */
int+Iparam normalize; /* toggle to normalize glyphs */
Mesh+Node_Data+Oparam out; /* output field */
method+notify_val+notify_inst upd_glyph_mod = "glyph_mod";
};
DVglyph places a geometrical object at each node of an input field so that node locations can be easily identified. The glyph can be sized and colored according to the selected data component at each node.
When combined with other base modules such as DVinterp_data, and vector base modules such as DVstreams, DVglyph acts like a "hedgehog" function.
A reference to a field with any type of mesh plus Node_Data
A reference to a mesh describing the geometry of the glyph. Any mesh can be used (for example, that of a teapot) but for convenience you can use one of the geometries in Geometries, such as Arrow1, Arrow2, or Cross3D.
An integer. If the value is not zero, the glyph (for example, an arrow) will be rotated to point at the direction of the data vector at that node. Scalar vectors rotate along the X axis, 2 element vectors along the XY axes, and 3 element vector components along all three axis.
An integer. Selects which component to use to draw and orient the glyph. The component can be scalar or vector.
An integer. Selects which component to use to color the glyph.
A float. This value adjusts the sizes of the glyphs.
An integer. If the value is zero, the sizes of the glyphs will be proportional to the data component values at each node. If the value is not zero, all glyphs are the same size.
The output is a new object that contains an unstructured mesh (mesh type Mesh) that is the meshes of all the glyphs. It also contains a new Node_Data consisting of the magnitude of the single component's data values.
Libraries.Main.Mappers.glyph
Libraries.Main.Mappers.probe
Libraries.Main.Mappers.advectorcompute the vector gradient of a field
group DVgrad {
Mesh+Node_Data+Iparam &in { /* input field */
nnodes+req;
xform+nonotify;
coordinates.values+req;
};
int+Iparam comp;
Node_Data+write+nonotify out_nd;
Mesh+Node_Data+nonotify+OPort2 &out => merge(out_nd, in);
method+notify_val+notify_inst upd_grad = "grad";
};
DVgrad computes the vector gradient of a field with any mesh.
The input is a reference to a field with any mesh type. The Node_Data must have one or more scalar components.
An integer. Sets which component's gradient to compute. The selected component must be scalar.
This output is a new Node_Data object. It contains one 3-vector float component at each node that represents the gradient.
This output is a new object that is the merge of the new out_nd Node_Data plus a reference to the original input field.
The algorithm used to compute the gradient in structured meshes is a finite difference approximation based on a central difference scheme. For unstructured meshes, the function is based on the cell shape functions and their derivatives.
In both cases, the equation used to compute the gradient is:
Libraries.Main.Filters.gradient
determine the length, area, or volume and mass of an unstructured field
group DVintegr_vol {
Mesh+Iparam &in { /* input field */
xform+nonotify;
nnodes+req;
};
int+Iparam component=0;
int+Iparam dim;
float+Oparam volume; /* volume of field */
float+Oparam mass; ' /* mass of field */
method+notify_val+notify_inst upd_integr_vol = "integr_vol";
} ;
DVintegr_vol calculates the length (1D cells), area (2D cells), or volume (3D cells) and mass of an unstructured field and outputs them as two float values.
A reference to an unstructured Mesh. Structured meshes (Mesh_Struct, Mesh_Unif, etc.) will be accepted but DVintegr_vol will create a temporary working version of the mesh by converting it to an unstructured Mesh of cell type Hex.
If only a Mesh is present, then only the length, area, or volume is calculated. To calculate mass, a Node_Data must be present.
An integer that selects which component of the Node_Data to use in the mass calculation. The selected component must be a scalar representing density. The default is the first (0th) component.
An integer. This value only comes into play if the unstructured mesh contains mixed (1D and 2D, or 2D and 3D) cell types. Then, you must specify whether you want to calculate the length of the 1D cells, the area of the 2D cells, or the volume of the 3D cells.
A float value that is the volume of the field.
A float value that is the mass of the field.
The algorithm used to calculate the volume and mass is: Gauss-Legendre quadrature (aka "Gauss sampling points").
Libraries.Main.Mappers.volume_integrate
sample cell data of one field at the node locations of another "probe" field
module DVinterp_cell_data {
/* uses data from the first field to interpolate data at
locations of the second field */
Mesh+Cell_Data+Iparam &in { /* input field */
nnodes+req;
coordinates+req;
coordinates.values+req;
};
Mesh+Iparam &probe { /* field grid */
nnodes+req;
coordinates+req;
coordinates.values+req;
};
int+Iparam component;
Node_Data+write+nonotify out_nd; /* output field */
Mesh+Node_Data+nonotify+OPort2 &out => merge(out_nd, probe);
method+notify_val+notify_inst interp_data_update<status=1> =
"DVinterp_cell_data";
};
DVinterp_cell_data uses the node coordinates specified in the input mesh (in_probe) as a set of sample points for the in_field. For each sample point, it locates the cell containing that point in the in_field, and uses the (possibly vector) value of the given component in that cell as the node data in the output field.
If there is no cell in in_field containing a given sample point, a null data value is used.
Mesh+Cell_Data. This field is sampled at the locations determined by the nodes of the probe mesh.
Mesh. The node coordinates of this field define the sample points for interpolating the input field.
int. Which data component to interpolate.
The interpolated output field.
use coordinates from a probe mesh as sample points to interpolate data in a field
group DVinterp_data {
Mesh+Node_Data+Iparam &in { /* input field */
xform+nonotify;
nnodes+req;
coordinates.values+req;
};
Mesh+Iparam &probe { /* field grid */
nnodes+req;
coordinates.values+req;
};
int+Iparam comps[];
Node_Data+write+nonotify out_nd; /*output field*/
Mesh+Node_Data+nonotify+OPort2 &out => merge(out_nd, probe);
method+notify_val+notify_inst upd_interp_data = "interp_data";
} ;
DVinterp_data uses the coordinates specified in an input mesh (in_probe) as a set of sample points for a field. It takes each set of coordinates in the mesh (the sample points), locates these same coordinates in the input field, then calculates what the interpolated data value of the selected scalar component would be at that exact location based on the values of the same component in the adjacent nodes.
A reference to a field with any mesh type and Node_Data. The Node_Data's first component will be used. It must be scalar.
A reference to any mesh whose coordinates represent the sample points.
To create this sampling mesh you could, for example, use the plane object in Geometries.plane or the DVslice module.
An integer array. Each array value is the number (from 0 up) of a component to interpolate. The specified component must be scalar. For example:
(a, b, c, [e, f, g]) --> set map_comp = {0, 2} --> (a, c)
causes a and c to be interpolated and sent to the output field.
Note that this array is not explicitly dimensioned. It is a variable-length array
that will have as many values as you assign to it with the = { n, n, n,...n} notation. The supplied AVS/Express modules that use DVinterp_data implicitly set the dimension to 1 by specifying map_comp = {0}, i.e., the user can specify any one component to send to the output field, and the default is the first (0th) component.This output is a new Node_Data object that contains the interpolated data values at the mesh nodes.
The output is a reference to a new object that is the merge of a new Node_Data out_nd, and a reference to the probe's unstructured mesh. That is, it is a reference to the interpolated data values at the mesh nodes, plus that mesh.
Structured fields use trilinear interpolation. Unstructured fields use shape function interpolation.
Libraries.Main.Mappers.interp_data
Libraries.Main.Mappers.probeproduce a mesh representing an isosurface
group DViso {
Mesh+Node_Data+Iparam &in {
xform_nonotify;
nnodes+req;
};
float+Iparam level;
Mesh+Oparam out {
&xform<weight=-1> => in.xform;
};
NParam_Data+Oparam nparam;
method+notify_val+notify_inst iso_update = "iso";
} ;
DViso is used to create isosurfaces-a 3D contour surface that passes through all cells containing a specified level value. The surface may actually occur between node locations. For example, if one node has a component value of 1.0, and the adjacent node's component value is 2.0, then if the user sets a level value of 1.5, the surface Mesh is interpolated and will occur midway between the two real nodes.
The input is a reference to a field with Mesh and Node_Data. Both structured and unstructured meshes are fully supported. It uses the first component of the Node_Data, which must be a scalar component.
A float. Sets the value for which an isosurface will be constructed. Its data type will be converted to the Node_Data's data type before use.
The output is a new object. It is an unstructured Mesh made up of one cell set. The cell type is Tri. The Mesh is the location of the isosurface. It includes a reference to the input field's xform.
This output is of type NParam_Data, which is defined as follows in v/fld.v:
dgroup NParam_Data {
int nnodes;
int min_node[nnodes];
int max_node[nnodes];
float tpar[nnodes];
};One often wishes to map the values of one component (for example, temperature), as a color onto the isosurface of another component (say, pressure). The picture would show an isosurface of component pressure = .25, and that surface would be colored by the interpolated temperature component values all along that isosurface.
To perform this mapping most efficiently, using a minimum of memory and node data processing, DViso outputs only a "table" that lists which pairs of nodes the isosurface crossed, and a parametric value from between 0.0 and 1.0 that tells where the isosurface crossed between the nodes. A different base module, DVnmap, can take this nparam data and quickly calculate interpolated values for any other component.
For example, consider the simpler 2D Mesh case. There are six nodes in two cells. The user-specified pressure component isosurface level is .25
The original Node_Data Data_Array is:
The nparam structure output by DViso would look like this:
That is, between the node that is the nval = 1 index into the component's Data_Array and node that is the nval = 4 index, the pressure component isosurface mesh crosses at .5. Thus, when DVnmap is trying to figure out what numeric value to produce for a temperature at that location, it knows that all it has to do is use the temperature component's nval = 1 and nval = 4 index node values and calculate ((nval[4] - nval[1]) * tpar).
isosurface uses the Marching Cubes algorithm to construct the isosurface. See W. Lorensen and H. Cline, "Marching Cubes: A High Resolution Surface Reconstruction Algorithm." Computer Graphics 21(4) (SIGGRAPH Proceedings, 1987), July, 1987, pp. 163-169.
This algorithm has a known limitation. There are cases where there are two possible paths that the isosurface could take through a cell, and only one is the correct path. If isosurface picks the wrong path, it will appear as a discontinuity in the surface such as a hole.
Libraries.Main.Mappers.isosurface
Libraries.Main.Mappers.slicecreate contour lines of constant value
group DVisoline {
Mesh+Node_Data+Iparam &in { /* input field */
xform_nonotify;
nnodes+req;
};
int+Iparam component;
float+Iparam level; /* isoline level */
int+Iparam color; /* toggle for colored lines */
Mesh+Node_Data+Oparam out { /* output field */
&xform<weight=-1> => in.xform;
};
method+notify_val+notify_inst isoline_update = "isoline";
};
DVisoline creates contour lines of a given level value in a 2D field. The contour lines can be colored by the level value. The selected component must be scalar.
The input is a reference to a field with a 2D mesh and Node_Data. The mesh can be of any defined type (Mesh, Mesh_Struct, Mesh_Unif, Mesh_Rect). However, the mesh must be 2D (nspace = 2 in structured fields, cell_ndim = 2 in unstructured fields). No checking is done to ensure that the mesh is 2D. 3D meshes will not generate output. The Node_Data must have a single scalar component.
A float. Sets the isoline level. The data type is converted to the data type of the input field prior to use.
An integer. If the value is not 0, then the isolines will be colored by the level value.
The output is a new object that contains an unstructured Mesh of cell type Line that represents the contour lines. The value of the Node_Data is the level value.
For each "cell" of the 2D field, a straight line is created connecting locations on the cell's edges with an interpolated value equal to the level. The interpolation is linear.
Libraries.Main.Mappers.isoline
create a local surface of constant value at a picked probe location
group DVisotrace {
Mesh_Struct+Dim3+Node_Data+Iparam &in {
xform+nonotify;
nnodes+req;
};
Grid+Xform+Iparam &probe;
float+Oparam level;
Mesh+Oparam out {
&xform<weight=-1> => in.xform;
};
NParam_Data+Oparam nparam;
method+notify_val+notify_inst isotrace_update = "isotrace";
};
DVisotrace takes a field and a probe location, and iteratively finds a surface of constant value starting at the seed point defined by the probe location. It outputs the value at the seed location and an NParam_Data data structure corresponding to the isosurface. An NParam_Data is an optimization structure containing the isosurface coordinates in a way designed to minimize recomputation due to incremental changes. See Section 4.56, DVnmap [page 4-121] for how NParam_Data can be used.
Libraries.Main.Mappers.isosurface_trace
create a local contour line of constant value at a picked probe location
group DVisoline_trace {
Mesh_Struct+Dim2+Node_Data+Iparam &in {
xform+nonotify;
nnodes+req;
};
Grid+Xform+Iparam &probe;
int+Iparam component;
int+Iparam color;
float+Oparam level;
Mesh+Node_Data+Oparam out {
&xform<weight=-1> => in.xform;
};
method+notify_val+notify_inst isoline_trace_update = "isoline_trace";
};
DVisoline_trace builds a local isoline of the specified component in the specified field from the given pick location by examining neighboring cells. If color is nonzero, the lines are colored by the data values. Otherwise the lines use the default line color in the viewer. It also outputs in "level" the value at the picked point (the value of the isoline).
execute an object n times using for loop-like controls
group DVloop {
link+notify+IPort2 trigger;
float+Iparam start;
float+Iparam end;
float+Iparam incr;
float+Oparam count;
int+Oparam done;
method+notify_val+notify_inst upd_loop = "loop";
};
DVloop is a for/Do loop mechanism. It provides a way to iteratively execute an object. The basic structure is:
for ( count = start; count < end; count = count + incr )
Note: DVloop cannot be interrupted. You will likely want to use the almost identical, but interruptible Templates.GMOD.loop instead.
A link. When the object that this is connected to changes, DVloop begins to execute its for loop. For example, this could be connected to UItoggle.
A float. Sets the initial value of the for loop control variable. It is the
"for (count = start" clause.A float. Sets the terminal value of the for loop's control variable. It is the "end" in "for ( count = start; count <end".
A float. Sets the increment to the for loop's control variable. It is the "incr" in
"for (count = start; count < end; count=count+incr". It must be non-zero.A float. This contains the current value of the for loop's control variable. It is the "count" in the "for ( count = start" clause. DVadvect, for example, uses count to set its time step input.
An integer. When this is set to 1, the loop has finished executing.
calculate the magnitude of a vector field
group DVmagnitude {
int+IPort2 component = 0;
Mesh+Node_Data+IPort2 ∈
Node_Data out_nd {
nnodes => in.nnodes;
nnode_data = 1;
node_data {
veclen+nres = 1;
values+nres => cache(magnitude(in.node_data[component].values));
null_flag+nres => in.node_data[component].null_flag;
null_value+nres => in.node_data[component].null_value;
&min => in.node_data[component].min;
&max => in.node_data[component].max;
&min_vec => in.node_data[component].min_vec;
&max_vec => in.node_data[component].max_vec;
labels+nres = "magnitude";
};
};
Mesh+Node_Data+OPort2 &out => merge(out_nd,in);
};
DVmagnitude calculates the magnitude of a vector field.
An integer. Selects which component of the input field to use in the magnitude calculation. The component should contain 1, 2, or 3 vector subcomponents. The default is the first (0th) component.
The input is a reference to a field with any mesh and Node_Data.
The output is a reference to the merge of the new magnitude Node_Data, plus a reference to the original input mesh. The new Node_Data has the same extents and null data is the input, but contains just one scalar component that is the magnitude, plus the label "magnitude".
The equation used to compute the magnitude is:
where a1, a2, etc. are the individual vector subcomponents within the selected component.
Libraries.Main.Filters.magnitude
generate texture (u,v) coordinates from the (x,y) coordinates of a mesh's nodes
module DVmesh_uv {
Mesh+IPort2 ∈
int+IPort2 uv_switch = 0;
int+IPort2 u_flip = 0;
int+IPort2 v_flip = 0;
float+IPort2 u_shift = 0;
float+IPort2 v_shift = 0;
float+IPort2 u_scale = 1;
float+IPort2 v_scale = 1;
.
. (internal subobjects omitted for brevity)
.
Node_Data uv_data {
nnodes => <-.in.nnodes;
nnode_data = 1;
node_data {
veclen = 2;
id = 670;
values => combine_array(switch_uv.out.values,switch_vu.out.values);
};
};
Mesh+Node_Data+OPort2 &out => merge(uv_data, in);
};
DVmesh_uv takes an input field and generates texture coordinates based on the physical (X,Y) coordinates of the mesh. The input Z coordinate is ignored. The resulting texture data is merged into the field and output. The output field can then accept a texture map.
Controls are provided to position the texture on the mesh by shifting and scaling the mapping from physical to texture space.
Field. The mesh to be textured.
int. Switch U and V (or X and Y) when generating the texture coordinates.
int. Flip U so that the texture is applied backwards in X.
int. Flip V so that the texture is applied backwards in Y.
float. Scale U by this amount. The larger this value, the less space in X the texture takes up. In other words, decreasing this value stretches the texture, increasing it compresses the texture.
float. Scale V by this amount. The larger this value, the less space in Y the texture takes up. In other words, decreasing this value stretches the texture, increasing it compresses the texture.
float. Shift U by this amount. Positive shift shifts the texture to the left, negative shifts to the right.
float. Shift V by this amount. Positive shift shifts the texture down, negative shifts up.
Mesh+Node_Data. Contains the input mesh and data, as well as the generated texture coordinates.
Libraries.Visualization.Primitives
create the mirror image of a mesh
group DVmirror {
Mesh+IPort2 &in ;
float+Iparam mir_x = -1.0;
float+Iparam mir_y = -1.0;
float+Iparam mir_z = -1.0;
DefaultXform+nonotify mirr_xform {
mat => {{mir_x, 0.0, 0.0, 0.0},
{0.0, mir_y, 0.0, 0.0},
{0.0, 0.0, mir_z, 0.0},
{0.0, 0.0, 0.0, 1.0}};
};
group out_xfm {
DefaultXform xform;
};
DVconcat_xform concat_xform {
xform_in1 => in.xform;
xform_in2 => mirr_xform;
&xform_out => out_xfm.xform;
};
Mesh+0Port2 &out => merge( out_xfm, in);
};
DVmirror generates a mesh that is the mirror image of the input mesh. "Mirror image" means that the mesh is mirrored about the X, Y, and/or Z plane. You can control each independently. It accomplishes this by modifying the xform transformation matrix object associated with a field. Mirroring is useful for visualization of axis symmetric problems.
The input is a reference to any mesh.
Floating parameters that define the transformation to apply to the X, Y, and Z axes of the mesh. The default for all is -1.0. If you change it to 0.0, that axis will not be mirrored.
The output is a reference a new object that is the merge of the new transformation matrix plus a reference to the original input field.
calculate data values at a given location based upon a node map
group DVnmap {
Node_Data+Iparam &in {
nnodes+req;
};
NParam_Data+Iparam &nparam {
nnodes+req;
};
int+Iparam map_comp[];
Node_Data+Oparam out;
method+notify_val+notify_inst upd_nmap = "nmap";
};
DVnmap is an optimization utility. It uses a data structure called NParam_Data (aka "node map") to quickly calculate the data value at a point that is between two real nodes in a Node_Data using linear interpolation. The DViso and DVisotrace base modules output this NParam_Data node map.
This input is a reference to any object with Node_Data.
This input is a reference to an NParam_Data object, which is defined as follows in v/fld.v:
dgroup NParam_Data {
int nnodes;
int min_node[nnodes];
int max_node[nnodes];
float tpar[nnodes];
};The DViso base module outputs this NParam_Data object.
This "node map" is a table that lists which pairs of nodes a sampling surface (such as an isosurface) crossed, and a parametric value from between 0.0 and 1.0 that tells where the where the surface crossed between the nodes. DVnmap, can take this nparam data and quickly calculate interpolated values for any component in the Node_Data.
The nparam structure output by DViso would look like this:
That is, between the node that is the nval = 1 index into the component's Data_Array and node that is the nval = 4 index, the pressure component isosurface mesh crosses at .5. Thus, when DVnmap is trying to figure out what numeric value to produce for a temperature at that location, it knows that all it has to do is use the temperature component's nval = 1 and nval = 4 index node values and calculate ((nval[4] - nval[1]) * tpar).
An integer array. Specifies which component will be mapped onto the isosurface (for example, map pressure value onto a density isosurface). Each array value is the number (from 0 up) of a component to map. For example:
(a, b, c, [e, f, g]) --> set map_comp = {0, 2} --> (a, b) in the output field
Note that this array is not explicitly dimensioned. It is a variable-length array that will have as many values as you assign to it with the = { n, n, n,...n} notation. The supplied AVS/Express modules that use DVnmap implicitly set the dimension to 1 by specifying map_comp = {0}, i.e., the user can specify any one component to map to the isosurface, and the default is the first (0th) component.
The output is a new Node_Data containing the computed values.
Libraries.Main.Mappers.isosurface
Libraries.Main.Mappers.sliceextract node data labels for display in a UIradioBoxLabel
group DVnode_data_labels {
group+Iparam &in{
group+opt node_data {
string+opt labels;
};
};
string+Oparam labels[];
int+Oparam ncomp => array_size(labels);
method+notify_val+notify_inst upd_node_data_labels = "node_data_labels";
};
DVnode_data_labels extracts the node data labels from the Data_Arrays within a Node_Data and stores them in a string array. This string array (along with the Node_Data's nnode_data value) can be used as inputs to a UIradioBoxLabel widget so that the user can pick which component, by label, he/she wants a downstream object to work on.
A string array object. The array is as long as the nnode_data of the input Node_Data. It contains the label strings from each component's Data_Array. If no label was present, the string value is "NO NAME".
An integer whose value is the size of the labels array (the number of components, nnode_data, in the input field).
Libraries.Main.Filters.extract_component
Libraries.Main.Filters.threshold
Libraries.Main.Filters.clamp
Libraries.Main.Mappers.surf_plot
and many othersdeform a mesh by data vector component at each node
group DVoffset {
Mesh+Node_Data+IPort2 &in ;
int+IPort2 component;
float+IPort2 scale;
Grid+Xform out_grid {
nnodes => in.nnodes;
nspace => in.nspace;
&xform => in.xform;
int npoints => nnodes;
float points[nnodes][nspace];
coordinates {
values+nres => in.coordinates.values +
scale*in.node_data[component].values;
};
};
Mesh+Node_Data+OPort2 &out => merge(out_grid, in);
};
DVoffset "physically" deforms a mesh by the values of a 1, 2 or 3 vector component located at each node. The first element of the vector translates the node's X coordinate, the second (if present) translates the Y coordinate, and the third (again, if present) translates the Z coordinate. The magnitude of each translation is proportional to the values at the nodes multiplied by a scaling factor.
A reference to a field with Mesh and Node_Data. Its components can be a 1, 2, or 3 element vector.
An integer. Selects which of the Node_Data's components to use for the offset calculation.
A float. A scaling factor to adjust the degree of distortion caused by the vector component.
A reference to an object that is the merge of the new Grid, plus a reference to the remaining fields of the input mesh, plus a reference to the original Node_Data. Mesh --> Mesh. Mesh_Struct or Mesh_Unif or Mesh_Rect --> Mesh_Struct.
discover the type of mesh, then call the corresponding orthoslicing base module
group DVorthoslice {
Mesh_Struct+Node_Data+Iparam &in {
nnodes+req;
};
int+Iparam axis;
int+Iparam plane;
DVorthoslice_struct DVorthoslice_struct {
&axis => <-.axis;
&plane => <-.plane;
};
DVorthoslice_unif DVorthoslice_unif {
&axis => <-.axis;
&plane => <-.plane;
};
DVorthoslice_rect DVorthoslice_rect {
&axis => <-.axis;
&plane => <-.plane;
};
DVfld_match DVfld_match {
Mesh_Struct+IPort2 &in=> <-.in;
links {
link0 => DVorthoslice_unif.in;
link1 => DVorthoslice_rect.in;
link2 => DVorthoslice_struct.in;
};
};
DVswitch DVswitch {
in => {DVorthoslice_unif.out, DVorthoslice_rect.out,
DVorthoslice_struct.out};
index => DVfld_match.index;
};
olink out => DVswitch.out;
};
DVorthoslice is a utility base module. It discovers what type of mesh (Mesh_Struct, Mesh_Rect, or Mesh_Unif) its input field has, then passes control through DVswitch to the corresponding base module (DVorthoslice_struct, DVorthoslice_rect, or DVorthoslice_unif).
A reference to a field containing any type of structured mesh, plus Node_Data.
The orthoslicing parameters. These are passed through to the selected base module.
The output is the same as the DVswitch selection.
Libraries.Main.Filters.orthoslice
produce a slice of a rectilinear field perpendicular to a coordinate axis
group DVorthoslice_rect {
Mesh_Rect+Iparam &in {
nnodes+req;
};
int+Iparam axis;
int+Iparam plane;
Mesh_Rect+Node_Data+Oparam out;
method+notify_val+notify_inst upd_orthoslice = "orthoslice";
} ;
DVorthoslice_rect subsets a rectilinear structured field (mesh type Mesh_Rect) by removing one slice plane. The slice plane can only be orthogonal to the X, Y, or Z axis.
The input is a reference to a field containing a Mesh_Rect and Node_Data. The input can be 1D, 2D, or 3D.
An integer. Selects which axis (X = 0, Y = 1, Z = 2) the orthoslice will be perpendicular to.
An integer. Selects which plane to extract from the input. The "units" are the array indices of the coordinates. So, for example, if you have a field that has 64 [0-63] nodes extending from -0.5 to 3.12 in X, you are picking a number from 0 to 63, not an absolute location from -0.5 to 3.12.
The output is a new field object with a new rectilinear mesh (mesh type Mesh_Rect) for the slice with a new Node_Data that contains all components of the slice.
Libraries.Main.Mappers.orthoslice
produce a slice of a structured field perpendicular to a coordinate axis
group DVorthoslice_struct {
Mesh_Struct+Node_Data+Iparam &in {
nnodes+req;
};
int+Iparam axis;
int+Iparam plane;
Mesh_Struct+Node_Data+Oparam out;
method+notify_val+notify_inst upd_orthoslice = "orthoslice";
};
DVorthoslice_struct subsets a structured field (mesh type Mesh_Struct) by removing one slice plane. The slice plane can only be orthogonal to the X, Y, or Z axis.
The input is a reference to a field containing a Mesh_Struct and Node_Data. Mesh_Unif and Mesh_Rect will be accepted, but may produce incorrect results. The input can be 1D, 2D, or 3D.
An integer. Selects which axis (X = 0, Y = 1, Z = 2) the orthoslice will be perpendicular to.
An integer. Selects which plane to extract from the input. The "units" are the array indices of the coordinates. So, for example, if you have a field that has 64 [0-63] nodes extending from -0.5 to 3.12 in X, you are picking a number from 0 to 63, not an absolute location from -0.5 to 3.12.
The output is a new field object with a new structured mesh (mesh type Mesh_Struct) for the slice that contains a new Node_Data that is all components of the slice.
Libraries.Main.Mappers.orthoslice
produce a slice of a uniform field perpendicular to a coordinate axis
group DVorthoslice_unif {
Mesh_Unif+Node_Data+Iparam &in {
nnodes+req;
};
int+Iparam axis;
int+Iparam plane;
Mesh_Unif+Node_Data+Oparam out;
method+notify_val+notify_inst upd_orthoslice = "orthoslice";
} ;
DVorthoslice_unif subsets a uniform structured field (mesh type Mesh_Unif) by removing one slice plane. The slice plane can only be orthogonal to the X, Y, or Z axis.
The input is a reference to a field containing a Mesh_Unif and Node_Data. The input can be 1D, 2D, or 3D.
An integer. Selects which axis (X = 0, Y = 1, Z = 2) the orthoslice will be perpendicular to.
An integer. Selects which plane to extract from the input. The "units" are the array indices of the coordinates. So, for example, if you have a field that has 64 [0-63] nodes you are picking a number from 0 to 63.
The output is a new field object with a new uniform mesh (mesh type Mesh_Unif) for the slice and a new Node_Data that contains all components of the slice.
Libraries.Main.Mappers.orthoslice
subset a volume using any number of 2D uniform grids as slicing planes
group DVplane_crop {
Mesh+Iparam &in { /* input field */
xform+nonotify;
nnodes+req;
};
Plane_Grid+Xform+Iparam &plane[]; /* slice planes */
int+Iparam in_out;
int+Iparam and_or = 1;
Mesh+Node_Data+Oparam out { /* output field */
&xform<weight=-1> => in.xform;
};
method+notify_val+notify_inst upd_plane_crop = "plane_crop";
};
DVplane_crop subsets a field by outputting all whole cells that are inside or outside a volume created by an unlimited number of slice planes.
The input is a field with any Mesh. Node_Data is optional.
An array of references to any number of Plane_Grids that will slice the volume. A Plane_Grid is defined as Grid_Unif+Space2+Dim2. It is therefore any 2D uniform grid.
An integer. When this value is not 0, then the entire cell intersected by a plane is output. If it is 0, then the entire cell is not output.
An integer. When this value is not 0, the cells inside the slicing planes are output. If it is 0, then the cells outside the slicing planes are output.
The output is a new Mesh and Node_Data that is the plane-cropped input Mesh, plus any Node_Data for the output nodes. The mesh contains a reference to the input field's xform.
compute distance from all nodes to a plane
group DVplane_dist {
Mesh+Iparam &in {
nnodes+req;
};
Plane_Grid+Xform+Iparam &plane;
Node_Data+Scalar+Float+Oparam out;
float+Oparam dist;
method+notify_val+notify_inst upd_plane_dist = "plane_dist";
} ;
DVplane_dist is an underlying utility base module that, combined with DViso, is widely used in slicing and cutting operations.
DVplane_dist requires an input plane and an input field. This plane, considered to be infinite, is positioned somewhere in space, likely slicing through the volume of the input field. DVplane_dist then calculates the distance from the plane to every node in the input field. "Distance" is measured along the normal (90 degrees) to the plane. These distances are output as a Node_Data.
When passed to the isosurfacing base module DViso, the field can be cut or sliced in two by finding everywhere that the isosurface level = 0 (meaning that the distance from the node to the plane is 0, or, in other words, the node is on the slicing plane).
The input is a reference to a field containing a mesh of any type.
This input is a reference to a Plane_Grid, such as that generated by Geometries.FPlane.
This output is a new Node_Data of scalar floats whose values are the distance from the plane to each node in the original data.
A float. The distance from the plane to the origin (0, 0, 0 index) of the data.
Libraries.Main.Mappers.slice
Libraries.Main.Mappers.cutprint a field's V and data to stderr
DVprint lists all of a field's V and data values to stderr.
A reference to an input field. The field can be an entire field or any subobject of a field.
read an image file and output an AVS/Express field
module DVread_image {
string+Iparam filename; /* name of file to read */
int+Iparam flip; /* invert image in y */
int+Iparam filetype; /* file type */
Mesh_Unif+Dim2+Space2+Node_Data+Vector4+Oparam out; /* out field */
method+notify_val+notify_inst read_image_update = "DVread_image_update";
} ;
DVread_image reads an image file of a specified type and converts it into an AVS/Express Field.
A string. Names the input file to be read. The string can be either the complete absolute pathname, or a relative pathname. If it is relative, it will be interpreted relative to the user's working directory when AVS/Express was started.
Boolean indicating whether to invert the image about the x axis, i.e. in the vertical direction. The renderers assume that the image origin is at the lower left: toggle the flip param if the image is rendered upside-down.
An integer value indicating the image file type. A value of 0 causes the type to be determined from the file itself by looking at the id information in the header, or by using the filename extension. The following image formats are currently supported:
Note: Developer Edition users wishing to create runtimes that include support for reading GIF and TIFF image formats, which use the patented LZW compression algorithm, must first obtain a license from Unisys Corporation:
WARNING: Use of this software for providing LZW capability for any purpose is not authorized unless user first enters into a license agreement with Unisys under U.S. Patent No. 4,558,302 and foreign counterparts. For information concering licensing, please contact:
Unisys Corporation
Welch Licensing Department - C1SW19
Township Line & Union Meeting Roads
P.O. Box 500
Blue Bell, PA 19422
Once you have entered into such a license agreement with Unisys Corp, runtime generation support for GIF and TIFF can be enabled in AVS/Express at no additional cost. Contact Advanced Visual Systems customer support for details.
Support for additional image formats can be provided by creating new readers using availabel API calls (see Appendix A, Adding your own image readers and writers). To obtain a current list of the supported image types, you can open v/modules.v and search for "Read_Image" - the list can be found in the defined radioBox labels.
The output is a new Mesh_Unif object.
veclen equals 4 (alpha, red, green, blue)
id equals GD_RGB_DATA_ID
values array contains the ARGBs of all pixels
primitive data type DTYPE_BYTE
ndims equal to 2 (from Dim2)
dims array equal to dims[0] = x; dims[1] = y
points array equal to: points[0] = 0.0
points[1] = 0.0
points[2] = (float) x - 1
points[3] = (float) y - 1
Note: The order of the image's scan lines is reversed. For example, if an input image had four rows of pixels (0, 1, 2, 3) with 0 the "top" of the image, the output image has four rows of pixels (3, 2, 1, 0) with 0 at the"bottom" of the image. The reason for this is that renderer is set up to recognize 0,0 as the lower left of an object, not the upper left. Reversing the image's scan lines means that the image appears upright in the renderer window.
Because the scan lines are reversed, a few image processing functions may not produce the same result as they would if the image was rightside up. To ensure correct results toggle the flip param in this module. You might also compare the output of the image processing operations (using IPcompare) both with and without inve rting the image to determine if this is necessary.
v/dv.v
modules/rd_image.c
modules/image.hLibraries.Main.Readers.Read_Image
Adding a new readable image format:
reads a data set from a netCDF file
module DVread_net_cdf<locked=0> {
string+Iparam filename;
olink out;
method+notify_val+notify_inst read_update<status=1> = "DVread_net_cdf";
};
Read_netCDF reads a data set from a netCDF file into an AVS/Express field.
string. Name of netCDF file to read
any. Object containing the elements of the specified netCDF file.
reads a multiblock Plot3D format data file
module DVread_PLOT3D_mb {
string+Iparam filename_xyz; /* name of file to read */
string+Iparam filename_q; /* name of file to read */
int+Iparam iblanks = 1;
Multi_Block+Oparam out; /* output field */
mlink+nonotify+OPort2 out_flds => out.fields;
method+notify_val+notify_inst upd_read_plot3d<status=1> =
"DVread_PLOT3D_mb";
};
DVread_PLOT3D_mb reads a pair of files which describe a Plot3D data set. It reads that data into an array of fields; each field describes one block of the data set. The result can be operated on by any of the *_ARR array-of-fields macros.
The Multi_Block object contains the array of fields plus some additional information, including the number of blocks and the bounds of the data set.
string. Name of Plot3d xyz file.
string. Name of Plot3d q file.
int. Accept blanks in input when nonzero.
Multi_Block. A Multi_Block object describing the read-in fields.
field[]. An array of fields, each field describing one block of the data set.
read an AVS volume (.dat file) and output an AVS/Express field
group DVread_vol {
string+Iparam filename;
Field_Unif+Dim3+Space3+Scalar+Byte+Oparam out;
method+notify_val+notify_inst upd_read_vol = "read_vol";
} ;
DVread_vol reads an Application Visualization System volume format file (.dat suffix) and converts it into an AVS/Express Field_Unif.
A string. Names the input file to be read as a .dat format file. The string can be either the complete absolute pathname, or a relative pathname. If it is relative, it will be interpreted relative to the user's working directory when AVS/Express was started.
The output is a new Field_Unif object containing:
dims array equal to dims[0] = x dim; dims[1] = y dim; dims[2] = z dim
points array equal to: points[0] = 0.0
points[1] = 0.0
points[2] = 0.0
points[3] = (float) x - 1.0
points[4] = (float) y - 1.0
points[5] = (float) z - 1.0
scale a 3D mesh in X, Y, and/or Z
group DVscale {
Mesh+IPort2 &in ;
float+Iparam scale_x = 1.0;
float+Iparam scale_y = 1.0;
float+Iparam scale_z = 1.0;
DefaultXform+nonotify scale_xform {
mat => {{scale_x, 0.0, 0.0, 0.0},
{0.0, scale_y, 0.0, 0.0},
{0.0, 0.0, scale_z, 0.0},
{0.0, 0.0, 0.0, 1.0}};
};
group out_xfm {
DefaultXform xform;
};
DVconcat_xform concat_xform {
xform_in1 => in.xform;
xform_in2 => scale_xform;
&xform_out => out_xfm.xform;
};
Mesh+OPort2 &out => merge( out_xfm, in);
};
DVscale scales a mesh in X, Y, and/or Z, making it appear larger or smaller in the renderer window. It accomplishes this by modifying the field's associated transformation matrix, xform.
The input is a reference to a field containing any 3D mesh.
Floats. These inputs independently control the degree of scaling in X, Y, and Z. The default 1.0 means "render at 'actual' size."
The output is a reference to a new object that is the merge of the new xform, plus a reference to the original field.
convert a scattered grid into triangular or tetrahedral unstructured mesh
group DVscat_to_tet {
Mesh+Node_Data+Iparam &in { /* input field */
nnodes+req;
xform+nonotify;
};
int+Iparam triangle=0;
Cells+write+nonotify out_mesh;
};
Mesh+Node_Data+nonotify+OPort2 &out => merge(out_mesh, in);
method+notify_val+notify_inst upd_scat_to_tet = "scat_to_tet";
};
DVscat_to_tet converts a field with a scattered grid into a triangular or tetrahedral mesh. A "scattered grid" means that there is a structured mesh made up of disconnected nodes in space. An example would be seismic data where the coordinates are the latitude, longitude, (and perhaps elevation) of a sensing station, and the Node_Data is a set of observations. The grid is "scattered" because the data samples are located at arbitrary positions in space, not on any grid.
Fields whose meshes have nspace=2 are always converted to triangular unstructured meshes. nspace=3 meshes are usually converted to tetrahedral unstructured meshes. But, if triangle does not equal 0, they are converted to triangular meshes (2D surface existing in 3-space).
A reference to any mesh with Node_Data.
An integer. If this flag is 0 and nspace=3, the field is converted to a tetrahedral mesh. If this flag is not 0 and nspace=2 or nspace=3, the field is converted to a triangle mesh.
This output is a new unstructured Mesh object that has been organized into Cells: cell type Tri (for nspace=2 or nspace=3 with triangles on input) or Tet (nspace =3 input).
The output is a reference to a merge of the new unstructured Mesh object and the original Node_Data.
DVscat_to_tet uses a proprietary version of the Delauney tesselation algorithm.
Libraries.Main.Mappers.scat_to_tri
interpolate scattered data into a uniform mesh
group DVscat_to_unif {
Mesh+Node_Data+Iparam &in { /* input field */
nnodes+req;
xform+nonotify;
};
int+Iparam rndim;
int+Iparam rdims[rndim];
float+Iparam min_xyz[rndim] => in.coordinates.min_vec[0:rndim-1];
float+Iparam max_xyz[rndim] => in.coordinates.max_vec[0:rndim-1];
float+Iparam search_cube[rndim] => 3*(max_xyz-min_xyz)/rdims;
int+Iparam interp_order = 2;
float+notify+IPort2 null_value => in.node_data[0].max+1;
Mesh_Unif+Node_Data+Oparam out { /* output field */
ndim => rndim;
dims => rdims;
nspace => rndim;
};
method+notify_val+notify_inst upd_scat_to_unif = "scat_to_unif";
} ;
DVscat_to_unif converts a field with a scattered grid into a field with a uniform mesh. A "scattered grid" means that there is a mesh made up of disconnected nodes in space. An example would be seismic data where the coordinates are the latitude, longitude, (and perhaps elevation) of a sensing station, and the Node_Data was a set of observations. The grid is "scattered" because the data points are located at arbitrary points in space, not on any grid.
DVscat_to_unif lets you define a uniform mesh of any dimensionality and coordinate extents. It superimposes the input grid over this new grid that you have defined. Then, for each new node, it searches the input grid's neighboring original nodes (where search_cube controls the depth of the search) and creates data values for all the nodes in the new grid from interpolations on those neighboring actual data values. You can control the order of interpolation and what number to use as the NULL data value should the search around a node fail to find any data in the original input.
The input is a reference to a field with any mesh and Node_Data.
An integer. Sets the dimensionality of the uniform grid to 1, 2, or 3D.
An integer array, rndim long. Sets the dimensions of the uniform grid. As this is a uniform grid, numbering always starts at 0. rdim specifies the upper dimension. For example rdim[0] = 100 means the X dimension is 100. rdim[1] = 50 means the Y dimension is 50, etc.
A float array, rndim long that sets the coordinate extents of the uniform grid (where the grid is located in space) for each dimension. They are initially set to the extents of the input Mesh.
A float array, rndim long that controls the depth of the search for nodes in the input mesh. The result of the default formula is 3 cells.
An integer that controls the order of interpolation done on the adjacent nodes.
A float that specifies a null value to put in the output Node_Data for each node in the uniform grid that failed to find any input data within search_cube cells of the node. By default, it is set to one above the input's maximum.
The output is a new Mesh_Unif with the dimensions specified by rndim and rdims, and a new Node_Data that has the interpolated values of each node, including null data values.
DVscat_to_unif uses a proprietary version of the Delauney tesselation algorithm.
DVMscat_2_unif_param, Scat2Unif
Libraries.Main.Mappers.scat_to_unif
extract one or more Cell_Sets from a Cells Grid
group DVselect_cells {
Mesh+Iparam ∈
int+Iparam sets[];
Cells+Oparam out_cells {
*cell_set[];
ncell_sets => array_size(cell_set);
};
Mesh+nonotify+OPort2 &out =>merge(out_cells, in);
method+notify_val+notify_inst upd_select_cells = "select_cells";
};
DVselect_cells extracts one or more Cell_Sets from a Cells Grid. You use it, for example, if the Grid contains both Tri and Hex cells, and all you want the downstream module to work on is the Tri cell_set.
A reference to an input Mesh that contains one or more Cell_Sets.
An integer array of variable length. Each array element is the index of a Cell_Set to extract. The array is as long as the number of Cell_Sets to be extracted. This array is typically generated by referencing the output of a UIoptionBoxLabel widget and the DVcell_labels base module.
The output is a reference to a merged object that contains a new Cells object with the selected cell_sets, plus the remainder of the input Mesh.
Libraries.Main.Filters.select_cell
flag a specified data value as NULL in one component of a field
group DVset_null {
Node_Data+IOparam &in { /* input field */
nnodes+req;
};
int+Iparam component; /* which component to set */
int+IOparam unset;
float+Iparam null_value; /* what is the NULL value */
Node_Data+Oparam &out => in; /* output field */
method+notify_val+notify_inst upd_set_null = "set_null";
} ;
DVset_null alters a field by defining a specified value as a NULL value and setting the flag that indicates the presence of NULL data to 1 ("has null data"). This is done on a per-component basis-one component may have NULL data while others do not. DVset_null can also turn off the NULL data flag.
A reference to a field with Node_Data.
An integer. Sets which component will be flagged as having NULL data. The components can be scalar or vector.
An integer. When not equal to 0, DVset_null will turn off the selected component's NULL data flag.
A float. Specifies the data value that will be treated as a NULL value. This is converted to the data type of the field before it is used.
The output is a reference to the input field. The input field has been modified so that its Node_Data Data_Array null_flag =1 and null_value is set for the component's Data_Array. DVset_null is one of the few modules that actually changes its input data field.
copy a slice of node data from an input field to an output field
module DVset_slice_data {
Mesh_Unif+Node_Data+Port2+nonotify &inField;
Mesh_Unif+Node_Data+Iparam &sliceField;
int+Iparam slice;
method+notify_val update<status=1> = "DVset_slice_data"
};
DVset_slice_data copies the node data from the slice field to a specified slice in the input field. Conceptually, this is the opposite of a module like orthoslice which extracts a slice from an input field. This module is useful in building up an output field from a series of individual slices.
Input field into which the slice field's data will be copied into.
The slice field that contains the node data that will be copied into the output field.
Index into the input field where the slice field's data will be written.
The output field as well as the input field.
Libraries.Main.Mappers.vect2rast_vol
set the transformation of a field
group DVset_xform {
Mesh+IPort2 ∈
group+IPort2 &in_xfm {
GDxform_templ &xform;
};
group set_xform {
GDxform_templ &xform=>in_xfm.xform;
};
Mesh+OPort2 &out => merge( set_xform, in);
};
DVset_xform sets the transformation of a field's mesh to be equal to an input transformation. It is used when you want to "synch up" the transformation of one field with another.
The input is a reference to a field with any mesh. This is the field to be transformed.
A transformation of type GDxform_templ. &in's transformation will be set to this transformation.
The output is a reference to a merged object that contains the original input, plus the new xform.
Libraries.Main.Filters.set_xform
Libraries.Main.Filters.reset_xformdiscover the type of mesh, then call the corresponding slicing base module
group DVslice {
Mesh+Node_Data+Iparam &in { /* input field */
nnodes+req;
};
Plane_Grid+Xform+Iparam &plane; /* slice plane */
float+notify+IPort2 dist; /* plane distance */
int+Iparam map_comp[];
DVslice_gen DVslice_gen {
plane => <-.plane;
&dist => <-.dist;
&map_comp => <-.map_comp;
};
DVslice_unif DVslice_unif {
plane => <-.plane;
&dist => <-.dist;
&map_comp => <-.map_comp;
};
DVslice_rect DVslice_rect {
plane => <-.plane;
&dist => <-.dist;
&map_comp => <-.map_comp;
};
DVfld_match DVfld_match {
in => <-.in;
links {
link0 => DVslice_unif.in;
link1 => DVslice_rect.in;
link2 => DVslice_gen.in;
};
};
DVswitch DVswitch {
in => {DVslice_unif.out, DVslice_rect.out, DVslice_gen.out};
index => DVfld_match.index;
};
olink out => DVswitch.out;
};
DVslice is a utility base module. It discovers what type of mesh (general (structured or unstructured), Mesh_Rect, or Mesh_Unif) its input field has, then passes control through DVswitch to the corresponding base module (DVslice_gen, DVslice_rect, or DVslice_unif).
A reference to a field containing any type of mesh, plus Node_Data.
The slicing parameters. These are passed through to the selected base module.
The output is the same as the DVswitch selection.
DVMslice_param, Slice, SliceTxt3D, SliceTxt2D
extract a 2D slice from a structured or unstructured field using an arbitrarily oriented slice plane
group DVslice_gen {
Mesh+Node_Data+Iparam &in { /* input field */
nnodes+req;
};
Plane_Grid+Xform+Iparam &plane; /* slice plane */
float+notify+IPort2 dist; /* plane distance */
int+Iparam map_comp[];
DVplane_dist DVplane_dist {
in => <-.in;
plane => <-.plane;
};
DVcomb_mesh_and_data DVcomb_mesh_and_data {
in_mesh => <-.in;
in_nd => DVplane_dist.out;
};
DViso DViso<vpy=341,vpx=297> {
in => DVcomb_mesh_and_data.out;
level => DVplane_dist.dist+(<-.dist);
};
DVnmap DVnmap {
in => <-.in;
nparam => DViso.nparam;
map_comp => <-.map_comp;
};
DVcomb_mesh_and_data DVcomb_mesh_and_data_1 {
in_mesh => DViso.out;
in_nd => DVnmap.out;
};
Mesh+Node_Data+Oparam &out=>DVcomb_mesh_and_data_1.out;
};
DVslice_gen extracts an arbitrarily-oriented 2D slice of data from an unstructured or structured 3D mesh field. Any number of components can be extracted. Output is generated every time the slice plane moves.
The input is a reference to a field that must be a 3D field (Dims3) with an unstructured or structured mesh and any type of Node_Data.
A reference to a Plane_Grid object that will be the slicing plane. This could be generated by the plane object found in Geometries.Plane, or it could be any 2D Mesh_Unif. The plane object generated by Geometries.Plane's advantage is that its plane object has its own Plane Transformation panel that controls plane rotation, translation, and scale, as well as controls to specify its size when it is connected to the Module Stack object.
A float. This value will move the plane through the field perpendicular to the plane. Though the Plane Transformation panel has X, Y, and Z transformation controls, it is usually easier to use plane's controls to orient and size the plane, but use this plane distance control to move the plane. DVslice_gen generates output whenever the slice plane moves.
An integer array. Each array value is the number (from 0 up) of a component to extract. For example:
(a, b, c, [e, f, g]) --> set map_comp = {0, 3} --> (a, [e, f, g]) in the output field
Note that this array is not explicitly dimensioned. It is a variable-length array that will have as many values as you assign to it with the = { n, n, n,...n} notation. The supplied AVS/Express modules that use DVslice_gen implicitly set the dimension to 1 by specifying map_comp = {0}, i.e., the user can specify any one component to send to the output field, and the default is the first (0th) component.
The output is a reference to the output of the DVcomb_mesh_and_data object. It contains a new, subsetted 2D Mesh and a new Node_Data of the selected components' slices. Where the slice plane does not land exactly on a node, the data value is interpolated from the values of the adjacent nodes.
DVslice_gen uses trilinear interpolation to interpolate data values between mesh nodes.
extract a 2D slice from a rectilinear field using an arbitrarily oriented slice plane
group DVslice_rect {
Mesh_Rect+Dim3+Node_Data+Iparam &in { /* rectilinear input field */
nnodes+req;
};
Plane_Grid+Xform+Iparam &plane; /* slice plane */
float+notify+IPort2 dist; /* plane distance */
int+Iparam map_comp[];
Mesh_Rect+Dim2+Node_Data+Oparam out; /* output field */
method+notify_val+notify_inst upd_slice = "slice";
};
DVslice_rect extracts an arbitrarily-oriented 2D slice of data from a 3D rectilinear mesh field. Any number of components can be extracted. Output is generated every time the slice plane moves.
The input is a reference to a field that must be a 3D field (Dims3) with a rectilinear mesh (mesh type Mesh_Rect) and any type of Node_Data.
A reference to a Plane_Grid object that will be the slicing plane. This could be generated by the plane object found in Geometries.Plane, or it could be any 2D Mesh_Unif. The plane object generated by Geometries.Plane's advantage is that its plane object has its own Plane Transformation panel that controls plane rotation, translation, and scale, as well as controls to specify its size when it is connected to the Module Stack object.
A float. This value will move the plane through the field perpendicular to the plane. Though the Plane Transformation panel has X, Y, and Z transformation controls, it is usually easier to use plane's controls to orient and size the plane, but use this plane distance control to move the plane. DVslice_rect generates output whenever the slice plane moves.
An integer array. Each array value is the number (from 0 up) of a component to extract. For example:
(a, b, c, [e, f, g]) --> set map_comp = {0, 3} --> (a, [e, f, g]) in the output field
Note that this array is not explicitly dimensioned. It is a variable-length array that will have as many values as you assign to it with the = { n, n, n,...n} notation. The supplied AVS/Express modules that use DVslice_rect implicitly set the dimension to 1 by specifying map_comp = {0}, i.e., the user can specify any one component to send to the output field, and the default is the first (0th) component.
The output is a new object. It contains a new, subsetted 2D Mesh_Rect and a new Node_Data of the selected components' slices. Where the slice plane does not land exactly on a node, the data value is interpolated from the values of the adjacent nodes.
DVslice_rect uses trilinear interpolation to interpolate values between mesh nodes.
extract a 2D slice from a uniform field using an arbitrarily oriented slice plane
group DVslice_unif {
Mesh_Unif+Dim3+Node_Data+Iparam &in { /* uniform input field */
nnodes + req;
};
Plane_Grid+Xform+Iparam &plane; /* slice plane */
float+notify+IPort2 dist; /* plane distance */
int+Iparam map_comp[];
Mesh_Unif+Dim2+Node_Data+Oparam out; /* output field */
method+notify_val+notify_inst upd_slice = "slice";
};
DVslice_unif extracts an arbitrarily-oriented 2D slice of data from a 3D uniform mesh field. Any number of components can be extracted. Output is generated every time the slice plane moves.
The input is a reference to a field that must be a 3D field (Dims3) with a uniform mesh (mesh type Mesh_Unif) and any type of Node_Data.
A reference to a Plane_Grid object that will be the slicing plane. This could be generated by the Plane object found in Geometries.Plane, or it could be any 2D Mesh_Unif. The plane object generated by Geometries.Plane's advantage is that its plane object has its own Plane Transformation panel that controls plane rotation, translation, and scale, as well as controls to specify its size when it is connected to the Module Stack object.
A float. This value will move the plane through the field perpendicular to the plane. Though the Plane Transformation panel has X, Y, and Z transformation controls, it is usually easier to use plane's controls to orient and size the plane, but use this plane distance control to move the plane. DVslice_unif generates output whenever the slice plane moves.
An integer array. Each array value is the number (from 0 up) of a component to extract. For example:
(a, b, c, [e, f, g]) --> set map_comp = {0, 3} --> (a, [e, f, g]) in the output field
Note that this array is not explicitly dimensioned. It is a variable-length array that will have as many values as you assign to it with the = { n, n, n,...n} notation. The supplied AVS/Express modules that use DVslice_unif implicitly set the dimension to 1 by specifying map_comp = {0}, i.e., the user can specify any one component to send to the output field, and the default is the first (0th) component.
The output is a new object. It contains a new, subsetted 2D Mesh_Unif and the new Node_Data of the selected components' slices. Where the slice plane does not land exactly on a node, the data value is interpolated from the values of the adjacent nodes.
DVslice_unif uses trilinear interpolation to interpolate data values between mesh nodes.
create multiple 2D or 3D filled contours
module DVsolid_contour {
Mesh+Node_Data+Iparam &in {
xform+nonotify;
nnodes+req;
};
int+Iparam contour_comp;
float+Iparam level[];
Mesh+Cell_Data+Oparam out {
&xform+nowrite => in.xform;
};
method+notify_val+notify_inst solid_contour_update<status=1> =
"DVsolid_contour";
};
DVsolid_contour produces solid (filled) contour regions of a given component of an input field. If the input mesh is 2D, the output is similar to contour lines, except the regions between the lines are filled in with a color representing the value of that contour. The output cells are subdivisions of the input cells, cut by the contour lines.
If the input mesh is 3D, the output is a set of 3D cells filling the regions between adjacent isosurfaces. The output cells are, in general, subdivisions of the input cells, cut by the contour surfaces.
The contour levels are defined by the elements of the levels[] array; the number of contours is the size of the array, and each element of the array defines one contour level.
The data value in the output cells is the average of the values of the two contour lines or surfaces bounding that region.
Mesh+Node_Data. 2D or 3D input field to be contoured.
int. Select which component of in_field to contour.
float[]. Array of levels; a contour will be made at each level.
Mesh+Cell_Data. Represents the solid contours. This mesh has the same
dimensionality as the input.integrate a velocity field producing streamlines or streamribbons
group DVstream {
Mesh+Node_Data+Iparam &in { /* input field */
xform+nonotify;
nnodes+req;
};
Grid+Xform+ Iparam &probe; /* where the streamlines originate */
int+Iparam order; /* order of integration */
int+Iparam forw_back; /* toggle for lines forward/backward */
int+Iparam nseg;
float+Iparam min_vel;
int+Iparam max_seg;
int+Iparam stream_comp;
int+Iparam ribbons;
int+notify rib_width;
int+notify rib_angle;
Mesh+Node_Data+Oparam out { /*output field */
&xform<weight=-1> => in.xform;
};
method+notify_val+notify_inst upd_stream = "stream";
} ;
DVstream generates streamlines or streamribbons based on a field of any mesh type that has at least one component that is a 1, 2, or 3 element vector.
You place a sample of points (the &probe) at a starting location in the field. Then, for every time step, DVstream advances each sample point through space based on the interpolated value of the vector field at its present position. The result is a set of streamlines or streamribbons showing the progress of massless particles through a vector field.
The input is a reference to a field with any type of mesh. Its Node_Data must contain at least one component that is a 1, 2, or 3 element velocity vector.
A reference to any mesh whose coordinates represent the sample points. To create this sampling mesh you could, for example, use the Plane, Line or Box objects in Geometries.[plane|slice|box] or the slice macro.
An integer. Sets the order of integration. Higher orders are more accurate, but execute more slowly.
An integer. If the value is not 0, streamlines are generated forward from the starting sample points. If the value is 0, they are generated backward from the starting sample points.
An integer. Sets how many integration steps will be used within one grid "cell" to compute the streamline path.
A float. When a streamline falls below this velocity, the integration process for that streamline stops. You use this to prevent wasted computation for streamlines barely moving, or even stationary (min_velocity =0).
An integer. Sets the total number of integration steps to take. When an individual streamline exceeds this value, integration for it stops.
An integer. Sets which component to base the streamlines upon. The selection must be a three element vector.
An integer. When this is not 0, DVstream will produce streamribbons rather than streamlines.
An integer. Scales the width of the ribbon. Ribbon width varies along its length according to the divergence of the flow. This value controls ribbon width at the beginning of the ribbon.
An integer. Controls the initial angle at which the ribbon is drawn. Reasonable values are from 0.0 to 360.0.
The output field is a new object. It contains an unstructured Mesh of cell type Polyline that represents streamlines. Its new Node_Data contains the selected element's velocity component. The output also contains a reference to the input field's xform.
The streamlines are calculated using the Runge-Kutte method of specified order with adaptive time steps.
Libraries.Main.Mappers.streamlines
Libraries.Main.Mappers.advectorcreate streamlines and stream ribbons for a Multi_Block object
module DVstream_multi_block {
/* integrates velocity field (produces streamlines) */
Multi_Block+Iparam &in { /* input field */
nblocks+req;
};
Grid+Xform+Iparam &probe { /* where the streamlines originate */
nnodes+req;
coordinates+req;
coordinates.values+req;
};
int+Iparam order; /* order of integration */
int+Iparam forw_back; /* toggle to generate lines forward */
int+Iparam nseg;
float+Iparam min_vel;
int+Iparam max_seg;
int+Iparam stream_comp;
int+Iparam ribbons;
float+notify rib_width;
float+notify rib_angle;
Mesh+Node_Data+Oparam out;
method+notify_val+notify_inst stream_multi_block<status=1> =
"DVstream_multi_block";
};
DVstream_multi_block creates streamlines and stream ribbons for a Multi_Block object.
Multi_Block. The input multiblock data set.
Grid+Xform. Streamlines start at each node of this mesh.
int. Integration order for the streamline advection. Higher orders are more accurate but execute more slowly. The default is 2, for second-order integration. The range is from 1 to 4.
int. When on (nonzero), streamlines are advected forward, in the downstream direction of the flow. When off (zero), they are advected backward, upstream in the flow. The default is forward.
int. How many integration steps are used per grid cell to compute the streamline path. The default is 2.
float. If the absolute value of the velocity is less than this limit, the streamline advection is terminated. This is usually used to avoid wasting computation on streamlines which are barely moving. Velocity is measured in the coordinate system of the data set. The default is 0.000001.
int. Maximum number of integration steps to take for an individual streamline. A streamline is terminated either when it leaves the data set, when the absolute value of its velocity is less than min_velocity (see below), or when it exceeds this number of integration steps.
int. Which component of the data set to use.
int. When on (nonzero), produces stream ribbons rather than streamlines. The width of the ribbons varies along the length with the divergence of the field, and the angle varies with the curl.
float. This value scales the width of the ribbons when ribbons are turned on.
float. This value sets the initial angle at which the ribbons are drawn. The ribbons twist along their length according to the curl of the field.
Mesh+Node_Data. Field containing the streamlines.
produce a 3D or 2D surface by extruding a 2D or 1D mesh according to data values
group DVsurf_plot {
Mesh+Node_Data+Port2 &in ;
int+IPort2 component;
float+IPort2 scale;
float+IPort2 offset;
Grid+Xform out_grid {
nnodes => in.nnodes;
nspace+nres => in.nspace+in.node_data[component].veclen;
&xform => in.xform;
int npoints => nnodes;
float points[nnodes][nspace];
coordinates {
values+nres => combine_array(in.coordinates.values,
offset+scale*in.node_data[component].values);
};
};
Mesh+Node_Data+OPort2 &out => merge(out_grid, in);
};
DVsurf_plot creates a 3D or 2D mesh whose height at each point is proportional to the scalar data value at that node location in the original field. 2D input produces a 3D mesh. 1D input produces a 2D output.
The input is a reference to a field of any mesh type and any Node_Data. The field's mesh should have nspace=1 or 2. However, no checking is done to enforce this restriction. The Node_Data must contain at least one scalar component.
An integer. Sets which of the input's data components to use to set the mesh height.
A float. Used to scale the height (scale*component values).
A float. Raises or lowers the resulting mesh with respect to the input mesh so that both are visible at the same time.
The output is a reference to a merged group made up of the new object out_grid, which is a mesh of the same type as the input mesh, with nspace+1, whose coordinate values represent the projected, scaled, and offset surface, plus a reference to the original &in field.
Libraries.Main.Mappers.surf_plot
Section 5.98, surf_plot [page 5-240]
create "height surfaces" of a 2D field that are continuous along one axis but discontinuous along the other
module DVsurf_ribbons {
Mesh_Unif+Dim2+Node_Data+Iparam &in {
xform+nonotify;
nnodes+req;
dims+req;
};
int+IPort2 ribbon_dir;
int+IPort2 height_comp;
int+IPort2 map_comp;
float+IPort2 scale;
float+IPort2 offset;
Mesh+Node_Data+Oparam out {
&xform+nowrite => in.xform;
};
method+notify_val+notify_inst surf_ribbons_update<status=1> =
"DVsurf_ribbons";
};
DVribbons_plot creates height surfaces of a 2D field by treating the values of a
component of that field as height above the surface of the field, and the values of
another component as color to be applied. The surfaces so created are continuous
along one axis (selectable as X or Y) and discontinuous along the other axis, so
they look like a set of colored ribbons draping over a surface.Mesh_Unif+Node_Data. The ribbon plot is built on this mesh, using the node data values as heights.
int. Selects which direction (X or Y) the ribbons should run in.
int. Which node data component to map to ribbon height.
int. Which node data component to map to ribbon color.
float. This scale factor is applied to the data values to convert them into heights above the mesh.
float. This offset is added to the heights to offset the ribbons from the surface of the field.
Mesh+Node_Data. Contains the generated ribbons.
Libraries.Main.Mappers.surf_plot
select one output from a series of inputs
DVswitch creates a new output that is selected by the user from any number or type of inputs.
An array of references to other objects.
An integer that selects which of the input objects to output.
The output is a new object that contains a reference to one of the input objects.
remove cells with nodes that contain null data from input field
group DVthresh_null {
Mesh+Node_Data+Iparam &in { /* input field */
xform+nonotify;
nnodes+req;
};
int+Iparam thresh_component; /* component to be thresholded */
Mesh+Node_Data+Oparam out { /* output field */
&xform<weight=-1> => in.xform;
};
method+notify_val+notify_inst upd_thresh_null = "thresh_null";
} ;
DVthresh_null removes cells where the selected component's node data is equal to the null data value; if the null_data flag is not set on the input field no processing is done. You would use DVthresh_null, for example, to improve the performance of the renderer when rendering fields with NULL data. While the renderer will automatically delete NULL data cells, it must do so every time the object is transformed. With DVthresh_null as a data "preprocessor," this overhead is removed.
The input is a reference to a field containing any mesh and Node_Data.
An integer. Sets which Node_Data component to use during the search for NULL data. The component can be scalar or vector.
The output is a new object. It contains the new unstructured Mesh and its new Node_Data contains all data that is not from a deleted cell.
Libraries.Main.Mappers.thresh_null
remove data below and/or above min/max threshold level by setting to NULL
group DVthreshold {
Node_Data+Iparam &in { /* input field */
nnodes+req;
};
int+Iparam check_vector;
int+Iparam check_comp;
int+Iparam thresh_vector;
int+Iparam below; /* toggle to turn on lower thresholding */
int+Iparam above; /* toggle to turn on upper thresholding */
float+Iparam min_value; /* lower threshold value */
float+Iparam max_value; /* upper threshold value */
float+Iparam null_value; /* value to set when data is out of range */
Node_Data+Oparam out; /* output field */
method+notify_val+notify_inst upd_threshold = "threshold";
} ;
DVthreshold "removes" all values in a field above a max_value, and/or below a min_value by setting them to NULL.
DVthreshold can be used in two ways.
1. It can look at the values in just one component and set them to null_value if they exceed max_value or min_value (thresh_vector = check vector). This is its most common use. Or,
2. It can look at the values in one scalar subcomponent to see if they exceed max_value or min_value. If they do exceed the threshold bounds, it then sets the corresponding array index value in a second, different component to null_value (thresh_vector not equal check_vector).
This second behavior is useful, for example, if you use one component to flag the visibility of a node (for example, 0 = invisible, 1 = visible) in another component.
- The thresh_vector component's Data_Array null_flag is set to 1 ("has null data") and its null_value is set to DVthreshold's null_value input.
- If above does not equal 0, then for each node DVthreshold checks the scalar subcomponent referenced by check_vector (which component) and check_comp (which subcomponent of that component) against max_value. If it is greater than max_value, it sets the corresponding node in thresh_vector to null_value.
If thresh_vector and check_vector point to the same component, the effect is simpler. Any value above max_value in that component is set to null_value.
- If below does not equal 0, then for each node DVthreshold checks the scalar subcomponent referenced by check_vector (which component) and check_comp (which subcomponent of that component) against min_value. If it is less than min_value, it sets the corresponding node in thresh_vector to null_value.
If thresh_vector and check_vector point to the same component, the effect is simpler. Any value below min_value in that component is set to null_value.
The input is a reference to a field with Node_Data of any type.
An integer. Sets which component will be compared against min_value and max_value.
An integer. Sets which subcomponent of check_vector will be compared against min_value and max_value.
An integer. Sets which component of the input field to threshold. The selected component can be scalar or vector.
An integer. When not 0, thresholds data above the max_value.
An integer. When not 0, thresholds data below the min_value.
Floats. Set the min and max values. The float value is converted to the data type of the input field before use.
A float. Establishes what the null_value is. The value specified is converted to the data type of the field before use.
The output is a new object that contains only the thresh_vector, thresholded Node_Data component.
Libraries.Main.Filters.threshold
module DVthreshold_cell { /* sets NULL data for all values below and/or
above min/max threshold level(s) */
Mesh+Cell_Data+Iparam &in { /* input field */
nnodes+req;
};
int+Iparam check_vector;
int+Iparam check_comp;
int+Iparam thresh_vector;
int+Iparam below; /* toggle to turn on lower thresholding */
int+Iparam above; /* toggle to turn on upper thresholding */
float+Iparam min_value; /* lower threshold value */
float+Iparam max_value; /* upper threshold value */
float+Iparam null_value; /* value to set when data is out of range */
int dim => in.ncell_sets;
group+nonotify out_data[dim] {
int ncells => in.cell_set[index_of(out_data)].ncells;
int ncell_data=1;
Data_Array cell_data[ncell_data] {
nvals => ncells;
};
};
group+nonotify out_sets[dim] {
group &out_set => merge(out_data[index_of(out_sets)],
in.cell_set[index_of(out_sets)]);
};
Cells+Cell_Data+nonotify+write out_cd {
*cell_set[];
ncell_sets => array_size(cell_set);
};
Mesh+OPort2+nonotify &out =>merge(out_cd, in);
method+notify_val+notify_inst upd_data_math<status=1> =
"DVthreshold_cell";
};
DVthreshold_cell sets the values of a given component of a cell-based data set to the null value if the value of another component (usually the same one) is above or below a given threshold.
Mesh+Cell_Data. The cell data set to be thresholded.
int. Selects which component to check. If this component exceeds the threshold(s) at some node, the value of the threshold_component at that node is set to the null data value.
int. If the selected component is a vector, this selects which element of that vector to threshold. If the selected component is scalar, this value is ignored.
int. Selects which component to threshold, based on the value of "check_comp."
int. When set (nonzero), values below the selected min value are set to the null value.
int. When set (nonzero), values above the selected max value are set to the null value.
float. The min value to check against.
float. The max value to check against.
float. The value to use in the output as the null value. Select a value for this which does not occur in the input data set.
Libraries.Main.Mappers.threshold_cell
write an image file from an AVS/Express field
module DVwrite_image {
Mesh_Unif+Dim2+Space2+Node_Data+Vector4+Oparam in; /* in field */
string+Iparam filename; /* name of file to write */
int+Iparam flip; /* invert image in y */
int+Iparam format; /* file format */
int+Iparam filetype; /* binary, ASCII */
int+Iparam depth; /* bits per pixel */
int+Iparam colortype; /* RGB, greyscale, BW */
int+Iparam compresstype; /* compression type to use */
int+Iparam reducetype; /* depth reduction method */
method+notify_val+notify_inst write_image_update = "DVwrite_image_update";
} ;
DVwrite_image writes an image file of a specified format from an AVS/Express Field.
A string. Names the input file to be written. The string can be either the complete absolute pathname, or a relative pathname. If it is relative, it will be interpreted relative to the user's working directory when AVS/Express was started.
Boolean indicating whether to invert the image about the x axis, i.e. in the vertical direction.
An integer value indicating the image file format to write. The following image formats are currently supported:
Note: Developer Edition users wishing to create runtimes that include support for writing GIF image format, which uses the patented LZW compression algorithm, must first obtain a license from Unisys Corporation:
WARNING: Use of this software for providing LZW capability for any purpose is not authorized unless user first enters into a license agreement with Unisys under U.S. Patent No. 4,558,302 and foreign counterparts. For information concering licensing, please contact:
Unisys Corporation
Welch Licensing Department - C1SW19
Township Line & Union Meeting Roads
P.O. Box 500
Blue Bell, PA 19422
Once you have entered into such a license agreement with Unisys Corp, runtime generation support for GIF can be enabled in AVS/Express at no additional cost. Contact Advanced Visual Systems customer support for details.
Support for additional image formats can be provided by creating new writers using available API calls (see Appendix A, Adding your own image readers and writers). To obtain a current list of the supported image formats, you can open v/modules.v and search for "Write_Image" - the list can be found in the defined radioBox labels.
An integer indicating whether the output file should be written in binary or ASCII. This option is only appropriate for certain formats, e.g. PBM.
An integer indicating how many bits per pixel should be written. For many formats this is fixed, e.g. GIF is always 8, AVS .x always 32.
An integer indicating whether separate red, green and blue values, or grey levels, or dithered black and white 2 level values should be written. This option is only appropriate for certain formats, e.g. GIF.
An integer indicating the type of compression to be used when writing the file. For most formats there is no choice, e.g. GIF is always written using LZW and AVS .x files are always uncompressed. TIFF, however, can support a number of different compression types.
An integer indicating which method to use when the 8 bit red, green and blue values of the input field have to be reduced ("quantized") to 8 bit colormap indices, for example.
Libraries.Main.Writers.Write_image
v/dv.v
modules/rd_image.c
modules/image.hAdding a new writable image format:
write a data set or object to a netCDF file
module DVwrite_net_cdf {
ilink+nonotify in;
string+Iparam filename;
method+notify_val+notify_inst write_update<status=1> =
"DVwrite_net_cdf";
};
Write_netCDF writes any V object (e.g. an AVS/Express field data set) to a netCDF file.
string. Name of netCDF file to write
any. Object containing the elements to be written to the specified netCDF file.
Libraries.Main.Writers.Write_netCDF
Transform the node coordinates of a mesh according to the transform specified in the mesh. Return an array containing the transformed coordinates.
module DVxform_coord {
Mesh+Iparam &in {
nnodes+req;
nspace+req;
};
int+Iparam comp[];
int+write coord_nspace;
float+Oparam coord[in.nnodes][coord_nspace];
method+notify_val+notify_inst upd_xform_coord = "DVxform_coord";
};
DVxform_coord takes a mesh as its input and returns an array containing the coordinates of this mesh, transformed according to the transformation matrix in the input mesh.
The output is a 2D array containing the X, Y and/or Z components of the mesh's coordinates after being transformed by the mesh's transformation matrix. If X (0) and Y (1) are selected, it outputs X0, Y0, X1, Y1, and so on. Note that the output coordinates are in general not the same as the coordinates of the mesh itself; they are transformed, so they are in "world coordinates", as you would see them in the viewer, because of the transformation step.
Mesh. The input mesh, containing the coordinates and the transformation matrix.
int[]. An array of up to three elements, selecting which of X, Y and/or Z to transform and output. Unselected elements are ignored. The behavior is undefined if this array has zero or more than three elements, or if the values are not in the range [0,2]. 0 selects X, 1 selects Y, and 2 selects Z.
float[][]. The output array, containing the transformed coordinates.
Copyright © 2001 Advanced Visual Systems
Inc.
All rights reserved.