Line.h 5.27 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
26
27
28
// ==                                                                        ==
// ============================================================================

/** \file Line.h */

#ifndef AMDIS_LINE_H
#define AMDIS_LINE_H

#include "Element.h"

namespace AMDiS {

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

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

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

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

62
63
64
65
    /// implements Element::getGeo
    inline int getGeo(GeoIndex i) const 
    {
      switch (i) {
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
      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;
      }
    }
83

84
85
    inline int getEdgeOfFace(int /* face */, int /*edge*/ ) const 
    {
86
      ERROR_EXIT("called for a line\n");
87
88
89
      return 0;
    }

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

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

101
    /// implements Element::getSideOfChild()
Thomas Witkowski's avatar
Thomas Witkowski committed
102
    virtual int getSideOfChild(int child, int side, int) const 
103
    {
104
      FUNCNAME("Line::getSideOfChild()");
Thomas Witkowski's avatar
Thomas Witkowski committed
105
106
      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");
107
108
      return sideOfChild[child][side];
    }
109

110
111
112
    /// implements Element::getVertexOfParent()
    virtual int getVertexOfParent(int child, int side, int) const 
    {
113
      FUNCNAME("Line::getVertexOfParent()");
Thomas Witkowski's avatar
Thomas Witkowski committed
114
115
      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");
116
117
      return vertexOfParent[child][side];
    }
118
119


120
121
122
    /// implements Element::hasSide
    inline bool hasSide(Element* /*sideElem*/) const 
    { 
123
124
125
      ERROR_EXIT("a Line has no side elements!\n");
      return false; 
    }
126

127
    /// Returns true because this element is a Line.
128
129
    inline bool isLine() const 
    { 
130
131
      return true; 
    }
132

133
    /// Returns false because this element is a Line.
134
135
    inline bool isTriangle() const 
    { 
136
137
      return false; 
    }
138

139
    /// Returns false because this element is a Line
140
141
    inline bool isTetrahedron() const 
    { 
142
143
      return false; 
    }
144
145
146
147
148
149

    /// Element type number is not used in 1d, so return 0.
    inline int getChildType(int) const
    {
      return 0;
    }
150
  
151
152
    std::string getTypeName() const 
    { 
153
154
      return "Line"; 
    }
155

156
    void getVertexDofs(FiniteElemSpace* feSpace, int ithEdge, int elType, 
157
158
159
		       DofContainer& dofs, 
		       bool reverseMode,
		       bool parentVertices = false) const
160
161
162
163
164
165
    {
      FUNCNAME("Line::getVertexDofs()");

      ERROR_EXIT("Not yet implemented!\n");
    }

166
    void getNonVertexDofs(FiniteElemSpace* feSpace, int ithEdge, int elType,
167
168
169
170
171
172
173
			  DofContainer& dofs) const
    {
      FUNCNAME("Line::getNonVertexDofs()");

      ERROR_EXIT("Not yet implemented!\n");
    }

174
175
176
177
178
179
  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];
180

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

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

}

#endif // AMDIS_LINE_H