]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Enabel VectorTools::interpolate for hp::MappingCollection 10770/head
authorPeter Munch <peterrmuench@gmail.com>
Thu, 30 Jul 2020 19:04:36 +0000 (21:04 +0200)
committerPeter Munch <peterrmuench@gmail.com>
Fri, 31 Jul 2020 04:31:42 +0000 (06:31 +0200)
include/deal.II/numerics/vector_tools_interpolate.h
include/deal.II/numerics/vector_tools_interpolate.templates.h
source/numerics/vector_tools_interpolate.inst.in

index 880f51a8cd18354790a265fe7c344911ca71048d..8ae0ab69caaaab47aad11a023c527cfab236bf30 100644 (file)
@@ -37,6 +37,12 @@ class InterGridMap;
 template <int dim, int spacedim>
 class Mapping;
 
+namespace hp
+{
+  template <int dim, int spacedim>
+  class MappingCollection;
+}
+
 namespace VectorTools
 {
   /**
@@ -56,9 +62,6 @@ namespace VectorTools
    * continuous again.
    *
    * See the general documentation of this namespace for further information.
-   *
-   * @todo The @p mapping argument should be replaced by a
-   * hp::MappingCollection in case of a hp::DoFHandler.
    */
   template <int dim, int spacedim, typename VectorType>
   void
@@ -69,6 +72,19 @@ namespace VectorTools
     VectorType &                                               vec,
     const ComponentMask &component_mask = ComponentMask());
 
+  /**
+   * Same as above but in an hp context.
+   */
+  template <int dim, int spacedim, typename VectorType>
+  void
+  interpolate(
+    const hp::MappingCollection<dim, spacedim> &               mapping,
+    const DoFHandler<dim, spacedim> &                          dof,
+    const Function<spacedim, typename VectorType::value_type> &function,
+    VectorType &                                               vec,
+    const ComponentMask &component_mask = ComponentMask());
+
+
   /**
    * Call the @p interpolate() function above with
    * <tt>mapping=MappingQGeneric1@<dim>@()</tt>.
index eac1231721fafaaaeb99debee493e2061da21648..b9dcad1d97676b7a195830e41a5d19d5c2e03f7e 100644 (file)
@@ -215,11 +215,11 @@ namespace VectorTools
     // A given cell is skipped if function(cell) == nullptr
     template <int dim, int spacedim, typename VectorType, typename T>
     void
-    interpolate(const Mapping<dim, spacedim> &   mapping,
-                const DoFHandler<dim, spacedim> &dof_handler,
-                T &                              function,
-                VectorType &                     vec,
-                const ComponentMask &            component_mask)
+    interpolate(const hp::MappingCollection<dim, spacedim> &mapping_collection,
+                const DoFHandler<dim, spacedim> &           dof_handler,
+                T &                                         function,
+                VectorType &                                vec,
+                const ComponentMask &                       component_mask)
     {
       Assert(component_mask.represents_n_components(
                dof_handler.get_fe_collection().n_components()),
@@ -308,8 +308,6 @@ namespace VectorTools
           support_quadrature.push_back(Quadrature<dim>(points));
         }
 
-      const hp::MappingCollection<dim, spacedim> mapping_collection(mapping);
-
       // An FEValues object to evaluate (generalized) support point
       // locations as well as Jacobians and their inverses.
       // the latter are only needed for Hcurl or Hdiv conforming elements,
@@ -481,7 +479,7 @@ namespace VectorTools
   template <int dim, int spacedim, typename VectorType>
   void
   interpolate(
-    const Mapping<dim, spacedim> &                             mapping,
+    const hp::MappingCollection<dim, spacedim> &               mapping,
     const DoFHandler<dim, spacedim> &                          dof_handler,
     const Function<spacedim, typename VectorType::value_type> &function,
     VectorType &                                               vec,
@@ -507,6 +505,24 @@ namespace VectorTools
 
 
 
+  template <int dim, int spacedim, typename VectorType>
+  void
+  interpolate(
+    const Mapping<dim, spacedim> &                             mapping,
+    const DoFHandler<dim, spacedim> &                          dof_handler,
+    const Function<spacedim, typename VectorType::value_type> &function,
+    VectorType &                                               vec,
+    const ComponentMask &                                      component_mask)
+  {
+    interpolate(hp::MappingCollection<dim, spacedim>(mapping),
+                dof_handler,
+                function,
+                vec,
+                component_mask);
+  }
+
+
+
   template <int dim, int spacedim, typename VectorType>
   void
   interpolate(
@@ -801,8 +817,11 @@ namespace VectorTools
         return nullptr;
     };
 
-    internal::interpolate(
-      mapping, dof_handler, function_map, vec, component_mask);
+    internal::interpolate(hp::MappingCollection<dim, spacedim>(mapping),
+                          dof_handler,
+                          function_map,
+                          vec,
+                          component_mask);
   }
 
   namespace internal
index a99aeb90183fa73437debbc794e3d76998af64e5..d4c0cec8ea4221e88ab0aa078e0fecc7995dc8aa 100644 (file)
@@ -22,6 +22,15 @@ for (VEC : VECTOR_TYPES; deal_II_dimension : DIMENSIONS;
     namespace VectorTools
     \{
 
+      template void
+      interpolate(
+        const hp::MappingCollection<deal_II_dimension, deal_II_space_dimension>
+          &,
+        const DoFHandler<deal_II_dimension, deal_II_space_dimension> &,
+        const Function<deal_II_space_dimension, VEC::value_type> &,
+        VEC &,
+        const ComponentMask &);
+
       template void
       interpolate(
         const Mapping<deal_II_dimension, deal_II_space_dimension> &,

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.