40 unsigned int degree_sum=0;
47 for(i_dim=0; i_dim <
dim; i_dim++) {
48 if (degree_sum < degree) {
53 degree_sum-=pows[i_dim];
57 if (i_dim == dim)
break;
64 unsigned int comp_index
72 for (
unsigned int j=0; j<this->
space_dim_; j++)
73 v *= pow(point[j], (
int)
powers[i][j]);
80 unsigned int comp_index
88 for (
unsigned int j=0; j<this->
space_dim_; j++)
91 if (
powers[i][j] == 0)
continue;
93 for (
unsigned int k=0; k<this->
space_dim_; k++)
95 grad[j] *= pow(p[k], (
int) (k==j?
powers[i][k]-1:
powers[i][k]));
111 template<
unsigned int dim>
120 this->dofs_.push_back(
Dof(
dim, 0, coords, { 1 },
Value));
130 arma::uvec ubc = arma::zeros<arma::uvec>(
dim+1);
147 while (ubc[c] == 0) c++;
149 if (c ==
dim) finish =
true;
159 for (
auto ubc : uvbc)
166 arma::uvec nonzeros = find(ubc);
168 arma::vec coords = arma::conv_to<arma::vec>::from(ubc);
173 unsigned int n_face_idx = -1;
174 switch (
dim-zeros.first) {
188 this->dofs_.push_back(
Dof(nonzeros.size()-1, n_face_idx, coords, { 1 },
Value));
196 template<
unsigned int dim>
224 template<
unsigned int dim>
229 for (
unsigned int i=0; i<this->
dofs_.size(); i++)
230 this->
dofs_[i].dim = dim;
242 template<
unsigned int dim>
254 arma::vec::fixed<dim> sp;
255 for (
unsigned int sid=0; sid<RefElement<dim>::n_sides; ++sid)
258 for (
unsigned int i=0; i<RefElement<dim>::n_nodes_per_side; ++i)
262 arma::vec::fixed<dim+1> bsp;
263 bsp.subvec(1,dim) = sp;
264 bsp[0] = 1. - arma::sum(sp);
276 template<
unsigned int dim>
288 arma::vec::fixed<dim> sp;
289 for (
unsigned int sid=0; sid<RefElement<dim>::n_sides; ++sid)
292 for (
unsigned int i=0; i<RefElement<dim>::n_nodes_per_side; ++i)
296 arma::vec::fixed<dim+1> bsp;
297 bsp.subvec(1,dim) = sp;
298 bsp[0] = 1. - arma::sum(sp);
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.
PolynomialSpace(unsigned int degree, unsigned int dim)
Constructor.
#define ASSERT_EQ_DBG(a, b)
Definition of comparative assert macro (EQual) only for debug mode.
Discontinuos Crouzeix-Raviart finite element on dim dimensional simplex.
FE_P_disc(unsigned int degree)
Constructor.
static std::pair< unsigned int, unsigned int > zeros_positions(const BaryPoint &barycentric, double tolerance=std::numeric_limits< double >::epsilon()*2)
std::vector< arma::uvec > powers
Coefficients of basis functions.
Discontinuous Lagrangean finite element on dim dimensional simplex.
std::vector< Dof > dofs_
Set of degrees of freedom (functionals) defining the FE.
Definitions of basic Lagrangean finite elements with polynomial shape functions.
unsigned int dim() const override
Dimension of function space (number of basis functions).
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.
FE_P(unsigned int degree)
Constructor.
virtual void compute_node_matrix()
Initializes the node_matrix for computing the coefficients of the shape functions in the raw basis of...
#define ASSERT_LE_DBG(a, b)
Definition of comparative assert macro (Less or Equal) only for debug mode.
std::shared_ptr< FunctionSpace > function_space_
Function space defining the FE.
void setup_components()
Initialize vectors with information about components of basis functions.
Conforming Lagrangean finite element on dim dimensional simplex.
Class RefElement defines numbering of vertices, sides, calculation of normal vectors etc...
unsigned int space_dim_
Space dimension of function arguments (i.e. 1, 2 or 3).
Abstract class for the description of a general finite element on a reference simplex in dim dimensio...
Crouzeix-Raviart finite element on dim dimensional simplex.
const unsigned int degree_
Max. degree of polynomials.