element.hh

Go to the documentation of this file.
1 
6 #ifndef dgElement_hh
7 #define dgElement_hh
8 
9 #include "basics/typedefs.hh"
10 #include "space/element.hh"
11 #include "geometry/cell3D.hh"
12 #include "geometry/topology3D.hh"
13 #include "function/vector.hh"
14 #include "space/tmatrix.hh"
16 #include "space/postProcess.hh"
17 #include "graphics/dataDX.hh"
18 
19 namespace linDG3D {
20 
21  using concepts::Real;
22 
23  // Forward declarations
24  class FvdgP0TetGraphics;
25  class FvdgP1TetGraphics;
26 
27  // ************************************************************** Elements **
31  class FvdgElement : public concepts::ElementWithCell<Real> {
32  public:
34  FvdgElement(const concepts::Tetrahedron3d& cell, uint idx[], uint m);
36  const concepts::Tetrahedron& support() const { return cell_.connector(); }
38  const concepts::TMatrixBase<Real>& T() const { return *T_; }
40  const concepts::Real3d vertex(const uint i) const {
41  return cell_.vertex(i);
42  }
44  virtual const concepts::Tetrahedron3d& cell() const { return cell_; }
49  virtual Real shapeFct(const uint fctIdx, const concepts::Real3d xi) const
50  = 0;
56  virtual Real shapeFctEdgeCenter(const uint fctIdx, const uint edgeIdx)
57  const = 0;
63  virtual Real shapeFctVertex(const uint fctIdx, const uint vtxIdx)
64  const = 0;
69  virtual concepts::Real3d shapeFctGradient(const uint fctIdx) const = 0;
76  const concepts::Real3d xi) const;
83  const uint edgeIdx) const = 0;
90  const uint vertexIdx) const = 0;
95  concepts::Real3d edgeCenter(uint edgeIdx) const;
97  virtual const concepts::ElementGraphics<Real>* graphics() const = 0;
98  protected:
100  virtual std::ostream& info(std::ostream& os) const;
101 
102  std::unique_ptr<concepts::TMatrixBase<Real> > T_;
104  static Real eta_[6][3];
105  };
106 
107  //********************************************************** FvdgP0TetElem **
111  class FvdgP0TetElem : public FvdgElement {
112  public:
122  Real shapeFct(const uint fctIdx, const concepts::Real3d xi) const {
123  return 1.0;
124  }
130  Real shapeFctEdgeCenter(const uint fctIdx, const uint edgeIdx) const {
131  return 1.0;
132  }
138  Real shapeFctVertex(const uint fctIdx, const uint vtxIdx) const {
139  return 1.0;
140  }
145  concepts::Real3d shapeFctGradient(const uint fctIdx) const {
146  return concepts::Real3d(0.0, 0.0, 0.0);
147  }
154  const uint edgeIdx) const {
155  return sol(T_->index(0));
156  }
163  const uint vertexIdx) const {
164  return sol(T_->index(0));
165  }
168  protected:
170  virtual std::ostream& info(std::ostream& os) const;
172  static std::unique_ptr<FvdgP0TetGraphics> graphics_;
173  };
174 
175  //********************************************************** FvdgP1TetElem **
179  class FvdgP1TetElem : public FvdgElement {
180  public:
190  Real shapeFct(const uint fctIdx, const concepts::Real3d xi) const;
196  Real shapeFctEdgeCenter(const uint fctIdx, const uint edgeIdx) const {
197  conceptsAssert(edgeIdx < 6, concepts::Assertion());
198  conceptsAssert(fctIdx < 4, concepts::Assertion());
199  return shapeFctEdgeCenter_[edgeIdx][fctIdx];
200  }
206  Real shapeFctVertex(const uint fctIdx, const uint vtxIdx) const {
207  conceptsAssert(vtxIdx < 4, concepts::Assertion());
208  conceptsAssert(fctIdx < 4, concepts::Assertion());
209  return shapeFctVertex_[vtxIdx][fctIdx];
210  }
215  concepts::Real3d shapeFctGradient(const uint fctIdx) const;
222  const uint edgeIdx) const;
229  const uint vertexIdx) const;
232  protected:
234  virtual std::ostream& info(std::ostream& os) const;
236  static Real shapeFctEdgeCenter_[6][4];
238  static Real shapeFctGradient_[3][4];
240  static uint nonVanishingNbr_[6];
244  static Real shapeFctVertex_[4][4];
246  static std::unique_ptr<FvdgP1TetGraphics> graphics_;
247  };
248 
249  // *************************************************** TetrahedronGraphics **
250 
255  public:
256  virtual void operator()(const concepts::Element<Real>& elm,
257  enum graphicsType type,
258  concepts::CellPostprocess<Real>& post) const;
259  protected:
260  virtual std::ostream& info(std::ostream& os) const;
261  };
262 
267  public:
268  virtual void operator()(const concepts::Element<Real>& elm,
269  enum graphicsType type,
270  concepts::CellPostprocess<Real>& post) const;
271  protected:
272  virtual std::ostream& info(std::ostream& os) const;
273  };
274 } // namespace linDG3D
275 
276 #endif
virtual Real solutionEdgeCenter(const concepts::Vector< Real > &sol, const uint edgeIdx) const =0
Returns the value of the solution sol at the center of edge edgeIdx of this tetrahedron.
const concepts::TMatrixBase< Real > & T() const
Returns the T matrix of this element.
Definition: element.hh:38
virtual std::ostream & info(std::ostream &os) const
Returns cell and T matrix of this element.
Real solutionEdgeCenter(const concepts::Vector< Real > &sol, const uint edgeIdx) const
Returns the value of the solution sol at the center of edge edgeIdx of this tetrahedron.
FvdgElement(const concepts::Tetrahedron3d &cell, uint idx[], uint m)
Constructor.
virtual const concepts::Tetrahedron3d & cell() const
Returns the geometrical cell of this element.
Definition: element.hh:44
const concepts::ElementGraphics< Real > * graphics() const
Returns the graphics object for the element.
Real shapeFct(const uint fctIdx, const concepts::Real3d xi) const
Shape function.
Tetrahedral element with linear shapefunctions.
Definition: element.hh:179
Tetrahedron & connector() const
Returns the connector.
Definition: cell3D.hh:100
static Real shapeFctEdgeCenter_[6][4]
Values of shape functions at edge centers.
Definition: element.hh:236
Generic tetrahedral element for FV/DG method.
Definition: element.hh:31
#define conceptsAssert(cond, exc)
Assert that a certain condition is fulfilled.
Definition: exceptions.hh:394
virtual void operator()(const concepts::Element< Real > &elm, enum graphicsType type, concepts::CellPostprocess< Real > &post) const
Real shapeFct(const uint fctIdx, const concepts::Real3d xi) const
Shape function.
Definition: element.hh:122
virtual Real shapeFctVertex(const uint fctIdx, const uint vtxIdx) const =0
Shapefunction at vertex.
Point< Real, 3 > Real3d
Real shapeFctVertex(const uint fctIdx, const uint vtxIdx) const
Shapefunction at vertex.
Definition: element.hh:138
Handles graphics for FvdgP0TetElem.
Definition: element.hh:254
concepts::Real3d shapeFctGradient(const uint fctIdx) const
Gradient of shape function.
Definition: element.hh:145
Real shapeFctEdgeCenter(const uint fctIdx, const uint edgeIdx) const
Shapefunction at edge center.
Definition: element.hh:196
static Real shapeFctVertex_[4][4]
Values of shape functions at vertices.
Definition: element.hh:244
virtual const concepts::ElementGraphics< Real > * graphics() const =0
Returns the graphics object for the element.
Element with cell.
virtual std::ostream & info(std::ostream &os) const
Returns cell and T matrix of this element.
Real solutionVertex(const concepts::Vector< Real > &sol, const uint vertexIdx) const
Returns the value of the solution sol at vertex vertexIdx of this tetrahedron.
const concepts::Tetrahedron & support() const
Returns the topological support of this element.
Definition: element.hh:36
virtual Real solutionVertex(const concepts::Vector< Real > &sol, const uint vertexIdx) const =0
Returns the value of the solution sol at vertex vertexIdx of this tetrahedron.
concepts::Real3d edgeCenter(uint edgeIdx) const
Returns the real world coordinates of the center of the edge with index edgeIdx.
Real solutionEdgeCenter(const concepts::Vector< Real > &sol, const uint edgeIdx) const
Returns the value of the solution sol at the center of edge edgeIdx of this tetrahedron.
Definition: element.hh:153
Exception class for assertions.
Definition: exceptions.hh:258
static uint nonVanishingNbr_[6]
Number of non vanishing shape function at edge centers.
Definition: element.hh:240
FvdgP1TetElem(const concepts::Tetrahedron3d &cell, uint idx[])
Constructor.
static std::unique_ptr< FvdgP0TetGraphics > graphics_
Graphics object of the element.
Definition: element.hh:172
A tetrahedron in the topology.
Definition: topology3D.hh:35
const concepts::ElementGraphics< Real > * graphics() const
Returns the graphics object for the element.
static Real nonVanishingSign_[6]
Value of non vanishing shape function at edge centers.
Definition: element.hh:242
virtual std::ostream & info(std::ostream &os) const
Returns cell and T matrix of this element.
Real3d vertex(uint i) const
Returns the coordinates of the ith vertex.
static std::unique_ptr< FvdgP1TetGraphics > graphics_
Graphics object of the element.
Definition: element.hh:246
const concepts::Tetrahedron3d & cell_
Definition: element.hh:103
std::unique_ptr< concepts::TMatrixBase< Real > > T_
Definition: element.hh:102
virtual std::ostream & info(std::ostream &os) const
A 3D cell: tetrahedron.
Definition: cell3D.hh:47
virtual Real shapeFct(const uint fctIdx, const concepts::Real3d xi) const =0
Shape function.
Real solutionVertex(const concepts::Vector< Real > &sol, const uint vertexIdx) const
Returns the value of the solution sol at vertex vertexIdx of this tetrahedron.
Definition: element.hh:162
const concepts::Real3d vertex(const uint i) const
Returns the vertex with local index i in this element.
Definition: element.hh:40
virtual void operator()(const concepts::Element< Real > &elm, enum graphicsType type, concepts::CellPostprocess< Real > &post) const
static Real shapeFctGradient_[3][4]
Values of shape function gradients.
Definition: element.hh:238
Real shapeFctEdgeCenter(const uint fctIdx, const uint edgeIdx) const
Shapefunction at edge center.
Definition: element.hh:130
Tetrahedral element with constant shapefunction.
Definition: element.hh:111
concepts::Real3d shapeFctGradient(const uint fctIdx) const
Gradient of shape function.
DG-FEM methods to solve elliptic and hyperbolic PDE's.
Definition: bilinearForm.hh:18
static Real eta_[6][3]
Definition: element.hh:104
Real shapeFctVertex(const uint fctIdx, const uint vtxIdx) const
Shapefunction at vertex.
Definition: element.hh:206
virtual std::ostream & info(std::ostream &os) const
FvdgP0TetElem(const concepts::Tetrahedron3d &cell, uint idx[])
Constructor.
virtual Real shapeFctEdgeCenter(const uint fctIdx, const uint edgeIdx) const =0
Shapefunction at edge center.
virtual concepts::Real3d shapeFctGradient(const uint fctIdx) const =0
Gradient of shape function.
double Real
Type normally used for a floating point number.
Definition: typedefs.hh:36
Handles graphics for FvdgP1TetElem.
Definition: element.hh:266
Real solution(const concepts::Vector< Real > &sol, const concepts::Real3d xi) const
Returns the value of the solution sol at the reference element coordinate xi.
Page URL: http://wiki.math.ethz.ch/bin/view/Concepts/WebHome
21 August 2020
© 2020 Eidgenössische Technische Hochschule Zürich