CouplingTimeInterface.h 3.59 KB
Newer Older
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
// ============================================================================
// ==                                                                        ==
// == AMDiS - Adaptive multidimensional simulations                          ==
// ==                                                                        ==
// ============================================================================
// ==                                                                        ==
// ==  crystal growth group                                                  ==
// ==                                                                        ==
// ==  Stiftung caesar                                                       ==
// ==  Ludwig-Erhard-Allee 2                                                 ==
// ==  53175 Bonn                                                            ==
// ==  germany                                                               ==
// ==                                                                        ==
// ============================================================================
// ==                                                                        ==
// ==  http://www.caesar.de/cg/AMDiS                                         ==
// ==                                                                        ==
// ============================================================================

/** \file CouplingTimeInterface.h */

#ifndef AMDIS_COUPLINGTIMEINTERFACE_H
#define AMDIS_COUPLINGTIMEINTERFACE_H

#include "Flag.h"
#include "ProblemTimeInterface.h"
#include <vector>

namespace AMDiS {

  // ============================================================================
  // ===== class CouplingTimeInterface ==========================================
  // ============================================================================

  /**
   * \ingroup Problem 
   *
   * \brief
   */
  class CouplingTimeInterface : public ProblemTimeInterface
  {
  public:
    void addTimeInterface(ProblemTimeInterface *interface) {
      interfaces_.push_back(interface);
    };

    /** \brief
     * Executes all needed operations when the simulation time changes.
     */
    virtual void setTime(AdaptInfo *adaptInfo) {
      int i, size = static_cast<int>(interfaces_.size());
      for(i = 0; i < size; i++) {
	interfaces_[i]->setTime(adaptInfo);
      }
    };

    /** \brief
     * Called at the beginning of each timestep
     */
    virtual void initTimestep(AdaptInfo *adaptInfo) {
      int i, size = static_cast<int>(interfaces_.size());
      for(i = 0; i < size; i++) {
	interfaces_[i]->initTimestep(adaptInfo);
      }
    };

    /** \brief
     * Called at the end of each timestep.
     */
    virtual void closeTimestep(AdaptInfo *adaptInfo) {
      int i, size = static_cast<int>(interfaces_.size());
      for(i = 0; i < size; i++) {
	interfaces_[i]->closeTimestep(adaptInfo);
      }
    };

    /** \brief
     * Solves the initial problem.
     */
    virtual void solveInitialProblem(AdaptInfo *adaptInfo) {
      int i, size = static_cast<int>(interfaces_.size());
      for(i = 0; i < size; i++) {
	interfaces_[i]->solveInitialProblem(adaptInfo);
      }
    };  

    /** \brief
     * Solves the initial problem.
     */
    virtual void transferInitialSolution(AdaptInfo *adaptInfo) {
      int i, size = static_cast<int>(interfaces_.size());
      for(i = 0; i < size; i++) {
	interfaces_[i]->transferInitialSolution(adaptInfo);
      }
    };  

  protected:
    /** \brief
     * vector of coupled time interfaces
     */
101
    std::vector<ProblemTimeInterface*> interfaces_;
102
103
104
105
106
  };

}

#endif