basis_fem_Pk_lagrange.h
Go to the documentation of this file.
#ifndef _RHEOLEF_BASIS_FEM_PK_LAGRANGE_H
#define _RHEOLEF_BASIS_FEM_PK_LAGRANGE_H
/*Class:sherwin
NAME: @code{Pk} - Lagrange polynomial basis
@cindex polynomial basis
@clindex space
@clindex basis
@clindex reference_element
SYNOPSIS:
space Vh(omega,"P1");
DESCRIPTION:
@noindent
This is the most popular polynomial @code{basis} for the finite element method.
It is indicated in the @code{space} (see @ref{space class})
by a string starting with
the letter @code{"P"},
followed by digits indicating the polynomial order.
OPTIONS:
This basis recognizes the equispaced/warburton node option
and the raw polynomial option.
See @ref{basis_option class}.
AUTHOR: Pierre.Saramito@imag.fr
DATE: 11 september 2017
End:
*/
#include "rheolef/basis.h"
namespace rheolef {
template<class T>
class basis_fem_Pk_lagrange: public basis_rep<T> {
public:
// typedefs:
typedef basis_rep<T> base;
typedef reference_element::size_type size_type;
typedef T value_type;
// allocators:
basis_fem_Pk_lagrange (size_type degree, const basis_option& sopt);
~basis_fem_Pk_lagrange();
// accessors:
virtual std::string family_name() const { return "P"; }
size_type degree() const { return _raw_basis.degree(); }
bool is_nodal() const;
size_type local_ndof_on_side (
reference_element hat_K,
const side_information_type& sid) const;
void local_idof_on_side (
reference_element hat_K,
const side_information_type& sid,
Eigen::Matrix<size_type,Eigen::Dynamic,1>& loc_idof) const;
const Eigen::Matrix<point_basic<T>,Eigen::Dynamic,1>&
hat_node (reference_element hat_K) const;
const Eigen::Matrix<T,Eigen::Dynamic,Eigen::Dynamic>&
vdm (reference_element hat_K) const;
const Eigen::Matrix<T,Eigen::Dynamic,Eigen::Dynamic>&
inv_vdm (reference_element hat_K) const;
// evaluation of all basis functions at hat_x:
void evaluate (
reference_element hat_K,
const point_basic<T>& hat_x,
Eigen::Matrix<T,Eigen::Dynamic,1>& value) const;
// evaluate the gradient:
void grad_evaluate (
reference_element hat_K,
const point_basic<T>& hat_x,
Eigen::Matrix<point_basic<T>,Eigen::Dynamic,1>& value) const;
// interpolate:
void _compute_dofs (
reference_element hat_K,
const Eigen::Matrix<T,Eigen::Dynamic,1>& f_xnod, // scalar-valued case
Eigen::Matrix<T,Eigen::Dynamic,1>& dof) const;
// internals:
void _initialize_cstor_sizes() const;
void _initialize_data (reference_element hat_K) const;
// code used also by basis_fem_Pk_bernstein.cc & basis_fem_Pk_sherwin.cc
static void init_local_first_idof_by_dimension (
reference_element hat_K,
size_type k,
std::array<size_type,5>& first_idof_by_dimension);
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,
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,
std::array<std::array<size_type,5>,reference_element::max_variant>& first_inod_by_dimension);
// code used also by numbering_Pkd:
static void init_local_ndof_on_subgeo (size_type k,
std::array<size_type,reference_element::max_variant>& loc_ndof_on_subgeo);
protected:
// data:
basis_raw_basic<T> _raw_basis;
mutable std::array<
Eigen::Matrix<point_basic<T>,Eigen::Dynamic,1>,
reference_element::max_variant> _hat_node;
mutable std::array<Eigen::Matrix<T,Eigen::Dynamic,Eigen::Dynamic>,
reference_element::max_variant> _vdm, _inv_vdm;
};
} // namespace rheolef
#endif // _RHEOLEF_BASIS_FEM_PK_LAGRANGE_H
size_type
field::size_type size_type
Definition: branch.cc:425
rheolef::basis_fem_Pk_lagrange
Definition: basis_fem_Pk_lagrange.h:52
rheolef::basis_fem_Pk_lagrange::base
basis_rep< T > base
Definition: basis_fem_Pk_lagrange.h:57
rheolef::basis_fem_Pk_lagrange::_inv_vdm
std::array< Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic >, reference_element::max_variant > _inv_vdm
Definition: basis_fem_Pk_lagrange.h:139
rheolef::basis_fem_Pk_lagrange::~basis_fem_Pk_lagrange
~basis_fem_Pk_lagrange()
Definition: basis_fem_Pk_lagrange.cc:87
rheolef::basis_fem_Pk_lagrange::value_type
T value_type
Definition: basis_fem_Pk_lagrange.h:59
rheolef::basis_fem_Pk_lagrange::_raw_basis
basis_raw_basic< T > _raw_basis
Definition: basis_fem_Pk_lagrange.h:132
rheolef::basis_fem_Pk_lagrange::init_local_first_idof_by_dimension
static void init_local_first_idof_by_dimension(reference_element hat_K, size_type k, std::array< size_type, 5 > &first_idof_by_dimension)
rheolef::basis_fem_Pk_lagrange::vdm
const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > & vdm(reference_element hat_K) const
Definition: basis_fem_Pk_lagrange.cc:128
rheolef::basis_fem_Pk_lagrange::_hat_node
std::array< Eigen::Matrix< point_basic< T >, Eigen::Dynamic, 1 >, reference_element::max_variant > _hat_node
Definition: basis_fem_Pk_lagrange.h:136
rheolef::basis_fem_Pk_lagrange::size_type
reference_element::size_type size_type
Definition: basis_fem_Pk_lagrange.h:58
rheolef::basis_fem_Pk_lagrange::local_idof_on_side
void local_idof_on_side(reference_element hat_K, const side_information_type &sid, Eigen::Matrix< size_type, Eigen::Dynamic, 1 > &loc_idof) const
Definition: basis_fem_Pk_lagrange.cc:220
rheolef::basis_fem_Pk_lagrange::degree
size_type degree() const
Definition: basis_fem_Pk_lagrange.h:69
rheolef::basis_fem_Pk_lagrange::_initialize_cstor_sizes
void _initialize_cstor_sizes() const
Definition: basis_fem_Pk_lagrange.cc:142
rheolef::basis_fem_Pk_lagrange::evaluate
void evaluate(reference_element hat_K, const point_basic< T > &hat_x, Eigen::Matrix< T, Eigen::Dynamic, 1 > &value) const
Definition: basis_fem_Pk_lagrange.cc:177
rheolef::basis_fem_Pk_lagrange::local_ndof_on_side
size_type local_ndof_on_side(reference_element hat_K, const side_information_type &sid) const
Definition: basis_fem_Pk_lagrange.cc:212
rheolef::basis_fem_Pk_lagrange::init_local_ndof_on_subgeo
static void init_local_ndof_on_subgeo(size_type k, std::array< size_type, reference_element::max_variant > &loc_ndof_on_subgeo)
rheolef::basis_fem_Pk_lagrange::grad_evaluate
void grad_evaluate(reference_element hat_K, const point_basic< T > &hat_x, Eigen::Matrix< point_basic< T >, Eigen::Dynamic, 1 > &value) const
Definition: basis_fem_Pk_lagrange.cc:190
rheolef::basis_fem_Pk_lagrange::_vdm
std::array< Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic >, reference_element::max_variant > _vdm
Definition: basis_fem_Pk_lagrange.h:139
rheolef::basis_fem_Pk_lagrange::_compute_dofs
void _compute_dofs(reference_element hat_K, const Eigen::Matrix< T, Eigen::Dynamic, 1 > &f_xnod, Eigen::Matrix< T, Eigen::Dynamic, 1 > &dof) const
Definition: basis_fem_Pk_lagrange.cc:230
rheolef::basis_fem_Pk_lagrange::basis_fem_Pk_lagrange
basis_fem_Pk_lagrange(size_type degree, const basis_option &sopt)
Definition: basis_fem_Pk_lagrange.cc:91
rheolef::basis_fem_Pk_lagrange::hat_node
const Eigen::Matrix< point_basic< T >, Eigen::Dynamic, 1 > & hat_node(reference_element hat_K) const
Definition: basis_fem_Pk_lagrange.cc:121
rheolef::basis_fem_Pk_lagrange::family_name
virtual std::string family_name() const
Definition: basis_fem_Pk_lagrange.h:68
rheolef::basis_fem_Pk_lagrange::initialize_local_first
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, 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, std::array< std::array< size_type, 5 >, reference_element::max_variant > &first_inod_by_dimension)
Definition: basis_fem_Pk_lagrange.cc:41
rheolef::basis_fem_Pk_lagrange::is_nodal
bool is_nodal() const
Definition: basis_fem_Pk_lagrange.cc:115
rheolef::basis_fem_Pk_lagrange::inv_vdm
const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > & inv_vdm(reference_element hat_K) const
Definition: basis_fem_Pk_lagrange.cc:135
rheolef::basis_fem_Pk_lagrange::_initialize_data
void _initialize_data(reference_element hat_K) const
Definition: basis_fem_Pk_lagrange.cc:154
rheolef::basis_option
see the basis_option page for the full documentation
Definition: basis_option.h:93
rheolef::basis_raw_basic
Definition: basis_raw.h:107
rheolef::basis_rep
Definition: basis.h:209
rheolef::basis_rep::is_continuous
bool is_continuous() const
Definition: basis.h:240
rheolef::basis_rep::size_type
reference_element::size_type size_type
Definition: basis.h:214
rheolef::basis_rep::first_idof_by_dimension
size_type first_idof_by_dimension(reference_element hat_K, size_type dim) const
Definition: basis.h:257
rheolef::basis_rep::nnod_on_subgeo
size_type nnod_on_subgeo(size_type map_dim, size_type subgeo_variant) const
Definition: basis.h:254
rheolef::basis_rep::ndof_on_subgeo
size_type ndof_on_subgeo(size_type map_dim, size_type subgeo_variant) const
Definition: basis.h:251
rheolef::basis_rep::first_inod_by_dimension
size_type first_inod_by_dimension(reference_element hat_K, size_type dim) const
Definition: basis.h:260
rheolef::point_basic
Definition: point.h:87
rheolef::reference_element
see the reference_element page for the full documentation
Definition: reference_element.h:66
rheolef::reference_element::max_variant
static const variant_type max_variant
Definition: reference_element.h:82
rheolef::reference_element::size_type
std::vector< int >::size_type size_type
Definition: reference_element.h:71
rheolef::value
rheolef::std value
T
Expr1::float_type T
Definition: field_expr.h:261
rheolef
This file is part of Rheolef.
Definition: compiler_eigen.h:37
rheolef::side_information_type
Definition: reference_element_face_transformation.h:37