InteriorBoundary.h 3.6 KB
Newer Older
1
2
3
4
5
6
// ============================================================================
// ==                                                                        ==
// == AMDiS - Adaptive multidimensional simulations                          ==
// ==                                                                        ==
// ============================================================================
// ==                                                                        ==
7
// ==  TU Dresden                                                            ==
8
// ==                                                                        ==
9
10
11
// ==  Institut für Wissenschaftliches Rechnen                               ==
// ==  Zellescher Weg 12-14                                                  ==
// ==  01069 Dresden                                                         ==
12
13
14
15
// ==  germany                                                               ==
// ==                                                                        ==
// ============================================================================
// ==                                                                        ==
16
// ==  https://gforge.zih.tu-dresden.de/projects/amdis/                      ==
17
18
19
20
21
22
23
24
25
// ==                                                                        ==
// ============================================================================

/** \file InteriorBoundary.h */

#ifndef AMDIS_INTERIORBOUNDARY_H
#define AMDIS_INTERIORBOUNDARY_H

#include <vector>
Thomas Witkowski's avatar
Thomas Witkowski committed
26
#include <map>
27
28

#include "MacroElement.h"
29
#include "AMDiS_fwd.h"
30
31
32
33
34

namespace AMDiS {

  /// Defines the geometrical objects that forms the boundary;
  struct BoundaryObject {
35
36
37
    BoundaryObject()
      : reverseMode(false)
    {}
38
39

    /// The macro element to which the boundary element corresponds to.
Thomas Witkowski's avatar
Thomas Witkowski committed
40
    Element* el;
41

42
43
44
    /// Index of the macro element.
    int elIndex;

45
46
47
    /// Element type index, only used in 3d.
    int elType;

48
49
50
51
    /** \brief
     * Defines the geometrical object at the boundary. It must be "a part" of the
     * macro element \ref el, i.e., either 1 (a vertex), 2 (an edge) or 3 (a face).
     */
52
    GeoIndex subObj;
53
54
55
56
57

    /** \brief
     * Defines which of vertix, edge or face of the macro element is part of the
     * boundary.
     *
58
59
60
     * Example: If the macro element is a triangle, than \ref subObj may be either
     * 1 (vertex) or 2 (edge). Assume its the last one. So this variable defines
     * which of the three possible edges of the triangle is at the interior
61
62
     * boundary.
     */
63
    int ithObj;
64
65
66
67

    bool reverseMode;

    void setReverseMode(BoundaryObject &otherBound, FiniteElemSpace *feSpace);
68
69
70
71
72
73
74
75
  };

  /** \brief 
   * Defines one atomic part of the boundary, i.e., two boundary objects where the
   * boundary goes through.
   */
  struct AtomicBoundary {
    /// The rank's part of the boundary.
76
    BoundaryObject rankObj;
77
78

    /// The object on the other side of the boundary.
79
    BoundaryObject neighObj;
80
81
82
83
84
85
86
  };

  /** \brief
   * Defines the interior boundary, i.e. a bound within the domain. It is used for
   * the classical domain decomposition parallelization.
   */
  class InteriorBoundary {
Thomas Witkowski's avatar
Thomas Witkowski committed
87
88
89
  public:
    typedef std::map<int, std::vector<AtomicBoundary> > RankToBoundMap;

90
  public:
Thomas Witkowski's avatar
Thomas Witkowski committed
91
92
    InteriorBoundary() {}

93
    AtomicBoundary& getNewAtomic(int rank);
Thomas Witkowski's avatar
Thomas Witkowski committed
94

95
    /// Writes this object to a file.
96
97
    void serialize(std::ostream &out);

98
99
    /// Reads the state of an interior boundary from a file.
    void deserialize(std::istream &in, std::map<int, Element*> &elIndexMap);
100

Thomas Witkowski's avatar
Thomas Witkowski committed
101
  public:
Thomas Witkowski's avatar
Thomas Witkowski committed
102
    RankToBoundMap boundary;
103
104
105
106
  };
}

#endif // AMDIS_INTERIORBOUNDARY_H