Am Montag, 13. Mai 2022, finden Wartungsarbeiten am Gitlab-Server (Update auf neue Version statt). Der Dienst wird daher am Montag für einige Zeit nicht verfügbar sein.
On Monday, May 13th 2022, the Gitlab server will be updated. The service will therefore not be accessible for some time on Monday.

BoundaryManager.h 4.46 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
// ============================================================================
// ==                                                                        ==
// == AMDiS - Adaptive multidimensional simulations                          ==
// ==                                                                        ==
// ============================================================================
// ==                                                                        ==
// ==  crystal growth group                                                  ==
// ==                                                                        ==
// ==  Stiftung caesar                                                       ==
// ==  Ludwig-Erhard-Allee 2                                                 ==
// ==  53175 Bonn                                                            ==
// ==  germany                                                               ==
// ==                                                                        ==
// ============================================================================
// ==                                                                        ==
// ==  http://www.caesar.de/cg/AMDiS                                         ==
// ==                                                                        ==
// ============================================================================

/** \file BoundaryManager.h */

#ifndef AMDIS_BOUNDARYMANAGER_H
#define AMDIS_BOUNDARYMANAGER_H

#include <map>

#include "Boundary.h"
#include "BoundaryCondition.h"

namespace AMDiS {

  class DOFMatrix;
  class FiniteElemSpace;
34
  template<typename T> class Vector;
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
  template<typename T> class DOFVectorBase;

  // ============================================================================
  // ===== class BoundaryManager ================================================
  // ============================================================================

  /**
   * \ingroup Assembler
   *
   * \brief
   * A BoundaryManager handles a set of boundary conditions and applies
   * this conditions to DOFVectorBase and DOFMatrix objects. Each DOFVectorBase
   * and each DOFMatrix has its own BoundaryManager.
   */
  class BoundaryManager
  {
  public:
    MEMORY_MANAGED(BoundaryManager);

Thomas Witkowski's avatar
Thomas Witkowski committed
54
55
56
57
58
59
    BoundaryManager(const FiniteElemSpace *feSpace);

    BoundaryManager(BoundaryManager &bm);

    ~BoundaryManager();

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
101
    /** \brief
     * Adds a local boundary condition to the list of managed conditions.
     */
    void addBoundaryCondition(BoundaryCondition *localBC) {
      BoundaryType type = localBC->getBoundaryType();
      TEST_EXIT(localBCs[type] == NULL)
	("there is already a condition for this type\n");
      localBCs[type] = localBC;
    };

    void initMatrix(DOFMatrix *matrix);

    void exitMatrix(DOFMatrix *matrix);

    void initVector(DOFVectorBase<double> *vector);

    void exitVector(DOFVectorBase<double> *vector);

    /** \brief
     * Calls DOFVectorBase::fillBoundaryCondition() for each local boundary condition
     * in \ref localBCs.
     */
    void fillBoundaryConditions(ElInfo *elInfo, DOFVectorBase<double> *vec);

    /** \brief
     * Calls DOFMatrix::fillBoundaryCondition() for each local boundary condition
     * in \ref localBCs.
     */
    void fillBoundaryConditions(ElInfo *elInfo, DOFMatrix *mat);

    /** \brief
     * Calls BoundaryCondition::boundResidual() for each boundary condition in 
     * \ref localBCs.
     */
    double boundResidual(ElInfo *elInfo, 
			 DOFMatrix *matrix,
			 const DOFVectorBase<double> *dv);

    inline BoundaryCondition *getBoundaryCondition(BoundaryType type) {
      return localBCs[type];
    };

102
    const std::map<BoundaryType, BoundaryCondition*>& getBoundaryConditionMap() {
103
104
105
      return localBCs;
    };

106
    void setBoundaryConditionMap(const std::map<BoundaryType, BoundaryCondition*>& bcs) {
107
108
109
110
      localBCs = bcs;
    };

  protected:
111
    /// Map of managed local boundary conditions.
112
    std::map<BoundaryType, BoundaryCondition*> localBCs;
Thomas Witkowski's avatar
Thomas Witkowski committed
113

114
    /// Temporary thread-safe variable for functions fillBoundaryconditions.
Thomas Witkowski's avatar
Thomas Witkowski committed
115
116
    std::vector<BoundaryType*> localBounds;

117
118
119
    /// Temporary thread-safe variable for functions fillBoundaryconditions.
    std::vector<Vector<DegreeOfFreedom> > dofIndices;

Thomas Witkowski's avatar
Thomas Witkowski committed
120
121
122
123
124
    /** \brief
     * Stores the number of byte that were allocated in the constructor for
     * each localBounds value. Is used to free the memory in the destructor.
     */
    int allocatedMemoryLocalBounds;
125
126
127
128
129
  };

}

#endif