InteriorBoundary.h 4.01 KB
Newer Older
1
2
3
4
5
6
// ============================================================================
// ==                                                                        ==
// == AMDiS - Adaptive multidimensional simulations                          ==
// ==                                                                        ==
// ============================================================================
// ==                                                                        ==
7
// ==  TU Dresden                                                            ==
8
// ==                                                                        ==
9
10
11
// ==  Institut fr 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 "AMDiS_fwd.h"
29
30
#include "MacroElement.h"
#include "Element.h"
31
32
33
34
35

namespace AMDiS {

  /// Defines the geometrical objects that forms the boundary;
  struct BoundaryObject {
36

37
    BoundaryObject()
38
39
40
41
42
43
44
45
46
47
48
49
      : reverseMode(false),
	notIncludedSubStructures(0)
    {}

    BoundaryObject(Element *e, int eType, GeoIndex sObj, int iObj)
      : el(e),
	elIndex(e->getIndex()),
	elType(eType),
	subObj(sObj),
	ithObj(iObj),
	reverseMode(false),
	notIncludedSubStructures(0)
50
    {}
51

52
53
54
55
56
57
    void setReverseMode(BoundaryObject &otherBound, FiniteElemSpace *feSpace);

    bool operator==(const BoundaryObject& other) const;
    
    bool operator!=(const BoundaryObject& other) const;

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

61
62
63
    /// Index of the macro element.
    int elIndex;

64
65
66
    /// Element type index, only used in 3d.
    int elType;

67
68
69
70
    /** \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).
     */
71
    GeoIndex subObj;
72
73
74
75
76

    /** \brief
     * Defines which of vertix, edge or face of the macro element is part of the
     * boundary.
     *
77
78
79
     * 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
80
81
     * boundary.
     */
82
    int ithObj;
83
84
85

    bool reverseMode;

86
    std::vector<int> notIncludedSubStructures;
87
88
89
90
91
92
93
94
  };

  /** \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.
95
    BoundaryObject rankObj;
96
97

    /// The object on the other side of the boundary.
98
    BoundaryObject neighObj;
99
100
101
102
103
104
105
  };

  /** \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
106
107
108
  public:
    typedef std::map<int, std::vector<AtomicBoundary> > RankToBoundMap;

109
  public:
Thomas Witkowski's avatar
Thomas Witkowski committed
110
111
    InteriorBoundary() {}

112
    AtomicBoundary& getNewAtomic(int rank);
Thomas Witkowski's avatar
Thomas Witkowski committed
113

114
    /// Writes this object to a file.
115
116
    void serialize(std::ostream &out);

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

Thomas Witkowski's avatar
Thomas Witkowski committed
120
  public:
Thomas Witkowski's avatar
Thomas Witkowski committed
121
    RankToBoundMap boundary;
122
123
124
125
  };
}

#endif // AMDIS_INTERIORBOUNDARY_H