Flow123d  release_3.0.0-968-gc87a28e79
fe_p.hh
Go to the documentation of this file.
1 /*!
2  *
3  * Copyright (C) 2015 Technical University of Liberec. All rights reserved.
4  *
5  * This program is free software; you can redistribute it and/or modify it under
6  * the terms of the GNU General Public License version 3 as published by the
7  * Free Software Foundation. (http://www.gnu.org/licenses/gpl-3.0.en.html)
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12  *
13  *
14  * @file fe_p.hh
15  * @brief Definitions of basic Lagrangean finite elements with polynomial shape functions.
16  * @author Jan Stebel
17  */
18 
19 #ifndef FE_P_HH_
20 #define FE_P_HH_
21 
22 #include <string> // for string
23 #include <vector> // for vector
24 #include <armadillo>
25 #include "fem/finite_element.hh" // for FiniteElement
26 #include "system/exc_common.hh" // for ExcAssertMsg
27 #include "system/exceptions.hh" // for ExcAssertMsg::...
28 #include "system/global_defs.h" // for OLD_ASSERT, msg
29 
30 
31 /**
32  * @brief Space of polynomial functions.
33  *
34  * This class serves for evaluation of the value and gradient
35  * of a polynomial of order @p degree in @p dim variables.
36  */
38 {
39 public:
40 
41  /**
42  * @brief Constructor.
43  *
44  * Creates the coefficients of the basis.
45  */
46  PolynomialSpace(unsigned int degree, unsigned int dim);
47 
48  const double basis_value(unsigned int basis_index,
49  const arma::vec &point,
50  unsigned int comp_index = 0
51  ) const override;
52 
53  const arma::vec basis_grad(unsigned int basis_index,
54  const arma::vec &point,
55  unsigned int comp_index = 0
56  ) const override;
57 
58  const unsigned int dim() const override { return powers.size(); }
59 
60 private:
61 
62  /// Max. degree of polynomials.
63  const unsigned int degree_;
64 
65  /**
66  * @brief Coefficients of basis functions.
67  *
68  * Powers of x, y, z, ... in the i-th basis function are stored
69  * in powers[i].
70  */
72 
73 };
74 
75 
76 
77 
78 
79 
80 /**
81  * @brief Conforming Lagrangean finite element on @p dim dimensional simplex.
82  *
83  * The finite element functions are continuous across the interfaces.
84  */
85 template <unsigned int dim>
86 class FE_P : public FiniteElement<dim>
87 {
88 public:
89  /// Constructor.
90  FE_P(unsigned int degree);
91 
92 protected:
93 
94  void init_dofs();
95 
96  /// Maximum degree of polynomials.
97  unsigned int degree_;
98 };
99 
100 
101 /**
102  * @brief Discontinuous Lagrangean finite element on @p dim dimensional simplex.
103  *
104  * No continuity of the finite element functions across the interfaces is
105  * imposed.
106  */
107 template <unsigned int dim>
108 class FE_P_disc : public FE_P<dim>
109 {
110 public:
111 
112  /// Constructor.
113  FE_P_disc(unsigned int degree);
114 
115 };
116 
117 
118 
119 
120 
121 
122 
123 
124 
125 
126 
127 
128 
129 
130 
131 
132 
133 
134 
135 
136 
137 
138 
139 
140 
141 
142 
143 
144 
145 
146 
147 
148 
149 
150 
151 
152 
153 
154 
155 
156 
157 
158 
159 
160 
161 
162 #endif /* FE_P_HH_ */
FE_P_disc::FE_P_disc
FE_P_disc(unsigned int degree)
Constructor.
Definition: fe_p.cc:226
FE_P::degree_
unsigned int degree_
Maximum degree of polynomials.
Definition: fe_p.hh:97
std::vector< arma::uvec >
exceptions.hh
FunctionSpace
Definition: finite_element.hh:125
FE_P
Conforming Lagrangean finite element on dim dimensional simplex.
Definition: fe_p.hh:86
PolynomialSpace::dim
const unsigned int dim() const override
Dimension of function space (number of basis functions).
Definition: fe_p.hh:58
finite_element.hh
Abstract class for description of finite elements.
FE_P::FE_P
FE_P(unsigned int degree)
Constructor.
Definition: fe_p.cc:198
PolynomialSpace::basis_grad
const arma::vec basis_grad(unsigned int basis_index, const arma::vec &point, unsigned int comp_index=0) const override
Gradient of the i th basis function at point point.
Definition: fe_p.cc:79
FE_P::init_dofs
void init_dofs()
Definition: fe_p.cc:113
FiniteElement
Abstract class for the description of a general finite element on a reference simplex in dim dimensio...
Definition: discrete_space.hh:25
exc_common.hh
PolynomialSpace::powers
std::vector< arma::uvec > powers
Coefficients of basis functions.
Definition: fe_p.hh:71
global_defs.h
Global macros to enhance readability and debugging, general constants.
PolynomialSpace::PolynomialSpace
PolynomialSpace(unsigned int degree, unsigned int dim)
Constructor.
Definition: fe_p.cc:25
PolynomialSpace::degree_
const unsigned int degree_
Max. degree of polynomials.
Definition: fe_p.hh:63
PolynomialSpace::basis_value
const double basis_value(unsigned int basis_index, const arma::vec &point, unsigned int comp_index=0) const override
Value of the i th basis function at point point.
Definition: fe_p.cc:62
FE_P_disc
Discontinuous Lagrangean finite element on dim dimensional simplex.
Definition: fe_p.hh:108
PolynomialSpace
Space of polynomial functions.
Definition: fe_p.hh:37