LAMA
|
The template ReadAccess is used to enforce the consistency of the template LAMAArray. More...
#include <ReadAccess.hpp>
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 ValueType * | get () 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 |
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.
typedef T lama::ReadAccess< T >::ValueType |
ValueType is the type stored in the wrapped container.
Reimplemented in lama::HostReadAccess< T >.
lama::ReadAccess< T >::ReadAccess | ( | const LAMAArray< ValueType > & | array, |
ContextPtr | context | ||
) |
acquire a ReadAccess to the passed LAMAArray for the passed context
[in] | array | the LAMAArray to acquire a ReadAccess for |
[in] | context | the context that needs a read acess |
Exception | if 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.
lama::ReadAccess< T >::ReadAccess | ( | const LAMAArrayView< ValueType > & | view, |
ContextPtr | context | ||
) |
lama::ReadAccess< T >::ReadAccess | ( | const LAMAArrayConstView< ValueType > & | view, |
ContextPtr | context | ||
) |
lama::ReadAccess< T >::~ReadAccess | ( | ) | [virtual] |
Releases the ReadAccess on the associated LAMAArray.
const T * lama::ReadAccess< T >::get | ( | ) | const |
returns a valid pointer to the data usable for the context
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().
lama::ReadAccess< T >::LAMA_LOG_DECL_STATIC_LOGGER | ( | logger | ) | [private] |
Reimplemented in lama::HostReadAccess< 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().
IndexType lama::ReadAccess< T >::size | ( | ) | const [inline] |
Returns the size of the array.
Referenced by lama::HaloBuilder::build(), lama::Redistributor::copy(), lama::Redistributor::copyN(), lama::Redistributor::gather(), lama::Redistributor::gatherN(), lama::MatrixStorage< T >::joinRows(), lama::DenseVector< T >::max(), lama::DenseVector< T >::min(), lama::Redistributor::scatter(), lama::Redistributor::scatterN(), and lama::Communicator::shift().
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.
[out] | stream | the stream to write to. |
Reimplemented from lama::BaseAccess.
const LAMAArrayConstView<ValueType>* lama::ReadAccess< T >::mArrayView [private] |
Referenced by lama::ReadAccess< T >::ReadAccess().
size_t lama::ReadAccess< T >::mIndex [private] |
Referenced by lama::ReadAccess< T >::ReadAccess().