]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Make VectorTools::integrate_difference() use ReadVector.
authorDavid Wells <drwells@email.unc.edu>
Sat, 13 May 2023 16:41:12 +0000 (12:41 -0400)
committerDavid Wells <drwells@email.unc.edu>
Sat, 1 Jul 2023 14:22:04 +0000 (10:22 -0400)
include/deal.II/numerics/vector_tools_integrate_difference.h
include/deal.II/numerics/vector_tools_integrate_difference.templates.h
source/numerics/vector_tools_integrate_difference.inst.in

index b493bc1e28db0ce27c611e3365c605632009f83c..e2664e40b1f9252bd4c5d1305d75498c2deeea7b 100644 (file)
@@ -144,19 +144,17 @@ namespace VectorTools
    * @dealiiConceptRequires{concepts::is_dealii_vector_type<InVector>
    *   &&concepts::is_writable_dealii_vector_type<OutVector>}
    */
-  template <int dim, class InVector, class OutVector, int spacedim>
-  DEAL_II_CXX20_REQUIRES(concepts::is_dealii_vector_type<InVector> &&
-                           concepts::is_writable_dealii_vector_type<OutVector>)
-  void integrate_difference(
-    const Mapping<dim, spacedim> &                           mapping,
-    const DoFHandler<dim, spacedim> &                        dof,
-    const InVector &                                         fe_function,
-    const Function<spacedim, typename InVector::value_type> &exact_solution,
-    OutVector &                                              difference,
-    const Quadrature<dim> &                                  q,
-    const NormType &                                         norm,
-    const Function<spacedim, double> *                       weight   = nullptr,
-    const double                                             exponent = 2.);
+  template <int dim, typename Number, class OutVector, int spacedim>
+  DEAL_II_CXX20_REQUIRES(concepts::is_writable_dealii_vector_type<OutVector>)
+  void integrate_difference(const Mapping<dim, spacedim> &    mapping,
+                            const DoFHandler<dim, spacedim> & dof,
+                            const ReadVector<Number> &        fe_function,
+                            const Function<spacedim, Number> &exact_solution,
+                            OutVector &                       difference,
+                            const Quadrature<dim> &           q,
+                            const NormType &                  norm,
+                            const Function<spacedim, double> *weight = nullptr,
+                            const double                      exponent = 2.);
 
   /**
    * Call the integrate_difference() function, see above, with
@@ -165,18 +163,16 @@ namespace VectorTools
    * @dealiiConceptRequires{concepts::is_dealii_vector_type<InVector>
    *   &&concepts::is_writable_dealii_vector_type<OutVector>}
    */
-  template <int dim, class InVector, class OutVector, int spacedim>
-  DEAL_II_CXX20_REQUIRES(concepts::is_dealii_vector_type<InVector> &&
-                           concepts::is_writable_dealii_vector_type<OutVector>)
-  void integrate_difference(
-    const DoFHandler<dim, spacedim> &                        dof,
-    const InVector &                                         fe_function,
-    const Function<spacedim, typename InVector::value_type> &exact_solution,
-    OutVector &                                              difference,
-    const Quadrature<dim> &                                  q,
-    const NormType &                                         norm,
-    const Function<spacedim, double> *                       weight   = nullptr,
-    const double                                             exponent = 2.);
+  template <int dim, typename Number, class OutVector, int spacedim>
+  DEAL_II_CXX20_REQUIRES(concepts::is_writable_dealii_vector_type<OutVector>)
+  void integrate_difference(const DoFHandler<dim, spacedim> & dof,
+                            const ReadVector<Number> &        fe_function,
+                            const Function<spacedim, Number> &exact_solution,
+                            OutVector &                       difference,
+                            const Quadrature<dim> &           q,
+                            const NormType &                  norm,
+                            const Function<spacedim, double> *weight = nullptr,
+                            const double                      exponent = 2.);
 
   /**
    * Same as above for hp.
@@ -184,19 +180,17 @@ namespace VectorTools
    * @dealiiConceptRequires{concepts::is_dealii_vector_type<InVector>
    *   &&concepts::is_writable_dealii_vector_type<OutVector>}
    */
