CouplingTimeInterface.h 2.75 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/******************************************************************************
 *
 * AMDiS - Adaptive multidimensional simulations
 *
 * Copyright (C) 2013 Dresden University of Technology. All Rights Reserved.
 * Web: https://fusionforge.zih.tu-dresden.de/projects/amdis
 *
 * Authors: 
 * Simon Vey, Thomas Witkowski, Andreas Naumann, Simon Praetorius, et al.
 *
 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 *
 *
 * This file is part of AMDiS
 *
 * See also license.opensource.txt in the distribution.
 * 
 ******************************************************************************/
20
21


22
23
24
25
26
27

/** \file CouplingTimeInterface.h */

#ifndef AMDIS_COUPLINGTIMEINTERFACE_H
#define AMDIS_COUPLINGTIMEINTERFACE_H

28
#include <vector>
29
30
31
32
33
34
35
36
37
38
#include "Flag.h"
#include "ProblemTimeInterface.h"

namespace AMDiS {

  /**
   * \ingroup Problem 
   *
   * \brief
   */
39
  class CouplingTimeInterface : public virtual ProblemTimeInterface
40
41
  {
  public:
42
43
    void addTimeInterface(ProblemTimeInterface *interface) 
    {
44
      interfaces_.push_back(interface);
45
    }
46

47
48
49
50
51
    /// Executes all needed operations when the simulation time changes.
    virtual void setTime(AdaptInfo *adaptInfo) 
    {
      int size = static_cast<int>(interfaces_.size());
      for (int i = 0; i < size; i++)
52
	interfaces_[i]->setTime(adaptInfo);
53
    }
54

55
56
57
58
59
    /// Called at the beginning of each timestep
    virtual void initTimestep(AdaptInfo *adaptInfo) 
    {
      int size = static_cast<int>(interfaces_.size());
      for (int i = 0; i < size; i++)
60
	interfaces_[i]->initTimestep(adaptInfo);
61
    }
62

63
64
65
    /// Called at the end of each timestep.
    virtual void closeTimestep(AdaptInfo *adaptInfo) 
    {
66
      int size = static_cast<int>(interfaces_.size());
67
      for (int i = 0; i < size; i++)
68
	interfaces_[i]->closeTimestep(adaptInfo);
69
    }
70

71
72
73
74
75
    /// Solves the initial problem.
    virtual void solveInitialProblem(AdaptInfo *adaptInfo) 
    {
      int size = static_cast<int>(interfaces_.size());
      for (int i = 0; i < size; i++)
76
	interfaces_[i]->solveInitialProblem(adaptInfo);
77
    }
78

79
    /// Solves the initial problem.
Thomas Witkowski's avatar
Thomas Witkowski committed
80
81
    virtual void transferInitialSolution(AdaptInfo *adaptInfo) 
    {
82
83
      int size = static_cast<int>(interfaces_.size());
      for (int i = 0; i < size; i++)
84
	interfaces_[i]->transferInitialSolution(adaptInfo);
85
    }
86

87
88
89
90
91
92
    /// 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) {};

93
  protected:
94
    /// vector of coupled time interfaces
95
    std::vector<ProblemTimeInterface*> interfaces_;
96
97
98
99
100
  };

}

#endif