Line.h 5 KB
Newer Older
1
2
3
4
// ============================================================================
// ==                                                                        ==
// == AMDiS - Adaptive multidimensional simulations                          ==
// ==                                                                        ==
5
// ==  http://www.amdis-fem.org                                              ==
6
7
// ==                                                                        ==
// ============================================================================
8
9
10
11
12
13
14
15
16
17
18
19
//
// 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.


20
21
22
23
24
25
26

/** \file Line.h */

#ifndef AMDIS_LINE_H
#define AMDIS_LINE_H

#include "Element.h"
27
#include "BoundaryObject.h"
28
29
30

namespace AMDiS {

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

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

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

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

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

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

92
    DofEdge getEdge(int localEdgeIndex) const
93
94
    {
      ERROR_EXIT("This does not work in 1D!\n");
95
96
97
98
99
100
101
      return DofEdge();
    }

    DofFace getFace(int localFaceIndex) const
    {
      ERROR_EXIT("This does not work in 1D!\n");
      return DofFace();
102
103
    }

104
    /// implements Element::sortFaceIndices
105
106
    const FixVec<int,WORLD>& sortFaceIndices(int face, 
					     FixVec<int,WORLD> *vec) const;
107
108
  

109
110
111
    /// implements Element::clone
    inline Element *clone() 
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
112
      return new Line(mesh); 
113
    }
114

115
    /// implements Element::getSideOfChild()
116
    int getSideOfChild(int child, int side, int) const 
117
    {
118
      FUNCNAME("Line::getSideOfChild()");
Thomas Witkowski's avatar
Thomas Witkowski committed
119
120
      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");
121
122
      return sideOfChild[child][side];
    }
123

124
125
126
127
128
129
    int getSubObjOfChild(int childnr, GeoIndex subObj, int ithObj, int elType) const
    {
      ERROR_EXIT("Not yet implemented!\n");
      return 0;
    }

130
    /// implements Element::getVertexOfParent()
131
    int getVertexOfParent(int child, int side, int) const 
132
    {
133
      FUNCNAME("Line::getVertexOfParent()");
Thomas Witkowski's avatar
Thomas Witkowski committed
134
135
      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");
136
137
      return vertexOfParent[child][side];
    }
138
139


140
141
142
    /// implements Element::hasSide
    inline bool hasSide(Element* /*sideElem*/) const 
    { 
143
144
145
      ERROR_EXIT("a Line has no side elements!\n");
      return false; 
    }
146

147
    /// Returns true because this element is a Line.
148
149
    inline bool isLine() const 
    { 
150
151
      return true; 
    }
152

153
    /// Returns false because this element is a Line.
154
155
    inline bool isTriangle() const 
    { 
156
157
      return false; 
    }
158

159
    /// Returns false because this element is a Line
160
161
    inline bool isTetrahedron() const 
    { 
162
163
      return false; 
    }
164
165
166
167
168
169

    /// Element type number is not used in 1d, so return 0.
    inline int getChildType(int) const
    {
      return 0;
    }
170
  
171
172
    std::string getTypeName() const 
    { 
173
174
      return "Line"; 
    }
175

176
177
    void getNodeDofs(const FiniteElemSpace*, BoundaryObject, 
		     DofContainer&, bool) const
178
    {
179
      FUNCNAME("Line::getNodeDofs()");
180
181
182
      ERROR_EXIT("Not yet implemented!\n");
    }

183
    void getHigherOrderDofs(const FiniteElemSpace*, BoundaryObject, 
184
			    DofContainer&, bool, vector<GeoIndex>*) const
185
    {
186
      FUNCNAME("Line::getHigherOrderDofs()");
187
188
189
      ERROR_EXIT("Not yet implemented!\n");
    }

190
  protected:
191
192
    /// vertexOfEdge[i][j] is the local number of the j-th vertex of the i-th 
    /// edge of this element.
193
    static const int vertexOfEdge[1][2];
194

195
196
197
198
    static const int sideOfChild[2][2];

    static const int vertexOfParent[2][2];
  };
199
200
201
202

}

#endif // AMDIS_LINE_H