CouplingTimeInterface.h 2.85 KB
Newer Older
1
2
3
4
// ============================================================================
// ==                                                                        ==
// == AMDiS - Adaptive multidimensional simulations                          ==
// ==                                                                        ==
5
// ==  http://www.amdis-fem.org                                              ==
6
7
// ==                                                                        ==
// ============================================================================
8
9
10
11
12
13
14
15
16
17
18
19
//
// 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.


20
21
22
23
24
25

/** \file CouplingTimeInterface.h */

#ifndef AMDIS_COUPLINGTIMEINTERFACE_H
#define AMDIS_COUPLINGTIMEINTERFACE_H

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

namespace AMDiS {

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

45
46
47
48
49
    /// 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++)
50
	interfaces_[i]->setTime(adaptInfo);
51
    }
52

53
54
55
56
57
    /// 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++)
58
	interfaces_[i]->initTimestep(adaptInfo);
59
    }
60

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

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

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

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

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

}

#endif