RTOpPack: Extra C/C++ Code for Vector Reduction/Transformation Operators Version of the Day
|struct RTOp_SubVector||RTOp_ROp_get_sub_vector_val (RTOp_ReductTarget reduct_obj)|
Reduction operator for extracting a sub-vector out of the whole vector.
sub_vec <- v(l,u)
This operator is only defined to allow one vector argument (
num_vecs == 1)
v. Using a reduction operator to extract a sub-vector will be reasonably efficient for some types of vector subclasses (e.g. serial vectors) but very slow for others (e.g. out-of-core and parallel vectors). It would be better for vector subclasses to implement this operation directly but if they don't you can use this operator to extract the required sub-vector.
This operator class works by allocating a dense sub-vector and then initializing the values to zero. During the reduction of a single vector chunk, nonzero values are set. After the global reduction is performed, the vector is compacted (i.e. the zero elements are removed if present) by the RTOp_ROp_get_sub_vector_val<tt>(...) function.
Definition in file RTOp_ROp_get_sub_vector.h.
|struct RTOp_SubVector RTOp_ROp_get_sub_vector_val||(||RTOp_ReductTarget||reduct_obj||)||
Get the sub-vector.
This function should only be called after the complete reduction operation has been finished. However,
RTOp_reduct_obj_free(...) should still be called to delete the
reduct_obj once it is finished being used.
|reduct_obj||[in/out] On input, this object must at least be initialized and may or may not have been through any reduction operations.|
free(reduct_obj)and then set
reduct_obj == RTOp_REDUCT_OBJ_NULLto avoid future mistakes.