LAMA
lama::SolutionProxy Class Reference

The SolutionProxy is used to avoid multiple residual calculations. More...

#include <SolutionProxy.hpp>

Public Member Functions

 SolutionProxy ()
 Creates a SolutionProxy with no associated vector.
 SolutionProxy (Vector *const solution)
 Creates a SolutionProxy for the given pointer.
 ~SolutionProxy ()
 SolutionProxy destructor.
const VectorgetConstReference () const
 Returns a constant reference to the underlying vector.
Vectoroperator* ()
 Returns a reference to the underlying vector.
void operator= (Vector *const newVector)
 Associates the given Vector Pointer with this SolutionProxy.
bool isDirty () const
 Determines if the proxy is dirty and the residual needs to be recomputed.
void setDirty (bool isDirty)
 Sets/unsets the isDirt flag of the SolutionProxy.
VectorgetReference ()
 Returns a reference to the underlying vector.
std::auto_ptr< Vectorcreate ()
void swap (Vector *&other)

Private Attributes

VectormSolution
 The underlying solution vector.
bool mIsDirty
 Flag which determines, if the Proxy is dirt or not.

Detailed Description

The SolutionProxy is used to avoid multiple residual calculations.

The SolutionProxy is used to avoid needless residual re-calculation. Basically it is a wraps around pointer to a vector. Each not read-only access to the underlying vector marks the proxy as dirty and by that signals the solver to recalculate the residual.


Constructor & Destructor Documentation

Creates a SolutionProxy with no associated vector.

Creates a SolutionProxy for the given pointer.

SolutionProxy does not take owner ship of the passed pointer. Therefore the caller has to make sure that the associated vector exists as long as this SolutionProxy exists.

Parameters:
[in]solutionThe pointer to the vector which the proxy will wrap.

SolutionProxy destructor.

The destructor ~SolutionProxy() does not destroy the associated vector.


Member Function Documentation

std::auto_ptr< Vector > lama::SolutionProxy::create ( )

Returns a constant reference to the underlying vector.

Returns:
constant reference to the underlying vector.

References mSolution.

Referenced by lama::Solver::getResidual(), and lama::SpecializedJacobi::iterateTyped().

Returns a reference to the underlying vector.

Returns a reference to the underlying vector. One may also use the * operator.

Returns:
Reference to the underlying vector.

References mSolution, and setDirty().

Referenced by operator*().

Determines if the proxy is dirty and the residual needs to be recomputed.

Returns:
Value to determine if the proxy is dirty.

References mIsDirty.

Referenced by lama::Solver::getResidual(), and setDirty().

Vector & lama::SolutionProxy::operator* ( )

Returns a reference to the underlying vector.

This call is equivalent to SolutionProxy::getReference(). It was introduced to use the SolutionProxy in the same manner a pointer can be used.

Returns:
Reference to the underlying vector.

References getReference().

void lama::SolutionProxy::operator= ( Vector *const  newVector)

Associates the given Vector Pointer with this SolutionProxy.

The assignment drops the probably existing association to anther Vector.

Parameters:
[in]newVectorthe Vector to which the SolutionProxy shall point to.

References mSolution, and setDirty().

void lama::SolutionProxy::setDirty ( bool  isDirty)

Sets/unsets the isDirt flag of the SolutionProxy.

Parameters:
[in]Booleanvalue determining whether the proxy is dirty or not.

References isDirty(), and mIsDirty.

Referenced by getReference(), lama::Solver::getResidual(), operator=(), and swap().

void lama::SolutionProxy::swap ( Vector *&  other)

References mSolution, and setDirty().


Field Documentation

Flag which determines, if the Proxy is dirt or not.

Referenced by isDirty(), and setDirty().

The underlying solution vector.

Referenced by create(), getConstReference(), getReference(), operator=(), and swap().


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