From f1171fa81ce6f8ca7e7bf06ef4f48f56d68fbb6a Mon Sep 17 00:00:00 2001 From: David Wells Date: Sat, 13 May 2023 12:41:12 -0400 Subject: [PATCH] Make VectorTools::integrate_difference() use ReadVector. --- .../vector_tools_integrate_difference.h | 92 +++++++------- ...tor_tools_integrate_difference.templates.h | 116 ++++++++---------- .../vector_tools_integrate_difference.inst.in | 50 ++++---- 3 files changed, 120 insertions(+), 138 deletions(-) diff --git a/include/deal.II/numerics/vector_tools_integrate_difference.h b/include/deal.II/numerics/vector_tools_integrate_difference.h index b493bc1e28..e2664e40b1 100644 --- a/include/deal.II/numerics/vector_tools_integrate_difference.h +++ b/include/deal.II/numerics/vector_tools_integrate_difference.h @@ -144,19 +144,17 @@ namespace VectorTools * @dealiiConceptRequires{concepts::is_dealii_vector_type * &&concepts::is_writable_dealii_vector_type} */ - template - DEAL_II_CXX20_REQUIRES(concepts::is_dealii_vector_type && - concepts::is_writable_dealii_vector_type) - void integrate_difference( - const Mapping & mapping, - const DoFHandler & dof, - const InVector & fe_function, - const Function &exact_solution, - OutVector & difference, - const Quadrature & q, - const NormType & norm, - const Function * weight = nullptr, - const double exponent = 2.); + template + DEAL_II_CXX20_REQUIRES(concepts::is_writable_dealii_vector_type) + void integrate_difference(const Mapping & mapping, + const DoFHandler & dof, + const ReadVector & fe_function, + const Function &exact_solution, + OutVector & difference, + const Quadrature & q, + const NormType & norm, + const Function *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 * &&concepts::is_writable_dealii_vector_type} */ - template - DEAL_II_CXX20_REQUIRES(concepts::is_dealii_vector_type && - concepts::is_writable_dealii_vector_type) - void integrate_difference( - const DoFHandler & dof, - const InVector & fe_function, - const Function &exact_solution, - OutVector & difference, - const Quadrature & q, - const NormType & norm, - const Function * weight = nullptr, - const double exponent = 2.); + template + DEAL_II_CXX20_REQUIRES(concepts::is_writable_dealii_vector_type) + void integrate_difference(const DoFHandler & dof, + const ReadVector & fe_function, + const Function &exact_solution, + OutVector & difference, + const Quadrature & q, + const NormType & norm, + const Function *weight = nullptr, + const double exponent = 2.); /** * Same as above for hp. @@ -184,19 +180,17 @@ namespace VectorTools * @dealiiConceptRequires{concepts::is_dealii_vector_type * &&concepts::is_writable_dealii_vector_type} */ - template - DEAL_II_CXX20_REQUIRES(concepts::is_dealii_vector_type && - concepts::is_writable_dealii_vector_type) - void integrate_difference( - const hp::MappingCollection & mapping, - const DoFHandler & dof, - const InVector & fe_function, - const Function &exact_solution, - OutVector & difference, - const hp::QCollection & q, - const NormType & norm, - const Function * weight = nullptr, - const double exponent = 2.); + template + DEAL_II_CXX20_REQUIRES(concepts::is_writable_dealii_vector_type) + void integrate_difference(const hp::MappingCollection &mapping, + const DoFHandler & dof, + const ReadVector & fe_function, + const Function &exact_solution, + OutVector & difference, + const hp::QCollection & q, + const NormType & norm, + const Function *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 * &&concepts::is_writable_dealii_vector_type} */ - template - DEAL_II_CXX20_REQUIRES(concepts::is_dealii_vector_type && - concepts::is_writable_dealii_vector_type) - void integrate_difference( - const DoFHandler & dof, - const InVector & fe_function, - const Function &exact_solution, - OutVector & difference, - const hp::QCollection & q, - const NormType & norm, - const Function * weight = nullptr, - const double exponent = 2.); + template + DEAL_II_CXX20_REQUIRES(concepts::is_writable_dealii_vector_type) + void integrate_difference(const DoFHandler & dof, + const ReadVector & fe_function, + const Function &exact_solution, + OutVector & difference, + const hp::QCollection & q, + const NormType & norm, + const Function *weight = nullptr, + const double exponent = 2.); /** * Take a Vector @p cellwise_error of errors on each cell with diff --git a/include/deal.II/numerics/vector_tools_integrate_difference.templates.h b/include/deal.II/numerics/vector_tools_integrate_difference.templates.h index b36c164049..ef889cad47 100644 --- a/include/deal.II/numerics/vector_tools_integrate_difference.templates.h +++ b/include/deal.II/numerics/vector_tools_integrate_difference.templates.h @@ -431,22 +431,19 @@ namespace VectorTools - template - DEAL_II_CXX20_REQUIRES( - concepts::is_dealii_vector_type - &&concepts::is_writable_dealii_vector_type) + template + DEAL_II_CXX20_REQUIRES(concepts::is_writable_dealii_vector_type) static void do_integrate_difference( - const dealii::hp::MappingCollection & mapping, - const DoFHandler & dof, - const InVector & fe_function, - const Function &exact_solution, - OutVector & difference, - const dealii::hp::QCollection & q, - const NormType & norm, - const Function * weight, - const double exponent_1) + const dealii::hp::MappingCollection &mapping, + const DoFHandler & dof, + const ReadVector & fe_function, + const Function & exact_solution, + OutVector & difference, + const dealii::hp::QCollection & q, + const NormType & norm, + const Function * 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 - DEAL_II_CXX20_REQUIRES(concepts::is_dealii_vector_type && - concepts::is_writable_dealii_vector_type) - void integrate_difference( - const Mapping & mapping, - const DoFHandler & dof, - const InVector & fe_function, - const Function &exact_solution, - OutVector & difference, - const Quadrature & q, - const NormType & norm, - const Function * weight, - const double exponent) + template + DEAL_II_CXX20_REQUIRES(concepts::is_writable_dealii_vector_type) + void integrate_difference(const Mapping & mapping, + const DoFHandler & dof, + const ReadVector & fe_function, + const Function &exact_solution, + OutVector & difference, + const Quadrature & q, + const NormType & norm, + const Function * weight, + const double exponent) { internal::do_integrate_difference(hp::MappingCollection( mapping), @@ -580,18 +575,16 @@ namespace VectorTools } - template - DEAL_II_CXX20_REQUIRES(concepts::is_dealii_vector_type && - concepts::is_writable_dealii_vector_type) - void integrate_difference( - const DoFHandler & dof, - const InVector & fe_function, - const Function &exact_solution, - OutVector & difference, - const Quadrature & q, - const NormType & norm, - const Function * weight, - const double exponent) + template + DEAL_II_CXX20_REQUIRES(concepts::is_writable_dealii_vector_type) + void integrate_difference(const DoFHandler & dof, + const ReadVector & fe_function, + const Function &exact_solution, + OutVector & difference, + const Quadrature & q, + const NormType & norm, + const Function * weight, + const double exponent) { internal::do_integrate_difference( hp::StaticMappingQ1::mapping_collection, @@ -606,19 +599,18 @@ namespace VectorTools } - template - DEAL_II_CXX20_REQUIRES(concepts::is_dealii_vector_type && - concepts::is_writable_dealii_vector_type) + template + DEAL_II_CXX20_REQUIRES(concepts::is_writable_dealii_vector_type) void integrate_difference( - const dealii::hp::MappingCollection & mapping, - const DoFHandler & dof, - const InVector & fe_function, - const Function &exact_solution, - OutVector & difference, - const dealii::hp::QCollection & q, - const NormType & norm, - const Function * weight, - const double exponent) + const dealii::hp::MappingCollection &mapping, + const DoFHandler & dof, + const ReadVector & fe_function, + const Function & exact_solution, + OutVector & difference, + const dealii::hp::QCollection & q, + const NormType & norm, + const Function * weight, + const double exponent) { internal::do_integrate_difference(mapping, dof, @@ -631,18 +623,16 @@ namespace VectorTools exponent); } - template - DEAL_II_CXX20_REQUIRES(concepts::is_dealii_vector_type && - concepts::is_writable_dealii_vector_type) - void integrate_difference( - const DoFHandler & dof, - const InVector & fe_function, - const Function &exact_solution, - OutVector & difference, - const dealii::hp::QCollection & q, - const NormType & norm, - const Function * weight, - const double exponent) + template + DEAL_II_CXX20_REQUIRES(concepts::is_writable_dealii_vector_type) + void integrate_difference(const DoFHandler & dof, + const ReadVector & fe_function, + const Function & exact_solution, + OutVector & difference, + const dealii::hp::QCollection &q, + const NormType & norm, + const Function * weight, + const double exponent) { internal::do_integrate_difference( hp::StaticMappingQ1::mapping_collection, diff --git a/source/numerics/vector_tools_integrate_difference.inst.in b/source/numerics/vector_tools_integrate_difference.inst.in index 2d11cbd6dc..a1dbd44850 100644 --- a/source/numerics/vector_tools_integrate_difference.inst.in +++ b/source/numerics/vector_tools_integrate_difference.inst.in @@ -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_space_dimension>( const Mapping &, const DoFHandler &, - const VEC &, - const Function &, + const ReadVector &, + const Function &, Vector &, const Quadrature &, const NormType &, @@ -38,12 +38,12 @@ for (VEC : VECTOR_TYPES; deal_II_dimension : DIMENSIONS; template void integrate_difference, deal_II_space_dimension>( const DoFHandler &, - const VEC &, - const Function &, + const ReadVector &, + const Function &, Vector &, const Quadrature &, const NormType &, @@ -52,13 +52,13 @@ for (VEC : VECTOR_TYPES; deal_II_dimension : DIMENSIONS; template void integrate_difference, deal_II_space_dimension>( const Mapping &, const DoFHandler &, - const VEC &, - const Function &, + const ReadVector &, + const Function &, Vector &, const Quadrature &, const NormType &, @@ -67,12 +67,12 @@ for (VEC : VECTOR_TYPES; deal_II_dimension : DIMENSIONS; template void integrate_difference, deal_II_space_dimension>( const DoFHandler &, - const VEC &, - const Function &, + const ReadVector &, + const Function &, Vector &, const Quadrature &, const NormType &, @@ -81,14 +81,14 @@ for (VEC : VECTOR_TYPES; deal_II_dimension : DIMENSIONS; template void integrate_difference, deal_II_space_dimension>( const hp::MappingCollection &, const DoFHandler &, - const VEC &, - const Function &, + const ReadVector &, + const Function &, Vector &, const hp::QCollection &, const NormType &, @@ -97,12 +97,12 @@ for (VEC : VECTOR_TYPES; deal_II_dimension : DIMENSIONS; template void integrate_difference, deal_II_space_dimension>( const DoFHandler &, - const VEC &, - const Function &, + const ReadVector &, + const Function &, Vector &, const hp::QCollection &, const NormType &, @@ -111,14 +111,14 @@ for (VEC : VECTOR_TYPES; deal_II_dimension : DIMENSIONS; template void integrate_difference, deal_II_space_dimension>( const hp::MappingCollection &, const DoFHandler &, - const VEC &, - const Function &, + const ReadVector &, + const Function &, Vector &, const hp::QCollection &, const NormType &, @@ -127,12 +127,12 @@ for (VEC : VECTOR_TYPES; deal_II_dimension : DIMENSIONS; template void integrate_difference, deal_II_space_dimension>( const DoFHandler &, - const VEC &, - const Function &, + const ReadVector &, + const Function &, Vector &, const hp::QCollection &, const NormType &, -- 2.39.5