RTOpPack: Extra C/C++ Code for Vector Reduction/Transformation Operators  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
RTOp_ROp_get_sub_vector.h File Reference
#include "RTOp.h"
Include dependency graph for RTOp_ROp_get_sub_vector.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

struct RTOp_SubVector RTOp_ROp_get_sub_vector_val (RTOp_ReductTarget reduct_obj)
 

Detailed Description

Reduction operator for extracting a sub-vector out of the whole vector.

sub_vec <- v[0](l,u)

This operator is only defined to allow one vector argument (num_vecs == 1) v[0]. 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.

Function Documentation

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.

Parameters
reduct_obj[in/out] On input, this object must at least be initialized and may or may not have been through any reduction operations.
Returns
The returned sub-vector object does not own any memory. technically, reduct_obj owns the memory. However, to transfer memory over the client, call free(reduct_obj) and then set reduct_obj == RTOp_REDUCT_OBJ_NULL to avoid future mistakes.

Definition at line 524 of file RTOp_ROp_get_sub_vector.c.