LAMA
lama::ReadAccess< T > Class Template Reference

The template ReadAccess is used to enforce the consistency of the template LAMAArray. More...

#include <ReadAccess.hpp>

Inheritance diagram for lama::ReadAccess< T >:

Public Types

typedef T ValueType
 ValueType is the type stored in the wrapped container.

Public Member Functions

 ReadAccess (const LAMAArray< ValueType > &array, ContextPtr context)
 acquire a ReadAccess to the passed LAMAArray for the passed context
 ReadAccess (const LAMAArrayView< ValueType > &view, ContextPtr context)
 ReadAccess (const LAMAArrayConstView< ValueType > &view, ContextPtr context)
virtual ~ReadAccess ()
 Releases the ReadAccess on the associated LAMAArray.
const ValueTypeget () const
 returns a valid pointer to the data usable for the context
virtual void release ()
 release the acquired ReadAccess.
virtual void writeAt (std::ostream &stream) const
 Writes some Information about this to the passed stream.
IndexType size () const
 Returns the size of the array.

Private Member Functions

 LAMA_LOG_DECL_STATIC_LOGGER (logger)

Private Attributes

const LAMAArrayConstView
< ValueType > * 
mArrayView
size_t mIndex

Detailed Description

template<typename T>
class lama::ReadAccess< T >

The template ReadAccess is used to enforce the consistency of the template LAMAArray.

ReadAccess enforces the consistency of the template LAMAArray by following the RAII Idiom. This is done by acquiring a read lock on a LAMAArray in the constructor and releasing this read lock in the destructor. Therefore a ReadAccess should be only used as a stack object.


Member Typedef Documentation

template<typename T>
typedef T lama::ReadAccess< T >::ValueType

ValueType is the type stored in the wrapped container.

Reimplemented in lama::HostReadAccess< T >.


Constructor & Destructor Documentation

template<typename T >
lama::ReadAccess< T >::ReadAccess ( const LAMAArray< ValueType > &  array,
ContextPtr  context 
)

acquire a ReadAccess to the passed LAMAArray for the passed context

Parameters:
[in]arraythe LAMAArray to acquire a ReadAccess for
[in]contextthe context that needs a read acess
Exceptions:
Exceptionif the ReadAccess can not be acquired, e.g. because a WriteAccess exists.

References lama::LAMAArrayConstView< T >::acquireReadAccess(), LAMA_ASSERT_ERROR, lama::ReadAccess< T >::mArrayView, and lama::ReadAccess< T >::mIndex.

template<typename T >
lama::ReadAccess< T >::~ReadAccess ( ) [virtual]

Releases the ReadAccess on the associated LAMAArray.


Member Function Documentation

template<typename T >
const T * lama::ReadAccess< T >::get ( ) const

returns a valid pointer to the data usable for the context

Returns:
a pointer to the wrapped LAMAArray.

References LAMA_THROWEXCEPTION.

