From c19220bf00d206be2d47ccc8aa081b6d823b8463 Mon Sep 17 00:00:00 2001 From: bangerth Date: Thu, 14 Dec 2006 22:00:23 +0000 Subject: [PATCH] Check in stubs for hp functions. They're presently not implemented, but will be next. git-svn-id: https://svn.dealii.org/trunk@14247 0785d39b-7218-0410-832d-ea1e28bc413d --- .../include/numerics/error_estimator.h | 155 +++++++++++++ .../source/numerics/error_estimator.cc | 211 ++++++++++++++++-- 2 files changed, 348 insertions(+), 18 deletions(-) diff --git a/deal.II/deal.II/include/numerics/error_estimator.h b/deal.II/deal.II/include/numerics/error_estimator.h index 2d17e5f29a..421583b003 100644 --- a/deal.II/deal.II/include/numerics/error_estimator.h +++ b/deal.II/deal.II/include/numerics/error_estimator.h @@ -396,6 +396,84 @@ class KellyErrorEstimator const unsigned int subdomain_id = deal_II_numbers::invalid_unsigned_int, const unsigned int material_id = deal_II_numbers::invalid_unsigned_int); + + /** + * Equivalent to the set of functions + * above, except that this one takes a + * quadrature collection for hp finite + * element dof handlers. + */ + template + static void estimate (const Mapping &mapping, + const DH &dof, + const hp::QCollection &quadrature, + const typename FunctionMap::type &neumann_bc, + const InputVector &solution, + Vector &error, + const std::vector &component_mask = std::vector(), + const Function *coefficients = 0, + const unsigned int n_threads = multithread_info.n_default_threads, + const unsigned int subdomain_id = deal_II_numbers::invalid_unsigned_int, + const unsigned int material_id = deal_II_numbers::invalid_unsigned_int); + + + /** + * Equivalent to the set of functions + * above, except that this one takes a + * quadrature collection for hp finite + * element dof handlers. + */ + template + static void estimate (const DH &dof, + const hp::QCollection &quadrature, + const typename FunctionMap::type &neumann_bc, + const InputVector &solution, + Vector &error, + const std::vector &component_mask = std::vector(), + const Function *coefficients = 0, + const unsigned int n_threads = multithread_info.n_default_threads, + const unsigned int subdomain_id = deal_II_numbers::invalid_unsigned_int, + const unsigned int material_id = deal_II_numbers::invalid_unsigned_int); + + + /** + * Equivalent to the set of functions + * above, except that this one takes a + * quadrature collection for hp finite + * element dof handlers. + */ + template + static void estimate (const Mapping &mapping, + const DH &dof, + const hp::QCollection &quadrature, + const typename FunctionMap::type &neumann_bc, + const std::vector &solutions, + std::vector*> &errors, + const std::vector &component_mask = std::vector(), + const Function *coefficients = 0, + const unsigned int n_threads = multithread_info.n_default_threads, + const unsigned int subdomain_id = deal_II_numbers::invalid_unsigned_int, + const unsigned int material_id = deal_II_numbers::invalid_unsigned_int); + + + /** + * Equivalent to the set of functions + * above, except that this one takes a + * quadrature collection for hp finite + * element dof handlers. + */ + template + static void estimate (const DH &dof, + const hp::QCollection &quadrature, + const typename FunctionMap::type &neumann_bc, + const std::vector &solutions, + std::vector*> &errors, + const std::vector &component_mask = std::vector(), + const Function *coefficients = 0, + const unsigned int n_threads = multithread_info.n_default_threads, + const unsigned int subdomain_id = deal_II_numbers::invalid_unsigned_int, + const unsigned int material_id = deal_II_numbers::invalid_unsigned_int); + /** * Exception @@ -841,6 +919,83 @@ class KellyErrorEstimator<1> const unsigned int subdomain_id = deal_II_numbers::invalid_unsigned_int, const unsigned int material_id = deal_II_numbers::invalid_unsigned_int); + + /** + * Equivalent to the set of functions + * above, except that this one takes a + * quadrature collection for hp finite + * element dof handlers. + */ + template + static void estimate (const Mapping<1> &mapping, + const DH &dof, + const hp::QCollection<0> &quadrature, + const typename FunctionMap<1>::type &neumann_bc, + const InputVector &solution, + Vector &error, + const std::vector &component_mask = std::vector(), + const Function<1> *coefficients = 0, + const unsigned int n_threads = multithread_info.n_default_threads, + const unsigned int subdomain_id = deal_II_numbers::invalid_unsigned_int, + const unsigned int material_id = deal_II_numbers::invalid_unsigned_int); + + + /** + * Equivalent to the set of functions + * above, except that this one takes a + * quadrature collection for hp finite + * element dof handlers. + */ + template + static void estimate (const DH &dof, + const hp::QCollection<0> &quadrature, + const typename FunctionMap<1>::type &neumann_bc, + const InputVector &solution, + Vector &error, + const std::vector &component_mask = std::vector(), + const Function<1> *coefficients = 0, + const unsigned int n_threads = multithread_info.n_default_threads, + const unsigned int subdomain_id = deal_II_numbers::invalid_unsigned_int, + const unsigned int material_id = deal_II_numbers::invalid_unsigned_int); + + + /** + * Equivalent to the set of functions + * above, except that this one takes a + * quadrature collection for hp finite + * element dof handlers. + */ + template + static void estimate (const Mapping<1> &mapping, + const DH &dof, + const hp::QCollection<0> &quadrature, + const typename FunctionMap<1>::type &neumann_bc, + const std::vector &solutions, + std::vector*> &errors, + const std::vector &component_mask = std::vector(), + const Function<1> *coefficients = 0, + const unsigned int n_threads = multithread_info.n_default_threads, + const unsigned int subdomain_id = deal_II_numbers::invalid_unsigned_int, + const unsigned int material_id = deal_II_numbers::invalid_unsigned_int); + + + /** + * Equivalent to the set of functions + * above, except that this one takes a + * quadrature collection for hp finite + * element dof handlers. + */ + template + static void estimate (const DH &dof, + const hp::QCollection<0> &quadrature, + const typename FunctionMap<1>::type &neumann_bc, + const std::vector &solutions, + std::vector*> &errors, + const std::vector &component_mask = std::vector(), + const Function<1> *coefficients = 0, + const unsigned int n_threads = multithread_info.n_default_threads, + const unsigned int subdomain_id = deal_II_numbers::invalid_unsigned_int, + const unsigned int material_id = deal_II_numbers::invalid_unsigned_int); /** * Exception diff --git a/deal.II/deal.II/source/numerics/error_estimator.cc b/deal.II/deal.II/source/numerics/error_estimator.cc index 7c4d86ca39..c224564e41 100644 --- a/deal.II/deal.II/source/numerics/error_estimator.cc +++ b/deal.II/deal.II/source/numerics/error_estimator.cc @@ -134,6 +134,91 @@ estimate (const DH &dof_handler, +template +void +KellyErrorEstimator<1>:: +estimate (const Mapping<1> &mapping, + const DH &dof_handler, + const hp::QCollection<0> &quadrature, + const FunctionMap<1>::type &neumann_bc, + const InputVector &solution, + Vector &error, + const std::vector &component_mask, + const Function<1> *coefficients, + const unsigned int n_threads, + const unsigned int subdomain_id, + const unsigned int material_id) +{ + // just pass on to the other function + const std::vector solutions (1, &solution); + std::vector*> errors (1, &error); + estimate (mapping, dof_handler, quadrature, neumann_bc, solutions, errors, + component_mask, coefficients, n_threads, subdomain_id, material_id); +} + + +template +void +KellyErrorEstimator<1>:: +estimate (const DH &dof_handler, + const hp::QCollection<0> &quadrature, + const FunctionMap<1>::type &neumann_bc, + const InputVector &solution, + Vector &error, + const std::vector &component_mask, + const Function<1> *coefficients, + const unsigned int n_threads, + const unsigned int subdomain_id, + const unsigned int material_id) +{ + Assert (DEAL_II_COMPAT_MAPPING, ExcCompatibility("mapping")); + estimate(StaticMappingQ1<1>::mapping, dof_handler, quadrature, neumann_bc, solution, + error, component_mask, coefficients, n_threads, subdomain_id, material_id); +} + + + +template +void +KellyErrorEstimator<1>:: +estimate (const DH &dof_handler, + const hp::QCollection<0> &quadrature, + const FunctionMap<1>::type &neumann_bc, + const std::vector &solutions, + std::vector*> &errors, + const std::vector &component_mask, + const Function<1> *coefficients, + const unsigned int n_threads, + const unsigned int subdomain_id, + const unsigned int material_id) +{ + Assert (DEAL_II_COMPAT_MAPPING, ExcCompatibility("mapping")); + estimate(StaticMappingQ1<1>::mapping, dof_handler, quadrature, neumann_bc, solutions, + errors, component_mask, coefficients, n_threads, subdomain_id, material_id); +} + + + + +template +void KellyErrorEstimator<1>:: +estimate (const Mapping<1> &mapping, + const DH &dof_handler, + const hp::QCollection<0> &, + const FunctionMap<1>::type &neumann_bc, + const std::vector &solutions, + std::vector*> &errors, + const std::vector &component_mask_, + const Function<1> *coefficient, + const unsigned int, + const unsigned int subdomain_id, + const unsigned int material_id) +{ + Assert (false, ExcInternalError()); +} + + + template void KellyErrorEstimator<1>:: estimate (const Mapping<1> &mapping, @@ -318,7 +403,7 @@ estimate (const Mapping<1> &mapping, for (unsigned int s=0; s +template +void +KellyErrorEstimator:: +estimate (const Mapping &mapping, + const DH &dof_handler, + const hp::QCollection &quadrature, + const typename FunctionMap::type &neumann_bc, + const InputVector &solution, + Vector &error, + const std::vector &component_mask, + const Function *coefficients, + const unsigned int n_threads, + const unsigned int subdomain_id, + const unsigned int material_id) +{ + // just pass on to the other function + const std::vector solutions (1, &solution); + std::vector*> errors (1, &error); + estimate (mapping, dof_handler, quadrature, neumann_bc, solutions, errors, + component_mask, coefficients, n_threads, subdomain_id, material_id); +} + + +template +template +void +KellyErrorEstimator:: +estimate (const DH &dof_handler, + const hp::QCollection &quadrature, + const typename FunctionMap::type &neumann_bc, + const InputVector &solution, + Vector &error, + const std::vector &component_mask, + const Function *coefficients, + const unsigned int n_threads, + const unsigned int subdomain_id, + const unsigned int material_id) +{ + Assert (DEAL_II_COMPAT_MAPPING, ExcCompatibility("mapping")); + estimate(StaticMappingQ1::mapping, dof_handler, quadrature, neumann_bc, solution, + error, component_mask, coefficients, n_threads, + subdomain_id, material_id); +} + template @@ -720,6 +850,27 @@ estimate_some (const hp::MappingCollection &mapping, +template +template +void +KellyErrorEstimator:: +estimate (const Mapping &/*mapping*/, + const DH &/*dof_handler*/, + const hp::QCollection &/*quadrature*/, + const typename FunctionMap::type &/*neumann_bc*/, + const std::vector &/*solutions*/, + std::vector*> &/*errors*/, + const std::vector &/*component_mask_*/, + const Function */*coefficients*/, + const unsigned int /*n_threads_*/, + const unsigned int /*subdomain_id*/, + const unsigned int /*material_id*/) +{ + Assert (false, ExcNotImplemented()); +} + + + template template void @@ -882,7 +1033,7 @@ estimate (const Mapping &mapping, (*errors[n]).reinit (dof_handler.get_tria().n_active_cells()); for (unsigned int i=0;i::estimate (const DH &do +template +template +void KellyErrorEstimator::estimate (const DH &dof_handler, + const hp::QCollection &quadrature, + const typename FunctionMap::type &neumann_bc, + const std::vector &solutions, + std::vector*> &errors, + const std::vector &component_mask, + const Function *coefficients, + const unsigned int n_threads, + const unsigned int subdomain_id, + const unsigned int material_id) +{ + Assert (DEAL_II_COMPAT_MAPPING, ExcCompatibility("mapping")); + estimate(StaticMappingQ1::mapping, dof_handler, quadrature, neumann_bc, solutions, + errors, component_mask, coefficients, n_threads, + subdomain_id, material_id); +} + + + template template void KellyErrorEstimator:: @@ -1076,8 +1248,8 @@ integrate_over_regular_face (const DH &dof_handl for (unsigned int point=0; pointat_boundary() == true) @@ -1115,8 +1287,8 @@ integrate_over_regular_face (const DH &dof_handl for (unsigned int component=0; componentface(neighbor_neighbor)] = face_integral; - }; + } // finally loop over all subfaces to @@ -1337,7 +1509,7 @@ integrate_over_irregular_face (const DH &dof_han for (unsigned int n=0; nchild(subface_no)][n]; - }; + } face_integrals[face] = sum; } @@ -1353,16 +1525,14 @@ template class KellyErrorEstimator; // instantiate the externally visible functions. define a list of functions // for vectors, where the vector/matrix can be replaced using a preprocessor -// variable VectorType/MatrixType. note that we need a space between -// "VectorType" and ">" to disambiguate ">>" when VectorType trails in an -// angle bracket -#define INSTANTIATE(InputVector,DH) \ +// variable VectorType/MatrixType +#define INSTANTIATE_1(InputVector,DH,Q) \ template \ void \ KellyErrorEstimator:: \ estimate (const Mapping &, \ const DH &, \ - const Quadrature &, \ + const Q &, \ const FunctionMap::type &, \ const InputVector &, \ Vector &, \ @@ -1376,7 +1546,7 @@ template \ void \ KellyErrorEstimator:: \ estimate (const DH &, \ - const Quadrature &, \ + const Q &, \ const FunctionMap::type &, \ const InputVector &, \ Vector &, \ @@ -1391,7 +1561,7 @@ void \ KellyErrorEstimator:: \ estimate (const Mapping &, \ const DH &, \ - const Quadrature &, \ + const Q &, \ const FunctionMap::type &, \ const std::vector &, \ std::vector*> &, \ @@ -1405,7 +1575,7 @@ template \ void \ KellyErrorEstimator:: \ estimate (const DH &, \ - const Quadrature &, \ + const Q &, \ const FunctionMap::type &, \ const std::vector &, \ std::vector*> &, \ @@ -1415,6 +1585,11 @@ estimate (const DH &, \ const unsigned int , \ const unsigned int) +#define INSTANTIATE(InputVector,DH) \ + INSTANTIATE_1(InputVector,DH,Quadrature); \ + INSTANTIATE_1(InputVector,DH,hp::QCollection) + + INSTANTIATE(Vector,DoFHandler); INSTANTIATE(Vector,DoFHandler); INSTANTIATE(BlockVector,DoFHandler); -- 2.39.5