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

Work on ShapeInfo::is_supported() #14953

Merged
merged 1 commit into from
Mar 27, 2023
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
15 changes: 14 additions & 1 deletion include/deal.II/matrix_free/shape_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,20 @@ namespace internal
const unsigned int base_element = 0);

/**
* Return which kinds of elements are supported by MatrixFree.
* Return whether an element is supported by MatrixFree.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kronbichler Have I missed any finite elements?

*
* The following scalar elements are supported:
* - FENothing, FE_DGP, and FE_Q_DG0
* - polynomial tensor-product elements based on
* Polynomials::Polynomial (FE_Q, FE_DG_Q, FE_DGQArbitraryNodes,
* FE_DGQHermite, FE_DGQLegendre) or Polynomials::PiecewisePolynomial
* (FE_Q_iso_Q1).
* - elements for simplex, pyramids, and wedges (FE_SimplexP,
* FE_SimplexDGP, FE_PyramidP, FE_PyramidDGP, FE_WedgeP, FE_WedgeDGP)
*
* In the case of vectorial elements, FE_RaviartThomasNodal
* and FESystem with base elements from the scalar elements
* listed above are supported.
*/
template <int dim, int spacedim>
static bool
Expand Down
35 changes: 22 additions & 13 deletions include/deal.II/matrix_free/shape_info.templates.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include <deal.II/fe/fe.h>
#include <deal.II/fe/fe_dgp.h>
#include <deal.II/fe/fe_dgq.h>
#include <deal.II/fe/fe_nothing.h>
#include <deal.II/fe/fe_poly.h>
#include <deal.II/fe/fe_pyramid_p.h>
#include <deal.II/fe/fe_q.h>
Expand Down Expand Up @@ -397,14 +398,12 @@ namespace internal
return;
}
else if (quad_in.is_tensor_product() == false ||
dynamic_cast<const FE_SimplexP<dim> *>(
&fe_in.base_element(base_element_number)) ||
dynamic_cast<const FE_SimplexDGP<dim> *>(
&fe_in.base_element(base_element_number)) ||
dynamic_cast<const FE_WedgeP<dim> *>(
&fe_in.base_element(base_element_number)) ||
dynamic_cast<const FE_PyramidP<dim> *>(
&fe_in.base_element(base_element_number)))
dynamic_cast<const FE_SimplexPoly<dim, dim> *>(
&fe_in.base_element(base_element_number)) != nullptr ||
dynamic_cast<const FE_WedgePoly<dim, dim> *>(
&fe_in.base_element(base_element_number)) != nullptr ||
dynamic_cast<const FE_PyramidPoly<dim, dim> *>(
&fe_in.base_element(base_element_number)) != nullptr)
Comment on lines +401 to +406
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was not correct and not an issue, since the first condition normally is true.

{
// specialization for arbitrary finite elements and quadrature rules
// as needed in the context, e.g., of simplices
Expand Down Expand Up @@ -1238,6 +1237,9 @@ namespace internal
if (dim != spacedim)
return false;

if (dynamic_cast<const FE_RaviartThomasNodal<dim> *>(&fe))
return true;

for (unsigned int base = 0; base < fe.n_base_elements(); ++base)
{
const FiniteElement<dim, spacedim> *fe_ptr = &(fe.base_element(base));
Expand All @@ -1251,13 +1253,17 @@ namespace internal
dynamic_cast<const FE_Poly<dim, spacedim> *>(fe_ptr);
// Simplices are a special case since the polynomial family is not
// indicative of their support
if (dynamic_cast<const FE_SimplexP<dim> *>(fe_poly_ptr) ||
dynamic_cast<const FE_SimplexDGP<dim> *>(fe_poly_ptr) ||
dynamic_cast<const FE_WedgeP<dim> *>(fe_poly_ptr) ||
dynamic_cast<const FE_PyramidP<dim> *>(fe_poly_ptr))
if (dynamic_cast<const FE_SimplexPoly<dim, dim> *>(fe_poly_ptr) !=
nullptr ||
dynamic_cast<const FE_WedgePoly<dim, dim> *>(fe_poly_ptr) !=
nullptr ||
dynamic_cast<const FE_PyramidPoly<dim, dim> *>(fe_poly_ptr) !=
nullptr)
return true;

if (dynamic_cast<const TensorProductPolynomials<dim> *>(
if (dynamic_cast<const TensorProductPolynomials<
dim,
Polynomials::Polynomial<double>> *>(
&fe_poly_ptr->get_poly_space()) == nullptr &&
dynamic_cast<const TensorProductPolynomials<
dim,
Expand All @@ -1269,6 +1275,9 @@ namespace internal
nullptr)
return false;
}
else if (dynamic_cast<const FE_Nothing<dim, spacedim> *>(fe_ptr) !=
nullptr)
return true;
else
return false;
}
Expand Down
4 changes: 2 additions & 2 deletions tests/matrix_free/is_supported_01.output
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ DEAL::FE_FaceP<2>(1) supported by MatrixFree: false
DEAL::FE_FaceQ<2>(1) supported by MatrixFree: false
DEAL::FE_P1NC supported by MatrixFree: false
DEAL::FE_Nedelec<2>(1) supported by MatrixFree: false
DEAL::FE_Nothing<2>() supported by MatrixFree: false
DEAL::FE_Nothing<2>() supported by MatrixFree: true
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 new supported elements :)

DEAL::FE_Q<1,2>(1) supported by MatrixFree: false
DEAL::FE_Q<2>(1) supported by MatrixFree: true
DEAL::FE_Q_Bubbles<2>(1) supported by MatrixFree: false
Expand All @@ -25,5 +25,5 @@ DEAL::FE_Q_Hierarchical<2>(1) supported by MatrixFree: true
DEAL::FE_Q_iso_Q1<2>(1) supported by MatrixFree: true
DEAL::FE_RannacherTurek<2>(0, 2) supported by MatrixFree: false
DEAL::FE_RaviartThomas<2>(1) supported by MatrixFree: false
DEAL::FE_RaviartThomasNodal<2>(1) supported by MatrixFree: false
DEAL::FE_RaviartThomasNodal<2>(1) supported by MatrixFree: true
DEAL::FE_TraceQ<2>(1) supported by MatrixFree: false