Skip to content
Snippets Groups Projects
Commit fed1a0df authored by Praetorius, Simon's avatar Praetorius, Simon
Browse files

const iterator for DOFVectors added

parent f950582e
Branches
Tags
No related merge requests found
......@@ -415,91 +415,5 @@ namespace Helpers {
} // end namespace Helpers
namespace AMDiS {
/** \ingroup DOFAdministration
* \brief
* Implements a DOFIterator for a DOFIndexed<T> object
*/
template<typename T>
class DOFConstIterator : public DOFIteratorBase
{
public:
/// Constructs a DOFIterator for cont of type t
DOFConstIterator(const DOFIndexed<T> *obj, DOFIteratorType t)
: DOFIteratorBase(dynamic_cast<DOFAdmin*>(obj->getFeSpace()->getAdmin()), t),
iteratedObject(obj)
{}
/// Constructs a DOFIterator for cont of type t
DOFConstIterator(DOFAdmin *admin,
const DOFIndexed<T> *obj,
DOFIteratorType t)
: DOFIteratorBase(admin, t),
iteratedObject(obj)
{}
/// Dereference operator
inline const T& operator*()
{
return *it;
}
/// Dereference operator
inline const T* operator->()
{
return &(*it);
}
inline bool operator!=(const DOFIterator<T>& rhs)
{
if (this->iteratedObject != rhs.iteratedObject)
return true;
if (this->it != rhs.it)
return true;
return false;
}
inline bool operator==(const DOFIterator<T>& rhs)
{
return !(this->operator==(rhs));
}
protected:
/// Implementation of DOFIteratorBase::goToBeginOfIteratedObject()
inline void goToBeginOfIteratedObject()
{
it = iteratedObject->begin();
}
/// Implementation of DOFIteratorBase::goToEndOfIteratedObject()
inline void goToEndOfIteratedObject()
{
it = iteratedObject->end();
}
/// Implementation of DOFIteratorBase::incObjectIterator()
inline void incObjectIterator()
{
++it;
}
/// Implementation of DOFIteratorBase::incObjectIterator()
inline void decObjectIterator()
{
--it;
}
protected:
/// Object that is iterated
const DOFIndexed<T> *iteratedObject;
/// Iterator for \ref iteratedObject
typename std::vector<T>::const_iterator it;
};
} // end namespace AMDiS
#endif // EXTENSIONS_HELPERS_H
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment