Flow123d  master-f44eb46
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_ */
Definitions of ASSERTS.
Discontinuos Crouzeix-Raviart finite element on dim dimensional simplex.
Definition: fe_p.hh:138
FE_CR_disc()
Definition: fe_p.cc:277
Crouzeix-Raviart finite element on dim dimensional simplex.
Definition: fe_p.hh:124
FE_CR()
Definition: fe_p.cc:243
Discontinuous Lagrangean finite element on dim dimensional simplex.
Definition: fe_p.hh:108
FE_P_disc(unsigned int degree)
Constructor.
Definition: fe_p.cc:225
Conforming Lagrangean finite element on dim dimensional simplex.
Definition: fe_p.hh:86
unsigned int degree_
Maximum degree of polynomials.
Definition: fe_p.hh:96
void init_dofs()
Definition: fe_p.cc:112
FE_P(unsigned int degree)
Constructor.
Definition: fe_p.cc:197
Abstract class for the description of a general finite element on a reference simplex in dim dimensio...
Space of polynomial functions.
Definition: fe_p.hh:37
unsigned int dim() const override
Dimension of function space (number of basis functions).
Definition: fe_p.hh:57
std::vector< arma::uvec > powers
Coefficients of basis functions.
Definition: fe_p.hh:70
const unsigned int degree_
Max. degree of polynomials.
Definition: fe_p.hh:62
PolynomialSpace(unsigned int degree, unsigned int dim)
Constructor.
Definition: fe_p.cc:25
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
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
Abstract class for description of finite elements.
ArmaVec< double, N > vec
Definition: armor.hh:885