Rheolef  7.2
an efficient C++ finite element environment
basis_fem_Pk_lagrange.h
Go to the documentation of this file.
1 #ifndef _RHEOLEF_BASIS_FEM_PK_LAGRANGE_H
2 #define _RHEOLEF_BASIS_FEM_PK_LAGRANGE_H
23 /*Class:sherwin
24 NAME: @code{Pk} - Lagrange polynomial basis
25 @cindex polynomial basis
26 @clindex space
27 @clindex basis
28 @clindex reference_element
29 SYNOPSIS:
30  space Vh(omega,"P1");
31 DESCRIPTION:
32  @noindent
33  This is the most popular polynomial @code{basis} for the finite element method.
34  It is indicated in the @code{space} (see @ref{space class})
35  by a string starting with
36  the letter @code{"P"},
37  followed by digits indicating the polynomial order.
38 
39 OPTIONS:
40  This basis recognizes the equispaced/warburton node option
41  and the raw polynomial option.
42  See @ref{basis_option class}.
43 
44 AUTHOR: Pierre.Saramito@imag.fr
45 DATE: 11 september 2017
46 End:
47 */
48 #include "rheolef/basis.h"
49 namespace rheolef {
50 
51 template<class T>
52 class basis_fem_Pk_lagrange: public basis_rep<T> {
53 public:
54 
55 // typedefs:
56 
57  typedef basis_rep<T> base;
59  typedef T value_type;
60 
61 // allocators:
62 
65 
66 // accessors:
67 
68  virtual std::string family_name() const { return "P"; }
69  size_type degree() const { return _raw_basis.degree(); }
70  bool is_nodal() const;
71 
73  reference_element hat_K,
74  const side_information_type& sid) const;
75  void local_idof_on_side (
76  reference_element hat_K,
77  const side_information_type& sid,
78  Eigen::Matrix<size_type,Eigen::Dynamic,1>& loc_idof) const;
79 
80  const Eigen::Matrix<point_basic<T>,Eigen::Dynamic,1>&
81  hat_node (reference_element hat_K) const;
82 
83  const Eigen::Matrix<T,Eigen::Dynamic,Eigen::Dynamic>&
84  vdm (reference_element hat_K) const;
85 
86  const Eigen::Matrix<T,Eigen::Dynamic,Eigen::Dynamic>&
87  inv_vdm (reference_element hat_K) const;
88 
89 // evaluation of all basis functions at hat_x:
90 
91  void evaluate (
92  reference_element hat_K,
93  const point_basic<T>& hat_x,
94  Eigen::Matrix<T,Eigen::Dynamic,1>& value) const;
95 
96 // evaluate the gradient:
97 
98  void grad_evaluate (
99  reference_element hat_K,
100  const point_basic<T>& hat_x,
101  Eigen::Matrix<point_basic<T>,Eigen::Dynamic,1>& value) const;
102 
103 // interpolate:
104  void _compute_dofs (
105  reference_element hat_K,
106  const Eigen::Matrix<T,Eigen::Dynamic,1>& f_xnod, // scalar-valued case
107  Eigen::Matrix<T,Eigen::Dynamic,1>& dof) const;
108 
109 // internals:
110 
111  void _initialize_cstor_sizes() const;
112  void _initialize_data (reference_element hat_K) const;
113 
114  // code used also by basis_fem_Pk_bernstein.cc & basis_fem_Pk_sherwin.cc
116  reference_element hat_K,
117  size_type k,
118  std::array<size_type,5>& first_idof_by_dimension);
119  static void initialize_local_first (
120  size_type k,
121  bool is_continuous,
122  std::array<std::array<size_type,reference_element::max_variant>,4>& ndof_on_subgeo_internal,
123  std::array<std::array<size_type,reference_element::max_variant>,4>& ndof_on_subgeo,
124  std::array<std::array<size_type,reference_element::max_variant>,4>& nnod_on_subgeo_internal,
125  std::array<std::array<size_type,reference_element::max_variant>,4>& nnod_on_subgeo,
126  std::array<std::array<size_type,5>,reference_element::max_variant>& first_idof_by_dimension_internal,
127  std::array<std::array<size_type,5>,reference_element::max_variant>& first_idof_by_dimension,
128  std::array<std::array<size_type,5>,reference_element::max_variant>& first_inod_by_dimension_internal,
129  std::array<std::array<size_type,5>,reference_element::max_variant>& first_inod_by_dimension);
130  // code used also by numbering_Pkd:
132  std::array<size_type,reference_element::max_variant>& loc_ndof_on_subgeo);
133 
134 protected:
135 // data:
137 
138  mutable std::array<
139  Eigen::Matrix<point_basic<T>,Eigen::Dynamic,1>,
141 
142  mutable std::array<Eigen::Matrix<T,Eigen::Dynamic,Eigen::Dynamic>,
144 };
145 
146 } // namespace rheolef
147 #endif // _RHEOLEF_BASIS_FEM_PK_LAGRANGE_H
field::size_type size_type
Definition: branch.cc:430
std::array< Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic >, reference_element::max_variant > _inv_vdm
static void init_local_first_idof_by_dimension(reference_element hat_K, size_type k, std::array< size_type, 5 > &first_idof_by_dimension)
const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > & vdm(reference_element hat_K) const
std::array< Eigen::Matrix< point_basic< T >, Eigen::Dynamic, 1 >, reference_element::max_variant > _hat_node
reference_element::size_type size_type
void local_idof_on_side(reference_element hat_K, const side_information_type &sid, Eigen::Matrix< size_type, Eigen::Dynamic, 1 > &loc_idof) const
void evaluate(reference_element hat_K, const point_basic< T > &hat_x, Eigen::Matrix< T, Eigen::Dynamic, 1 > &value) const
static void initialize_local_first(size_type k, bool is_continuous, std::array< std::array< size_type, reference_element::max_variant >, 4 > &ndof_on_subgeo_internal, std::array< std::array< size_type, reference_element::max_variant >, 4 > &ndof_on_subgeo, std::array< std::array< size_type, reference_element::max_variant >, 4 > &nnod_on_subgeo_internal, std::array< std::array< size_type, reference_element::max_variant >, 4 > &nnod_on_subgeo, std::array< std::array< size_type, 5 >, reference_element::max_variant > &first_idof_by_dimension_internal, std::array< std::array< size_type, 5 >, reference_element::max_variant > &first_idof_by_dimension, std::array< std::array< size_type, 5 >, reference_element::max_variant > &first_inod_by_dimension_internal, std::array< std::array< size_type, 5 >, reference_element::max_variant > &first_inod_by_dimension)
size_type local_ndof_on_side(reference_element hat_K, const side_information_type &sid) const
static void init_local_ndof_on_subgeo(size_type k, std::array< size_type, reference_element::max_variant > &loc_ndof_on_subgeo)
void grad_evaluate(reference_element hat_K, const point_basic< T > &hat_x, Eigen::Matrix< point_basic< T >, Eigen::Dynamic, 1 > &value) const
std::array< Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic >, reference_element::max_variant > _vdm
void _compute_dofs(reference_element hat_K, const Eigen::Matrix< T, Eigen::Dynamic, 1 > &f_xnod, Eigen::Matrix< T, Eigen::Dynamic, 1 > &dof) const
basis_fem_Pk_lagrange(size_type degree, const basis_option &sopt)
const Eigen::Matrix< point_basic< T >, Eigen::Dynamic, 1 > & hat_node(reference_element hat_K) const
virtual std::string family_name() const
const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > & inv_vdm(reference_element hat_K) const
void _initialize_data(reference_element hat_K) const
see the basis_option page for the full documentation
Definition: basis_option.h:93
bool is_continuous() const
Definition: basis.h:240
size_type first_inod_by_dimension_internal(reference_element hat_K, size_type dim) const
Definition: basis.h:283
size_type ndof_on_subgeo_internal(size_type map_dim, size_type subgeo_variant) const
Definition: basis.h:274
size_type first_idof_by_dimension_internal(reference_element hat_K, size_type dim) const
Definition: basis.h:280
reference_element::size_type size_type
Definition: basis.h:214
size_type first_idof_by_dimension(reference_element hat_K, size_type dim) const
Definition: basis.h:259
size_type nnod_on_subgeo(size_type map_dim, size_type subgeo_variant) const
Definition: basis.h:256
size_type ndof_on_subgeo(size_type map_dim, size_type subgeo_variant) const
Definition: basis.h:253
size_type first_inod_by_dimension(reference_element hat_K, size_type dim) const
Definition: basis.h:262
size_type nnod_on_subgeo_internal(size_type map_dim, size_type subgeo_variant) const
Definition: basis.h:277
see the reference_element page for the full documentation
static const variant_type max_variant
std::vector< int >::size_type size_type
rheolef::std value
Expr1::float_type T
Definition: field_expr.h:230
This file is part of Rheolef.