185 const bool function_describes_relative_displacement)
195 std::vector<Point<spacedim>> points;
197 const auto mapping_q =
200 if (mapping_q !=
nullptr && this->get_degree() == mapping_q->get_degree())
209 auto &fe_values = fe_values_all.
get();
210 if (fe_values.get() ==
nullptr)
215 std::vector<Point<dim>> quadrature_points;
217 FETools::hierarchic_to_lexicographic_numbering<dim>(
218 this->polynomial_degree))
219 quadrature_points.push_back(quadrature_gl.point(i));
222 fe_values = std::make_unique<FEValues<dim, spacedim>>(
226 fe_values->reinit(cell);
227 points = fe_values->get_quadrature_points();
230 for (
auto &p : points)
231 if (function_describes_relative_displacement)
232 p += transformation_function(cell, p);
234 p = transformation_function(cell, p);
239 uses_level_info =
true;
294 const VectorType &vector,
295 const bool vector_describes_relative_displacement)
302 const unsigned int is_fe_q =
304 const unsigned int is_fe_dgq =
307 const auto lexicographic_to_hierarchic_numbering =
309 FETools::hierarchic_to_lexicographic_numbering<spacedim>(
310 this->get_degree()));
316 const IndexSet locally_relevant_dofs =
319 locally_relevant_dofs,
321 copy_locally_owned_data_from(vector, vector_ghosted);
332 const bool interpolation_of_values_is_needed =
333 ((is_fe_q || is_fe_dgq) && fe.
degree == this->get_degree()) ==
false;
340 const bool is_active_non_artificial_cell =
341 (cell_tria->is_active() == true) &&
342 (cell_tria->is_artificial() == false);
344 const typename DoFHandler<dim, spacedim>::cell_iterator cell_dofs(
345 &cell_tria->get_triangulation(),
350 const auto mapping_q =
351 dynamic_cast<const MappingQ<dim, spacedim> *>(&mapping);
355 ((vector_describes_relative_displacement ||
356 (is_active_non_artificial_cell == false)) &&
357 ((mapping_q != nullptr &&
358 this->get_degree() == mapping_q->get_degree()) ==
361 (is_active_non_artificial_cell && interpolation_of_values_is_needed) )
366 auto &fe_values = fe_values_all.get();
367 if (fe_values.get() == nullptr)
369 const QGaussLobatto<dim> quadrature_gl(this->polynomial_degree +
372 std::vector<Point<dim>> quadrature_points;
374 FETools::hierarchic_to_lexicographic_numbering<dim>(
375 this->polynomial_degree))
376 quadrature_points.push_back(quadrature_gl.point(i));
377 const Quadrature<dim> quadrature(quadrature_points);
379 fe_values = std::make_unique<FEValues<dim, spacedim>>(
381 interpolation_of_values_is_needed ?
383 static_cast<const FiniteElement<dim, spacedim> &>(fe_nothing),
385 update_quadrature_points | update_values);
388 if (interpolation_of_values_is_needed)
389 fe_values->reinit(cell_dofs);
391 fe_values->reinit(cell_tria);
399 if (vector_describes_relative_displacement ||
400 is_active_non_artificial_cell ==
false)
402 if (mapping_q !=
nullptr &&
403 this->get_degree() == mapping_q->get_degree())
404 result = mapping_q->compute_mapping_support_points(cell_tria);
406 result = fe_values_all.
get()->get_quadrature_points();
411 if (is_active_non_artificial_cell ==
false)
417 Utilities::pow<unsigned int>(this->get_degree() + 1, dim));
421 if (interpolation_of_values_is_needed ==
false)
425 std::vector<types::global_dof_index> dof_indices(
427 cell_dofs->get_dof_indices(dof_indices);
429 for (
unsigned int i = 0; i < dof_indices.size(); ++i)
436 if (vector_describes_relative_displacement)
437 result[
id.second][
id.first] +=
438 vector_ghosted(dof_indices[i]);
440 result[
id.second][
id.first] =
441 vector_ghosted(dof_indices[i]);
446 if (vector_describes_relative_displacement)
447 result[lexicographic_to_hierarchic_numbering[
id.second]]
448 [
id.first] += vector_ghosted(dof_indices[i]);
450 result[lexicographic_to_hierarchic_numbering[
id.second]]
451 [
id.first] = vector_ghosted(dof_indices[i]);
461 auto &fe_values = fe_values_all.
get();
463 std::vector<Vector<typename VectorType::value_type>> values(
464 fe_values->n_quadrature_points,
467 fe_values->get_function_values(vector_ghosted, values);
469 for (
unsigned int q = 0; q < fe_values->n_quadrature_points; ++q)
470 for (
unsigned int c = 0; c < spacedim; ++c)
471 if (vector_describes_relative_displacement)
472 result[q][c] += values[q][c];
474 result[q][c] = values[q][c];
480 uses_level_info =
false;
492 const bool vector_describes_relative_displacement)
502 const unsigned int is_fe_q =
504 const unsigned int is_fe_dgq =
507 const auto lexicographic_to_hierarchic_numbering =
509 FETools::hierarchic_to_lexicographic_numbering<spacedim>(
510 this->get_degree()));
520 const IndexSet locally_relevant_dofs =
523 locally_relevant_dofs,
525 copy_locally_owned_data_from(vectors[l], vectors_ghosted[l]);
526 vectors_ghosted[l].update_ghost_values();
537 const bool interpolation_of_values_is_needed =
538 ((is_fe_q || is_fe_dgq) && fe.
degree == this->get_degree()) ==
false;
545 const bool is_non_artificial_cell =
546 cell_tria->level_subdomain_id() != numbers::artificial_subdomain_id;
548 const typename DoFHandler<dim, spacedim>::level_cell_iterator cell_dofs(
549 &cell_tria->get_triangulation(),
554 const auto mapping_q =
555 dynamic_cast<const MappingQ<dim, spacedim> *>(&mapping);
559 ((vector_describes_relative_displacement ||
560 (is_non_artificial_cell == false)) &&
561 ((mapping_q != nullptr &&
562 this->get_degree() == mapping_q->get_degree()) ==
565 (is_non_artificial_cell == true && interpolation_of_values_is_needed) )
570 auto &fe_values = fe_values_all.get();
571 if (fe_values.get() == nullptr)
573 const QGaussLobatto<dim> quadrature_gl(this->polynomial_degree +
576 std::vector<Point<dim>> quadrature_points;
578 FETools::hierarchic_to_lexicographic_numbering<dim>(
579 this->polynomial_degree))
580 quadrature_points.push_back(quadrature_gl.point(i));
581 const Quadrature<dim> quadrature(quadrature_points);
583 fe_values = std::make_unique<FEValues<dim, spacedim>>(
585 interpolation_of_values_is_needed ?
587 static_cast<const FiniteElement<dim, spacedim> &>(fe_nothing),
589 update_quadrature_points | update_values);
592 if (interpolation_of_values_is_needed)
593 fe_values->reinit(cell_dofs);
595 fe_values->reinit(cell_tria);
603 if (vector_describes_relative_displacement ||
604 (is_non_artificial_cell ==
false))
606 if (mapping_q !=
nullptr &&
607 this->get_degree() == mapping_q->get_degree())
608 result = mapping_q->compute_mapping_support_points(cell_tria);
610 result = fe_values_all.
get()->get_quadrature_points();
615 if (is_non_artificial_cell ==
false)
621 Utilities::pow<unsigned int>(this->get_degree() + 1, dim));
625 if (interpolation_of_values_is_needed ==
false)
629 std::vector<types::global_dof_index> dof_indices(
631 cell_dofs->get_mg_dof_indices(dof_indices);
633 for (
unsigned int i = 0; i < dof_indices.size(); ++i)
640 if (vector_describes_relative_displacement)
641 result[
id.second][
id.first] +=
642 vectors_ghosted[cell_tria->level()](dof_indices[i]);
644 result[
id.second][
id.first] =
645 vectors_ghosted[cell_tria->level()](dof_indices[i]);
650 if (vector_describes_relative_displacement)
651 result[lexicographic_to_hierarchic_numbering[
id.second]]
653 vectors_ghosted[cell_tria->level()](dof_indices[i]);
655 result[lexicographic_to_hierarchic_numbering[
id.second]]
657 vectors_ghosted[cell_tria->level()](dof_indices[i]);
667 auto &fe_values = fe_values_all.
get();
669 std::vector<types::global_dof_index> dof_indices(
671 cell_dofs->get_mg_dof_indices(dof_indices);
673 std::vector<typename VectorType::value_type> dof_values(
677 dof_values[i] = vectors_ghosted[cell_tria->level()](dof_indices[i]);
679 for (
unsigned int c = 0; c < spacedim; ++c)
681 for (
unsigned int q = 0; q < fe_values->n_quadrature_points; ++q)
682 if (vector_describes_relative_displacement ==
false && i == 0)
684 dof_values[i] * fe_values->shape_value_component(i, q, c);
687 dof_values[i] * fe_values->shape_value_component(i, q, c);
693 uses_level_info =
true;