BoundaryObject.h 3.68 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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
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
102
103
104
105
106
// ============================================================================
// ==                                                                        ==
// == AMDiS - Adaptive multidimensional simulations                          ==
// ==                                                                        ==
// ==  http://www.amdis-fem.org                                              ==
// ==                                                                        ==
// ============================================================================
//
// 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.



/** \file BoundaryObject.h */

#ifndef AMDIS_BOUNDARY_OBJECT_H
#define AMDIS_BOUNDARY_OBJECT_H

#include <vector>

#include "MacroElement.h"
#include "Element.h"
#include "Boundary.h"

namespace AMDiS {

  using namespace std;

  typedef vector<pair<GeoIndex, int> > ExcludeList;

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

    BoundaryObject();

    BoundaryObject(Element *e, 
		   int eType, 
		   GeoIndex sObj, 
		   int iObj, 
		   bool rMode = false);

    static bool computeReverseMode(BoundaryObject &obj0,
				   BoundaryObject &obj1,
				   const FiniteElemSpace *feSpace,
				   BoundaryType boundary);

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

    /// The macro element to which the boundary element corresponds to.
    Element* el;

    /// Index of the macro element.
    int elIndex;

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

    /** \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 subObj;

    /** \brief
     * Defines which of vertex, edge or face of the macro element is part of the
     * boundary.
     *
     * 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
     * boundary.
     */
    int ithObj;

    bool reverseMode;

    /** \brief
     * In many situations it may be necessary to exclude some parts of the 
     * element to be part of the boundary. In 3d, when a face is part of the 
     * boundary, an edge or an vertex may be exludeded. In 2d only vertices may
     * be exluded to be part of an edge boundary. This list contains pairs of 
     * exludeded structures. The first component of every pair denotes if it is
     * a vertex or an edge, and the second component denotes the local index of
     * the structure.
     */
    ExcludeList excludedSubstructures;
  };



  /** \brief 
   * Defines one atomic part of the boundary, i.e., two boundary objects where
   * the boundary goes through.
   */
  struct AtomicBoundary {
    AtomicBoundary()
107
108
    : type(INTERIOR),
      maxLevel(0)
109
110
111
112
    {}

    bool operator==(const AtomicBoundary& other) const;

113
114
    bool operator!=(const AtomicBoundary& other) const;

115
116
117
118
119
120
121
122
123
124
    /// The rank's part of the boundary.
    BoundaryObject rankObj;

    /// The object on the other side of the boundary.
    BoundaryObject neighObj;

    /// Integer flag that is used to distinguish between different types of 
    /// boundaries. Till now it is used only for periodic boundaries, which are
    /// also handles as interior boundaries.
    BoundaryType type;
125
126

    int maxLevel;
127
128
129
130
131
132
  };


}

#endif