// ============================================================================ // == == // == AMDiS - Adaptive multidimensional simulations == // == == // ============================================================================ // == == // == TU Dresden == // == == // == Institut für Wissenschaftliches Rechnen == // == Zellescher Weg 12-14 == // == 01069 Dresden == // == germany == // == == // ============================================================================ // == == // == https://gforge.zih.tu-dresden.de/projects/amdis/ == // == == // ============================================================================ /** \file ProblemInstat.h */ #ifndef AMDIS_PROBLEM_INSTAT_H_ #define AMDIS_PROBLEM_INSTAT_H_ #include "ProblemScal.h" #include "ProblemVec.h" #include "ProblemTimeInterface.h" #include "AdaptInstationary.h" namespace AMDiS { /** * \ingroup Problem * * \brief * Base class for ProblemInstatScal and ProblemInstatVec. */ class ProblemInstat : public ProblemTimeInterface, public ProblemStatBase { public: /// Constructor. ProblemInstat(std::string probName, ProblemStatBase *initialProb) : name(probName), initialProblem(initialProb ? initialProb : this) {} /// Destructor. virtual ~ProblemInstat(); /// Initialisation of the problem. virtual void initialize(Flag initFlag, ProblemInstat *adoptProblem = NULL, Flag adoptFlag = INIT_NOTHING); virtual void solve(AdaptInfo* adaptInfo) {} virtual void solve(AdaptInfo *adaptInfo, bool fixedMatrix) { solve(adaptInfo); } virtual void estimate(AdaptInfo *adaptInfo) {} virtual void buildBeforeRefine(AdaptInfo *adaptInfo, Flag) {} virtual void buildBeforeCoarsen(AdaptInfo *adaptInfo, Flag) {} virtual void buildAfterCoarsen(AdaptInfo *adaptInfo, Flag, bool, bool) {} virtual Flag markElements(AdaptInfo *adaptInfo) { return 0; } virtual Flag refineMesh(AdaptInfo *adaptInfo) { return 0; } virtual Flag coarsenMesh(AdaptInfo *adaptInfo) { return 0; } /// Implementation of ProblemTimeInterface::closeTimestep(). virtual void closeTimestep() {} /// Returns \ref name. inline std::string getName() { return name; } /// Used by \ref problemInitial virtual void solveInitialProblem(AdaptInfo *adaptInfo); protected: /// Name of the problem. std::string name; ProblemStatBase *initialProblem; }; /** * \ingroup Problem * * \brief * Standard implementation of ProblemTimeInterface for a time dependent problems. */ class ProblemInstatScal : public ProblemInstat { public: /// Constructs a ProblemInstatScal with prob as its stationary problem. ProblemInstatScal(std::string name, ProblemScal *prob, ProblemStatBase *initialProb = NULL); /// Destructor. virtual ~ProblemInstatScal(); /// Initialisation of the problem. virtual void initialize(Flag initFlag, ProblemInstat *adoptProblem = NULL, Flag adoptFlag = INIT_NOTHING); /// Used in \ref initialize(). virtual void createUhOld(); /// Implementation of ProblemTimeInterface::initTimestep(). virtual void initTimestep(AdaptInfo *adaptInfo); /// Implementation of ProblemTimeInterface::closeTimestep(). virtual void closeTimestep(AdaptInfo *adaptInfo); /// Returns \ref problemStat. inline ProblemScal* getStatProblem() { return problemStat; } /// Returns \ref oldSolution. inline DOFVector *getOldSolution() { return oldSolution; } /// Used by \ref problemInitial virtual void transferInitialSolution(AdaptInfo *adaptInfo); virtual void serialize(std::ostream &out) {} virtual void deserialize(std::istream &in) {} protected: /// Space problem solved in each timestep. ProblemScal* problemStat; /// Solution of the last timestep. DOFVector* oldSolution; }; /** * \ingroup Problem * * \brief * Standard implementation of ProblemTimeInterface for a time dependent * vector valued problems. */ class ProblemInstatVec : public ProblemInstat { public: /// Constructs a ProblemInstatVec with prob as its stationary problem. ProblemInstatVec(std::string name, ProblemVec *prob, ProblemStatBase *initialProb = NULL); /// Destructor. virtual ~ProblemInstatVec(); /// Initialisation of the problem. virtual void initialize(Flag initFlag, ProblemInstat *adoptProblem = NULL, Flag adoptFlag = INIT_NOTHING); /// Used in \ref initialize(). virtual void createUhOld(); /// Implementation of ProblemTimeInterface::initTimestep(). virtual void initTimestep(AdaptInfo *adaptInfo); /// Implementation of ProblemTimeInterface::closeTimestep(). virtual void closeTimestep(AdaptInfo *adaptInfo); /// Returns \ref problemStat. inline ProblemVec* getStatProblem() { return problemStat; } /// Returns \ref oldSolution. inline SystemVector *getOldSolution() { return oldSolution; } /// Used by \ref problemInitial virtual void transferInitialSolution(AdaptInfo *adaptInfo); virtual void serialize(std::ostream &out) {} virtual void deserialize(std::istream &in) {} protected: /// Space problem solved in each timestep. ProblemVec* problemStat; /// Solution of the last timestep. SystemVector *oldSolution; }; } #endif