// ============================================================================ // == == // == AMDiS - Adaptive multidimensional simulations == // == == // ============================================================================ // == == // == crystal growth group == // == == // == Stiftung caesar == // == Ludwig-Erhard-Allee 2 == // == 53175 Bonn == // == germany == // == == // ============================================================================ // == == // == http://www.caesar.de/cg/AMDiS == // == == // ============================================================================ /** \file DOFContainer.h */ #ifndef AMDIS_DOFCONTAINER_H #define AMDIS_DOFCONTAINER_H #include "Global.h" namespace AMDiS { // =========================================================================== // ===== class DOFContainer ================================================== // =========================================================================== /** \ingroup DOFAdministration * \brief * DOFContainer is the base class for objects that stores DOF indices. * After a DOFContainer object is registered to a DOFAdmin, the DOF * indices of the container will be managed during DOF compression. The * DOFAdmin then calls the compress method of every registered DOFContainer. */ class DOFContainer { public: virtual ~DOFContainer() {}; /** \brief * Returns the DOF index at position i. Must be overriden by a concrete * DOFContainer. */ virtual DegreeOfFreedom& operator[](int i) = 0; virtual void freeDOFIndex(DegreeOfFreedom dof) {}; /** \brief * Used by DOFAdmin to actualize the DOF indices in this container after * DOF compression. */ virtual void compressDOFContainer(int size, std::vector<DegreeOfFreedom> &newDOF) { int i, j; for(i=0; i < size; i++) { if((j = newDOF[operator[](i)]) >= 0) { operator[](i) = j; } else { ERROR_EXIT("invalid dof in dof container\n"); } } }; }; } #endif