// ============================================================================ // == == // == AMDiS - Adaptive multidimensional simulations == // == == // ============================================================================ // == == // == crystal growth group == // == == // == Stiftung caesar == // == Ludwig-Erhard-Allee 2 == // == 53175 Bonn == // == germany == // == == // ============================================================================ // == == // == http://www.caesar.de/cg/AMDiS == // == == // ============================================================================ /** \file ProblemInstat.h */ #ifndef AMDIS_PROBLEM_INSTAT_H_ #define AMDIS_PROBLEM_INSTAT_H_ #include "ProblemScal.h" #include "ProblemVec.h" #include "MemoryManager.h" #include "ProblemTimeInterface.h" #include "AdaptInstationary.h" namespace AMDiS { // =========================================================================== // ===== class ProblemInstat ================================================= // =========================================================================== /** * \ingroup Problem * * \brief * Base class for ProblemInstatScal and ProblemInstatVec. */ class ProblemInstat : public ProblemTimeInterface, public ProblemStatBase { public: /** \brief * Constructor. */ ProblemInstat(::std::string name_, ProblemStatBase *initialProb) : name(name_), initialProblem(initialProb ? initialProb : this) {}; /** \brief * Destructor. */ virtual ~ProblemInstat(); /** \brief * Initialisation of the problem. */ virtual void initialize(Flag initFlag, ProblemInstat *adoptProblem = NULL, Flag adoptFlag = INIT_NOTHING); /** \brief */ virtual void solve(AdaptInfo *adaptInfo) {}; /** \brief */ virtual void estimate(AdaptInfo *adaptInfo) {}; /** \brief */ virtual void buildBeforeRefine(AdaptInfo *adaptInfo, Flag) {}; /** \brief */ virtual void buildBeforeCoarsen(AdaptInfo *adaptInfo, Flag) {}; /** \brief */ virtual void buildAfterCoarsen(AdaptInfo *adaptInfo, Flag) {}; /** \brief */ virtual Flag markElements(AdaptInfo *adaptInfo) { return 0; }; /** \brief */ virtual Flag refineMesh(AdaptInfo *adaptInfo) { return 0; }; /** \brief */ virtual Flag coarsenMesh(AdaptInfo *adaptInfo) { return 0; }; /** \brief * Implementation of ProblemTimeInterface::closeTimestep(). */ virtual void closeTimestep() {}; /** \brief * Returns \ref name. */ inline const ::std::string& getName() { return name; }; /** \brief * Used by \ref problemInitial */ virtual void solveInitialProblem(AdaptInfo *adaptInfo); protected: /** \brief * Name of the problem. */ ::std::string name; ProblemStatBase *initialProblem; }; // =========================================================================== // ===== class ProblemInstatScal ============================================= // =========================================================================== /** * \ingroup Problem * * \brief * Standard implementation of ProblemTimeInterface for a time dependent problems. */ class ProblemInstatScal : public ProblemInstat { public: MEMORY_MANAGED(ProblemInstatScal); /** \brief * Constructs a ProblemInstatScal with prob as its stationary problem. */ ProblemInstatScal(char* name_, ProblemScal *prob, ProblemStatBase *initialProb = NULL); /** \brief * Destructor. */ virtual ~ProblemInstatScal(); /** \brief * Initialisation of the problem. */ virtual void initialize(Flag initFlag, ProblemInstat *adoptProblem = NULL, Flag adoptFlag = INIT_NOTHING); /** \brief * Used in \ref initialize(). */ virtual void createUhOld(); /** \brief * Implementation of ProblemTimeInterface::initTimestep(). */ virtual void initTimestep(AdaptInfo *adaptInfo); /** \brief * Implementation of ProblemTimeInterface::closeTimestep(). */ virtual void closeTimestep(AdaptInfo *adaptInfo); /** \brief * Returns \ref problemStat. */ inline ProblemScal* getStatProblem() { return problemStat; }; /** \brief * Returns \ref oldSolution. */ inline DOFVector *getOldSolution() { return oldSolution; }; /** \brief * Used by \ref problemInitial */ virtual void transferInitialSolution(AdaptInfo *adaptInfo); virtual void serialize(::std::ostream &out) {}; virtual void deserialize(::std::istream &in) {}; protected: /** \brief * Space problem solved in each timestep. */ ProblemScal* problemStat; /** \brief * Solution of the last timestep. */ DOFVector* oldSolution; }; // =========================================================================== // ===== class ProblemInstatVec ============================================== // =========================================================================== /** * \ingroup Problem * * \brief * Standard implementation of ProblemTimeInterface for a time dependent * vector valued problems. */ class ProblemInstatVec : public ProblemInstat { public: MEMORY_MANAGED(ProblemInstatVec); /** \brief * Constructs a ProblemInstatVec with prob as its stationary problem. */ ProblemInstatVec(char *name_, ProblemVec *prob, ProblemStatBase *initialProb = NULL); /** \brief * Destructor. */ virtual ~ProblemInstatVec(); /** \brief * Initialisation of the problem. */ virtual void initialize(Flag initFlag, ProblemInstat *adoptProblem = NULL, Flag adoptFlag = INIT_NOTHING); /** \brief * Used in \ref initialize(). */ virtual void createUhOld(); /** \brief * Implementation of ProblemTimeInterface::initTimestep(). */ virtual void initTimestep(AdaptInfo *adaptInfo); /** \brief * Implementation of ProblemTimeInterface::closeTimestep(). */ virtual void closeTimestep(AdaptInfo *adaptInfo); /** \brief * Returns \ref problemStat. */ inline ProblemVec* getStatProblem() { return problemStat; }; /** \brief * Returns \ref oldSolution. */ inline SystemVector *getOldSolution() { return oldSolution; }; /** \brief * Used by \ref problemInitial */ virtual void transferInitialSolution(AdaptInfo *adaptInfo); virtual void serialize(::std::ostream &out) {}; virtual void deserialize(::std::istream &in) {}; protected: /** \brief * Space problem solved in each timestep. */ ProblemVec* problemStat; /** \brief * Solution of the last timestep. */ SystemVector *oldSolution; }; } #endif