AbstractLinAlgPack: C++ Interfaces For Vectors, Matrices And Related Linear Algebra Objects  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Member Functions | List of all members
AbstractLinAlgPack::VectorDenseEncap Class Reference

Extract a constant DenseLinAlgPack::DVectorSlice view of a Vector object. More...

#include <AbstractLinAlgPack_VectorDenseEncap.hpp>

Public Member Functions

 VectorDenseEncap (const Vector &vec)
 Calls vec.get_sub_vector(Range1D(),DENSE,&sub_vec) to get the view. More...
 
 ~VectorDenseEncap ()
 Calls vec.free_sub_vector(&sub_vec) to release the view. More...
 
const DVectorSliceoperator() () const
 Returns a reference to a constant view of the dense vector. More...
 

Detailed Description

Extract a constant DenseLinAlgPack::DVectorSlice view of a Vector object.

This class is only to be used with Vector objects that store all of their elements in the local address space or can easily access all of the vector elements in this process (or thread). It is generally to be used in serial applications but might also find use in parallel appliations where a vector is replicated across processes.

This utility class is defined purly in terms of the abstract interfaces. It is only to be used as an automatic variable on the stack. For example, to extract a DVectorSlice view of an abstract vector and use it to copy to another DVectorSlice object you could write a function like:

void copy(const Vector& vec_in, DVectorSlice* vs_out ) {
VectorDenseEncap vs_in(vec_in);
vs_out = vs_in();
}

In the above code, if the underlying Vector object does not have to perform any dynamic memory allocations and copy in the method Vector::get_sub_vector() then the above code will only have a constant time overhead. However, the above approach will work for any Vector object (no matter how inefficient it may be).

Definition at line 78 of file AbstractLinAlgPack_VectorDenseEncap.hpp.

Constructor & Destructor Documentation

AbstractLinAlgPack::VectorDenseEncap::VectorDenseEncap ( const Vector vec)
inline

Calls vec.get_sub_vector(Range1D(),DENSE,&sub_vec) to get the view.

Definition at line 134 of file AbstractLinAlgPack_VectorDenseEncap.hpp.

AbstractLinAlgPack::VectorDenseEncap::~VectorDenseEncap ( )
inline

Calls vec.free_sub_vector(&sub_vec) to release the view.

Definition at line 147 of file AbstractLinAlgPack_VectorDenseEncap.hpp.

Member Function Documentation

const DVectorSlice & AbstractLinAlgPack::VectorDenseEncap::operator() ( ) const
inline

Returns a reference to a constant view of the dense vector.

Definition at line 153 of file AbstractLinAlgPack_VectorDenseEncap.hpp.


The documentation for this class was generated from the following file: