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