MOOCHO (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Member Functions | Private Attributes | 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...
 

Private Member Functions

 VectorDenseEncap ()
 
 VectorDenseEncap (const VectorDenseEncap &)
 
VectorDenseEncapoperator= (const VectorDenseEncap &)
 

Private Attributes

const Vectorvec_
 
RTOpPack::SubVector sub_vec_
 
DVectorSlice vs_
 

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.

AbstractLinAlgPack::VectorDenseEncap::VectorDenseEncap ( )
private
AbstractLinAlgPack::VectorDenseEncap::VectorDenseEncap ( const VectorDenseEncap )
private

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.

VectorDenseEncap& AbstractLinAlgPack::VectorDenseEncap::operator= ( const VectorDenseEncap )
private

Member Data Documentation

const Vector& AbstractLinAlgPack::VectorDenseEncap::vec_
private

Definition at line 90 of file AbstractLinAlgPack_VectorDenseEncap.hpp.

RTOpPack::SubVector AbstractLinAlgPack::VectorDenseEncap::sub_vec_
private

Definition at line 91 of file AbstractLinAlgPack_VectorDenseEncap.hpp.

DVectorSlice AbstractLinAlgPack::VectorDenseEncap::vs_
private

Definition at line 92 of file AbstractLinAlgPack_VectorDenseEncap.hpp.


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