CouplingIterationInterface.h 3.6 KB
 Praetorius, Simon committed Aug 12, 2011 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 // ============================================================================ // == == // == AMDiS - Adaptive multidimensional simulations == // == == // == http://www.amdis-fem.org == // == == // ============================================================================ // // Software License for AMDiS // // Copyright (c) 2010 Dresden University of Technology // All rights reserved. // Authors: Simon Vey, Thomas Witkowski et al. // // This file is part of AMDiS // // See also license.opensource.txt in the distribution. /** \file CouplingIterationInterface.h */ #ifndef AMDIS_COUPLINGITERATIONINTERFACE_H #define AMDIS_COUPLINGITERATIONINTERFACE_H #include "Flag.h" #include "AdaptInfo.h" #include "ProblemIterationInterface.h" namespace AMDiS { /** \brief * Interface for master problems needed by the adaption loop. A master problem * can handle one single or multiple coupled problems. In the latter case, * the master problem can determine the execution order of the build, solve, * estimate, and adapt steps of the single problems in \ref oneIteration(). * Standard execution order depends on the ordering of the problems in the * problem-list, that is filled by addProblem. Alternatively one can a access * each problem by an unique name. */ class CouplingIterationInterface : public ProblemIterationInterface { public: virtual ~CouplingIterationInterface() {} /// add problem by number virtual void addIterationInterface(ProblemIterationInterface* probIter, int number = -1); /// Called before each adaption loop iteration. virtual void beginIteration(AdaptInfo *adaptInfo); /** \brief * Determines the execution order of the single adaption steps. If adapt is * true, mesh adaption will be performed. This allows to avoid mesh adaption, * e.g. in timestep adaption loops of timestep adaptive strategies. */ virtual Flag oneIteration(AdaptInfo *adaptInfo, Flag toDo = FULL_ITERATION); /// Called after each adaption loop iteration. virtual void endIteration(AdaptInfo *adaptInfo); virtual int getNumProblems();  Praetorius, Simon committed Sep 01, 2011 64 65 66  /// Returns number of managed problems virtual size_t getNumIterationInterfaces() { return problems.size(); }  Praetorius, Simon committed Aug 12, 2011 67 68 69 70 71 72  /** \brief * Returns the problem with the given number. If only one problem * is managed by this master problem, the number hasn't to be given. */ virtual ProblemStatBase *getProblem(int number = 0);  Praetorius, Simon committed Sep 01, 2011 73 74  virtual ProblemIterationInterface *getIterationInterface(size_t number = 0) { return problems[number]; }  Praetorius, Simon committed Aug 12, 2011 75  /// Returns the name of the problem with the given number.  Praetorius, Simon committed Sep 01, 2011 76  virtual std::string getName(size_t number);  Praetorius, Simon committed Aug 12, 2011 77 78  virtual std::string getName() { return getName(0); }  Praetorius, Simon committed Sep 01, 2011 79 80 81  virtual void setSolveProblem(size_t number, bool flag = true) { solveProblem[number] = flag; } virtual void setSolveProblem(std::string name, bool flag = true);  Praetorius, Simon committed Aug 12, 2011 82 83 84 85 86 87 88 89 90 91  /// Function that serializes the problem plus information about the iteration. virtual void serialize(std::ostream &out) {}; /// Function that deserializes the problem plus information about the iteration. virtual void deserialize(std::istream &in) {}; protected: /// vector/map of coupled stationary problems std::vector problems;  Praetorius, Simon committed Sep 01, 2011 92  std::vector solveProblem;  Praetorius, Simon committed Aug 12, 2011 93 94 95 96 97 98  }; } #endif // AMDIS_COUPLINGITERATIONINTERFACE_H