From 0020bbdd4829034325e0caa026a09accccb79a97 Mon Sep 17 00:00:00 2001
From: Simon Sticko <simon@sticko.se>
Date: Fri, 28 May 2021 18:00:42 +0200
Subject: [PATCH] A better assert in
 FE_Q_Base::get_subface_interpolation_matrix

The previous assert checked that the element derived from FE_Q_Base
or FE_SimplexPoly. This isn't right for FE_Bernstein, which derives
from FE_Q_Base, but doesn't have support points. Instead of throwing
ExcInterpolationNotImplemented, using FE_Bernstein resulted in an
exception which was hard to understand. Change the assert so that it
checks if the incoming element has support points on the face and has
the right number of components.
---
 source/fe/fe_q_base.cc | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/source/fe/fe_q_base.cc b/source/fe/fe_q_base.cc
index aed1067735..10ceee4f0a 100644
--- a/source/fe/fe_q_base.cc
+++ b/source/fe/fe_q_base.cc
@@ -632,10 +632,10 @@ FE_Q_Base<dim, spacedim>::get_subface_interpolation_matrix(
          ExcDimensionMismatch(interpolation_matrix.m(),
                               source_fe.n_dofs_per_face(face_no)));
 
-  // see if source is a Q or P element
-  if ((dynamic_cast<const FE_Q_Base<dim, spacedim> *>(&source_fe) != nullptr) ||
-      (dynamic_cast<const FE_SimplexPoly<dim, spacedim> *>(&source_fe) !=
-       nullptr))
+  Assert(source_fe.n_components() == this->n_components(),
+         ExcDimensionMismatch(source_fe.n_components(), this->n_components()));
+
+  if (source_fe.has_face_support_points(face_no))
     {
       // have this test in here since a table of size 2x0 reports its size as
       // 0x0
-- 
2.39.5