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

/** \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
35
36

namespace AMDiS {

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

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

39
40
41
    /// Index of the macro element.
    int elIndex;

42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
    /** \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).
     */
    GeoIndex subObjAtBoundary;

    /** \brief
     * Defines which of vertix, edge or face of the macro element is part of the
     * boundary.
     *
     * Example: If the macro element is a triangle, than \ref subObjAtBoundary 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
     * boundary.
     */
    int ithObjAtBoundary;
  };

  /** \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.
Thomas Witkowski's avatar
Thomas Witkowski committed
66
    BoundaryObject rankObject;
67
68

    /// The object on the other side of the boundary.
Thomas Witkowski's avatar
Thomas Witkowski committed
69
    BoundaryObject neighbourObject;
70
71
72
73
74
75
76
  };

  /** \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
77
78
79
  public:
    typedef std::map<int, std::vector<AtomicBoundary> > RankToBoundMap;

80
  public:
Thomas Witkowski's avatar
Thomas Witkowski committed
81
82
83
84
    InteriorBoundary() {}

    AtomicBoundary& getNewAtomicBoundary(int rank);

85
    /// Writes this object to a file.
86
87
    void serialize(std::ostream &out);

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

Thomas Witkowski's avatar
Thomas Witkowski committed
91
  public:
Thomas Witkowski's avatar
Thomas Witkowski committed
92
    RankToBoundMap boundary;
93
94
95
96
  };
}

#endif // AMDIS_INTERIORBOUNDARY_H