DVextr_vector


Synopsis

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";
} ;

Description

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.

Input

&in

A reference to the input field from which elements will be extracted.

veclen

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.

components[veclen]

An integer pointer to an array whose values specify which of &in's components will be examined for subcomponent extraction. For example:

(a, b, c, [d, e, f])

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]).

sub_components[veclen]

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:

(a, b, c, [d, e, f])

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).

Output

out

The output is a new Node_Data object containing the extracted values. It has one component. That component's elements are the extracted values.

Files

v/dv.v
modules/extr_vec.c

Utility DVM macros

DVMcombine_vect_param, CombineVect

Example

Libraries.Main.Filters.combine_vect

See also