46 template <
int dim,
int spacedim>
48 compute_embedding_matrices(
53 const unsigned int dpc = fe.n_dofs_per_cell();
54 const unsigned int degree = fe.degree;
57 std::unique_ptr<Quadrature<dim>>
q_fine;
59 std::vector<double>(1, 1.));
64 q_fine = std::make_unique<QGauss<dim>>(degree + 1);
65 else if (spacedim == 2)
67 std::make_unique<QAnisotropic<dim>>(
QGauss<1>(degree + 1),
71 std::make_unique<QAnisotropic<dim>>(
QGauss<1>(degree + 1),
77 q_fine = std::make_unique<QGauss<dim>>(degree + 1);
80 std::make_unique<QAnisotropic<dim>>(
QGauss<1>(degree + 1),
85 q_fine = std::make_unique<QGauss<dim>>(degree + 1);
101 const unsigned int nc =
104 for (
unsigned int i = 0; i <
nc; ++i)
118 tr.execute_coarsening_and_refinement();
121 dh.distribute_dofs(fe);
130 const unsigned int n_dofs = dh.n_dofs();
135 std::vector<std::vector<types::global_dof_index>>
child_ldi(
136 nc, std::vector<types::global_dof_index>(fe.n_dofs_per_cell()));
147 for (
unsigned int q = 0;
q <
nq; ++
q)
148 for (
unsigned int i = 0; i <
dpc; ++i)
149 for (
unsigned int j = 0;
j <
dpc; ++
j)
157 for (
unsigned int k = 0;
k < dim; ++
k)
172 for (
unsigned int i = 0; i <
dpc; ++i)
173 for (
unsigned int j = 0;
j <
dpc; ++
j)
177 if (std::fabs(solution(
gdi,
j)) > 1.e-12)
187template <
int dim,
int spacedim>
196 get_riaf_vector(q_degree))
197 , n_bubbles((q_degree <= 1) ? 1 : dim)
200 ExcMessage(
"This element can only be used for polynomial degrees "
201 "greater than zero"));
207 for (
unsigned int d = 0; d < dim; ++d)
209 for (
unsigned int i = 0; i <
n_bubbles; ++i)
216 internal::FE_Q_Bubbles::compute_embedding_matrices(*
this,
226template <
int dim,
int spacedim>
230 Polynomials::generate_complete_Lagrange_basis(points.get_points())),
235 get_riaf_vector(points.size() - 1))
236 , n_bubbles((points.size() - 1 <= 1) ? 1 : dim)
239 ExcMessage(
"This element can only be used for polynomial degrees "
246 for (
unsigned int d = 0; d < dim; ++d)
248 for (
unsigned int i = 0; i <
n_bubbles; ++i)
255 internal::FE_Q_Bubbles::compute_embedding_matrices(*
this,
265template <
int dim,
int spacedim>
275 const unsigned int n_points = this->degree;
276 std::vector<double> points(n_points);
277 const unsigned int dofs_per_cell = this->n_dofs_per_cell();
278 const std::vector<Point<dim>> &unit_support_points =
279 this->unit_support_points;
280 unsigned int index = 0;
283 for (
unsigned int j = 0;
j < dofs_per_cell; ++
j)
285 if ((dim > 1) ? (unit_support_points[
j](1) == 0 &&
286 ((dim > 2) ? unit_support_points[
j](2) == 0 :
true)) :
290 points[index] = unit_support_points[
j](0);
292 points[n_points - 1] = unit_support_points[
j](0);
294 points[index - 1] = unit_support_points[
j](0);
300 Assert(index == n_points || (dim == 1 && index == n_points + n_bubbles),
302 "Could not decode support points in one coordinate direction."));
305 for (
unsigned int j = 0;
j < n_points; ++
j)
306 if (std::fabs(points[
j] -
static_cast<double>(
j) / (this->degree - 1)) >
315 if (this->degree > 3)
317 <<
">(QIterated(QTrapezoid()," << this->degree - 1 <<
"))";
320 <<
">(" << this->degree - 1 <<
")";
327 for (
unsigned int j = 0;
j < n_points; ++
j)
334 namebuf <<
"FE_Q_Bubbles<" << dim <<
">(" << this->degree - 1 <<
")";
336 namebuf <<
"FE_Q_Bubbles<" << dim <<
">(QUnknownNodes(" << this->degree
344template <
int dim,
int spacedim>
345std::unique_ptr<FiniteElement<dim, spacedim>>
348 return std::make_unique<FE_Q_Bubbles<dim, spacedim>>(*this);
353template <
int dim,
int spacedim>
367 this->n_components()));
369 for (
unsigned int i = 0; i < this->n_dofs_per_cell() - 1; ++i)
371 const std::pair<unsigned int, unsigned int> index =
372 this->system_to_component_index(i);
377 for (
unsigned int i = 0; i < n_bubbles; ++i)
383template <
int dim,
int spacedim>
395 (
x_source_fe.get_name().find(
"FE_Q_Bubbles<") == 0) ||
400 this->n_dofs_per_cell()));
415 spacedim>::ExcInterpolationNotImplemented()));
420template <
int dim,
int spacedim>
425 const unsigned int n_bubbles = (
q_deg <= 1 ? 1 : dim);
426 return std::vector<bool>(
n_cont_dofs + n_bubbles,
true);
431template <
int dim,
int spacedim>
432std::vector<unsigned int>
435 std::vector<unsigned int>
dpo(dim + 1, 1U);
436 for (
unsigned int i = 1; i <
dpo.
size(); ++i)
447template <
int dim,
int spacedim>
451 const unsigned int face_index)
const
454 if (
shape_index >= this->n_dofs_per_cell() - n_bubbles)
463template <
int dim,
int spacedim>
466 const unsigned int child,
473 "Prolongation matrices are only available for refined cells!"));
476 Assert(this->prolongation[refinement_case - 1][child].n() != 0,
477 ExcMessage(
"This prolongation matrix has not been computed yet!"));
479 return this->prolongation[refinement_case - 1][child];
484template <
int dim,
int spacedim>
487 const unsigned int child,
494 "Restriction matrices are only available for refined cells!"));
497 Assert(this->restriction[refinement_case - 1][child].n() != 0,
498 ExcMessage(
"This restriction matrix has not been computed yet!"));
501 return this->restriction[refinement_case - 1][child];
506template <
int dim,
int spacedim>
510 const unsigned int codim)
const
539 if (fe_nothing->is_dominating())
554#include "fe_q_bubbles.inst"
void reinit(value_type *starting_element, const std::size_t n_elements)
const unsigned int q_degree
void initialize(const std::vector< Point< 1 > > &support_points_1d)
virtual bool has_support_on_face(const unsigned int shape_index, const unsigned int face_index) const override
virtual bool has_support_on_face(const unsigned int shape_index, const unsigned int face_index) const override
static std::vector< bool > get_riaf_vector(const unsigned int degree)
virtual void get_interpolation_matrix(const FiniteElement< dim, spacedim > &source, FullMatrix< double > &matrix) const override
virtual const FullMatrix< double > & get_restriction_matrix(const unsigned int child, const RefinementCase< dim > &refinement_case) const override
virtual FiniteElementDomination::Domination compare_for_domination(const FiniteElement< dim, spacedim > &fe_other, const unsigned int codim=0) const override final
virtual const FullMatrix< double > & get_prolongation_matrix(const unsigned int child, const RefinementCase< dim > &refinement_case) const override
const unsigned int n_bubbles
virtual void convert_generalized_support_point_values_to_dof_values(const std::vector< Vector< double > > &support_point_values, std::vector< double > &nodal_values) const override
virtual std::unique_ptr< FiniteElement< dim, spacedim > > clone() const override
FE_Q_Bubbles(const unsigned int p)
virtual std::string get_name() const override
static std::vector< unsigned int > get_dpo_vector(const unsigned int degree)
unsigned int n_dofs_per_cell() const
std::vector< std::vector< FullMatrix< double > > > restriction
void reinit_restriction_and_prolongation_matrices(const bool isotropic_restriction_only=false, const bool isotropic_prolongation_only=false)
std::vector< Point< dim > > unit_support_points
std::vector< std::vector< FullMatrix< double > > > prolongation
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
static ::ExceptionBase & ExcNotImplemented()
#define Assert(cond, exc)
static ::ExceptionBase & ExcImpossibleInDim(int arg1)
#define AssertDimension(dim1, dim2)
#define AssertIndexRange(index, range)
static ::ExceptionBase & ExcInternalError()
static ::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
static ::ExceptionBase & ExcMessage(std::string arg1)
#define AssertThrow(cond, exc)
typename ActiveSelector::active_cell_iterator active_cell_iterator
@ update_values
Shape function values.
@ update_JxW_values
Transformed quadrature weights.
@ update_quadrature_points
Transformed quadrature points.
const Mapping< dim, spacedim > & get_default_linear_mapping(const Triangulation< dim, spacedim > &triangulation)
@ either_element_can_dominate
@ other_element_dominates
@ neither_element_dominates
void hyper_cube(Triangulation< dim, spacedim > &tria, const double left=0., const double right=1., const bool colorize=false)
std::string dim_string(const int dim, const int spacedim)
static unsigned int n_children(const RefinementCase< dim > &refinement_case)