Line.h 5.33 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 Line.h */

#ifndef AMDIS_LINE_H
#define AMDIS_LINE_H

#include "Element.h"
26
#include "parallel/InteriorBoundary.h"
27
28
29

namespace AMDiS {

30
31
32
33
34
35
36
  /** \ingroup Triangulation 
   * \brief
   * A Line is an 1-dimensional Element.
   *
   * A Line and its refinements:
   *
   * <img src = "line.png">
37
   */
38
39
40
  class Line : public Element
  {
  public:
41
    /// calls base class contructor.
42
43
44
45
    Line(Mesh* aMesh) 
      : Element(aMesh) 
    {}

46
47
48
    /// implements Element::getVertexOfEdge
    inline int getVertexOfEdge(int i, int j) const 
    {
49
50
      return vertexOfEdge[i][j];
    }
51

52
    /// implements Element::getVertexOfPosition
53
    virtual int getVertexOfPosition(GeoIndex position,
54
55
				    int positionIndex,
				    int vertexIndex) const;
56

57
58
    virtual int getPositionOfVertex(int side, int vertex) const 
    {
59
      static int positionOfVertex[2][2] = {{0, -1}, {-1, 0}};
60
61
      return positionOfVertex[side][vertex];
    }
62

63
64
65
66
    /// implements Element::getGeo
    inline int getGeo(GeoIndex i) const 
    {
      switch (i) {
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
      case VERTEX: case PARTS: case NEIGH:
	return 2;
	break;
      case EDGE: case FACE:
	return 0;
	break;
      case CENTER: case DIMEN:
	return 1;
	break;
      case PROJECTION: case BOUNDARY:
	return 2;
	break;
      default:
	ERROR_EXIT("invalid geo-index\n");
	return 0;
      }
    }
84

85
86
    inline int getEdgeOfFace(int /* face */, int /*edge*/ ) const 
    {
87
      ERROR_EXIT("This does not work in 2D!\n");
88
89
90
      return 0;
    }

91
    /// implements Element::sortFaceIndices
92
93
    const FixVec<int,WORLD>& sortFaceIndices(int face, 
					     FixVec<int,WORLD> *vec) const;
94
95
  

96
97
98
    /// implements Element::clone
    inline Element *clone() 
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
99
      return new Line(mesh); 
100
    }
101

102
    /// implements Element::getSideOfChild()
103
    int getSideOfChild(int child, int side, int) const 
104
    {
105
      FUNCNAME("Line::getSideOfChild()");
Thomas Witkowski's avatar
Thomas Witkowski committed
106
107
      TEST_EXIT_DBG(child == 0 || child == 1)("Child must be either 0 or 1!\n");
      TEST_EXIT_DBG(side >= 0 && side <= 1)("Side must be either 0 or 1!\n");
108
109
      return sideOfChild[child][side];
    }
110

111
112
113
114
115
116
    int getSubObjOfChild(int childnr, GeoIndex subObj, int ithObj, int elType) const
    {
      ERROR_EXIT("Not yet implemented!\n");
      return 0;
    }

117
    /// implements Element::getVertexOfParent()
118
    int getVertexOfParent(int child, int side, int) const 
119
    {
120
      FUNCNAME("Line::getVertexOfParent()");
Thomas Witkowski's avatar
Thomas Witkowski committed
121
122
      TEST_EXIT_DBG(child == 0 || child == 1)("Child must be either 0 or 1!\n");
      TEST_EXIT_DBG(side >= 0 && side <= 1)("Side must be between 0 and 2!\n");
123
124
      return vertexOfParent[child][side];
    }
125
126


127
128
129
    /// implements Element::hasSide
    inline bool hasSide(Element* /*sideElem*/) const 
    { 
130
131
132
      ERROR_EXIT("a Line has no side elements!\n");
      return false; 
    }
133

134
    /// Returns true because this element is a Line.
135
136
    inline bool isLine() const 
    { 
137
138
      return true; 
    }
139

140
    /// Returns false because this element is a Line.
141
142
    inline bool isTriangle() const 
    { 
143
144
      return false; 
    }
145

146
    /// Returns false because this element is a Line
147
148
    inline bool isTetrahedron() const 
    { 
149
150
      return false; 
    }
151
152
153
154
155
156

    /// Element type number is not used in 1d, so return 0.
    inline int getChildType(int) const
    {
      return 0;
    }
157
  
158
159
    std::string getTypeName() const 
    { 
160
161
      return "Line"; 
    }
162

163
    void getVertexDofs(FiniteElemSpace*, BoundaryObject, DofContainer&) const
164
165
166
167
168
    {
      FUNCNAME("Line::getVertexDofs()");
      ERROR_EXIT("Not yet implemented!\n");
    }

169
    void getNonVertexDofs(FiniteElemSpace*, BoundaryObject, DofContainer&) const
170
171
172
173
174
    {
      FUNCNAME("Line::getNonVertexDofs()");
      ERROR_EXIT("Not yet implemented!\n");
    }

175
176
177
178
179
180
  protected:
    /** \brief
     * vertexOfEdge[i][j] is the local number of the j-th vertex of the i-th 
     * edge of this element.
     */
    static const int vertexOfEdge[1][2];
181

182
183
184
185
    static const int sideOfChild[2][2];

    static const int vertexOfParent[2][2];
  };
186
187
188
189

}

#endif // AMDIS_LINE_H