From: Peter Munch Date: Tue, 16 Jun 2020 15:34:58 +0000 (+0200) Subject: Remove DoFHandlerType from MatrixFree::reinit() X-Git-Tag: v9.3.0-rc1~1426^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1b68a1bb2a7a294487978aeb32a724d9f12266d0;p=dealii.git Remove DoFHandlerType from MatrixFree::reinit() --- diff --git a/doc/news/changes/incompatibilities/20200617Munch b/doc/news/changes/incompatibilities/20200617Munch new file mode 100644 index 0000000000..e6a5b08671 --- /dev/null +++ b/doc/news/changes/incompatibilities/20200617Munch @@ -0,0 +1,6 @@ +Deprecated: The functions MatrixFree::reinit(), which take +a vector of hp::DoFHandlers, have been deprecated. Users are asked +to provide vectors of DoFhandlers, which may contain hp::DoFHandlers. This is +possible now since hp::DoFHandler is deriving from DoFHandler. +
+(Peter Munch, 2020/06/03) diff --git a/include/deal.II/matrix_free/matrix_free.h b/include/deal.II/matrix_free/matrix_free.h index 28eea44a7b..95498dc7b3 100644 --- a/include/deal.II/matrix_free/matrix_free.h +++ b/include/deal.II/matrix_free/matrix_free.h @@ -556,10 +556,10 @@ public: * not allowed. In that case, use the initialization function with * several DoFHandler arguments. */ - template + template void reinit(const Mapping & mapping, - const DoFHandlerType & dof_handler, + const DoFHandler & dof_handler, const AffineConstraints &constraint, const QuadratureType & quad, const AdditionalData & additional_data = AdditionalData()); @@ -568,9 +568,9 @@ public: * Initializes the data structures. Same as above, but using a $Q_1$ * mapping. */ - template + template void - reinit(const DoFHandlerType & dof_handler, + reinit(const DoFHandler & dof_handler, const AffineConstraints &constraint, const QuadratureType & quad, const AdditionalData & additional_data = AdditionalData()); @@ -582,10 +582,10 @@ public: * more. Use the reinit function without index set argument to choose the * one provided by DoFHandler::locally_owned_dofs(). */ - template + template DEAL_II_DEPRECATED void reinit(const Mapping & mapping, - const DoFHandlerType & dof_handler, + const DoFHandler & dof_handler, const AffineConstraints &constraint, const IndexSet & locally_owned_dofs, const QuadratureType & quad, @@ -612,10 +612,23 @@ public: * can be sets independently from the number of DoFHandlers, when several * elements are always integrated with the same quadrature formula. */ - template + template void reinit(const Mapping & mapping, - const std::vector & dof_handler, + const std::vector *> & dof_handler, + const std::vector *> &constraint, + const std::vector & quad, + const AdditionalData &additional_data = AdditionalData()); + + /** + * Initializes the data structures. Same as above, but using hp::DoFHandlers. + * + * @deprecated Use the overload taking a DoFHandler object instead. + */ + template + DEAL_II_DEPRECATED void + reinit(const Mapping & mapping, + const std::vector *> & dof_handler_hp, const std::vector *> &constraint, const std::vector & quad, const AdditionalData &additional_data = AdditionalData()); @@ -624,9 +637,21 @@ public: * Initializes the data structures. Same as above, but using a $Q_1$ * mapping. */ - template + template + void + reinit(const std::vector *> & dof_handler, + const std::vector *> &constraint, + const std::vector & quad, + const AdditionalData &additional_data = AdditionalData()); + + /** + * Initializes the data structures. Same as above, but using hp::DoFHandlers. + * + * @deprecated Use the overload taking a DoFHandler object instead. + */ + template void - reinit(const std::vector & dof_handler, + reinit(const std::vector *> & dof_handler_hp, const std::vector *> &constraint, const std::vector & quad, const AdditionalData &additional_data = AdditionalData()); @@ -638,10 +663,24 @@ public: * more. Use the reinit function without index set argument to choose the * one provided by DoFHandler::locally_owned_dofs(). */ - template + template DEAL_II_DEPRECATED void reinit(const Mapping & mapping, - const std::vector & dof_handler, + const std::vector *> & dof_handler, + const std::vector *> &constraint, + const std::vector & locally_owned_set, + const std::vector &quad, + const AdditionalData & additional_data = AdditionalData()); + + /** + * Initializes the data structures. Same as above, but using hp::DoFHandlers. + * + * @deprecated Use the overload taking a DoFHandler object instead. + */ + template + DEAL_II_DEPRECATED void + reinit(const Mapping & mapping, + const std::vector *> & dof_handler_hp, const std::vector *> &constraint, const std::vector & locally_owned_set, const std::vector &quad, @@ -654,10 +693,23 @@ public: * as might be necessary when several components in a vector-valued problem * are integrated together based on the same quadrature formula. */ - template + template void reinit(const Mapping & mapping, - const std::vector & dof_handler, + const std::vector *> & dof_handler, + const std::vector *> &constraint, + const QuadratureType & quad, + const AdditionalData &additional_data = AdditionalData()); + + /** + * Initializes the data structures. Same as above, but using hp::DoFHandlers. + * + * @deprecated Use the overload taking a DoFHandler object instead. + */ + template + DEAL_II_DEPRECATED void + reinit(const Mapping & mapping, + const std::vector *> & dof_handler_hp, const std::vector *> &constraint, const QuadratureType & quad, const AdditionalData &additional_data = AdditionalData()); @@ -666,9 +718,21 @@ public: * Initializes the data structures. Same as above, but using a $Q_1$ * mapping. */ - template + template void - reinit(const std::vector & dof_handler, + reinit(const std::vector *> & dof_handler, + const std::vector *> &constraint, + const QuadratureType & quad, + const AdditionalData &additional_data = AdditionalData()); + + /** + * Initializes the data structures. Same as above, but using hp::DoFHandlers. + * + * @deprecated Use the overload taking a DoFHandler object instead. + */ + template + DEAL_II_DEPRECATED void + reinit(const std::vector *> & dof_handler_hp, const std::vector *> &constraint, const QuadratureType & quad, const AdditionalData &additional_data = AdditionalData()); @@ -2759,22 +2823,6 @@ namespace internal { namespace MatrixFreeImplementation { - template - inline std::vector - extract_locally_owned_index_sets( - const std::vector &dofh, - const unsigned int level) - { - std::vector locally_owned_set; - locally_owned_set.reserve(dofh.size()); - for (unsigned int j = 0; j < dofh.size(); j++) - if (level == numbers::invalid_unsigned_int) - locally_owned_set.push_back(dofh[j]->locally_owned_dofs()); - else - AssertThrow(false, ExcNotImplemented()); - return locally_owned_set; - } - template inline std::vector extract_locally_owned_index_sets( @@ -2796,10 +2844,10 @@ namespace internal template -template +template void MatrixFree::reinit( - const DoFHandlerType & dof_handler, + const DoFHandler & dof_handler, const AffineConstraints &constraints_in, const QuadratureType & quad, const typename MatrixFree::AdditionalData @@ -2831,11 +2879,11 @@ MatrixFree::reinit( template -template +template void MatrixFree::reinit( const Mapping & mapping, - const DoFHandlerType & dof_handler, + const DoFHandler & dof_handler, const AffineConstraints &constraints_in, const QuadratureType & quad, const typename MatrixFree::AdditionalData @@ -2865,10 +2913,10 @@ MatrixFree::reinit( template -template +template void MatrixFree::reinit( - const std::vector & dof_handler, + const std::vector *> & dof_handler, const std::vector *> &constraint, const std::vector & quad, const typename MatrixFree::AdditionalData @@ -2891,10 +2939,30 @@ MatrixFree::reinit( template -template +template +void +MatrixFree::reinit( + const Mapping & mapping, + const std::vector *> & dof_handler_hp, + const std::vector *> &constraint, + const std::vector & quad, + const AdditionalData & additional_data) +{ + std::vector *> dof_handlers; + + for (const auto dof_handler : dof_handler_hp) + dof_handlers.push_back(dof_handler); + + this->reinit(mapping, dof_handlers, constraint, quad, additional_data); +} + + + +template +template void MatrixFree::reinit( - const std::vector & dof_handler, + const std::vector *> & dof_handler, const std::vector *> &constraint, const QuadratureType & quad, const typename MatrixFree::AdditionalData @@ -2916,11 +2984,30 @@ MatrixFree::reinit( template -template +template +void +MatrixFree::reinit( + const std::vector *> & dof_handler_hp, + const std::vector *> &constraint, + const std::vector & quad, + const AdditionalData & additional_data) +{ + std::vector *> dof_handlers; + + for (const auto dof_handler : dof_handler_hp) + dof_handlers.push_back(dof_handler); + + this->reinit(dof_handlers, constraint, quad, additional_data); +} + + + +template +template void MatrixFree::reinit( const Mapping & mapping, - const std::vector & dof_handler, + const std::vector *> & dof_handler, const std::vector *> &constraint, const QuadratureType & quad, const typename MatrixFree::AdditionalData @@ -2942,11 +3029,37 @@ MatrixFree::reinit( template -template +template +void +MatrixFree::reinit( + const Mapping & mapping, + const std::vector *> & dof_handler_hp, + const std::vector *> &constraint, + const std::vector & locally_owned_set, + const std::vector & quad, + const AdditionalData & additional_data) +{ + std::vector *> dof_handlers; + + for (const auto dof_handler : dof_handler_hp) + dof_handlers.push_back(dof_handler); + + this->reinit(mapping, + dof_handlers, + constraint, + locally_owned_set, + quad, + additional_data); +} + + + +template +template void MatrixFree::reinit( const Mapping & mapping, - const std::vector & dof_handler, + const std::vector *> & dof_handler, const std::vector *> &constraint, const std::vector & quad, const typename MatrixFree::AdditionalData @@ -2969,11 +3082,31 @@ MatrixFree::reinit( template -template +template +void +MatrixFree::reinit( + const Mapping & mapping, + const std::vector *> & dof_handler_hp, + const std::vector *> &constraint, + const QuadratureType & quad, + const AdditionalData & additional_data) +{ + std::vector *> dof_handlers; + + for (const auto dof_handler : dof_handler_hp) + dof_handlers.push_back(dof_handler); + + this->reinit(mapping, dof_handlers, constraint, quad, additional_data); +} + + + +template +template void MatrixFree::reinit( const Mapping & mapping, - const std::vector & dof_handler, + const std::vector *> & dof_handler, const std::vector *> &constraint, const std::vector & locally_owned_set, const std::vector & quad, @@ -2994,6 +3127,25 @@ MatrixFree::reinit( +template +template +void +MatrixFree::reinit( + const std::vector *> & dof_handler_hp, + const std::vector *> &constraint, + const QuadratureType & quad, + const AdditionalData & additional_data) +{ + std::vector *> dof_handlers; + + for (const auto dof_handler : dof_handler_hp) + dof_handlers.push_back(dof_handler); + + this->reinit(dof_handlers, constraint, quad, additional_data); +} + + + // ------------------------------ implementation of loops -------------------- // internal helper functions that define how to call MPI data exchange