Flow123d  JS_before_hm-1621-g63a12c7
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  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  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  * @brief Crouzeix-Raviart finite element on @p dim dimensional simplex.
120  *
121  * Consists of linear functions with continuity at side barycenters.
122  */
123 template<unsigned int dim>
124 class FE_CR : public FiniteElement<dim>
125 {
126 public:
127  FE_CR();
128 
129 };
130 
131 
132 /**
133  * @brief Discontinuos Crouzeix-Raviart finite element on @p dim dimensional simplex.
134  *
135  * Consists of linear functions with continuity at side barycenters.
136  */
137 template<unsigned int dim>
138 class FE_CR_disc : public FiniteElement<dim>
139 {
140 public:
141  FE_CR_disc();
142 
143 };
144 
145 
146 
147 
148 
149 
150 
151 
152 
153 
154 #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:78
PolynomialSpace(unsigned int degree, unsigned int dim)
Constructor.
Definition: fe_p.cc:25
Space of polynomial functions.
Definition: fe_p.hh:37
ArmaVec< double, N > vec
Definition: armor.hh:885
Discontinuos Crouzeix-Raviart finite element on dim dimensional simplex.
Definition: fe_p.hh:138
unsigned int degree_
Maximum degree of polynomials.
Definition: fe_p.hh:97
std::vector< arma::uvec > powers
Coefficients of basis functions.
Definition: fe_p.hh:71
Discontinuous Lagrangean finite element on dim dimensional simplex.
Definition: fe_p.hh:108
Global macros to enhance readability and debugging, general constants.
unsigned int dim() const override
Dimension of function space (number of basis functions).
Definition: fe_p.hh:58
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
Conforming Lagrangean finite element on dim dimensional simplex.
Definition: fe_p.hh:86
Abstract class for description of finite elements.
Abstract class for the description of a general finite element on a reference simplex in dim dimensio...
Crouzeix-Raviart finite element on dim dimensional simplex.
Definition: fe_p.hh:124
const unsigned int degree_
Max. degree of polynomials.
Definition: fe_p.hh:63