elementPair.hh

Go to the documentation of this file.
1 
6 #ifndef elementPairDG2D_hh
7 #define elementPairDG2D_hh
8 
9 #include "space/elementPairs.hh"
10 #include "edgeInfo.hh"
11 
12 // debugging
13 #include "basics/debug.hh"
14 
15 #define DGElementPair2dConstr_D 0
16 
17 namespace linDG2D {
18 
19  using concepts::Real;
20 
21  // *********************************************************** ElementPair **
22 
27  class ElementPair : public concepts::ElementPair<Real> {
28  public:
35  const EdgeInfo& edgeInfo) :
38  idxs_[0] = &(elm1.cell()) == edgeInfo.cell(0) ?
39  edgeInfo.idx(0) : edgeInfo.idx(1);
40  idxs_[1] = &(elm2.cell()) == edgeInfo.cell(0) ?
41  edgeInfo.idx(0) : edgeInfo.idx(1);
42  }
44  virtual const Triangle& elm1() const { return elm1_; }
46  virtual const Triangle& elm2() const { return elm2_; }
48  const EdgeInfo& edgeInfo() const { return edgeInfo_; }
55  Real shapeFct(uint e, uint i, Real xi) const {
56  const Triangle& elm = e == 0 ? elm1_ : elm2_;
57  Real xim = &(elm.cell()) == edgeInfo_.cell(0) ? xi : 1.0 - xi;
58  switch(idxs_[e]) {
59  case 0: return elm.shapeFct(i, xim, 0.0);
60  case 1: return elm.shapeFct(i, 1.0, xim);
61  case 2: return elm.shapeFct(i, 1.0-xim, 1.0-xim);
62  default: conceptsAssert(false, concepts::Assertion()); return 0.0;
63  }
64  }
65  private:
66  const Triangle& elm1_;
67  const Triangle& elm2_;
69  uint idxs_[2];
70  };
71 
72 }
73 
74 #endif // elementPairDG2D_hh
Gives access to a pair of elements.
Definition: elementPairs.hh:25
virtual const concepts::Triangle2d & cell() const
Returns the underlying geometrical triangle.
Definition: triangle.hh:45
const Triangle & elm1_
Definition: elementPair.hh:66
#define DGElementPair2dConstr_D
Definition: elementPair.hh:15
#define conceptsAssert(cond, exc)
Assert that a certain condition is fulfilled.
Definition: exceptions.hh:394
Real shapeFct(uint e, uint i, Real xi) const
Evaluate trace of shapefunction from element e onto edge.
Definition: elementPair.hh:55
DG FEM for 2D problems using piecewise linear shape functions.
Definition: bilinearForm.hh:15
const EdgeInfo & edgeInfo_
Definition: elementPair.hh:68
Edge information for DG FEM.
Definition: edgeInfo.hh:31
#define DEBUGL(doit, msg)
Element pair for DG FEM in 2D.
Definition: elementPair.hh:27
Exception class for assertions.
Definition: exceptions.hh:258
uint idx(uint i) const
Return index of edge represented in cell i.
Definition: edgeInfo.hh:46
virtual const Triangle & elm1() const
Returns the first element.
Definition: elementPair.hh:44
const EdgeInfo & edgeInfo() const
Returns the edge information object.
Definition: elementPair.hh:48
virtual Real shapeFct(const uint i, const Real xi1, const Real xi2) const =0
Computes the value of the ith shape function in the point (xi1, xi2).
virtual const Triangle & elm2() const
Returns the second element.
Definition: elementPair.hh:46
const concepts::Triangle2d * cell(uint i) const
Return cell adjacent to the edge.
Definition: edgeInfo.hh:42
const Triangle & elm2_
Definition: elementPair.hh:67
ElementPair(const Triangle &elm1, const Triangle &elm2, const EdgeInfo &edgeInfo)
Constructor.
Definition: elementPair.hh:34
Abstract base class for triangular elements in 2D DGFEM.
Definition: triangle.hh:30
double Real
Type normally used for a floating point number.
Definition: typedefs.hh:36
Page URL: http://wiki.math.ethz.ch/bin/view/Concepts/WebHome
21 August 2020
© 2020 Eidgenössische Technische Hochschule Zürich