From d4edc2d0413d55fbb63a246e68df652073996059 Mon Sep 17 00:00:00 2001 From: David Wells Date: Fri, 2 Jun 2023 16:08:10 -0400 Subject: [PATCH] Make VectorTools::compute_mean_value() use ReadVector. --- .../numerics/vector_tools_mean_value.h | 44 ++++++++----------- .../vector_tools_mean_value.templates.h | 38 +++++++--------- .../numerics/vector_tools_mean_value.inst.in | 35 +++++++++------ 3 files changed, 57 insertions(+), 60 deletions(-) diff --git a/include/deal.II/numerics/vector_tools_mean_value.h b/include/deal.II/numerics/vector_tools_mean_value.h index c366a22ebc..4282935aaa 100644 --- a/include/deal.II/numerics/vector_tools_mean_value.h +++ b/include/deal.II/numerics/vector_tools_mean_value.h @@ -19,6 +19,8 @@ #include +#include + #include DEAL_II_NAMESPACE_OPEN @@ -161,47 +163,39 @@ namespace VectorTools * finite element function with mean value zero. In fact, it only works for * Lagrangian elements. For all other elements, you will need to compute the * mean value and subtract it right inside the evaluation routine. - * - * @dealiiConceptRequires{concepts::is_dealii_vector_type} */ - template - DEAL_II_CXX20_REQUIRES(concepts::is_dealii_vector_type) - typename VectorType::value_type compute_mean_value( + template + Number + compute_mean_value( const hp::MappingCollection &mapping_collection, const DoFHandler & dof, const hp::QCollection & q_collection, - const VectorType & v, + const ReadVector & v, const unsigned int component); /** * Calls the other compute_mean_value() function, see above, for the non-hp * case. That means, it requires a single FiniteElement, a single Quadrature, * and a single Mapping object. - * - * @dealiiConceptRequires{concepts::is_dealii_vector_type} */ - template - DEAL_II_CXX20_REQUIRES(concepts::is_dealii_vector_type) - typename VectorType::value_type - compute_mean_value(const Mapping & mapping, - const DoFHandler &dof, - const Quadrature & quadrature, - const VectorType & v, - const unsigned int component); + template + Number + compute_mean_value(const Mapping & mapping, + const DoFHandler &dof, + const Quadrature & quadrature, + const ReadVector & v, + const unsigned int component); /** * Call the other compute_mean_value() function, see above, with * mapping=MappingQ@(1). - * - * @dealiiConceptRequires{concepts::is_dealii_vector_type} */ - template - DEAL_II_CXX20_REQUIRES(concepts::is_dealii_vector_type) - typename VectorType::value_type - compute_mean_value(const DoFHandler &dof, - const Quadrature & quadrature, - const VectorType & v, - const unsigned int component); + template + Number + compute_mean_value(const DoFHandler &dof, + const Quadrature & quadrature, + const ReadVector & v, + const unsigned int component); /** @} */ } // namespace VectorTools diff --git a/include/deal.II/numerics/vector_tools_mean_value.templates.h b/include/deal.II/numerics/vector_tools_mean_value.templates.h index 7b3be8aed4..654b3727d1 100644 --- a/include/deal.II/numerics/vector_tools_mean_value.templates.h +++ b/include/deal.II/numerics/vector_tools_mean_value.templates.h @@ -290,17 +290,15 @@ namespace VectorTools - template - DEAL_II_CXX20_REQUIRES(concepts::is_dealii_vector_type) - typename VectorType::value_type compute_mean_value( + template + Number + compute_mean_value( const hp::MappingCollection &mapping_collection, const DoFHandler & dof, const hp::QCollection & q_collection, - const VectorType & v, + const ReadVector & v, const unsigned int component) { - using Number = typename VectorType::value_type; - const hp::FECollection &fe_collection = dof.get_fe_collection(); const unsigned int n_components = fe_collection.n_components(); @@ -371,14 +369,13 @@ namespace VectorTools } - template - DEAL_II_CXX20_REQUIRES(concepts::is_dealii_vector_type) - typename VectorType::value_type - compute_mean_value(const Mapping & mapping, - const DoFHandler &dof, - const Quadrature & quadrature, - const VectorType & v, - const unsigned int component) + template + Number + compute_mean_value(const Mapping & mapping, + const DoFHandler &dof, + const Quadrature & quadrature, + const ReadVector & v, + const unsigned int component) { return compute_mean_value(hp::MappingCollection(mapping), dof, @@ -388,13 +385,12 @@ namespace VectorTools } - template - DEAL_II_CXX20_REQUIRES(concepts::is_dealii_vector_type) - typename VectorType::value_type - compute_mean_value(const DoFHandler &dof, - const Quadrature & quadrature, - const VectorType & v, - const unsigned int component) + template + Number + compute_mean_value(const DoFHandler &dof, + const Quadrature & quadrature, + const ReadVector & v, + const unsigned int component) { return compute_mean_value(get_default_linear_mapping( dof.get_triangulation()), diff --git a/source/numerics/vector_tools_mean_value.inst.in b/source/numerics/vector_tools_mean_value.inst.in index bb9c726e9d..4555c80c3f 100644 --- a/source/numerics/vector_tools_mean_value.inst.in +++ b/source/numerics/vector_tools_mean_value.inst.in @@ -13,35 +13,42 @@ // // --------------------------------------------------------------------- - -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 namespace VectorTools \{ - - template VEC::value_type - compute_mean_value( + template S + compute_mean_value( const Mapping &, const DoFHandler &, const Quadrature &, - const VEC &, + const ReadVector &, const unsigned int); - template VEC::value_type - compute_mean_value( + template S + compute_mean_value( const DoFHandler &, const Quadrature &, - const VEC &, + const ReadVector &, const unsigned int); + \} +#endif + } +for (VEC : VECTOR_TYPES; deal_II_dimension : DIMENSIONS; + deal_II_space_dimension : SPACE_DIMENSIONS) + { +#if deal_II_dimension <= deal_II_space_dimension + namespace VectorTools + \{ template void - add_constant<>(VEC & solution, - const DoFHandler &dof_handler, - const unsigned int component, - const typename VEC::value_type constant_adjustment); + add_constant(VEC &solution, + const DoFHandler + & dof_handler, + const unsigned int component, + const typename VEC::value_type constant_adjustment); \} #endif } -- 2.39.5