From f1b5ed5c2ba8d397f74b984e96eb6e418c225241 Mon Sep 17 00:00:00 2001 From: Peter Munch Date: Thu, 30 Jul 2020 21:04:36 +0200 Subject: [PATCH] Enabel VectorTools::interpolate for hp::MappingCollection --- .../numerics/vector_tools_interpolate.h | 22 +++++++++-- .../vector_tools_interpolate.templates.h | 39 ++++++++++++++----- .../numerics/vector_tools_interpolate.inst.in | 9 +++++ 3 files changed, 57 insertions(+), 13 deletions(-) diff --git a/include/deal.II/numerics/vector_tools_interpolate.h b/include/deal.II/numerics/vector_tools_interpolate.h index 880f51a8cd..8ae0ab69ca 100644 --- a/include/deal.II/numerics/vector_tools_interpolate.h +++ b/include/deal.II/numerics/vector_tools_interpolate.h @@ -37,6 +37,12 @@ class InterGridMap; template class Mapping; +namespace hp +{ + template + class MappingCollection; +} + namespace VectorTools { /** @@ -56,9 +62,6 @@ namespace VectorTools * continuous again. * * See the general documentation of this namespace for further information. - * - * @todo The @p mapping argument should be replaced by a - * hp::MappingCollection in case of a hp::DoFHandler. */ template void @@ -69,6 +72,19 @@ namespace VectorTools VectorType & vec, const ComponentMask &component_mask = ComponentMask()); + /** + * Same as above but in an hp context. + */ + template + void + interpolate( + const hp::MappingCollection & mapping, + const DoFHandler & dof, + const Function &function, + VectorType & vec, + const ComponentMask &component_mask = ComponentMask()); + + /** * Call the @p interpolate() function above with * mapping=MappingQGeneric1@@(). diff --git a/include/deal.II/numerics/vector_tools_interpolate.templates.h b/include/deal.II/numerics/vector_tools_interpolate.templates.h index eac1231721..b9dcad1d97 100644 --- a/include/deal.II/numerics/vector_tools_interpolate.templates.h +++ b/include/deal.II/numerics/vector_tools_interpolate.templates.h @@ -215,11 +215,11 @@ namespace VectorTools // A given cell is skipped if function(cell) == nullptr template void - interpolate(const Mapping & mapping, - const DoFHandler &dof_handler, - T & function, - VectorType & vec, - const ComponentMask & component_mask) + interpolate(const hp::MappingCollection &mapping_collection, + const DoFHandler & dof_handler, + T & function, + VectorType & vec, + const ComponentMask & component_mask) { Assert(component_mask.represents_n_components( dof_handler.get_fe_collection().n_components()), @@ -308,8 +308,6 @@ namespace VectorTools support_quadrature.push_back(Quadrature(points)); } - const hp::MappingCollection mapping_collection(mapping); - // An FEValues object to evaluate (generalized) support point // locations as well as Jacobians and their inverses. // the latter are only needed for Hcurl or Hdiv conforming elements, @@ -481,7 +479,7 @@ namespace VectorTools template void interpolate( - const Mapping & mapping, + const hp::MappingCollection & mapping, const DoFHandler & dof_handler, const Function &function, VectorType & vec, @@ -507,6 +505,24 @@ namespace VectorTools + template + void + interpolate( + const Mapping & mapping, + const DoFHandler & dof_handler, + const Function &function, + VectorType & vec, + const ComponentMask & component_mask) + { + interpolate(hp::MappingCollection(mapping), + dof_handler, + function, + vec, + component_mask); + } + + + template void interpolate( @@ -801,8 +817,11 @@ namespace VectorTools return nullptr; }; - internal::interpolate( - mapping, dof_handler, function_map, vec, component_mask); + internal::interpolate(hp::MappingCollection(mapping), + dof_handler, + function_map, + vec, + component_mask); } namespace internal diff --git a/source/numerics/vector_tools_interpolate.inst.in b/source/numerics/vector_tools_interpolate.inst.in index a99aeb9018..d4c0cec8ea 100644 --- a/source/numerics/vector_tools_interpolate.inst.in +++ b/source/numerics/vector_tools_interpolate.inst.in @@ -22,6 +22,15 @@ for (VEC : VECTOR_TYPES; deal_II_dimension : DIMENSIONS; namespace VectorTools \{ + template void + interpolate( + const hp::MappingCollection + &, + const DoFHandler &, + const Function &, + VEC &, + const ComponentMask &); + template void interpolate( const Mapping &, -- 2.39.5