Referenced by lama::DenseVector< T >::assign(), lama::LAMAArrayUtils::assignImpl2(), lama::SparseMatrix< T >::assignTransposeImpl(), lama::COOStorage< T >::buildCSR(), lama::ELLStorage< T >::buildCSR(), lama::JDSStorage< T >::buildCSR(), lama::DIAStorage< T >::buildCSR(), lama::DenseStorageView< T >::buildCSR(), lama::CSRStorage< T >::buildCSR(), lama::ELLStorage< T >::buildRowIndexes(), lama::CSRStorage< T >::buildRowIndexes(), lama::ELLStorage< T >::check(), lama::JDSStorage< T >::check(), lama::JDSStorage< T >::checkDiagonalProperty(), lama::ELLStorage< T >::checkDiagonalProperty(), lama::CSRStorage< T >::checkDiagonalProperty(), lama::ELLStorage< T >::compress(), lama::LUSolver::computeLUFactorization(), lama::MatrixStorage< T >::convertCSR2CSC(), lama::DenseVector< T >::dotProduct(), lama::Communicator::exchangeByPlan(), lama::StorageMethods< T >::exchangeHaloCSR(), lama::LAMAArrayUtils::gather(), lama::COOStorage< T >::getDiagonalImpl(), lama::ELLStorage< T >::getDiagonalImpl(), lama::CSRStorage< T >::getDiagonalImpl(), lama::DenseStorageView< T >::getDiagonalImpl(), lama::DIAStorage< T >::getDiagonalImpl(), lama::JDSStorage< T >::getDiagonalImpl(), lama::ELLStorage< T >::getNumValues(), lama::_MatrixStorage::getNumValues(), lama::ELLStorage< T >::getRowImpl(), lama::JDSStorage< T >::getRowImpl(), lama::ELLStorage< T >::getValue(), lama::JDSStorage< T >::getValue(), lama::JDSStorage< T >::jacobiIterate(), lama::DIAStorage< T >::jacobiIterate(), lama::COOStorage< T >::jacobiIterate(), lama::ELLStorage< T >::jacobiIterate(), lama::CSRStorage< T >::jacobiIterate(), lama::JDSStorage< T >::jacobiIterateHalo(), lama::ELLStorage< T >::jacobiIterateHalo(), lama::CSRStorage< T >::jacobiIterateHalo(), lama::MatrixStorage< T >::joinRows(), lama::DenseVector< T >::l1Norm(), lama::DenseVector< T >::l2Norm(), lama::ELLStorage< T >::matrixAddMatrixELL(), lama::DenseStorageView< T >::matrixTimesMatrixDense(), lama::ELLStorage< T >::matrixTimesMatrixELL(), lama::JDSStorage< T >::matrixTimesVector(), lama::DIAStorage< T >::matrixTimesVector(), lama::DenseStorageView< T >::matrixTimesVector(), lama::COOStorage< T >::matrixTimesVector(), lama::ELLStorage< T >::matrixTimesVector(), lama::CSRStorage< T >::matrixTimesVector(), lama::CSRStorage< T >::matrixTimesVectorN(), lama::DenseStorageView< T >::maxDiffNormImpl(), lama::CSRStorage< T >::maxDiffNormImpl(), lama::DenseVector< T >::maxNorm(), lama::DenseStorageView< T >::print(), lama::LUSolver::ptrsm(), lama::DenseVector< T >::redistribute(), lama::StorageMethods< T >::redistributeCSR(), lama::StorageMethods< T >::replicateCSR(), lama::JDSStorage< T >::scaleImpl(), lama::ELLStorage< T >::scaleImpl(), lama::CSRStorage< T >::scaleImpl(), lama::DenseStorageView< T >::setCSRDataImpl(), lama::CSRStorage< T >::setCSRDataImpl(), lama::COOStorage< T >::setCSRDataImpl(), lama::ELLStorage< T >::setCSRDataImpl(), lama::JDSStorage< T >::setCSRDataImpl(), lama::SparseAssemblyStorage< T >::setCSRDataImpl(), lama::DIAStorage< T >::setCSRDataImpl(), lama::CSRStorage< T >::setCSRDataSwap(), lama::COOStorage< T >::setDiagonalImpl(), lama::ELLStorage< T >::setDiagonalImpl(), lama::CSRStorage< T >::setDiagonalImpl(), lama::JDSStorage< T >::setDiagonalImpl(), lama::DIAStorage< T >::setDiagonalImpl(), lama::DenseStorageView< T >::setDiagonalImpl(), lama::JDSStorage< T >::setupData(), lama::Communicator::shift(), lama::DenseVector< T >::vectorPlusVector(), lama::StorageIO< T >::writeCSRToBinaryFile(), lama::StorageIO< T >::writeCSRToXDRFile(), lama::DenseVector< T >::writeVectorDataToBinaryFile(), and lama::DenseVector< T >::writeVectorToXDRFile().

template<typename T>
lama::ReadAccess< T >::LAMA_LOG_DECL_STATIC_LOGGER ( logger  ) [private]

Reimplemented in lama::HostReadAccess< T >.

template<typename T >
void lama::ReadAccess< T >::release ( ) [virtual]

release the acquired ReadAccess.

Release is mandatory to unlock the array so that it might be used for further write accesses.

Implements lama::BaseAccess.

Referenced by lama::CSRStorage< T >::compress(), and lama::StorageMethods< T >::exchangeHaloCSR().

template<typename T >
void lama::ReadAccess< T >::writeAt ( std::ostream &  stream) const [virtual]

Writes some Information about this to the passed stream.

If a deriving class does not overrides writeAt, typeid(this).name() is written to stream.

Parameters:
[out]streamthe stream to write to.

Reimplemented from lama::BaseAccess.


Field Documentation

template<typename T>
const LAMAArrayConstView<ValueType>* lama::ReadAccess< T >::mArrayView [private]
template<typename T>
size_t lama::ReadAccess< T >::mIndex [private]

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