From 833dba9f773d86c898b3c0e646c4628f9c256675 Mon Sep 17 00:00:00 2001 From: David Wells Date: Sat, 13 May 2023 10:04:47 -0400 Subject: [PATCH] Make KellyErrorEstimator use ReadVector. --- include/deal.II/numerics/error_estimator.h | 240 ++++++++---------- .../numerics/error_estimator.templates.h | 174 ++++++------- source/numerics/error_estimator.inst.in | 234 ++++++++--------- source/numerics/error_estimator_1d.cc | 126 +++++---- source/numerics/error_estimator_1d.inst.in | 218 ++++++++-------- 5 files changed, 462 insertions(+), 530 deletions(-) diff --git a/include/deal.II/numerics/error_estimator.h b/include/deal.II/numerics/error_estimator.h index ecf4c1fb83..92c67404d8 100644 --- a/include/deal.II/numerics/error_estimator.h +++ b/include/deal.II/numerics/error_estimator.h @@ -336,16 +336,15 @@ public: * cell in the mesh as reported by * parallel::distributed::Triangulation::n_locally_owned_active_cells(). */ - template + template static void estimate( const Mapping & mapping, const DoFHandler &dof, const Quadrature & quadrature, - const std::map *> + const std::map *> & neumann_bc, - const InputVector & solution, + const ReadVector &solution, Vector & error, const ComponentMask & component_mask = ComponentMask(), const Function *coefficients = nullptr, @@ -358,15 +357,14 @@ public: * Call the @p estimate function, see above, with * mapping=MappingQ@(1). */ - template + template static void estimate( const DoFHandler &dof, const Quadrature & quadrature, - const std::map *> + const std::map *> & neumann_bc, - const InputVector & solution, + const ReadVector &solution, Vector & error, const ComponentMask & component_mask = ComponentMask(), const Function *coefficients = nullptr, @@ -388,60 +386,57 @@ public: * construct of vector of references, so we had to use a vector of * pointers.) */ - template + template static void estimate( const Mapping & mapping, const DoFHandler &dof, const Quadrature & quadrature, - const std::map *> - & neumann_bc, - const std::vector &solutions, - std::vector *> & errors, - const ComponentMask & component_mask = ComponentMask(), - const Function * coefficients = nullptr, - const unsigned int n_threads = numbers::invalid_unsigned_int, - const types::subdomain_id subdomain_id = numbers::invalid_subdomain_id, - const types::material_id material_id = numbers::invalid_material_id, - const Strategy strategy = cell_diameter_over_24); + const std::map *> + & neumann_bc, + const std::vector *> &solutions, + std::vector *> & errors, + const ComponentMask & component_mask = ComponentMask(), + const Function *coefficients = nullptr, + const unsigned int n_threads = numbers::invalid_unsigned_int, + const types::subdomain_id subdomain_id = numbers::invalid_subdomain_id, + const types::material_id material_id = numbers::invalid_material_id, + const Strategy strategy = cell_diameter_over_24); /** * Call the @p estimate function, see above, with * mapping=MappingQ@(1). */ - template + template static void estimate( const DoFHandler &dof, const Quadrature & quadrature, - const std::map *> - & neumann_bc, - const std::vector &solutions, - std::vector *> & errors, - const ComponentMask & component_mask = ComponentMask(), - const Function * coefficients = nullptr, - const unsigned int n_threads = numbers::invalid_unsigned_int, - const types::subdomain_id subdomain_id = numbers::invalid_subdomain_id, - const types::material_id material_id = numbers::invalid_material_id, - const Strategy strategy = cell_diameter_over_24); + const std::map *> + & neumann_bc, + const std::vector *> &solutions, + std::vector *> & errors, + const ComponentMask & component_mask = ComponentMask(), + const Function *coefficients = nullptr, + const unsigned int n_threads = numbers::invalid_unsigned_int, + const types::subdomain_id subdomain_id = numbers::invalid_subdomain_id, + const types::material_id material_id = numbers::invalid_material_id, + const Strategy strategy = cell_diameter_over_24); /** * Equivalent to the set of functions above, except that this one takes a * quadrature collection for hp-finite element dof handlers. */ - template + template static void estimate( const Mapping & mapping, const DoFHandler &dof, const hp::QCollection & quadrature, - const std::map *> + const std::map *> & neumann_bc, - const InputVector & solution, + const ReadVector &solution, Vector & error, const ComponentMask & component_mask = ComponentMask(), const Function *coefficients = nullptr, @@ -455,15 +450,14 @@ public: * Equivalent to the set of functions above, except that this one takes a * quadrature collection for hp-finite element dof handlers. */ - template + template static void estimate( const DoFHandler &dof, const hp::QCollection & quadrature, - const std::map *> + const std::map *> & neumann_bc, - const InputVector & solution, + const ReadVector &solution, Vector & error, const ComponentMask & component_mask = ComponentMask(), const Function *coefficients = nullptr, @@ -477,45 +471,43 @@ public: * Equivalent to the set of functions above, except that this one takes a * quadrature collection for hp-finite element dof handlers. */ - template + template static void estimate( const Mapping & mapping, const DoFHandler &dof, const hp::QCollection & quadrature, - const std::map *> - & neumann_bc, - const std::vector &solutions, - std::vector *> & errors, - const ComponentMask & component_mask = ComponentMask(), - const Function * coefficients = nullptr, - const unsigned int n_threads = numbers::invalid_unsigned_int, - const types::subdomain_id subdomain_id = numbers::invalid_subdomain_id, - const types::material_id material_id = numbers::invalid_material_id, - const Strategy strategy = cell_diameter_over_24); + const std::map *> + & neumann_bc, + const std::vector *> &solutions, + std::vector *> & errors, + const ComponentMask & component_mask = ComponentMask(), + const Function *coefficients = nullptr, + const unsigned int n_threads = numbers::invalid_unsigned_int, + const types::subdomain_id subdomain_id = numbers::invalid_subdomain_id, + const types::material_id material_id = numbers::invalid_material_id, + const Strategy strategy = cell_diameter_over_24); /** * Equivalent to the set of functions above, except that this one takes a * quadrature collection for hp-finite element dof handlers. */ - template + template static void estimate( const DoFHandler &dof, const hp::QCollection & quadrature, - const std::map *> - & neumann_bc, - const std::vector &solutions, - std::vector *> & errors, - const ComponentMask & component_mask = ComponentMask(), - const Function * coefficients = nullptr, - const unsigned int n_threads = numbers::invalid_unsigned_int, - const types::subdomain_id subdomain_id = numbers::invalid_subdomain_id, - const types::material_id material_id = numbers::invalid_material_id, - const Strategy strategy = cell_diameter_over_24); + const std::map *> + & neumann_bc, + const std::vector *> &solutions, + std::vector *> & errors, + const ComponentMask & component_mask = ComponentMask(), + const Function *coefficients = nullptr, + const unsigned int n_threads = numbers::invalid_unsigned_int, + const types::subdomain_id subdomain_id = numbers::invalid_subdomain_id, + const types::material_id material_id = numbers::invalid_material_id, + const Strategy strategy = cell_diameter_over_24); /** * Exception @@ -624,16 +616,15 @@ public: * respective parameter for compatibility with the function signature in the * general case. */ - template + template static void estimate( const Mapping<1, spacedim> & mapping, const DoFHandler<1, spacedim> &dof, const Quadrature<0> & quadrature, - const std::map *> + const std::map *> & neumann_bc, - const InputVector & solution, + const ReadVector &solution, Vector & error, const ComponentMask & component_mask = ComponentMask(), const Function *coefficient = nullptr, @@ -648,15 +639,14 @@ public: * Call the @p estimate function, see above, with * mapping=MappingQ1<1>(). */ - template + template static void estimate( const DoFHandler<1, spacedim> &dof, const Quadrature<0> & quadrature, - const std::map *> + const std::map *> & neumann_bc, - const InputVector & solution, + const ReadVector &solution, Vector & error, const ComponentMask & component_mask = ComponentMask(), const Function *coefficients = nullptr, @@ -680,23 +670,22 @@ public: * construct of vector of references, so we had to use a vector of * pointers.) */ - template + template static void estimate( const Mapping<1, spacedim> & mapping, const DoFHandler<1, spacedim> &dof, const Quadrature<0> & quadrature, - const std::map *> - & neumann_bc, - const std::vector &solutions, - std::vector *> & errors, - const ComponentMask & component_mask = ComponentMask(), - const Function * coefficients = nullptr, - const unsigned int n_threads = numbers::invalid_unsigned_int, - const types::subdomain_id subdomain_id = numbers::invalid_subdomain_id, - const types::material_id material_id = numbers::invalid_material_id, - const Strategy strategy = cell_diameter_over_24); + const std::map *> + & neumann_bc, + const std::vector *> &solutions, + std::vector *> & errors, + const ComponentMask & component_mask = ComponentMask(), + const Function *coefficients = nullptr, + const unsigned int n_threads = numbers::invalid_unsigned_int, + const types::subdomain_id subdomain_id = numbers::invalid_subdomain_id, + const types::material_id material_id = numbers::invalid_material_id, + const Strategy strategy = cell_diameter_over_24); @@ -704,22 +693,21 @@ public: * Call the @p estimate function, see above, with * mapping=MappingQ1<1>(). */ - template + template static void estimate( const DoFHandler<1, spacedim> &dof, const Quadrature<0> & quadrature, - const std::map *> - & neumann_bc, - const std::vector &solutions, - std::vector *> & errors, - const ComponentMask & component_mask = ComponentMask(), - const Function * coefficients = nullptr, - const unsigned int n_threads = numbers::invalid_unsigned_int, - const types::subdomain_id subdomain_id = numbers::invalid_subdomain_id, - const types::material_id material_id = numbers::invalid_material_id, - const Strategy strategy = cell_diameter_over_24); + const std::map *> + & neumann_bc, + const std::vector *> &solutions, + std::vector *> & errors, + const ComponentMask & component_mask = ComponentMask(), + const Function *coefficients = nullptr, + const unsigned int n_threads = numbers::invalid_unsigned_int, + const types::subdomain_id subdomain_id = numbers::invalid_subdomain_id, + const types::material_id material_id = numbers::invalid_material_id, + const Strategy strategy = cell_diameter_over_24); @@ -727,16 +715,15 @@ public: * Equivalent to the set of functions above, except that this one takes a * quadrature collection for hp-finite element dof handlers. */ - template + template static void estimate( const Mapping<1, spacedim> & mapping, const DoFHandler<1, spacedim> &dof, const hp::QCollection<0> & quadrature, - const std::map *> + const std::map *> & neumann_bc, - const InputVector & solution, + const ReadVector &solution, Vector & error, const ComponentMask & component_mask = ComponentMask(), const Function *coefficients = nullptr, @@ -751,15 +738,14 @@ public: * Equivalent to the set of functions above, except that this one takes a * quadrature collection for hp-finite element dof handlers. */ - template + template static void estimate( const DoFHandler<1, spacedim> &dof, const hp::QCollection<0> & quadrature, - const std::map *> + const std::map *> & neumann_bc, - const InputVector & solution, + const ReadVector &solution, Vector & error, const ComponentMask & component_mask = ComponentMask(), const Function *coefficients = nullptr, @@ -774,23 +760,22 @@ public: * Equivalent to the set of functions above, except that this one takes a * quadrature collection for hp-finite element dof handlers. */ - template + template static void estimate( const Mapping<1, spacedim> & mapping, const DoFHandler<1, spacedim> &dof, const hp::QCollection<0> & quadrature, - const std::map *> - & neumann_bc, - const std::vector &solutions, - std::vector *> & errors, - const ComponentMask & component_mask = ComponentMask(), - const Function * coefficients = nullptr, - const unsigned int n_threads = numbers::invalid_unsigned_int, - const types::subdomain_id subdomain_id = numbers::invalid_subdomain_id, - const types::material_id material_id = numbers::invalid_material_id, - const Strategy strategy = cell_diameter_over_24); + const std::map *> + & neumann_bc, + const std::vector *> &solutions, + std::vector *> & errors, + const ComponentMask & component_mask = ComponentMask(), + const Function *coefficients = nullptr, + const unsigned int n_threads = numbers::invalid_unsigned_int, + const types::subdomain_id subdomain_id = numbers::invalid_subdomain_id, + const types::material_id material_id = numbers::invalid_material_id, + const Strategy strategy = cell_diameter_over_24); @@ -798,22 +783,21 @@ public: * Equivalent to the set of functions above, except that this one takes a * quadrature collection for hp-finite element dof handlers. */ - template + template static void estimate( const DoFHandler<1, spacedim> &dof, const hp::QCollection<0> & quadrature, - const std::map *> - & neumann_bc, - const std::vector &solutions, - std::vector *> & errors, - const ComponentMask & component_mask = ComponentMask(), - const Function * coefficients = nullptr, - const unsigned int n_threads = numbers::invalid_unsigned_int, - const types::subdomain_id subdomain_id = numbers::invalid_subdomain_id, - const types::material_id material_id = numbers::invalid_material_id, - const Strategy strategy = cell_diameter_over_24); + const std::map *> + & neumann_bc, + const std::vector *> &solutions, + std::vector *> & errors, + const ComponentMask & component_mask = ComponentMask(), + const Function *coefficients = nullptr, + const unsigned int n_threads = numbers::invalid_unsigned_int, + const types::subdomain_id subdomain_id = numbers::invalid_subdomain_id, + const types::material_id material_id = numbers::invalid_material_id, + const Strategy strategy = cell_diameter_over_24); diff --git a/include/deal.II/numerics/error_estimator.templates.h b/include/deal.II/numerics/error_estimator.templates.h index 13594abf08..7a059b6e73 100644 --- a/include/deal.II/numerics/error_estimator.templates.h +++ b/include/deal.II/numerics/error_estimator.templates.h @@ -652,14 +652,13 @@ namespace internal * boundary), or the other side's refinement level is the same as that of * this side, then handle the integration of these both cases together. */ - template + template void integrate_over_regular_face( - const std::vector &solutions, - ParallelData - & parallel_data, + const std::vector *> &solutions, + ParallelData & parallel_data, std::map::face_iterator, - std::vector> &local_face_integrals, + std::vector> & local_face_integrals, const typename DoFHandler::active_cell_iterator &cell, const unsigned int face_no, dealii::hp::FEFaceValues &fe_face_values_cell, @@ -746,14 +745,13 @@ namespace internal * over face @p face_no of @p cell, where the respective neighbor is * refined, so that the integration is a bit more complex. */ - template + template void integrate_over_irregular_face( - const std::vector &solutions, - ParallelData - & parallel_data, + const std::vector *> &solutions, + ParallelData & parallel_data, std::map::face_iterator, - std::vector> &local_face_integrals, + std::vector> & local_face_integrals, const typename DoFHandler::active_cell_iterator &cell, const unsigned int face_no, dealii::hp::FEFaceValues & fe_face_values, @@ -861,15 +859,14 @@ namespace internal * This function is only needed in two or three dimensions. The error * estimator in one dimension is implemented separately. */ - template + template void estimate_one_cell( const typename DoFHandler::active_cell_iterator &cell, - ParallelData - & parallel_data, + ParallelData & parallel_data, std::map::face_iterator, - std::vector> & local_face_integrals, - const std::vector &solutions, + std::vector> & local_face_integrals, + const std::vector *> &solutions, const typename KellyErrorEstimator::Strategy strategy) { const unsigned int n_solution_vectors = solutions.size(); @@ -1001,16 +998,15 @@ namespace internal // the following function is still independent of dimension, but it // calls dimension dependent functions template -template +template void KellyErrorEstimator::estimate( const Mapping & mapping, const DoFHandler &dof_handler, const Quadrature & quadrature, - const std::map *> + const std::map *> & neumann_bc, - const InputVector & solution, + const ReadVector &solution, Vector & error, const ComponentMask & component_mask, const Function *coefficients, @@ -1020,8 +1016,8 @@ KellyErrorEstimator::estimate( const Strategy strategy) { // just pass on to the other function - const std::vector solutions(1, &solution); - std::vector *> errors(1, &error); + const std::vector *> solutions(1, &solution); + std::vector *> errors(1, &error); estimate(mapping, dof_handler, quadrature, @@ -1038,15 +1034,14 @@ KellyErrorEstimator::estimate( template -template +template void KellyErrorEstimator::estimate( const DoFHandler &dof_handler, const Quadrature & quadrature, - const std::map *> + const std::map *> & neumann_bc, - const InputVector & solution, + const ReadVector &solution, Vector & error, const ComponentMask & component_mask, const Function *coefficients, @@ -1071,16 +1066,15 @@ KellyErrorEstimator::estimate( template -template +template void KellyErrorEstimator::estimate( const Mapping & mapping, const DoFHandler &dof_handler, const hp::QCollection & quadrature, - const std::map *> + const std::map *> & neumann_bc, - const InputVector & solution, + const ReadVector &solution, Vector & error, const ComponentMask & component_mask, const Function *coefficients, @@ -1090,8 +1084,8 @@ KellyErrorEstimator::estimate( const Strategy strategy) { // just pass on to the other function - const std::vector solutions(1, &solution); - std::vector *> errors(1, &error); + const std::vector *> solutions(1, &solution); + std::vector *> errors(1, &error); estimate(mapping, dof_handler, quadrature, @@ -1108,15 +1102,14 @@ KellyErrorEstimator::estimate( template -template +template void KellyErrorEstimator::estimate( const DoFHandler &dof_handler, const hp::QCollection & quadrature, - const std::map *> + const std::map *> & neumann_bc, - const InputVector & solution, + const ReadVector &solution, Vector & error, const ComponentMask & component_mask, const Function *coefficients, @@ -1142,19 +1135,18 @@ KellyErrorEstimator::estimate( template -template +template void KellyErrorEstimator::estimate( const Mapping & mapping, const DoFHandler &dof_handler, const hp::QCollection & face_quadratures, - const std::map *> - & neumann_bc, - const std::vector &solutions, - std::vector *> & errors, - const ComponentMask & component_mask, - const Function * coefficients, + const std::map *> + & neumann_bc, + const std::vector *> &solutions, + std::vector *> & errors, + const ComponentMask & component_mask, + const Function * coefficients, const unsigned int, const types::subdomain_id subdomain_id_, const types::material_id material_id, @@ -1222,17 +1214,17 @@ KellyErrorEstimator::estimate( // all the data needed in the error estimator by each of the threads is // gathered in the following structures const hp::MappingCollection mapping_collection(mapping); - const internal::ParallelData - parallel_data(dof_handler.get_fe_collection(), - face_quadratures, - mapping_collection, - (!neumann_bc.empty() || (coefficients != nullptr)), - solutions.size(), - subdomain_id, - material_id, - &neumann_bc, - component_mask, - coefficients); + const internal::ParallelData parallel_data( + dof_handler.get_fe_collection(), + face_quadratures, + mapping_collection, + (!neumann_bc.empty() || (coefficients != nullptr)), + solutions.size(), + subdomain_id, + material_id, + &neumann_bc, + component_mask, + coefficients); std::map::face_iterator, std::vector> sample_local_face_integrals; @@ -1244,10 +1236,9 @@ KellyErrorEstimator::estimate( dof_handler.end()), [&solutions, strategy]( const typename DoFHandler::active_cell_iterator &cell, - internal::ParallelData - & parallel_data, + internal::ParallelData ¶llel_data, std::map::face_iterator, - std::vector> &local_face_integrals) { + std::vector> & local_face_integrals) { internal::estimate_one_cell( cell, parallel_data, local_face_integrals, solutions, strategy); }, @@ -1311,23 +1302,22 @@ KellyErrorEstimator::estimate( template -template +template void KellyErrorEstimator::estimate( const Mapping & mapping, const DoFHandler &dof_handler, const Quadrature & quadrature, - const std::map *> - & neumann_bc, - const std::vector &solutions, - std::vector *> & errors, - const ComponentMask & component_mask, - const Function * coefficients, - const unsigned int n_threads, - const types::subdomain_id subdomain_id, - const types::material_id material_id, - const Strategy strategy) + const std::map *> + & neumann_bc, + const std::vector *> &solutions, + std::vector *> & errors, + const ComponentMask & component_mask, + const Function * coefficients, + const unsigned int n_threads, + const types::subdomain_id subdomain_id, + const types::material_id material_id, + const Strategy strategy) { // forward to the function with the QCollection estimate(mapping, @@ -1346,22 +1336,21 @@ KellyErrorEstimator::estimate( template -template +template void KellyErrorEstimator::estimate( const DoFHandler &dof_handler, const Quadrature & quadrature, - const std::map *> - & neumann_bc, - const std::vector &solutions, - std::vector *> & errors, - const ComponentMask & component_mask, - const Function * coefficients, - const unsigned int n_threads, - const types::subdomain_id subdomain_id, - const types::material_id material_id, - const Strategy strategy) + const std::map *> + & neumann_bc, + const std::vector *> &solutions, + std::vector *> & errors, + const ComponentMask & component_mask, + const Function * coefficients, + const unsigned int n_threads, + const types::subdomain_id subdomain_id, + const types::material_id material_id, + const Strategy strategy) { estimate(get_default_linear_mapping(dof_handler.get_triangulation()), dof_handler, @@ -1380,22 +1369,21 @@ KellyErrorEstimator::estimate( template -template +template void KellyErrorEstimator::estimate( const DoFHandler &dof_handler, const hp::QCollection & quadrature, - const std::map *> - & neumann_bc, - const std::vector &solutions, - std::vector *> & errors, - const ComponentMask & component_mask, - const Function * coefficients, - const unsigned int n_threads, - const types::subdomain_id subdomain_id, - const types::material_id material_id, - const Strategy strategy) + const std::map *> + & neumann_bc, + const std::vector *> &solutions, + std::vector *> & errors, + const ComponentMask & component_mask, + const Function * coefficients, + const unsigned int n_threads, + const types::subdomain_id subdomain_id, + const types::material_id material_id, + const Strategy strategy) { estimate(get_default_linear_mapping(dof_handler.get_triangulation()), dof_handler, diff --git a/source/numerics/error_estimator.inst.in b/source/numerics/error_estimator.inst.in index 2e8413b372..211ffe29f9 100644 --- a/source/numerics/error_estimator.inst.in +++ b/source/numerics/error_estimator.inst.in @@ -22,158 +22,142 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS) #endif } -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 != 1 && deal_II_dimension <= deal_II_space_dimension template void KellyErrorEstimator::estimate< - VEC>( - const Mapping &, - const DoFHandler &, - const Quadrature &, - const std::map *> - &, - const VEC &, - Vector &, - const ComponentMask &, - const Function *, - const unsigned int, - const types::subdomain_id, - const types::material_id, - const KellyErrorEstimator::Strategy); + S>(const Mapping &, + const DoFHandler &, + const Quadrature &, + const std::map *> &, + const ReadVector &, + Vector &, + const ComponentMask &, + const Function *, + const unsigned int, + const types::subdomain_id, + const types::material_id, + const KellyErrorEstimator::Strategy); template void KellyErrorEstimator::estimate< - VEC>( - const DoFHandler &, - const Quadrature &, - const std::map *> - &, - const VEC &, - Vector &, - const ComponentMask &, - const Function *, - const unsigned int, - const types::subdomain_id, - const types::material_id, - const KellyErrorEstimator::Strategy); + S>(const DoFHandler &, + const Quadrature &, + const std::map *> &, + const ReadVector &, + Vector &, + const ComponentMask &, + const Function *, + const unsigned int, + const types::subdomain_id, + const types::material_id, + const KellyErrorEstimator::Strategy); template void KellyErrorEstimator::estimate< - VEC>( - const Mapping &, - const DoFHandler &, - const Quadrature &, - const std::map *> - &, - const std::vector &, - std::vector *> &, - const ComponentMask &, - const Function *, - const unsigned int, - const types::subdomain_id, - const types::material_id, - const KellyErrorEstimator::Strategy); + S>(const Mapping &, + const DoFHandler &, + const Quadrature &, + const std::map *> &, + const std::vector *> &, + std::vector *> &, + const ComponentMask &, + const Function *, + const unsigned int, + const types::subdomain_id, + const types::material_id, + const KellyErrorEstimator::Strategy); template void KellyErrorEstimator::estimate< - VEC>( - const DoFHandler &, - const Quadrature &, - const std::map *> - &, - const std::vector &, - std::vector *> &, - const ComponentMask &, - const Function *, - const unsigned int, - const types::subdomain_id, - const types::material_id, - const KellyErrorEstimator::Strategy); + S>(const DoFHandler &, + const Quadrature &, + const std::map *> &, + const std::vector *> &, + std::vector *> &, + const ComponentMask &, + const Function *, + const unsigned int, + const types::subdomain_id, + const types::material_id, + const KellyErrorEstimator::Strategy); template void KellyErrorEstimator::estimate< - VEC>( - const Mapping &, - const DoFHandler &, - const hp::QCollection &, - const std::map *> - &, - const VEC &, - Vector &, - const ComponentMask &, - const Function *, - const unsigned int, - const types::subdomain_id, - const types::material_id, - const KellyErrorEstimator::Strategy); + S>(const Mapping &, + const DoFHandler &, + const hp::QCollection &, + const std::map *> &, + const ReadVector &, + Vector &, + const ComponentMask &, + const Function *, + const unsigned int, + const types::subdomain_id, + const types::material_id, + const KellyErrorEstimator::Strategy); template void KellyErrorEstimator::estimate< - VEC>( - const DoFHandler &, - const hp::QCollection &, - const std::map *> - &, - const VEC &, - Vector &, - const ComponentMask &, - const Function *, - const unsigned int, - const types::subdomain_id, - const types::material_id, - const KellyErrorEstimator::Strategy); + S>(const DoFHandler &, + const hp::QCollection &, + const std::map *> &, + const ReadVector &, + Vector &, + const ComponentMask &, + const Function *, + const unsigned int, + const types::subdomain_id, + const types::material_id, + const KellyErrorEstimator::Strategy); template void KellyErrorEstimator::estimate< - VEC>( - const Mapping &, - const DoFHandler &, - const hp::QCollection &, - const std::map *> - &, - const std::vector &, - std::vector *> &, - const ComponentMask &, - const Function *, - const unsigned int, - const types::subdomain_id, - const types::material_id, - const KellyErrorEstimator::Strategy); + S>(const Mapping &, + const DoFHandler &, + const hp::QCollection &, + const std::map *> &, + const std::vector *> &, + std::vector *> &, + const ComponentMask &, + const Function *, + const unsigned int, + const types::subdomain_id, + const types::material_id, + const KellyErrorEstimator::Strategy); template void KellyErrorEstimator::estimate< - VEC>( - const DoFHandler &, - const hp::QCollection &, - const std::map *> - &, - const std::vector &, - std::vector *> &, - const ComponentMask &, - const Function *, - const unsigned int, - const types::subdomain_id, - const types::material_id, - const KellyErrorEstimator::Strategy); + S>(const DoFHandler &, + const hp::QCollection &, + const std::map *> &, + const std::vector *> &, + std::vector *> &, + const ComponentMask &, + const Function *, + const unsigned int, + const types::subdomain_id, + const types::material_id, + const KellyErrorEstimator::Strategy); #endif } diff --git a/source/numerics/error_estimator_1d.cc b/source/numerics/error_estimator_1d.cc index da43a3157c..4ad0d8302a 100644 --- a/source/numerics/error_estimator_1d.cc +++ b/source/numerics/error_estimator_1d.cc @@ -56,16 +56,15 @@ DEAL_II_NAMESPACE_OPEN template -template +template void KellyErrorEstimator<1, spacedim>::estimate( const Mapping<1, spacedim> & mapping, const DoFHandler<1, spacedim> &dof_handler, const Quadrature<0> & quadrature, - const std::map *> + const std::map *> & neumann_bc, - const InputVector & solution, + const ReadVector &solution, Vector & error, const ComponentMask & component_mask, const Function *coefficients, @@ -75,8 +74,8 @@ KellyErrorEstimator<1, spacedim>::estimate( const Strategy strategy) { // just pass on to the other function - const std::vector solutions(1, &solution); - std::vector *> errors(1, &error); + const std::vector *> solutions(1, &solution); + std::vector *> errors(1, &error); estimate(mapping, dof_handler, quadrature, @@ -94,15 +93,14 @@ KellyErrorEstimator<1, spacedim>::estimate( template -template +template void KellyErrorEstimator<1, spacedim>::estimate( const DoFHandler<1, spacedim> &dof_handler, const Quadrature<0> & quadrature, - const std::map *> + const std::map *> & neumann_bc, - const InputVector & solution, + const ReadVector &solution, Vector & error, const ComponentMask & component_mask, const Function *coefficients, @@ -129,22 +127,21 @@ KellyErrorEstimator<1, spacedim>::estimate( template -template +template void KellyErrorEstimator<1, spacedim>::estimate( const DoFHandler<1, spacedim> &dof_handler, const Quadrature<0> & quadrature, - const std::map *> - & neumann_bc, - const std::vector &solutions, - std::vector *> & errors, - const ComponentMask & component_mask, - const Function * coefficients, - const unsigned int n_threads, - const types::subdomain_id subdomain_id, - const types::material_id material_id, - const Strategy strategy) + const std::map *> + & neumann_bc, + const std::vector *> &solutions, + std::vector *> & errors, + const ComponentMask & component_mask, + const Function * coefficients, + const unsigned int n_threads, + const types::subdomain_id subdomain_id, + const types::material_id material_id, + const Strategy strategy) { const auto reference_cell = ReferenceCells::Line; estimate(reference_cell.template get_default_linear_mapping<1, spacedim>(), @@ -164,16 +161,15 @@ KellyErrorEstimator<1, spacedim>::estimate( template -template +template void KellyErrorEstimator<1, spacedim>::estimate( const Mapping<1, spacedim> & mapping, const DoFHandler<1, spacedim> &dof_handler, const hp::QCollection<0> & quadrature, - const std::map *> + const std::map *> & neumann_bc, - const InputVector & solution, + const ReadVector &solution, Vector & error, const ComponentMask & component_mask, const Function *coefficients, @@ -183,8 +179,8 @@ KellyErrorEstimator<1, spacedim>::estimate( const Strategy strategy) { // just pass on to the other function - const std::vector solutions(1, &solution); - std::vector *> errors(1, &error); + const std::vector *> solutions(1, &solution); + std::vector *> errors(1, &error); estimate(mapping, dof_handler, quadrature, @@ -202,15 +198,14 @@ KellyErrorEstimator<1, spacedim>::estimate( template -template +template void KellyErrorEstimator<1, spacedim>::estimate( const DoFHandler<1, spacedim> &dof_handler, const hp::QCollection<0> & quadrature, - const std::map *> + const std::map *> & neumann_bc, - const InputVector & solution, + const ReadVector &solution, Vector & error, const ComponentMask & component_mask, const Function *coefficients, @@ -237,22 +232,21 @@ KellyErrorEstimator<1, spacedim>::estimate( template -template +template void KellyErrorEstimator<1, spacedim>::estimate( const DoFHandler<1, spacedim> &dof_handler, const hp::QCollection<0> & quadrature, - const std::map *> - & neumann_bc, - const std::vector &solutions, - std::vector *> & errors, - const ComponentMask & component_mask, - const Function * coefficients, - const unsigned int n_threads, - const types::subdomain_id subdomain_id, - const types::material_id material_id, - const Strategy strategy) + const std::map *> + & neumann_bc, + const std::vector *> &solutions, + std::vector *> & errors, + const ComponentMask & component_mask, + const Function * coefficients, + const unsigned int n_threads, + const types::subdomain_id subdomain_id, + const types::material_id material_id, + const Strategy strategy) { const auto reference_cell = ReferenceCells::Line; estimate(reference_cell.template get_default_linear_mapping<1, spacedim>(), @@ -272,26 +266,25 @@ KellyErrorEstimator<1, spacedim>::estimate( template -template +template void KellyErrorEstimator<1, spacedim>::estimate( const Mapping<1, spacedim> & mapping, const DoFHandler<1, spacedim> &dof_handler, const hp::QCollection<0> &, - const std::map *> - & neumann_bc, - const std::vector &solutions, - std::vector *> & errors, - const ComponentMask & component_mask, - const Function * coefficient, + const std::map *> + & neumann_bc, + const std::vector *> &solutions, + std::vector *> & errors, + const ComponentMask & component_mask, + const Function * coefficient, const unsigned int, const types::subdomain_id subdomain_id_, const types::material_id material_id, const Strategy strategy) { AssertThrow(strategy == cell_diameter_over_24, ExcNotImplemented()); - using number = typename InputVector::value_type; + using number = Number; types::subdomain_id subdomain_id = numbers::invalid_subdomain_id; if (const auto *triangulation = dynamic_cast< const parallel::DistributedTriangulationBase<1, spacedim> *>( @@ -463,7 +456,7 @@ KellyErrorEstimator<1, spacedim>::estimate( { if (n_components == 1) { - const typename InputVector::value_type v = + const Number v = neumann_bc.find(n)->second->value(cell->vertex(n)); for (unsigned int s = 0; s < n_solution_vectors; ++s) @@ -471,7 +464,7 @@ KellyErrorEstimator<1, spacedim>::estimate( } else { - Vector v(n_components); + Vector v(n_components); neumann_bc.find(n)->second->vector_value(cell->vertex(n), v); @@ -530,23 +523,22 @@ KellyErrorEstimator<1, spacedim>::estimate( template -template +template void KellyErrorEstimator<1, spacedim>::estimate( const Mapping<1, spacedim> & mapping, const DoFHandler<1, spacedim> &dof_handler, const Quadrature<0> & quadrature, - const std::map *> - & neumann_bc, - const std::vector &solutions, - std::vector *> & errors, - const ComponentMask & component_mask, - const Function * coefficients, - const unsigned int n_threads, - const types::subdomain_id subdomain_id, - const types::material_id material_id, - const Strategy strategy) + const std::map *> + & neumann_bc, + const std::vector *> &solutions, + std::vector *> & errors, + const ComponentMask & component_mask, + const Function * coefficients, + const unsigned int n_threads, + const types::subdomain_id subdomain_id, + const types::material_id material_id, + const Strategy strategy) { const hp::QCollection<0> quadrature_collection(quadrature); estimate(mapping, diff --git a/source/numerics/error_estimator_1d.inst.in b/source/numerics/error_estimator_1d.inst.in index 23ed005479..ea3f510579 100644 --- a/source/numerics/error_estimator_1d.inst.in +++ b/source/numerics/error_estimator_1d.inst.in @@ -14,150 +14,134 @@ // --------------------------------------------------------------------- -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 == 1 && deal_II_dimension <= deal_II_space_dimension template void KellyErrorEstimator::estimate< - VEC>( - const Mapping &, - const DoFHandler &, - const Quadrature &, - const std::map *> - &, - const VEC &, - Vector &, - const ComponentMask &, - const Function *, - const unsigned int, - const types::subdomain_id, - const types::material_id, - const Strategy); + S>(const Mapping &, + const DoFHandler &, + const Quadrature &, + const std::map *> &, + const ReadVector &, + Vector &, + const ComponentMask &, + const Function *, + const unsigned int, + const types::subdomain_id, + const types::material_id, + const Strategy); template void KellyErrorEstimator::estimate< - VEC>( - const DoFHandler &, - const Quadrature &, - const std::map *> - &, - const VEC &, - Vector &, - const ComponentMask &, - const Function *, - const unsigned int, - const types::subdomain_id, - const types::material_id, - const Strategy); + S>(const DoFHandler &, + const Quadrature &, + const std::map *> &, + const ReadVector &, + Vector &, + const ComponentMask &, + const Function *, + const unsigned int, + const types::subdomain_id, + const types::material_id, + const Strategy); template void KellyErrorEstimator::estimate< - VEC>( - const Mapping &, - const DoFHandler &, - const Quadrature &, - const std::map *> - &, - const std::vector &, - std::vector *> &, - const ComponentMask &, - const Function *, - const unsigned int, - const types::subdomain_id, - const types::material_id, - const Strategy); + S>(const Mapping &, + const DoFHandler &, + const Quadrature &, + const std::map *> &, + const std::vector *> &, + std::vector *> &, + const ComponentMask &, + const Function *, + const unsigned int, + const types::subdomain_id, + const types::material_id, + const Strategy); template void KellyErrorEstimator::estimate< - VEC>( - const DoFHandler &, - const Quadrature &, - const std::map *> - &, - const std::vector &, - std::vector *> &, - const ComponentMask &, - const Function *, - const unsigned int, - const types::subdomain_id, - const types::material_id, - const Strategy); + S>(const DoFHandler &, + const Quadrature &, + const std::map *> &, + const std::vector *> &, + std::vector *> &, + const ComponentMask &, + const Function *, + const unsigned int, + const types::subdomain_id, + const types::material_id, + const Strategy); template void KellyErrorEstimator::estimate< - VEC>( - const Mapping &, - const DoFHandler &, - const hp::QCollection &, - const std::map *> - &, - const VEC &, - Vector &, - const ComponentMask &, - const Function *, - const unsigned int, - const types::subdomain_id, - const types::material_id, - const Strategy); + S>(const Mapping &, + const DoFHandler &, + const hp::QCollection &, + const std::map *> &, + const ReadVector &, + Vector &, + const ComponentMask &, + const Function *, + const unsigned int, + const types::subdomain_id, + const types::material_id, + const Strategy); template void KellyErrorEstimator::estimate< - VEC>( - const DoFHandler &, - const hp::QCollection &, - const std::map *> - &, - const VEC &, - Vector &, - const ComponentMask &, - const Function *, - const unsigned int, - const types::subdomain_id, - const types::material_id, - const Strategy); + S>(const DoFHandler &, + const hp::QCollection &, + const std::map *> &, + const ReadVector &, + Vector &, + const ComponentMask &, + const Function *, + const unsigned int, + const types::subdomain_id, + const types::material_id, + const Strategy); template void KellyErrorEstimator::estimate< - VEC>( - const Mapping &, - const DoFHandler &, - const hp::QCollection &, - const std::map *> - &, - const std::vector &, - std::vector *> &, - const ComponentMask &, - const Function *, - const unsigned int, - const types::subdomain_id, - const types::material_id, - const Strategy); + S>(const Mapping &, + const DoFHandler &, + const hp::QCollection &, + const std::map *> &, + const std::vector *> &, + std::vector *> &, + const ComponentMask &, + const Function *, + const unsigned int, + const types::subdomain_id, + const types::material_id, + const Strategy); template void KellyErrorEstimator::estimate< - VEC>( - const DoFHandler &, - const hp::QCollection &, - const std::map *> - &, - const std::vector &, - std::vector *> &, - const ComponentMask &, - const Function *, - const unsigned int, - const types::subdomain_id, - const types::material_id, - const Strategy); + S>(const DoFHandler &, + const hp::QCollection &, + const std::map *> &, + const std::vector *> &, + std::vector *> &, + const ComponentMask &, + const Function *, + const unsigned int, + const types::subdomain_id, + const types::material_id, + const Strategy); #endif } -- 2.39.5