-  template <int dim, class InVector, class OutVector, int spacedim>
-  DEAL_II_CXX20_REQUIRES(concepts::is_dealii_vector_type<InVector> &&
-                           concepts::is_writable_dealii_vector_type<OutVector>)
-  void integrate_difference(
-    const hp::MappingCollection<dim, spacedim> &             mapping,
-    const DoFHandler<dim, spacedim> &                        dof,
-    const InVector &                                         fe_function,
-    const Function<spacedim, typename InVector::value_type> &exact_solution,
-    OutVector &                                              difference,
-    const hp::QCollection<dim> &                             q,
-    const NormType &                                         norm,
-    const Function<spacedim, double> *                       weight   = nullptr,
-    const double                                             exponent = 2.);
+  template <int dim, typename Number, class OutVector, int spacedim>
+  DEAL_II_CXX20_REQUIRES(concepts::is_writable_dealii_vector_type<OutVector>)
+  void integrate_difference(const hp::MappingCollection<dim, spacedim> &mapping,
+                            const DoFHandler<dim, spacedim> &           dof,
+                            const ReadVector<Number> &        fe_function,
+                            const Function<spacedim, Number> &exact_solution,
+                            OutVector &                       difference,
+                            const hp::QCollection<dim> &      q,
+                            const NormType &                  norm,
+                            const Function<spacedim, double> *weight = nullptr,
+                            const double                      exponent = 2.);
 
   /**
    * Call the integrate_difference() function, see above, with
@@ -205,18 +199,16 @@ namespace VectorTools
    * @dealiiConceptRequires{concepts::is_dealii_vector_type<InVector>
    *   &&concepts::is_writable_dealii_vector_type<OutVector>}
    */
