From f254953ff606d6a0137016c4c7b5eece9abcdffa Mon Sep 17 00:00:00 2001
From: Matthias Maier <tamiko@43-1.org>
Date: Fri, 24 Nov 2017 11:27:47 -0600
Subject: [PATCH] add a new assert checking for non-interpolatory base elements

---
 include/deal.II/numerics/vector_tools.h         | 10 ----------
 .../deal.II/numerics/vector_tools.templates.h   | 17 +++++++++++++++++
 2 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/include/deal.II/numerics/vector_tools.h b/include/deal.II/numerics/vector_tools.h
index 669709d97b..fdc24fced4 100644
--- a/include/deal.II/numerics/vector_tools.h
+++ b/include/deal.II/numerics/vector_tools.h
@@ -2981,16 +2981,6 @@ namespace VectorTools
 
   //@}
 
-  /**
-   * Exception
-   */
-  DeclExceptionMsg (ExcNonInterpolatingFE,
-                    "You are attempting an operation that requires the "
-                    "finite element involved to be 'interpolating', i.e., "
-                    "it needs to have support points. The finite element "
-                    "you are using here does not appear to have those for "
-                    "the required components.");
-
   /**
    * Exception
    */
diff --git a/include/deal.II/numerics/vector_tools.templates.h b/include/deal.II/numerics/vector_tools.templates.h
index 2af1e9ec92..65b671e924 100644
--- a/include/deal.II/numerics/vector_tools.templates.h
+++ b/include/deal.II/numerics/vector_tools.templates.h
@@ -442,6 +442,23 @@ namespace VectorTools
 
               if (selected)
                 {
+#ifdef DEBUG
+                  // make sure that all selected base elements are indeed
+                  // interpolatory
+
+                  if (const auto fe_system =
+                        dynamic_cast<const FESystem<dim> *>(&fe[fe_index]))
+                    {
+                      const auto index =
+                        fe_system->system_to_base_index(i).first.first;
+                      Assert(fe_system->base_element(index)
+                             .has_generalized_support_points(),
+                             ExcMessage("The component mask supplied to "
+                                        "VectorTools::interpolate selects a "
+                                        "non-interpolatory element."));
+                    }
+#endif
+
                   // Add local values to the global vectors
                   ::dealii::internal::ElementAccess<VectorType>::add(dof_values[i],
                                                                      dofs_on_cell[i],
-- 
2.39.5