CouplingTimeInterface.h 3.2 KB
 Peter Gottschling committed Feb 15, 2008 1 2 3 4 5 6 ``````// ============================================================================ // == == // == AMDiS - Adaptive multidimensional simulations == // == == // ============================================================================ // == == `````` Thomas Witkowski committed Sep 28, 2009 7 ``````// == TU Dresden == `````` Peter Gottschling committed Feb 15, 2008 8 ``````// == == `````` Thomas Witkowski committed Sep 28, 2009 9 10 11 ``````// == Institut fr Wissenschaftliches Rechnen == // == Zellescher Weg 12-14 == // == 01069 Dresden == `````` Peter Gottschling committed Feb 15, 2008 12 13 14 15 ``````// == germany == // == == // ============================================================================ // == == `````` Thomas Witkowski committed Sep 28, 2009 16 ``````// == https://gforge.zih.tu-dresden.de/projects/amdis/ == `````` Peter Gottschling committed Feb 15, 2008 17 18 19 20 21 22 23 24 ``````// == == // ============================================================================ /** \file CouplingTimeInterface.h */ #ifndef AMDIS_COUPLINGTIMEINTERFACE_H #define AMDIS_COUPLINGTIMEINTERFACE_H `````` Thomas Witkowski committed May 07, 2009 25 ``````#include `````` Peter Gottschling committed Feb 15, 2008 26 27 28 29 30 31 32 33 34 35 36 37 38 ``````#include "Flag.h" #include "ProblemTimeInterface.h" namespace AMDiS { /** * \ingroup Problem * * \brief */ class CouplingTimeInterface : public ProblemTimeInterface { public: `````` Thomas Witkowski committed May 07, 2009 39 40 `````` void addTimeInterface(ProblemTimeInterface *interface) { `````` Peter Gottschling committed Feb 15, 2008 41 `````` interfaces_.push_back(interface); `````` Thomas Witkowski committed May 07, 2009 42 `````` } `````` Peter Gottschling committed Feb 15, 2008 43 `````` `````` Thomas Witkowski committed May 07, 2009 44 45 46 47 48 `````` /// Executes all needed operations when the simulation time changes. virtual void setTime(AdaptInfo *adaptInfo) { int size = static_cast(interfaces_.size()); for (int i = 0; i < size; i++) `````` Peter Gottschling committed Feb 15, 2008 49 `````` interfaces_[i]->setTime(adaptInfo); `````` Thomas Witkowski committed May 07, 2009 50 `````` } `````` Peter Gottschling committed Feb 15, 2008 51 `````` `````` Thomas Witkowski committed May 07, 2009 52 53 54 55 56 `````` /// Called at the beginning of each timestep virtual void initTimestep(AdaptInfo *adaptInfo) { int size = static_cast(interfaces_.size()); for (int i = 0; i < size; i++) `````` Peter Gottschling committed Feb 15, 2008 57 `````` interfaces_[i]->initTimestep(adaptInfo); `````` Thomas Witkowski committed May 07, 2009 58 `````` } `````` Peter Gottschling committed Feb 15, 2008 59 `````` `````` Thomas Witkowski committed May 07, 2009 60 61 62 `````` /// Called at the end of each timestep. virtual void closeTimestep(AdaptInfo *adaptInfo) { `````` Peter Gottschling committed Feb 15, 2008 63 `````` int i, size = static_cast(interfaces_.size()); `````` Thomas Witkowski committed May 07, 2009 64 `````` for (int i = 0; i < size; i++) `````` Peter Gottschling committed Feb 15, 2008 65 `````` interfaces_[i]->closeTimestep(adaptInfo); `````` Thomas Witkowski committed May 07, 2009 66 `````` } `````` Peter Gottschling committed Feb 15, 2008 67 `````` `````` Thomas Witkowski committed May 07, 2009 68 69 70 71 72 `````` /// Solves the initial problem. virtual void solveInitialProblem(AdaptInfo *adaptInfo) { int size = static_cast(interfaces_.size()); for (int i = 0; i < size; i++) `````` Peter Gottschling committed Feb 15, 2008 73 `````` interfaces_[i]->solveInitialProblem(adaptInfo); `````` Thomas Witkowski committed May 07, 2009 74 `````` } `````` Peter Gottschling committed Feb 15, 2008 75 `````` `````` Thomas Witkowski committed May 07, 2009 76 `````` /// Solves the initial problem. `````` Thomas Witkowski committed Jun 10, 2009 77 78 `````` virtual void transferInitialSolution(AdaptInfo *adaptInfo) { `````` Thomas Witkowski committed May 07, 2009 79 80 `````` int size = static_cast(interfaces_.size()); for (int i = 0; i < size; i++) `````` Peter Gottschling committed Feb 15, 2008 81 `````` interfaces_[i]->transferInitialSolution(adaptInfo); `````` Thomas Witkowski committed May 07, 2009 82 `````` } `````` Peter Gottschling committed Feb 15, 2008 83 84 `````` protected: `````` Thomas Witkowski committed May 07, 2009 85 `````` /// vector of coupled time interfaces `````` Thomas Witkowski committed Aug 29, 2008 86 `````` std::vector interfaces_; `````` Peter Gottschling committed Feb 15, 2008 87 88 89 90 91 `````` }; } #endif``````