-  template <int dim, class InVector, class OutVector, int spacedim>
-  DEAL_II_CXX20_REQUIRES(concepts::is_dealii_vector_type<InVector> &&
-                           concepts::is_writable_dealii_vector_type<OutVector>)
-  void integrate_difference(
-    const DoFHandler<dim, spacedim> &                        dof,
-    const InVector &                                         fe_function,
-    const Function<spacedim, typename InVector::value_type> &exact_solution,
-    OutVector &                                              difference,
-    const hp::QCollection<dim> &                             q,
-    const NormType &                                         norm,
-    const Function<spacedim, double> *                       weight   = nullptr,
-    const double                                             exponent = 2.);
+  template <int dim, typename Number, class OutVector, int spacedim>
+  DEAL_II_CXX20_REQUIRES(concepts::is_writable_dealii_vector_type<OutVector>)
+  void integrate_difference(const DoFHandler<dim, spacedim> & dof,
+                            const ReadVector<Number> &        fe_function,
+                            const Function<spacedim, Number> &exact_solution,
+                            OutVector &                       difference,
+                            const hp::QCollection<dim> &      q,
+                            const NormType &                  norm,
+                            const Function<spacedim, double> *weight = nullptr,
+                            const double                      exponent = 2.);
 
   /**
    * Take a Vector @p cellwise_error of errors on each cell with
index b36c164049a978e684b8a9037f0b2dd03ce46036..ef889cad47416152e02514b6efb6b00d0afab3c9 100644 (file)
@@ -431,22 +431,19 @@ namespace VectorTools
 
 
 
-    template <int dim, int spacedim, class InVector, class OutVector>
-    DEAL_II_CXX20_REQUIRES(
-      concepts::is_dealii_vector_type<InVector>
-        &&concepts::is_writable_dealii_vector_type<OutVector>)
+    template <int dim, int spacedim, typename Number, class OutVector>
+    DEAL_II_CXX20_REQUIRES(concepts::is_writable_dealii_vector_type<OutVector>)
     static void do_integrate_difference(
-      const dealii::hp::MappingCollection<dim, spacedim> &     mapping,
-      const DoFHandler<dim, spacedim> &                        dof,
-      const InVector &                                         fe_function,
-      const Function<spacedim, typename InVector::value_type> &exact_solution,
-      OutVector &                                              difference,
-      const dealii::hp::QCollection<dim> &                     q,
-      const NormType &                                         norm,
-      const Function<spacedim> *                               weight,
-      const double                                             exponent_1)
+      const dealii::hp::MappingCollection<dim, spacedim> &mapping,
+      const DoFHandler<dim, spacedim> &                   dof,
+      const ReadVector<Number> &                          fe_function,
+      const Function<spacedim, Number> &                  exact_solution,
+      OutVector &                                         difference,
+      const dealii::hp::QCollection<dim> &                q,
+      const NormType &                                    norm,
+      const Function<spacedim> *                          weight,
+      const double                                        exponent_1)
     {
-      using Number = typename InVector::value_type;
       // we mark the "exponent" parameter to this function "const" since it is
       // strictly incoming, but we need to set it to something different later
       // on, if necessary, so have a read-write version of it:
@@ -553,19 +550,17 @@ namespace VectorTools
 
 
 
-  template <int dim, class InVector, class OutVector, int spacedim>
-  DEAL_II_CXX20_REQUIRES(concepts::is_dealii_vector_type<InVector> &&
-                           concepts::is_writable_dealii_vector_type<OutVector>)
-  void integrate_difference(
-    const Mapping<dim, spacedim> &                           mapping,
-    const DoFHandler<dim, spacedim> &                        dof,
-    const InVector &                                         fe_function,
-    const Function<spacedim, typename InVector::value_type> &exact_solution,
-    OutVector &                                              difference,
-    const Quadrature<dim> &                                  q,
-    const NormType &                                         norm,
-    const Function<spacedim> *                               weight,
-    const double                                             exponent)
+  template <int dim, typename Number, class OutVector, int spacedim>
+  DEAL_II_CXX20_REQUIRES(concepts::is_writable_dealii_vector_type<OutVector>)
+  void integrate_difference(const Mapping<dim, spacedim> &    mapping,
+                            const DoFHandler<dim, spacedim> & dof,
+                            const ReadVector<Number> &        fe_function,
+                            const Function<spacedim, Number> &exact_solution,
+                            OutVector &                       difference,
+                            const Quadrature<dim> &           q,
+                            const NormType &                  norm,
+                            const Function<spacedim> *        weight,
+                            const double                      exponent)
   {
     internal::do_integrate_difference(hp::MappingCollection<dim, spacedim>(
                                         mapping),
@@ -580,18 +575,16 @@ namespace VectorTools
   }
 
 
-  template <int dim, class InVector, class OutVector, int spacedim>
-  DEAL_II_CXX20_REQUIRES(concepts::is_dealii_vector_type<InVector> &&
-                           concepts::is_writable_dealii_vector_type<OutVector>)
-  void integrate_difference(
-    const DoFHandler<dim, spacedim> &                        dof,
-    const InVector &                                         fe_function,
-    const Function<spacedim, typename InVector::value_type> &exact_solution,
-    OutVector &                                              difference,
-    const Quadrature<dim> &                                  q,
-    const NormType &                                         norm,
-    const Function<spacedim> *                               weight,
-    const double                                             exponent)
+  template <int dim, typename Number, class OutVector, int spacedim>
+  DEAL_II_CXX20_REQUIRES(concepts::is_writable_dealii_vector_type<OutVector>)
+  void integrate_difference(const DoFHandler<dim, spacedim> & dof,
+                            const ReadVector<Number> &        fe_function,
+                            const Function<spacedim, Number> &exact_solution,
+                            OutVector &                       difference,
+                            const Quadrature<dim> &           q,
+                            const NormType &                  norm,
+                            const Function<spacedim> *        weight,
+                            const double                      exponent)
   {
     internal::do_integrate_difference(
       hp::StaticMappingQ1<dim, spacedim>::mapping_collection,
@@ -606,19 +599,18 @@ namespace VectorTools
   }
 
 
-  template <int dim, class InVector, class OutVector, int spacedim>
-  DEAL_II_CXX20_REQUIRES(concepts::is_dealii_vector_type<InVector> &&
-                           concepts::is_writable_dealii_vector_type<OutVector>)
+  template <int dim, typename Number, class OutVector, int spacedim>
+  DEAL_II_CXX20_REQUIRES(concepts::is_writable_dealii_vector_type<OutVector>)
   void integrate_difference(
-    const dealii::hp::MappingCollection<dim, spacedim> &     mapping,
-    const DoFHandler<dim, spacedim> &                        dof,
-    const InVector &                                         fe_function,
-    const Function<spacedim, typename InVector::value_type> &exact_solution,
-    OutVector &                                              difference,
-    const dealii::hp::QCollection<dim> &                     q,
-    const NormType &                                         norm,
-    const Function<spacedim> *                               weight,
-    const double                                             exponent)
+    const dealii::hp::MappingCollection<dim, spacedim> &mapping,
+    const DoFHandler<dim, spacedim> &                   dof,
+    const ReadVector<Number> &                          fe_function,
+    const Function<spacedim, Number> &                  exact_solution,
+    OutVector &                                         difference,
+    const dealii::hp::QCollection<dim> &                q,
+    const NormType &                                    norm,
+    const Function<spacedim> *                          weight,
+    const double                                        exponent)
   {
     internal::do_integrate_difference(mapping,
                                       dof,
@@ -631,18 +623,16 @@ namespace VectorTools
                                       exponent);
   }
 
-  template <int dim, class InVector, class OutVector, int spacedim>
-  DEAL_II_CXX20_REQUIRES(concepts::is_dealii_vector_type<InVector> &&
-                           concepts::is_writable_dealii_vector_type<OutVector>)
-  void integrate_difference(
-    const DoFHandler<dim, spacedim> &                        dof,
-    const InVector &                                         fe_function,
-    const Function<spacedim, typename InVector::value_type> &exact_solution,
-    OutVector &                                              difference,
-    const dealii::hp::QCollection<dim> &                     q,
-    const NormType &                                         norm,
-    const Function<spacedim> *                               weight,
-    const double                                             exponent)
+  template <int dim, typename Number, class OutVector, int spacedim>
+  DEAL_II_CXX20_REQUIRES(concepts::is_writable_dealii_vector_type<OutVector>)
+  void integrate_difference(const DoFHandler<dim, spacedim> &   dof,
+                            const ReadVector<Number> &          fe_function,
+                            const Function<spacedim, Number> &  exact_solution,
+                            OutVector &                         difference,
+                            const dealii::hp::QCollection<dim> &q,
+                            const NormType &                    norm,
+                            const Function<spacedim> *          weight,
+                            const double                        exponent)
   {
     internal::do_integrate_difference(
       hp::StaticMappingQ1<dim, spacedim>::mapping_collection,
index 2d11cbd6dcb063d664f7c2710dba8ec98d730be4..a1dbd44850c3bb7a597ca682c9c3b47ec367f5df 100644 (file)
@@ -14,7 +14,7 @@
 // ---------------------------------------------------------------------
 
 
-for (VEC : VECTOR_TYPES; deal_II_dimension : DIMENSIONS;
+for (S : REAL_AND_COMPLEX_SCALARS; deal_II_dimension : DIMENSIONS;
      deal_II_space_dimension : SPACE_DIMENSIONS)
   {
 #if deal_II_dimension <= deal_II_space_dimension
@@ -23,13 +23,13 @@ for (VEC : VECTOR_TYPES; deal_II_dimension : DIMENSIONS;
 
       template void
       integrate_difference<deal_II_dimension,
-                           VEC,
+                           S,
                            Vector<float>,
                            deal_II_space_dimension>(
         const Mapping<deal_II_dimension, deal_II_space_dimension> &,
         const DoFHandler<deal_II_dimension, deal_II_space_dimension> &,
-        const VEC &,
-        const Function<deal_II_space_dimension, typename VEC::value_type> &,
+        const ReadVector<S> &,
+        const Function<deal_II_space_dimension, S> &,
         Vector<float> &,
         const Quadrature<deal_II_dimension> &,
         const NormType &,
@@ -38,12 +38,12 @@ for (VEC : VECTOR_TYPES; deal_II_dimension : DIMENSIONS;
 
       template void
       integrate_difference<deal_II_dimension,
-                           VEC,
+                           S,
                            Vector<float>,
                            deal_II_space_dimension>(
         const DoFHandler<deal_II_dimension, deal_II_space_dimension> &,
-        const VEC &,
-        const Function<deal_II_space_dimension, typename VEC::value_type> &,
+        const ReadVector<S> &,
+        const Function<deal_II_space_dimension, S> &,
         Vector<float> &,
         const Quadrature<deal_II_dimension> &,
         const NormType &,
@@ -52,13 +52,13 @@ for (VEC : VECTOR_TYPES; deal_II_dimension : DIMENSIONS;
 
       template void
       integrate_difference<deal_II_dimension,
-                           VEC,
+                           S,
                            Vector<double>,
                            deal_II_space_dimension>(
         const Mapping<deal_II_dimension, deal_II_space_dimension> &,
         const DoFHandler<deal_II_dimension, deal_II_space_dimension> &,
-        const VEC &,
-        const Function<deal_II_space_dimension, typename VEC::value_type> &,
+        const ReadVector<S> &,
+        const Function<deal_II_space_dimension, S> &,
         Vector<double> &,
         const Quadrature<deal_II_dimension> &,
         const NormType &,
@@ -67,12 +67,12 @@ for (VEC : VECTOR_TYPES; deal_II_dimension : DIMENSIONS;
 
       template void
       integrate_difference<deal_II_dimension,
-                           VEC,
+                           S,
                            Vector<double>,
                            deal_II_space_dimension>(
         const DoFHandler<deal_II_dimension, deal_II_space_dimension> &,
-        const VEC &,
-        const Function<deal_II_space_dimension, typename VEC::value_type> &,
+        const ReadVector<S> &,
+        const Function<deal_II_space_dimension, S> &,
         Vector<double> &,
         const Quadrature<deal_II_dimension> &,
         const NormType &,
@@ -81,14 +81,14 @@ for (VEC : VECTOR_TYPES; deal_II_dimension : DIMENSIONS;
 
       template void
       integrate_difference<deal_II_dimension,
-                           VEC,
+                           S,
                            Vector<double>,
                            deal_II_space_dimension>(
         const hp::MappingCollection<deal_II_dimension, deal_II_space_dimension>
           &,
         const DoFHandler<deal_II_dimension, deal_II_space_dimension> &,
-        const VEC &,
-        const Function<deal_II_space_dimension, typename VEC::value_type> &,
+        const ReadVector<S> &,
+        const Function<deal_II_space_dimension, S> &,
         Vector<double> &,
         const hp::QCollection<deal_II_dimension> &,
         const NormType &,
@@ -97,12 +97,12 @@ for (VEC : VECTOR_TYPES; deal_II_dimension : DIMENSIONS;
 
       template void
       integrate_difference<deal_II_dimension,
-                           VEC,
+                           S,
                            Vector<double>,
                            deal_II_space_dimension>(
         const DoFHandler<deal_II_dimension, deal_II_space_dimension> &,
-        const VEC &,
-        const Function<deal_II_space_dimension, typename VEC::value_type> &,
+        const ReadVector<S> &,
+        const Function<deal_II_space_dimension, S> &,
         Vector<double> &,
         const hp::QCollection<deal_II_dimension> &,
         const NormType &,
@@ -111,14 +111,14 @@ for (VEC : VECTOR_TYPES; deal_II_dimension : DIMENSIONS;
 
       template void
       integrate_difference<deal_II_dimension,
-                           VEC,
+                           S,
                            Vector<float>,
                            deal_II_space_dimension>(
         const hp::MappingCollection<deal_II_dimension, deal_II_space_dimension>
           &,
         const DoFHandler<deal_II_dimension, deal_II_space_dimension> &,
-        const VEC &,
-        const Function<deal_II_space_dimension, typename VEC::value_type> &,
+        const ReadVector<S> &,
+        const Function<deal_II_space_dimension, S> &,
         Vector<float> &,
         const hp::QCollection<deal_II_dimension> &,
         const NormType &,
@@ -127,12 +127,12 @@ for (VEC : VECTOR_TYPES; deal_II_dimension : DIMENSIONS;
 
       template void
       integrate_difference<deal_II_dimension,
-                           VEC,
+                           S,
                            Vector<float>,
                            deal_II_space_dimension>(
         const DoFHandler<deal_II_dimension, deal_II_space_dimension> &,
-        const VEC &,
-        const Function<deal_II_space_dimension, typename VEC::value_type> &,
+        const ReadVector<S> &,
+        const Function<deal_II_space_dimension, S> &,
         Vector<float> &,
         const hp::QCollection<deal_II_dimension> &,
         const NormType &,

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.