LAMA
|
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 Vector & | getConstReference () const |
Returns a constant reference to the underlying vector. | |
Vector & | operator* () |
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. | |
Vector & | getReference () |
Returns a reference to the underlying vector. | |
std::auto_ptr< Vector > | create () |
void | swap (Vector *&other) |
Private Attributes | |
Vector * | mSolution |
The underlying solution vector. | |
bool | mIsDirty |
Flag which determines, if the Proxy is dirt or not. |
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.
Creates a SolutionProxy with no associated vector.
lama::SolutionProxy::SolutionProxy | ( | Vector *const | solution | ) |
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.
[in] | solution | The pointer to the vector which the proxy will wrap. |
SolutionProxy destructor.
The destructor ~SolutionProxy() does not destroy the associated vector.
std::auto_ptr< Vector > lama::SolutionProxy::create | ( | ) |
References lama::Vector::create(), and mSolution.
const Vector & lama::SolutionProxy::getConstReference | ( | ) | const |
Returns a 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.
References mSolution, and setDirty().
Referenced by operator*().
bool lama::SolutionProxy::isDirty | ( | ) | const |
Determines if the proxy is dirty and the residual needs to be recomputed.
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.
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.
[in] | newVector | the 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.
[in] | Boolean | value 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().
bool lama::SolutionProxy::mIsDirty [private] |
Flag which determines, if the Proxy is dirt or not.
Referenced by isDirty(), and setDirty().
Vector* lama::SolutionProxy::mSolution [private] |
The underlying solution vector.
Referenced by create(), getConstReference(), getReference(), operator=(), and swap().