35 unsigned int basis_idx)
const
41 ASSERT(function_space.space_dim()+1 == coords.size());
48 arma::vec vec_value(function_space.n_components());
52 arma::vec f_coords(function_space.space_dim());
53 if (function_space.space_dim() > 0)
54 f_coords = coords.subvec(1,coords.size()-1);
55 for (
unsigned int c=0; c<function_space.n_components(); c++)
56 vec_value[c] = function_space.basis_value(basis_idx, f_coords, c);
57 return dot(coefs, vec_value);
62 ASSERT_PERMANENT(
false).error(
"Dof evaluation not implemented for this type.");
73 template<
unsigned int dim>
75 : function_space_(nullptr)
80 template<
unsigned int dim>
84 is_primitive_ = primitive;
89 template<
unsigned int dim>
92 component_indices_.resize(dofs_.size(), 0);
93 nonzero_components_.resize(dofs_.size(), { true });
97 template<
unsigned int dim>
inline
102 for (
unsigned int i = 0; i < dofs_.size(); i++)
103 for (
unsigned int j = 0; j < dofs_.size(); j++) {
104 M(j, i) = dofs_[i].evaluate(*function_space_, j);
107 node_matrix = arma::inv(M);
111 template<
unsigned int dim>
113 const arma::vec::fixed<dim> &p,
114 const unsigned int comp)
const
116 ASSERT( comp < n_components() );
117 ASSERT( i < dofs_.size()).error(
"Index of basis function is out of range.");
120 for (
unsigned int j=0; j<function_space_->dim(); j++)
121 value += function_space_->basis_value(j, p, comp) * node_matrix(i,j);
126 template<
unsigned int dim>
128 const arma::vec::fixed<dim> &p,
129 const unsigned int comp)
const
131 ASSERT( comp < n_components() );
132 ASSERT( i < dofs_.size()).error(
"Index of basis function is out of range.");
138 for (
unsigned int j=0; j<function_space_->dim(); j++)
139 grad += function_space_->basis_grad(j, p, comp) * node_matrix(i,j);
145 template<
unsigned int dim>
inline
177 template<
unsigned int dim>
190 return spacedim*spacedim;
194 ASSERT(fe_sys !=
nullptr).error(
"Mixed system must be represented by FESystem.");
207 template<
unsigned int dim>
211 for(
auto dof : this->dofs_)
212 points.push_back(dof.coords);
#define ASSERT_PERMANENT(expr)
Allow use shorter versions of macro names if these names is not used with external library.
double evaluate(const FS &function_space, unsigned int basis_idx) const
Evaulate dof for basis function of given function space.
Compound finite element on dim dimensional simplex.
std::vector< unsigned int > get_vector_components() const
std::vector< unsigned int > get_scalar_components() const
std::vector< unsigned int > get_tensor_components() const
Abstract class for the description of a general finite element on a reference simplex in dim dimensio...
unsigned int n_space_components(unsigned int spacedim)
Number of components of FE in a mapped space with dimension spacedim.
virtual UpdateFlags update_each(UpdateFlags flags)
Decides which additional quantities have to be computed for each cell.
virtual std::vector< arma::vec::fixed< dim+1 > > dof_points() const
void init(bool primitive=true, FEType type=FEScalar)
Clears all internal structures.
double shape_value(const unsigned int i, const arma::vec::fixed< dim > &p, const unsigned int comp=0) const
Calculates the value of the comp-th component of the i-th shape function at the point p on the refere...
void setup_components()
Initialize vectors with information about components of basis functions.
virtual void compute_node_matrix()
Initializes the node_matrix for computing the coefficients of the shape functions in the raw basis of...
arma::vec::fixed< dim > shape_grad(const unsigned int i, const arma::vec::fixed< dim > &p, const unsigned int comp=0) const
Calculates the comp-th component of the gradient of the i-th shape function at the point p on the ref...
FiniteElement()
Constructor.
Declaration of class which handles the ordering of degrees of freedom (dof) and mappings between loca...
Class FESystem for compound finite elements.
Class FEValues calculates finite element data on the actual cells such as shape function values,...
Abstract class for description of finite elements.
static constexpr bool value
ArmaMat< double, N, M > mat
Basic definitions of numerical quadrature rules.
UpdateFlags
Enum type UpdateFlags indicates which quantities are to be recomputed on each finite element cell.
@ update_volume_elements
Determinant of the Jacobian.
@ update_values
Shape function values.
@ update_jacobians
Volume element.
@ update_inverse_jacobians
Volume element.
@ update_gradients
Shape function gradients.