Flow123d  release_2.2.0-914-gf1a3a4f
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 <vector>
23 
24 #include "system/global_defs.h"
25 #include "system/system.hh"
26 #include "fem/finite_element.hh"
27 
28 
29 /**
30  * @brief Space of polynomial functions.
31  *
32  * This class serves for evaluation of the value and gradient
33  * of a polynomial of order @p degree in @p dim variables.
34  */
36 {
37 public:
38 
39  /**
40  * @brief Constructor.
41  *
42  * Creates the coefficients of the basis.
43  */
44  PolynomialSpace(unsigned int degree, unsigned int dim);
45 
46  const double basis_value(unsigned int basis_index,
47  const arma::vec &point,
48  unsigned int comp_index = 0
49  ) const override;
50 
51  const arma::vec basis_grad(unsigned int basis_index,
52  const arma::vec &point,
53  unsigned int comp_index = 0
54  ) const override;
55 
56  const unsigned int dim() const override { return powers.size(); }
57 
58 private:
59 
60  /// Max. degree of polynomials.
61  const unsigned int degree_;
62 
63  /**
64  * @brief Coefficients of basis functions.
65  *
66  * Powers of x, y, z, ... in the i-th basis function are stored
67  * in powers[i].
68  */
70 
71 };
72 
73 
74 
75 
76 
77 
78 /**
79  * @brief Conforming Lagrangean finite element on @p dim dimensional simplex.
80  *
81  * The finite element functions are continuous across the interfaces.
82  */
83 template <unsigned int dim, unsigned int spacedim>
84 class FE_P : public FiniteElement<dim,spacedim>
85 {
86 public:
87  /// Constructor.
88  FE_P(unsigned int degree);
89 
90 protected:
91 
92  void init_dofs();
93 
94  /// Maximum degree of polynomials.
95  unsigned int degree_;
96 };
97 
98 
99 /**
100  * @brief Discontinuous Lagrangean finite element on @p dim dimensional simplex.
101  *
102  * No continuity of the finite element functions across the interfaces is
103  * imposed.
104  */
105 template <unsigned int dim, unsigned int spacedim>
106 class FE_P_disc : public FE_P<dim,spacedim>
107 {
108 public:
109 
110  /// Constructor.
111  FE_P_disc(unsigned int degree);
112 
113 };
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 #endif /* FE_P_HH_ */
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:80
PolynomialSpace(unsigned int degree, unsigned int dim)
Constructor.
Definition: fe_p.cc:25
Space of polynomial functions.
Definition: fe_p.hh:35
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:63
std::vector< arma::uvec > powers
Coefficients of basis functions.
Definition: fe_p.hh:69
Discontinuous Lagrangean finite element on dim dimensional simplex.
Definition: fe_p.hh:106
Global macros to enhance readability and debugging, general constants.
Conforming Lagrangean finite element on dim dimensional simplex.
Definition: fe_p.hh:84
const unsigned int dim() const override
Dimension of function space (number of basis functions).
Definition: fe_p.hh:56
unsigned int degree_
Maximum degree of polynomials.
Definition: fe_p.hh:95
Abstract class for description of finite elements.
Abstract class for the description of a general finite element on a reference simplex in dim dimensio...
Definition: dofhandler.hh:30
const unsigned int degree_
Max. degree of polynomials.
Definition: fe_p.hh:61