From: Peter Munch Date: Thu, 25 Jun 2020 05:59:02 +0000 (+0200) Subject: Remove DoFHandlerType from numerics/derivative_approximation X-Git-Tag: v9.3.0-rc1~1370^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=61a139bbeafaf43ad84349b808675d322f21b500;p=dealii.git Remove DoFHandlerType from numerics/derivative_approximation --- diff --git a/include/deal.II/numerics/derivative_approximation.h b/include/deal.II/numerics/derivative_approximation.h index 732b6e52ff..9474ba5d8b 100644 --- a/include/deal.II/numerics/derivative_approximation.h +++ b/include/deal.II/numerics/derivative_approximation.h @@ -21,6 +21,8 @@ #include #include +#include + #include #include @@ -74,7 +76,7 @@ DEAL_II_NAMESPACE_OPEN * of file in function * void DerivativeApproximation::approximate(...) * [with DerivativeDescription = DerivativeApproximation::Gradient<3>, int - * dim = 3, DoFHandlerType = DoFHandler, InputVector = Vector] + * dim = 3, InputVector = Vector, spacedim = 3] * The violated condition was: * determinant(Y) != 0 * The name and call sequence of the exception was: @@ -173,29 +175,23 @@ namespace DerivativeApproximation * In a parallel computation the @p solution vector needs to contain the * locally relevant unknowns. */ - template class DoFHandlerType, - class InputVector, - int spacedim> + template void - approximate_gradient(const Mapping & mapping, - const DoFHandlerType &dof, - const InputVector & solution, - Vector & derivative_norm, - const unsigned int component = 0); + approximate_gradient(const Mapping & mapping, + const DoFHandler &dof, + const InputVector & solution, + Vector & derivative_norm, + const unsigned int component = 0); /** * Call the function above with mapping=MappingQGeneric@(1). */ - template class DoFHandlerType, - class InputVector, - int spacedim> + template void - approximate_gradient(const DoFHandlerType &dof, - const InputVector & solution, - Vector & derivative_norm, - const unsigned int component = 0); + approximate_gradient(const DoFHandler &dof, + const InputVector & solution, + Vector & derivative_norm, + const unsigned int component = 0); /** * This function is the analogue to the one above, computing finite @@ -214,27 +210,21 @@ namespace DerivativeApproximation * In a parallel computation the @p solution vector needs to contain the * locally relevant unknowns. */ - template class DoFHandlerType, - class InputVector, - int spacedim> + template void - approximate_second_derivative(const Mapping & mapping, - const DoFHandlerType &dof, - const InputVector & solution, + approximate_second_derivative(const Mapping & mapping, + const DoFHandler &dof, + const InputVector & solution, Vector & derivative_norm, const unsigned int component = 0); /** * Call the function above with mapping=MappingQGeneric@(1). */ - template class DoFHandlerType, - class InputVector, - int spacedim> + template void - approximate_second_derivative(const DoFHandlerType &dof, - const InputVector & solution, + approximate_second_derivative(const DoFHandler &dof, + const InputVector & solution, Vector & derivative_norm, const unsigned int component = 0); @@ -251,42 +241,37 @@ namespace DerivativeApproximation * In a parallel computation the @p solution vector needs to contain the * locally relevant unknowns. */ - template + template void approximate_derivative_tensor( - const Mapping - & mapping, - const DoFHandlerType &dof, - const InputVector & solution, + const Mapping & mapping, + const DoFHandler &dof, + const InputVector & solution, #ifndef _MSC_VER - const typename DoFHandlerType::active_cell_iterator &cell, + const typename DoFHandler::active_cell_iterator &cell, #else - const TriaActiveIterator< - dealii::DoFCellAccessor> &cell, + const TriaActiveIterator> + &cell, #endif - Tensor &derivative, - const unsigned int component = 0); + Tensor &derivative, + const unsigned int component = 0); /** * Same as above, with mapping=MappingQGeneric@(1). */ - template + template void approximate_derivative_tensor( - const DoFHandlerType &dof, - const InputVector & solution, + const DoFHandler &dof, + const InputVector & solution, #ifndef _MSC_VER - const typename DoFHandlerType::active_cell_iterator &cell, + const typename DoFHandler::active_cell_iterator &cell, #else - const TriaActiveIterator< - dealii::DoFCellAccessor> &cell, + const TriaActiveIterator> + &cell, #endif - Tensor &derivative, - const unsigned int component = 0); + Tensor &derivative, + const unsigned int component = 0); /** * Return the norm of the derivative. diff --git a/source/numerics/derivative_approximation.cc b/source/numerics/derivative_approximation.cc index 3c6aa413c9..38ad27d01b 100644 --- a/source/numerics/derivative_approximation.cc +++ b/source/numerics/derivative_approximation.cc @@ -736,16 +736,15 @@ namespace DerivativeApproximation */ template class DoFHandlerType, class InputVector, int spacedim> void approximate_cell( - const Mapping & mapping, - const DoFHandlerType &dof_handler, - const InputVector & solution, - const unsigned int component, - const typename DoFHandlerType::active_cell_iterator &cell, + const Mapping & mapping, + const DoFHandler &dof_handler, + const InputVector & solution, + const unsigned int component, + const typename DoFHandler::active_cell_iterator &cell, typename DerivativeDescription::Derivative &derivative) { QMidpoint midpoint_rule; @@ -776,7 +775,7 @@ namespace DerivativeApproximation // active neighbors of a cell // reserve the maximal number of // active neighbors - std::vector::active_cell_iterator> + std::vector::active_cell_iterator> active_neighbors; active_neighbors.reserve(GeometryInfo::faces_per_cell * @@ -815,7 +814,7 @@ namespace DerivativeApproximation // first collect all neighbor // cells in a vector, and then // collect the data from them - GridTools::get_active_neighbors>( + GridTools::get_active_neighbors>( cell, active_neighbors); // now loop over all active @@ -907,16 +906,15 @@ namespace DerivativeApproximation */ template class DoFHandlerType, class InputVector, int spacedim> void approximate( SynchronousIterators< - std::tuple::active_cell_iterator, + std::tuple::active_cell_iterator, Vector::iterator>> const &cell, const Mapping & mapping, - const DoFHandlerType & dof_handler, + const DoFHandler & dof_handler, const InputVector & solution, const unsigned int component) { @@ -928,16 +926,13 @@ namespace DerivativeApproximation typename DerivativeDescription::Derivative derivative; // call the function doing the actual // work on this cell - approximate_cell(mapping, - dof_handler, - solution, - component, - std::get<0>(*cell), - derivative); + approximate_cell( + mapping, + dof_handler, + solution, + component, + std::get<0>(*cell), + derivative); // evaluate the norm and fill the vector //*derivative_norm_on_this_cell @@ -959,15 +954,14 @@ namespace DerivativeApproximation */ template class DoFHandlerType, class InputVector, int spacedim> void - approximate_derivative(const Mapping & mapping, - const DoFHandlerType &dof_handler, - const InputVector & solution, - const unsigned int component, - Vector & derivative_norm) + approximate_derivative(const Mapping & mapping, + const DoFHandler &dof_handler, + const InputVector & solution, + const unsigned int component, + Vector & derivative_norm) { Assert(derivative_norm.size() == dof_handler.get_triangulation().n_active_cells(), @@ -977,7 +971,7 @@ namespace DerivativeApproximation AssertIndexRange(component, dof_handler.get_fe(0).n_components()); using Iterators = - std::tuple::active_cell_iterator, + std::tuple::active_cell_iterator, Vector::iterator>; SynchronousIterators begin( Iterators(dof_handler.begin_active(), derivative_norm.begin())), @@ -993,11 +987,7 @@ namespace DerivativeApproximation SynchronousIterators const &cell, Assembler::Scratch const &, Assembler::CopyData &) { - approximate( + approximate( cell, mapping, dof_handler, solution, component); }, std::function(), @@ -1014,31 +1004,25 @@ namespace DerivativeApproximation namespace DerivativeApproximation { - template class DoFHandlerType, - class InputVector, - int spacedim> + template void - approximate_gradient(const Mapping & mapping, - const DoFHandlerType &dof_handler, - const InputVector & solution, - Vector & derivative_norm, - const unsigned int component) + approximate_gradient(const Mapping & mapping, + const DoFHandler &dof_handler, + const InputVector & solution, + Vector & derivative_norm, + const unsigned int component) { internal::approximate_derivative, dim>( mapping, dof_handler, solution, component, derivative_norm); } - template class DoFHandlerType, - class InputVector, - int spacedim> + template void - approximate_gradient(const DoFHandlerType &dof_handler, - const InputVector & solution, - Vector & derivative_norm, - const unsigned int component) + approximate_gradient(const DoFHandler &dof_handler, + const InputVector & solution, + Vector & derivative_norm, + const unsigned int component) { internal::approximate_derivative, dim>( StaticMappingQ1::mapping, @@ -1049,33 +1033,25 @@ namespace DerivativeApproximation } - template class DoFHandlerType, - class InputVector, - int spacedim> + template void - approximate_second_derivative( - const Mapping & mapping, - const DoFHandlerType &dof_handler, - const InputVector & solution, - Vector & derivative_norm, - const unsigned int component) + approximate_second_derivative(const Mapping & mapping, + const DoFHandler &dof_handler, + const InputVector & solution, + Vector & derivative_norm, + const unsigned int component) { internal::approximate_derivative, dim>( mapping, dof_handler, solution, component, derivative_norm); } - template class DoFHandlerType, - class InputVector, - int spacedim> + template void - approximate_second_derivative( - const DoFHandlerType &dof_handler, - const InputVector & solution, - Vector & derivative_norm, - const unsigned int component) + approximate_second_derivative(const DoFHandler &dof_handler, + const InputVector & solution, + Vector & derivative_norm, + const unsigned int component) { internal::approximate_derivative, dim>( StaticMappingQ1::mapping, @@ -1086,56 +1062,49 @@ namespace DerivativeApproximation } - template + template void approximate_derivative_tensor( - const Mapping - & mapping, - const DoFHandlerType &dof, - const InputVector & solution, + const Mapping & mapping, + const DoFHandler &dof, + const InputVector & solution, #ifndef _MSC_VER - const typename DoFHandlerType::active_cell_iterator &cell, + const typename DoFHandler::active_cell_iterator &cell, #else - const TriaActiveIterator< - dealii::DoFCellAccessor> &cell, + const TriaActiveIterator> + &cell, #endif - Tensor &derivative, - const unsigned int component) + Tensor &derivative, + const unsigned int component) { internal::approximate_cell< - typename internal::DerivativeSelector:: - DerivDescr>(mapping, dof, solution, component, cell, derivative); + typename internal::DerivativeSelector::DerivDescr>( + mapping, dof, solution, component, cell, derivative); } - template + template void approximate_derivative_tensor( - const DoFHandlerType &dof, - const InputVector & solution, + const DoFHandler &dof, + const InputVector & solution, #ifndef _MSC_VER - const typename DoFHandlerType::active_cell_iterator &cell, + const typename DoFHandler::active_cell_iterator &cell, #else - const TriaActiveIterator< - dealii::DoFCellAccessor> &cell, + const TriaActiveIterator> + &cell, #endif - Tensor &derivative, - const unsigned int component) + Tensor &derivative, + const unsigned int component) { // just call the respective function with Q1 mapping - approximate_derivative_tensor( - StaticMappingQ1::mapping, - dof, - solution, - cell, - derivative, - component); + approximate_derivative_tensor(StaticMappingQ1::mapping, + dof, + solution, + cell, + derivative, + component); } diff --git a/source/numerics/derivative_approximation.inst.in b/source/numerics/derivative_approximation.inst.in index e34c0b85ff..0eff551f4b 100644 --- a/source/numerics/derivative_approximation.inst.in +++ b/source/numerics/derivative_approximation.inst.in @@ -14,92 +14,109 @@ // --------------------------------------------------------------------- -for (deal_II_dimension : DIMENSIONS; VEC : REAL_VECTOR_TYPES; - DH : DOFHANDLER_TEMPLATES) +for (deal_II_dimension : DIMENSIONS; VEC : REAL_VECTOR_TYPES) { namespace DerivativeApproximation \{ template void approximate_gradient( - const Mapping &mapping, - const DH & dof_handler, - const VEC & solution, - Vector & derivative_norm, - const unsigned int component); + const Mapping & mapping, + const DoFHandler &dof_handler, + const VEC & solution, + Vector & derivative_norm, + const unsigned int component); template void approximate_gradient( - const DH &dof_handler, - const VEC & solution, - Vector & derivative_norm, - const unsigned int component); + const DoFHandler &dof_handler, + const VEC & solution, + Vector & derivative_norm, + const unsigned int component); template void approximate_second_derivative( - const Mapping &mapping, - const DH & dof_handler, - const VEC & solution, - Vector & derivative_norm, - const unsigned int component); + const Mapping & mapping, + const DoFHandler &dof_handler, + const VEC & solution, + Vector & derivative_norm, + const unsigned int component); template void approximate_second_derivative( - const DH &dof_handler, - const VEC & solution, - Vector & derivative_norm, - const unsigned int component); + const DoFHandler &dof_handler, + const VEC & solution, + Vector & derivative_norm, + const unsigned int component); template void - approximate_derivative_tensor, VEC, 1>( - const Mapping & mapping, - const DH & dof_handler, - const VEC & solution, - const DH::active_cell_iterator &cell, - Tensor<1, deal_II_dimension> & derivative, - const unsigned int component); + approximate_derivative_tensor( + const Mapping & mapping, + const DoFHandler & dof_handler, + const VEC & solution, + const DoFHandler::active_cell_iterator &cell, + Tensor<1, deal_II_dimension> & derivative, + const unsigned int component); template void - approximate_derivative_tensor, VEC, 2>( - const Mapping & mapping, - const DH & dof_handler, - const VEC & solution, - const DH::active_cell_iterator &cell, - Tensor<2, deal_II_dimension> & derivative, - const unsigned int component); + approximate_derivative_tensor( + const Mapping & mapping, + const DoFHandler & dof_handler, + const VEC & solution, + const DoFHandler::active_cell_iterator &cell, + Tensor<2, deal_II_dimension> & derivative, + const unsigned int component); template void - approximate_derivative_tensor, VEC, 3>( - const Mapping & mapping, - const DH & dof_handler, - const VEC & solution, - const DH::active_cell_iterator &cell, - Tensor<3, deal_II_dimension> & derivative, - const unsigned int component); + approximate_derivative_tensor( + const Mapping & mapping, + const DoFHandler & dof_handler, + const VEC & solution, + const DoFHandler::active_cell_iterator &cell, + Tensor<3, deal_II_dimension> & derivative, + const unsigned int component); template void - approximate_derivative_tensor, VEC, 1>( - const DH & dof_handler, - const VEC & solution, - const DH::active_cell_iterator &cell, - Tensor<1, deal_II_dimension> & derivative, - const unsigned int component); + approximate_derivative_tensor( + const DoFHandler & dof_handler, + const VEC & solution, + const DoFHandler::active_cell_iterator &cell, + Tensor<1, deal_II_dimension> & derivative, + const unsigned int component); template void - approximate_derivative_tensor, VEC, 2>( - const DH & dof_handler, - const VEC & solution, - const DH::active_cell_iterator &cell, - Tensor<2, deal_II_dimension> & derivative, - const unsigned int component); + approximate_derivative_tensor( + const DoFHandler & dof_handler, + const VEC & solution, + const DoFHandler::active_cell_iterator &cell, + Tensor<2, deal_II_dimension> & derivative, + const unsigned int component); template void - approximate_derivative_tensor, VEC, 3>( - const DH & dof_handler, - const VEC & solution, - const DH::active_cell_iterator &cell, - Tensor<3, deal_II_dimension> & derivative, - const unsigned int component); + approximate_derivative_tensor( + const DoFHandler & dof_handler, + const VEC & solution, + const DoFHandler::active_cell_iterator &cell, + Tensor<3, deal_II_dimension> & derivative, + const unsigned int component); \} }