35 template<
unsigned int degree,
unsigned int dim>
52 const double basis_value(
unsigned int i,
const arma::vec::fixed<dim> &p)
const;
59 const arma::vec::fixed<dim>
basis_grad(
unsigned int i,
const arma::vec::fixed<dim> &p)
const;
89 template<
unsigned int degree,
unsigned int dim>
108 unsigned int number_of_single_dofs[dim + 1];
114 unsigned int number_of_pairs[dim + 1];
119 unsigned int number_of_triples[dim + 1];
124 unsigned int number_of_sextuples[dim + 1];
144 template <
unsigned int degree,
unsigned int dim,
unsigned int spacedim>
164 double basis_value(
const unsigned int i,
const arma::vec::fixed<dim> &p)
const;
171 arma::vec::fixed<dim>
basis_grad(
const unsigned int i,
const arma::vec::fixed<dim> &p)
const;
176 arma::vec::fixed<dim> basis_vector(
const unsigned int i,
const arma::vec::fixed<dim> &p)
const;
181 arma::mat::fixed<dim,dim> basis_grad_vector(
const unsigned int i,
const arma::vec::fixed<dim> &p)
const;
201 template <
unsigned int degree,
unsigned int dim,
unsigned int spacedim>
222 double basis_value(
const unsigned int i,
const arma::vec::fixed<dim> &p)
const;
229 arma::vec::fixed<dim>
basis_grad(
const unsigned int i,
const arma::vec::fixed<dim> &p)
const;
234 arma::vec::fixed<dim> basis_vector(
const unsigned int i,
const arma::vec::fixed<dim> &p)
const;
239 arma::mat::fixed<dim,dim> basis_grad_vector(
const unsigned int i,
const arma::vec::fixed<dim> &p)
const;
255 template<
unsigned int degree,
unsigned int dim>
266 arma::uvec::fixed<dim> pows;
269 unsigned int degree_sum=0;
277 for(i_dim=0; i_dim < dim; i_dim++) {
278 if (degree_sum < degree) {
283 degree_sum-=pows[i_dim];
287 if (i_dim == dim)
break;
291 template<
unsigned int degree,
unsigned int dim>
298 for (
unsigned int j=0; j<dim; j++)
299 v *= pow(p[j], (
int)
powers[i][j]);
305 template<
unsigned int degree,
unsigned int dim>
310 arma::vec::fixed<dim> grad;
312 for (
unsigned int j=0; j<dim; j++)
315 if (
powers[i][j] == 0)
continue;
317 for (
unsigned int k=0; k<dim; k++)
319 grad[j] *= pow(p[k], (
int) (k==j?
powers[i][k]-1:
powers[i][k]));
335 template<
unsigned int degree,
unsigned int dim,
unsigned int spacedim>
340 for (
int i=0; i<=dim; i++)
342 number_of_dofs += dof_distribution.number_of_single_dofs[i]
343 +2*dof_distribution.number_of_pairs[i]
344 +3*dof_distribution.number_of_triples[i]
345 +6*dof_distribution.number_of_sextuples[i];
347 number_of_single_dofs[i] = dof_distribution.number_of_single_dofs[i];
348 number_of_pairs[i] = dof_distribution.number_of_pairs[i];
349 number_of_triples[i] = dof_distribution.number_of_triples[i];
350 number_of_sextuples[i] = dof_distribution.number_of_sextuples[i];
353 for (
int i=0; i<dof_distribution.unit_support_points.size(); i++)
354 unit_support_points.push_back(dof_distribution.unit_support_points[i]);
358 this->compute_node_matrix();
361 template<
unsigned int degree,
unsigned int dim,
unsigned int spacedim>
364 OLD_ASSERT(i <= number_of_dofs,
"Index of basis function is out of range.");
365 return poly_space.basis_value(i, p);
368 template<
unsigned int degree,
unsigned int dim,
unsigned int spacedim>
371 OLD_ASSERT(i <= number_of_dofs,
"Index of basis function is out of range.");
372 return poly_space.basis_grad(i, p);
375 template<
unsigned int degree,
unsigned int dim,
unsigned int spacedim>
378 OLD_ASSERT(
false,
"basis_vector() may not be called for scalar finite element.");
381 template<
unsigned int degree,
unsigned int dim,
unsigned int spacedim>
384 OLD_ASSERT(
false,
"basis_grad_vector() may not be called for scalar finite element.");
387 template<
unsigned int degree,
unsigned int dim,
unsigned int spacedim>
406 template<
unsigned int degree,
unsigned int dim,
unsigned int spacedim>
411 number_of_dofs += dof_distribution.number_of_dofs;
413 number_of_single_dofs[dim] = number_of_dofs;
415 for (
unsigned int i=0; i<dof_distribution.unit_support_points.size(); i++)
416 unit_support_points.push_back(dof_distribution.unit_support_points[i]);
420 this->compute_node_matrix();
423 template<
unsigned int degree,
unsigned int dim,
unsigned int spacedim>
426 OLD_ASSERT(i <= number_of_dofs,
"Index of basis function is out of range.");
427 return poly_space.basis_value(i, p);
430 template<
unsigned int degree,
unsigned int dim,
unsigned int spacedim>
433 OLD_ASSERT(i <= number_of_dofs,
"Index of basis function is out of range.");
434 return poly_space.basis_grad(i, p);
437 template<
unsigned int degree,
unsigned int dim,
unsigned int spacedim>
440 OLD_ASSERT(
false,
"basis_vector() may not be called for scalar finite element.");
441 return arma::vec::fixed<dim>();
444 template<
unsigned int degree,
unsigned int dim,
unsigned int spacedim>
447 OLD_ASSERT(
false,
"basis_grad_vector() may not be called for scalar finite element.");
448 return arma::mat::fixed<dim,dim>();
451 template<
unsigned int degree,
unsigned int dim,
unsigned int spacedim>
467 #ifndef DOXYGEN_SHOULD_SKIP_THIS arma::vec::fixed< dim > basis_grad(const unsigned int i, const arma::vec::fixed< dim > &p) const
Returns the gradient of the ith basis function at the point p.
Space of polynomial functions.
unsigned int number_of_dofs
Total number of degrees of freedom at one finite element.
PolynomialSpace()
Constructor.
double basis_value(const unsigned int i, const arma::vec::fixed< dim > &p) const
Returns the ith basis function evaluated at the point p.
Discontinuous Lagrangean finite element on dim dimensional simplex.
DofDistribution< degree, dim > dof_distribution
The auxiliary dof distribution.
Global macros to enhance readability and debugging, general constants.
PolynomialSpace< degree, dim > poly_space
The auxiliary polynomial space.
arma::vec::fixed< dim > basis_vector(const unsigned int i, const arma::vec::fixed< dim > &p) const
The vector variant of basis_value must be implemented but may not be used.
virtual ~FE_P_disc()
Destructor.
DofDistribution()
Constructor.
double basis_value(const unsigned int i, const arma::vec::fixed< dim > &p) const
Returns the ith basis function evaluated at the point p.
const arma::vec::fixed< dim > basis_grad(unsigned int i, const arma::vec::fixed< dim > &p) const
Gradient of the i th basis function at point p.
Conforming Lagrangean finite element on dim dimensional simplex.
DofDistribution< degree, dim > dof_distribution
The auxiliary dof distribution.
const double basis_value(unsigned int i, const arma::vec::fixed< dim > &p) const
Value of the i th basis function at point p.
arma::mat::fixed< dim, dim > basis_grad_vector(const unsigned int i, const arma::vec::fixed< dim > &p) const
The vector variant of basis_grad must be implemented but may not be used.
arma::mat::fixed< dim, dim > basis_grad_vector(const unsigned int i, const arma::vec::fixed< dim > &p) const
The vector variant of basis_grad must be implemented but may not be used.
Distribution of dofs for polynomial finite elements.
Abstract class for description of finite elements.
arma::vec::fixed< dim > basis_grad(const unsigned int i, const arma::vec::fixed< dim > &p) const
Returns the gradient of the ith basis function at the point p.
Abstract class for the description of a general finite element on a reference simplex in dim dimensio...
arma::vec::fixed< dim > basis_vector(const unsigned int i, const arma::vec::fixed< dim > &p) const
The vector variant of basis_value must be implemented but may not be used.
std::vector< arma::uvec::fixed< dim > > powers
Coefficients of basis functions.
std::vector< arma::vec::fixed< dim > > unit_support_points
Support points.
PolynomialSpace< degree, dim > poly_space
The auxiliary polynomial space.