57 std::vector<
bool>(dim, true)))
93 std::vector<FullMatrix<double>> face_embeddings(
102 unsigned int target_row = 0;
103 for (
const auto &face_embedding : face_embeddings)
104 for (
unsigned int i = 0; i < face_embedding.m(); ++i)
106 for (
unsigned int j = 0; j < face_embedding.n(); ++j)
125 std::ostringstream namebuf;
127 namebuf <<
"FE_ABF<" << dim <<
">(" << rt_order <<
")";
129 return namebuf.str();
135 std::unique_ptr<FiniteElement<dim, dim>>
138 return std_cxx14::make_unique<FE_ABF<dim>>(rt_order);
154 const unsigned int n_interior_points = cell_quadrature.
size();
156 unsigned int n_face_points = (dim > 1) ? 1 : 0;
158 for (
unsigned int d = 1;
d < dim; ++
d)
159 n_face_points *= deg + 1;
161 this->generalized_support_points.resize(
163 this->generalized_face_support_points.resize(n_face_points);
168 std::vector<AnisotropicPolynomials<dim> *> polynomials_abf(dim);
171 for (
unsigned int dd = 0; dd < dim; ++dd)
173 std::vector<std::vector<Polynomials::Polynomial<double>>> poly(dim);
174 for (
unsigned int d = 0;
d < dim; ++
d)
182 unsigned int current = 0;
186 QGauss<dim - 1> face_points(deg + 1);
190 boundary_weights.reinit(n_face_points, legendre.n());
195 for (
unsigned int k = 0; k < n_face_points; ++k)
197 this->generalized_face_support_points[k] = face_points.point(k);
201 for (
unsigned int i = 0; i < legendre.n(); ++i)
203 boundary_weights(k, i) =
204 face_points.weight(k) *
205 legendre.compute_value(i, face_points.point(k));
211 for (; current < GeometryInfo<dim>::faces_per_cell * n_face_points;
216 this->generalized_support_points[current] = faces.
point(current);
225 boundary_weights_abf.reinit(faces.
size(), polynomials_abf[0]->n() * dim);
226 for (
unsigned int k = 0; k < faces.
size(); ++k)
228 for (
unsigned int i = 0; i < polynomials_abf[0]->n() * dim; ++i)
230 boundary_weights_abf(k, i) =
231 polynomials_abf[i % dim]->compute_value(i / dim,
242 std::vector<AnisotropicPolynomials<dim> *> polynomials(dim);
244 for (
unsigned int dd = 0; dd < dim; ++dd)
246 std::vector<std::vector<Polynomials::Polynomial<double>>> poly(dim);
247 for (
unsigned int d = 0;
d < dim; ++
d)
254 interior_weights.reinit(
257 for (
unsigned int k = 0; k < cell_quadrature.
size(); ++k)
259 for (
unsigned int i = 0; i < polynomials[0]->n(); ++i)
260 for (
unsigned int d = 0;
d < dim; ++
d)
261 interior_weights(k, i,
d) =
262 cell_quadrature.
weight(k) *
263 polynomials[
d]->compute_value(i, cell_quadrature.
point(k));
266 for (
unsigned int d = 0;
d < dim; ++
d)
267 delete polynomials[
d];
273 for (
unsigned int k = 0; k < cell_quadrature.
size(); ++k)
274 this->generalized_support_points[current++] = cell_quadrature.
point(k);
281 polynomials_abf[0]->n() * dim,
285 for (
unsigned int k = 0; k < cell_quadrature.
size(); ++k)
287 for (
unsigned int i = 0; i < polynomials_abf[0]->n() * dim; ++i)
290 polynomials_abf[i % dim]->compute_grad(i / dim,
291 cell_quadrature.
point(k)) *
292 cell_quadrature.
weight(k);
295 for (
unsigned int d = 0;
d < dim; ++
d)
296 interior_weights_abf(k, i,
d) = -poly_grad[
d];
300 for (
unsigned int d = 0;
d < dim; ++
d)
301 delete polynomials_abf[
d];
303 Assert(current == this->generalized_support_points.size(),
326 for (
unsigned int i = 0; i < GeometryInfo<dim>::max_children_per_cell;
328 this->restriction[iso][i].
reinit(0, 0);
332 QGauss<dim - 1> q_base(rt_order + 1);
333 const unsigned int n_face_points = q_base.size();
347 for (
unsigned int k = 0; k < q_face.
size(); ++k)
348 for (
unsigned int i = 0; i < this->dofs_per_cell; ++i)
349 cached_values_face(i, k) = this->shape_value_component(
352 for (
unsigned int sub = 0; sub < GeometryInfo<dim>::max_children_per_face;
376 for (
unsigned int k = 0; k < n_face_points; ++k)
377 for (
unsigned int i_child = 0; i_child < this->dofs_per_cell;
379 for (
unsigned int i_face = 0; i_face < this->dofs_per_face;
387 this->restriction[iso][child](face * this->dofs_per_face +
390 Utilities::fixed_power<dim - 1>(.5) * q_sub.
weight(k) *
391 cached_values_face(i_child, k) *
392 this->shape_value_component(
393 face * this->dofs_per_face + i_face,
406 std::vector<AnisotropicPolynomials<dim> *> polynomials(dim);
407 for (
unsigned int dd = 0; dd < dim; ++dd)
409 std::vector<std::vector<Polynomials::Polynomial<double>>> poly(dim);
410 for (
unsigned int d = 0;
d < dim; ++
d)
418 const unsigned int start_cell_dofs =
425 for (
unsigned int k = 0; k < q_cell.
size(); ++k)
426 for (
unsigned int i = 0; i < this->dofs_per_cell; ++i)
427 for (
unsigned int d = 0;
d < dim; ++
d)
428 cached_values_cell(i, k,
d) =
429 this->shape_value_component(i, q_cell.
point(k),
d);
431 for (
unsigned int child = 0; child < GeometryInfo<dim>::max_children_per_cell;
436 for (
unsigned int k = 0; k < q_sub.
size(); ++k)
437 for (
unsigned int i_child = 0; i_child < this->dofs_per_cell; ++i_child)
438 for (
unsigned int d = 0;
d < dim; ++
d)
439 for (
unsigned int i_weight = 0; i_weight < polynomials[
d]->n();
442 this->restriction[iso][child](start_cell_dofs + i_weight * dim +
445 q_sub.
weight(k) * cached_values_cell(i_child, k,
d) *
446 polynomials[
d]->compute_value(i_weight, q_sub.
point(k));
450 for (
unsigned int d = 0;
d < dim; ++
d)
451 delete polynomials[
d];
457 std::vector<unsigned int>
463 return std::vector<unsigned int>();
471 unsigned int dofs_per_face = 1;
472 for (
int d = 0;
d < dim - 1; ++
d)
473 dofs_per_face *= rt_order + 1;
476 const unsigned int interior_dofs = dim * (rt_order + 1) * dofs_per_face;
478 std::vector<unsigned int> dpo(dim + 1);
479 dpo[dim - 1] = dofs_per_face;
480 dpo[dim] = interior_dofs;
492 const unsigned int face_index)
const
513 return (face_index !=
535 std::vector<double> & nodal_values)
const
537 Assert(support_point_values.size() == this->generalized_support_points.size(),
539 this->generalized_support_points.size()));
543 Assert(nodal_values.size() == this->dofs_per_cell,
546 std::fill(nodal_values.begin(), nodal_values.end(), 0.);
548 const unsigned int n_face_points = boundary_weights.size(0);
550 for (
unsigned int k = 0; k < n_face_points; ++k)
551 for (
unsigned int i = 0; i < boundary_weights.size(1); ++i)
553 nodal_values[i + face * this->dofs_per_face] +=
554 boundary_weights(k, i) *
555 support_point_values[face * n_face_points + k][
GeometryInfo<
556 dim>::unit_normal_direction[face]];
559 const unsigned int start_cell_dofs =
561 const unsigned int start_cell_points =
564 for (
unsigned int k = 0; k < interior_weights.size(0); ++k)
565 for (
unsigned int i = 0; i < interior_weights.size(1); ++i)
566 for (
unsigned int d = 0;
d < dim; ++
d)
567 nodal_values[start_cell_dofs + i * dim +
d] +=
568 interior_weights(k, i,
d) *
569 support_point_values[k + start_cell_points][
d];
571 const unsigned int start_abf_dofs =
572 start_cell_dofs + interior_weights.size(1) * dim;
575 for (
unsigned int k = 0; k < interior_weights_abf.size(0); ++k)
576 for (
unsigned int i = 0; i < interior_weights_abf.size(1); ++i)
577 for (
unsigned int d = 0;
d < dim; ++
d)
578 nodal_values[start_abf_dofs + i] +=
579 interior_weights_abf(k, i,
d) *
580 support_point_values[k + start_cell_points][
d];
586 for (
unsigned int fp = 0; fp < n_face_points; ++fp)
591 face,
false,
false,
false, n_face_points);
592 for (
unsigned int i = 0; i < boundary_weights_abf.size(1); ++i)
593 nodal_values[start_abf_dofs + i] +=
594 n_orient * boundary_weights_abf(k + fp, i) *
595 support_point_values[face * n_face_points + fp][
GeometryInfo<
596 dim>::unit_normal_direction[face]];
601 for (
unsigned int i = 0; i < boundary_weights_abf.size(1); ++i)
602 if (
std::fabs(nodal_values[start_abf_dofs + i]) < 1.0
e-16)
603 nodal_values[start_abf_dofs + i] = 0.0;
619 #include "fe_abf.inst"