-
Thomas Witkowski authoredThomas Witkowski authored
DOFIndexed.h 4.47 KiB
// ============================================================================
// == ==
// == AMDiS - Adaptive multidimensional simulations ==
// == ==
// ============================================================================
// == ==
// == crystal growth group ==
// == ==
// == Stiftung caesar ==
// == Ludwig-Erhard-Allee 2 ==
// == 53175 Bonn ==
// == germany ==
// == ==
// ============================================================================
// == ==
// == http://www.caesar.de/cg/AMDiS ==
// == ==
// ============================================================================
/** \file DOFIndexed.h */
#ifndef AMDIS_DOFINDEXED_H
#define AMDIS_DOFINDEXED_H
#include <vector>
#include "Global.h"
#include "DOFIterator.h"
namespace AMDiS {
class RCNeighbourList;
class FiniteElemSpace;
class DOFMatrix;
class ElInfo;
class Quadrature;
class FastQuadrature;
// ============================================================================
// ===== class DOFIndexedBase =================================================
// ============================================================================
/** \ingroup DOFAdministration
* \brief
* Interface for objects that stores information indexed by DOF indices
* (like DOFVector or DOFMatrix). This interface is template type independent,
* so a DOFAdmin can handle a single list of DOFIndexedBase objects.
*/
class DOFIndexedBase
{
public:
virtual ~DOFIndexedBase() {}
/// Returns the actual size. Must be overriden by sub classes
virtual int getSize() const = 0;
/// Resizes the object to size. Must be overriden by sub classes
virtual void resize(int size) = 0;
/// Used by DOFAdmin::compress. Must be overriden by sub classes
virtual void compressDOFIndexed(int first, int last,
std::vector<DegreeOfFreedom> &newDOF) = 0;
/** \brief
* Performs needed action when a DOF index is freed. Can be overriden in
* sub classes. The default behavior is to do nothing.
*/
virtual void freeDOFContent(int) {}
/** \brief
* Interpolation after refinement. Can be overriden in subclasses.
* The default behavior is to do nothing.
*/
virtual void refineInterpol(RCNeighbourList&, int) {}
/** \brief
* Restriction after coarsening. Can be overriden in subclasses.
* The default behavior is to do nothing.
*/
virtual void coarseRestrict(RCNeighbourList&, int) {}
/** \brief
* Returns the finite element space of this DOFIndexed object. Must be
* overriden in sub classes.
*/
virtual const FiniteElemSpace* getFESpace() const = 0;
};
// ============================================================================
// ===== class DOFIndexed =====================================================
// ============================================================================
/** \ingroup DOFAdministration
* \brief
* Templated interface for DOFIndexed objects.
*/
template<typename T>
class DOFIndexed : public DOFIndexedBase
{
public:
virtual ~DOFIndexed() {}
/// Returns iterator to the begin of container
virtual typename std::vector<T>::iterator begin() = 0;
/// Returns iterator to the end of container
virtual typename std::vector<T>::iterator end() = 0;
/// Returns container element at index i
virtual T& operator[](DegreeOfFreedom i) = 0;
/// Returns container element at index i
virtual const T& operator[](DegreeOfFreedom i) const = 0;
};
void mv(MatrixTranspose transpose,
const DOFMatrix &a,
DOFIndexed<double> &x,
DOFIndexed<double> &result,
bool add = false);
}
#endif // AMDIS_DOFINDEXED_H