LAMA
lama::HostWriteAccess< T > Class Template Reference

HostWriteAccess is a specialization of WriteAccess for the Host Location with an extended interface. More...

#include <HostWriteAccess.hpp>

Inheritance diagram for lama::HostWriteAccess< T >:

Public Types

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

Public Member Functions

 HostWriteAccess (LAMAArray< ValueType > &array)
 acquire a WriteAccess to the passed LAMAArray for the Host location
 HostWriteAccess (LAMAArray< ValueType > &array, const IndexType size, const bool keep)
 HostWriteAccess (LAMAArrayView< ValueType > &view, const bool keep=true)
virtual ~HostWriteAccess ()
 Releases the WriteAccess on the associated LAMAArray.
ValueTypeoperator[] (const IndexType i)
 access to the element i of the wrapped LAMAArray
 operator ValueType * ()
 conversion to a ValueType pointer (shortcut for get() )
void push_back (const ValueType val)
 appends val to the end of the wrapped LAMAArray.
ValueTypeget ()
 returns a pointer to the data of the wrapped LAMAArray
void clear ()
 Set the size of the LAMAArray to 0.
void resize (const IndexType newSize)
 resizes the wrapped LAMAArray
void reserve (const IndexType capacity)
 reserve storage for wth wrapped LAMAArray at the associated location
IndexType capacity () const
 query the capacity of the array on the reserved context
virtual void release ()
 Releases the WriteAccess on the associated LAMAArray.
virtual void writeAt (std::ostream &stream) const
 Writes some Information about this to the passed stream.
IndexType size () const
 Returns the size of the wrapped LAMAArray.

Protected Member Functions

 LAMA_LOG_DECL_STATIC_LOGGER (logger)

Protected Attributes

ValueTypemData
LAMAArrayView< ValueType > * mArrayView
size_t mIndex

Detailed Description

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

HostWriteAccess is a specialization of WriteAccess for the Host Location with an extended interface.


Member Typedef Documentation

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

ValueType is the type stored in the wrapped container.

Reimplemented from lama::WriteAccess< T >.

Reimplemented in lama::HostWriteOnlyAccess< T >.


Constructor & Destructor Documentation

template<typename T >
lama::HostWriteAccess< T >::HostWriteAccess ( LAMAArray< ValueType > &  array)

acquire a WriteAccess to the passed LAMAArray for the Host location

Parameters:
[in]arraythe LAMAArray to acquire a WriteAccess for
[in]keepif the contents of the LAMAArray should be kept or not (default: true)
Exceptions:
Exceptionif the WriteAccess can not be acquired, e.g. because another WriteAccess exists.
See also:
WriteAccess for more details
template<typename T >
lama::HostWriteAccess< T >::HostWriteAccess ( LAMAArray< ValueType > &  array,
const IndexType  size,
const bool  keep 
)
template<typename T >
lama::HostWriteAccess< T >::HostWriteAccess ( LAMAArrayView< ValueType > &  view,
const bool  keep = true 
)
template<typename T >
lama::HostWriteAccess< T >::~HostWriteAccess ( ) [virtual]

Releases the WriteAccess on the associated LAMAArray.


Member Function Documentation

template<typename T >
IndexType lama::WriteAccess< T >::capacity ( ) const [inherited]

query the capacity of the array on the reserved context

References LAMA_ASSERT_ERROR.

Referenced by lama::Communicator::shift().

template<typename T >
void lama::WriteAccess< T >::clear ( ) [inherited]

Set the size of the LAMAArray to 0.

This operation only sets the size but does not free any reserved memory.

This operation should always be called when an array is completely rewritten. to avoid that data will be transfered from other locations or copying of old values during the resize.

   LAMAArray& arr = ...
   arr.clear();
   HostWriteAccess writeArr( arr );
   writeArr.resize( 100 );
   for ( int i = 0; i < 100; i++)
   {
       writeArr[i] = 0.0;
   }

References LAMA_ASSERT_ERROR.

Referenced by lama::Communicator::exchangeByPlan(), and lama::_MatrixStorage::offsets2sizes().

template<typename T >
T * lama::WriteAccess< T >::get ( ) [inherited]

returns a pointer to the data of the wrapped LAMAArray

Returns:
a pointer to the wrapped LAMAArray.

References LAMA_THROWEXCEPTION.

Referenced by lama::JDSStorage< T >::allocate(), lama::CSRStorage< T >::allocate(), lama::CommunicationPlan::allocateTranspose(), lama::DenseStorageView< T >::assignDenseStorageImpl(), lama::LAMAArrayUtils::assignImpl2(), lama::HaloBuilder::build(), lama::COOStorage< T >::buildCSR(), lama::ELLStorage< T >::buildCSR(), lama::JDSStorage< T >::buildCSR(), lama::DIAStorage< T >::buildCSR(), lama::DenseStorageView< T >::buildCSR(), lama::SparseAssemblyStorage< T >::buildCSR(), lama::CSRStorage< T >::buildCSR(), lama::ELLStorage< T >::buildRowIndexes(), lama::CSRStorage< T >::buildRowIndexes(), lama::ELLStorage< T >::compress(), lama::LUSolver::computeLUFactorization(), lama::Communicator::computeOwners(), lama::MatrixStorage< T >::convertCSR2CSC(), lama::DenseStorage< T >::DenseStorage(), lama::ELLStorage< T >::ELLStorage(), 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 >::getRowImpl(), lama::JDSStorage< T >::getRowImpl(), lama::DenseVector< T >::invert(), lama::DenseMatrixOps::invertCyclic(), lama::DenseMatrix< T >::invertCyclic(), lama::DenseStorageView< T >::invertDense(), 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::JDSStorage< T >::JDSStorage(), lama::MatrixStorage< T >::joinRows(), lama::StorageMethods< T >::localizeCSR(), lama::CSRStorage< T >::matrixAddMatrixCSR(), lama::ELLStorage< T >::matrixAddMatrixELL(), lama::CSRStorage< T >::matrixTimesMatrixCSR(), 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::LUSolver::plaswp(), lama::LUSolver::ptrsm(), lama::StorageIO< T >::readCSRFromBinaryFile(), lama::StorageIO< T >::readCSRFromMMFile(), lama::StorageIO< T >::readCSRFromXDRFile(), lama::DenseVector< T >::readVectorDataFromBinaryFile(), lama::DenseVector< T >::redistribute(), lama::StorageMethods< T >::redistributeCSR(), lama::StorageMethods< T >::replicateCSR(), lama::ELLStorage< T >::scaleImpl(), lama::CSRStorage< T >::scaleImpl(), lama::JDSStorage< T >::scaleImpl(), lama::DenseStorageView< T >::scaleImpl(), lama::DenseStorageView< T >::setCSRDataImpl(), lama::CSRStorage< T >::setCSRDataImpl(), lama::COOStorage< T >::setCSRDataImpl(), lama::JDSStorage< T >::setCSRDataImpl(), lama::ELLStorage< T >::setCSRDataImpl(), lama::COOStorage< T >::setDiagonalImpl(), lama::ELLStorage< T >::setDiagonalImpl(), lama::CSRStorage< T >::setDiagonalImpl(), lama::JDSStorage< T >::setDiagonalImpl(), lama::DenseStorageView< T >::setDiagonalImpl(), lama::DIAStorage< T >::setDiagonalImpl(), lama::DenseStorageView< T >::setIdentity(), lama::COOStorage< T >::setIdentity(), lama::ELLStorage< T >::setIdentity(), lama::CSRStorage< T >::setIdentity(), lama::JDSStorage< T >::setIdentity(), lama::DIAStorage< T >::setIdentity(), lama::JDSStorage< T >::setupData(), lama::DenseStorageView< T >::setZero(), lama::Communicator::shift(), lama::JDSStorage< T >::sortRows(), lama::StorageMethods< T >::splitCSR(), and lama::DenseVector< T >::vectorPlusVector().

template<typename T>
lama::WriteAccess< T >::LAMA_LOG_DECL_STATIC_LOGGER ( logger  ) [protected, inherited]
template<typename T >
lama::HostWriteAccess< T >::operator ValueType * ( ) [inline]

conversion to a ValueType pointer (shortcut for get() )

Returns:
a pointer to the data of the wrapped LAMAArray
template<typename T >
T & lama::HostWriteAccess< T >::operator[] ( const IndexType  i) [inline]

access to the element i of the wrapped LAMAArray

Parameters:
[in]ithe index of the element of the wrapped LAMAArray to access
Returns:
a reference to the element i of the wrapped LAMAArray

References LAMA_ASSERT_ERROR.

template<typename T >
void lama::HostWriteAccess< T >::push_back ( const ValueType  val)

appends val to the end of the wrapped LAMAArray.

Parameters:
[in]valthe value to append
template<typename T >
void lama::WriteAccess< T >::reserve ( const IndexType  capacity) [inherited]

reserve storage for wth wrapped LAMAArray at the associated location

Parameters:
[in]capacitythe number of elements that should fit into the new storage

References LAMA_ASSERT_ERROR.

Referenced by lama::SparseMatrix< T >::setComputeKind(), lama::DenseVector< T >::updateHalo(), and lama::DenseVector< T >::updateHaloAsync().

template<typename T >
IndexType lama::WriteAccess< T >::size ( ) const [inline, inherited]
template<typename T >
void lama::WriteAccess< T >::writeAt ( std::ostream &  stream) const [virtual, inherited]

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>
LAMAArrayView<ValueType>* lama::WriteAccess< T >::mArrayView [protected, inherited]
template<typename T>
ValueType* lama::WriteAccess< T >::mData [protected, inherited]
template<typename T>
size_t lama::WriteAccess< T >::mIndex [protected, inherited]

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