triangle.hh

Go to the documentation of this file.
1 
6 #ifndef DGTriangle_hh
7 #define DGTriangle_hh
8 
9 #include "linearFEM/element.hh"
10 #include "geometry/cell2D.hh"
11 
12 namespace concepts {
13  // forward declaration
14  template<typename F>
15  class ElementGraphics;
16 }
17 
18 namespace linDG2D {
19 
20  // forward declaration
21  class TriangleGraphics;
22 
23  using concepts::Real;
24 
25  // ************************************************************** Triangle **
26 
30  class Triangle : public linearFEM::Element {
31  public:
38  Triangle(const concepts::Triangle2d& cell, uint nDoF, uint idx[])
39  : linearFEM::Element(nDoF, idx), cell_(cell) {}
41  virtual const concepts::Triangle& support() const {
42  return cell_.connector();
43  }
45  virtual const concepts::Triangle2d& cell() const { return cell_; }
53  virtual Real shapeFct(const uint i, const Real xi1, const Real xi2) const = 0;
59  virtual Real solution(const concepts::Vector<Real>& coeffs,
60  const Real xi1, const Real xi2) const = 0;
62  virtual const concepts::ElementGraphics<Real>* graphics() const;
63  protected:
64  virtual std::ostream& info(std::ostream& os) const;
65  private:
69  static std::unique_ptr<TriangleGraphics> graphics_;
70  };
71 
72  // ************************************************************ TriangleP1 **
73 
77  class TriangleP1 : public Triangle {
78  public:
84  TriangleP1(const concepts::Triangle2d& cell, uint idx[])
85  : Triangle(cell, 3, idx) {}
93  virtual Real shapeFct(const uint i, const Real xi1, const Real xi2) const;
99  concepts::Real2d shapeFctGradient(const uint i) const;
105  virtual Real solution(const concepts::Vector<Real>& coeffs,
106  const Real xi1, const Real xi2) const;
107  protected:
108  virtual std::ostream& info(std::ostream& os) const;
109  };
110 
111  // ************************************************************ TriangleP0 **
112 
116  class TriangleP0 : public Triangle {
117  public:
124  : Triangle(cell, 1, idx) {}
132  virtual Real shapeFct(const uint i, const Real xi1, const Real xi2) const {
133  return 1;
134  }
135  virtual Real solution(const concepts::Vector<Real>& coeffs,
136  const Real xi1, const Real xi2) const;
137  protected:
138  virtual std::ostream& info(std::ostream& os) const;
139  };
140 
141 } // namespace linDG2D
142 
143 #endif // DGTriangle_hh
144 
virtual Real shapeFct(const uint i, const Real xi1, const Real xi2) const
Computes the value of the ith shape function in the point (xi1, xi2).
Definition: triangle.hh:132
virtual const concepts::Triangle & support() const
Returns the topological triangle supporting the element.
Definition: triangle.hh:41
virtual const concepts::ElementGraphics< Real > * graphics() const
Returns the element graphics object.
Triangle & connector() const
Returns the triangle connector (topology)
Definition: cell2D.hh:91
virtual std::ostream & info(std::ostream &os) const
Triangular element with orthogonal linear shape functions in 2D.
Definition: triangle.hh:77
virtual std::ostream & info(std::ostream &os) const
virtual const concepts::Triangle2d & cell() const
Returns the underlying geometrical triangle.
Definition: triangle.hh:45
Triangle(const concepts::Triangle2d &cell, uint nDoF, uint idx[])
Constructor.
Definition: triangle.hh:38
virtual Real solution(const concepts::Vector< Real > &coeffs, const Real xi1, const Real xi2) const =0
Returns the value of a mesh function within this element.
TriangleP0(const concepts::Triangle2d &cell, uint *idx)
Constructor.
Definition: triangle.hh:123
concepts::Real2d shapeFctGradient(const uint i) const
Returns the gradient of the ith shape function, transformed to real world coordinates.
A 2D cell: triangle.
Definition: cell2D.hh:31
TriangleP1(const concepts::Triangle2d &cell, uint idx[])
Constructor.
Definition: triangle.hh:84
DG FEM for 2D problems using piecewise linear shape functions.
Definition: bilinearForm.hh:15
virtual Real solution(const concepts::Vector< Real > &coeffs, const Real xi1, const Real xi2) const
Returns the value of a mesh function within this element.
Linear FEM in 1D, 2D and 3D.
Definition: spaceTraits.hh:19
virtual Real shapeFct(const uint i, const Real xi1, const Real xi2) const
Computes the value of the ith shape function in the point (xi1, xi2).
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).
Element(const uint i, uint idx[])
Constructor.
static std::unique_ptr< TriangleGraphics > graphics_
Graphics object of this element.
Definition: triangle.hh:69
Triangular element with constant shape function in 2D.
Definition: triangle.hh:116
Abstract base class for triangular elements in 2D DGFEM.
Definition: triangle.hh:30
virtual std::ostream & info(std::ostream &os) const
Base class for the element for linear FEM.
Definition: element.hh:30
const concepts::Triangle2d & cell_
Cell under this element.
Definition: triangle.hh:67
virtual Real solution(const concepts::Vector< Real > &coeffs, const Real xi1, const Real xi2) const
Returns the value of a mesh function within this element.
A triangle in the topology.
Definition: topology.hh:193
double Real
Type normally used for a floating point number.
Definition: typedefs.hh:36
Basic namespace for Concepts-2.
Definition: pml_formula.h:16
Page URL: http://wiki.math.ethz.ch/bin/view/Concepts/WebHome
21 August 2020
© 2020 Eidgenössische Technische Hochschule Zürich