Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fast hanging-node algorithm for FE_Q_iso_Q1 #14385

Merged
merged 1 commit into from
Nov 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 8 additions & 3 deletions include/deal.II/matrix_free/hanging_nodes_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <deal.II/dofs/dof_accessor.h>

#include <deal.II/fe/fe_q.h>
#include <deal.II/fe/fe_q_iso_q1.h>
#include <deal.II/fe/fe_tools.h>

#include <deal.II/hp/fe_collection.h>
Expand Down Expand Up @@ -491,9 +492,13 @@ namespace internal
for (unsigned int c = 0;
c < fe_collection[i].element_multiplicity(base_element_index);
++c, ++comp)
if (dim == 1 || dynamic_cast<const FE_Q<dim> *>(
&fe_collection[i].base_element(
base_element_index)) == nullptr)
if (dim == 1 ||
(dynamic_cast<const FE_Q<dim> *>(
&fe_collection[i].base_element(base_element_index)) ==
nullptr &&
dynamic_cast<const FE_Q_iso_Q1<dim> *>(
&fe_collection[i].base_element(base_element_index)) ==
nullptr))
supported_components[i][comp] = false;
else
supported_components[i][comp] = true;
Expand Down
25 changes: 20 additions & 5 deletions include/deal.II/matrix_free/shape_info.templates.h
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,8 @@ namespace internal
}
}

if (dim > 1 && dynamic_cast<const FE_Q<dim> *>(&fe))
if (dim > 1 && (dynamic_cast<const FE_Q<dim> *>(&fe) ||
dynamic_cast<const FE_Q_iso_Q1<dim> *>(&fe)))
{
auto &subface_interpolation_matrix_0 =
univariate_shape_data.subface_interpolation_matrices[0];
Expand All @@ -770,19 +771,33 @@ namespace internal
subface_interpolation_matrix_scalar_0.resize(nn * nn);
subface_interpolation_matrix_scalar_1.resize(nn * nn);

std::vector<Point<1>> fe_q_points = QGaussLobatto<1>(nn).get_points();
const std::vector<Polynomials::Polynomial<double>> poly =
const bool is_feq = dynamic_cast<const FE_Q<dim> *>(&fe) != nullptr;

std::vector<Point<1>> fe_q_points =
is_feq ? QGaussLobatto<1>(nn).get_points() :
QIterated<1>(QTrapezoid<1>(), nn - 1).get_points();

const std::vector<Polynomials::Polynomial<double>> poly_feq =
Polynomials::generate_complete_Lagrange_basis(fe_q_points);

const std::vector<Polynomials::PiecewisePolynomial<double>>
poly_feq_iso_q1 =
Polynomials::generate_complete_Lagrange_basis_on_subdivisions(nn -
1,
1);

for (unsigned int i = 0, c = 0; i < nn; ++i)
for (unsigned int j = 0; j < nn; ++j, ++c)
{
subface_interpolation_matrix_scalar_0[c] =
poly[j].value(0.5 * fe_q_points[i][0]);
is_feq ? poly_feq[j].value(0.5 * fe_q_points[i][0]) :
poly_feq_iso_q1[j].value(0.5 * fe_q_points[i][0]);
subface_interpolation_matrix_0[c] =
subface_interpolation_matrix_scalar_0[c];
subface_interpolation_matrix_scalar_1[c] =
poly[j].value(0.5 + 0.5 * fe_q_points[i][0]);
is_feq ?
poly_feq[j].value(0.5 + 0.5 * fe_q_points[i][0]) :
poly_feq_iso_q1[j].value(0.5 + 0.5 * fe_q_points[i][0]);
subface_interpolation_matrix_1[c] =
subface_interpolation_matrix_scalar_1[c];
}
Expand Down