Flow123d  3.9.0-960b954f9
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/exceptions.hh" // for ExcAssertMsg::...
27 #include "system/asserts.hh" // for ASSERT_PERMANENT, msg
28 
29 
30 /**
31  * @brief Space of polynomial functions.
32  *
33  * This class serves for evaluation of the value and gradient
34  * of a polynomial of order @p degree in @p dim variables.
35  */
37 {
38 public:
39 
40  /**
41  * @brief Constructor.
42  *
43  * Creates the coefficients of the basis.
44  */
45  PolynomialSpace(unsigned int degree, unsigned int dim);
46 
47  double basis_value(unsigned int basis_index,
48  const arma::vec &point,
49  unsigned int comp_index = 0
50  ) const override;
51 
52  const arma::vec basis_grad(unsigned int basis_index,
53  const arma::vec &point,
54  unsigned int comp_index = 0
55  ) const override;
56 
57  unsigned int dim() const override { return powers.size(); }
58 
59 private:
60 
61  /// Max. degree of polynomials.
62  const unsigned int degree_;
63 
64  /**
65  * @brief Coefficients of basis functions.
66  *
67  * Powers of x, y, z, ... in the i-th basis function are stored
68  * in powers[i].
69  */
71 
72 };
73 
74 
75 
76 
77 
78 
79 /**
80  * @brief Conforming Lagrangean finite element on @p dim dimensional simplex.
81  *
82  * The finite element functions are continuous across the interfaces.
83  */
84 template <unsigned int dim>
85 class FE_P : public FiniteElement<dim>
86 {
87 public:
88  /// Constructor.
89  FE_P(unsigned int degree);
90 
91 protected:
92 
93  void init_dofs();
94 
95  /// Maximum degree of polynomials.
96  unsigned int degree_;
97 };
98 
99 
100 /**
101  * @brief Discontinuous Lagrangean finite element on @p dim dimensional simplex.
102  *
103  * No continuity of the finite element functions across the interfaces is
104  * imposed.
105  */
106 template <unsigned int dim>
107 class FE_P_disc : public FE_P<dim>
108 {
109 public:
110 
111  /// Constructor.
112  FE_P_disc(unsigned int degree);
113 
114 };
115 
116 
117 /**
118  * @brief Crouzeix-Raviart finite element on @p dim dimensional simplex.
119  *
120  * Consists of linear functions with continuity at side barycenters.
121  */
122 template<unsigned int dim>
123 class FE_CR : public FiniteElement<dim>
124 {
125 public:
126  FE_CR();
127 
128 };
129 
130 
131 /**
132  * @brief Discontinuos Crouzeix-Raviart finite element on @p dim dimensional simplex.
133  *
134  * Consists of linear functions with continuity at side barycenters.
135  */
136 template<unsigned int dim>
137 class FE_CR_disc : public FiniteElement<dim>
138 {
139 public:
140  FE_CR_disc();
141 
142 };
143 
144 
145 
146 
147 
148 
149 
150 
151 
152 
153 #endif /* FE_P_HH_ */
Armor::vec
ArmaVec< double, N > vec
Definition: armor.hh:885
FE_CR
Crouzeix-Raviart finite element on dim dimensional simplex.
Definition: fe_p.hh:123
FE_P_disc::FE_P_disc
FE_P_disc(unsigned int degree)
Constructor.
Definition: fe_p.cc:225
asserts.hh
Definitions of ASSERTS.
FE_P::degree_
unsigned int degree_
Maximum degree of polynomials.
Definition: fe_p.hh:96
FE_CR::FE_CR
FE_CR()
Definition: fe_p.cc:243
std::vector< arma::uvec >
exceptions.hh
FunctionSpace
Definition: finite_element.hh:121
PolynomialSpace::dim
unsigned int dim() const override
Dimension of function space (number of basis functions).
Definition: fe_p.hh:57
PolynomialSpace::basis_value
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
Conforming Lagrangean finite element on dim dimensional simplex.
Definition: fe_p.hh:85
FE_CR_disc
Discontinuos Crouzeix-Raviart finite element on dim dimensional simplex.
Definition: fe_p.hh:137
finite_element.hh
Abstract class for description of finite elements.
FE_P::FE_P
FE_P(unsigned int degree)
Constructor.
Definition: fe_p.cc:197
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:78
FE_P::init_dofs
void init_dofs()
Definition: fe_p.cc:112
FiniteElement
Abstract class for the description of a general finite element on a reference simplex in dim dimensio...
Definition: discrete_space.hh:26
FE_CR_disc::FE_CR_disc
FE_CR_disc()
Definition: fe_p.cc:277
PolynomialSpace::powers
std::vector< arma::uvec > powers
Coefficients of basis functions.
Definition: fe_p.hh:70
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:62
FE_P_disc
Discontinuous Lagrangean finite element on dim dimensional simplex.
Definition: fe_p.hh:107
PolynomialSpace
Space of polynomial functions.
Definition: fe_p.hh:36