From 2f8fc5df0b0fd48467209e42bf67ac8c08090db8 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Mon, 23 Oct 2017 22:03:57 -0600 Subject: [PATCH] Change argument of DoFRenumbering::downstream() to Tensor<1,dim>. That's because this kind of argument indicates a *direction*, not a point, and for the former Tensor<1,dim> is the correct data type. --- include/deal.II/dofs/dof_renumbering.h | 72 +++++++++----------------- source/dofs/dof_renumbering.cc | 42 +++++++++------ source/dofs/dof_renumbering.inst.in | 6 +-- 3 files changed, 55 insertions(+), 65 deletions(-) diff --git a/include/deal.II/dofs/dof_renumbering.h b/include/deal.II/dofs/dof_renumbering.h index e79b96b347..f7f7694f12 100644 --- a/include/deal.II/dofs/dof_renumbering.h +++ b/include/deal.II/dofs/dof_renumbering.h @@ -831,9 +831,9 @@ namespace DoFRenumbering * numbering is performed cell-wise, otherwise it is performed based on the * location of the support points. * - * The cells are sorted such that the centers of higher numbers are further + * The cells are sorted such that the centers of cells numbered higher are further * downstream with respect to the constant vector @p direction than the - * centers of lower numbers. Even if this yields a downstream numbering with + * centers of of cells numbered lower. Even if this yields a downstream numbering with * respect to the flux on the edges for fairly general grids, this might not * be guaranteed for all meshes. * @@ -852,48 +852,48 @@ namespace DoFRenumbering */ template void - downstream (DoFHandlerType &dof_handler, - const Point &direction, - const bool dof_wise_renumbering = false); + downstream (DoFHandlerType &dof_handler, + const Tensor<1,DoFHandlerType::space_dimension> &direction, + const bool dof_wise_renumbering = false); /** * Cell-wise downstream numbering with respect to a constant flow direction - * on one level. See the other function with the same name. + * on one level of a multigrid hierarchy. See the other function with the same name. */ template void - downstream (DoFHandlerType &dof_handler, - const unsigned int level, - const Point &direction, - const bool dof_wise_renumbering = false); + downstream (DoFHandlerType &dof_handler, + const unsigned int level, + const Tensor<1,DoFHandlerType::space_dimension> &direction, + const bool dof_wise_renumbering = false); /** - * Compute the renumbering vector needed by the downstream() function. Does + * Compute the set of renumbering indices needed by the downstream() function. Does * not perform the renumbering on the DoFHandler dofs but returns the * renumbering vector. */ template void - compute_downstream (std::vector &new_dof_indices, - std::vector &reverse, - const DoFHandlerType &dof_handler, - const Point &direction, - const bool dof_wise_renumbering); + compute_downstream (std::vector &new_dof_indices, + std::vector &reverse, + const DoFHandlerType &dof_handler, + const Tensor<1,DoFHandlerType::space_dimension> &direction, + const bool dof_wise_renumbering); /** - * Compute the renumbering vector needed by the downstream() function. Does + * Compute the set of renumbering indices needed by the downstream() function. Does * not perform the renumbering on the DoFHandler dofs but returns the * renumbering vector. */ template void - compute_downstream (std::vector &new_dof_indices, - std::vector &reverse, - const DoFHandlerType &dof_handler, - const unsigned int level, - const Point &direction, - const bool dof_wise_renumbering); + compute_downstream (std::vector &new_dof_indices, + std::vector &reverse, + const DoFHandlerType &dof_handler, + const unsigned int level, + const Tensor<1,DoFHandlerType::space_dimension> &direction, + const bool dof_wise_renumbering); /** * Cell-wise clockwise numbering. @@ -910,8 +910,8 @@ namespace DoFRenumbering const bool counter = false); /** - * Cell-wise clockwise numbering on one level. See the other function with - * the same name. + * Cell-wise clockwise numbering on one level of a multigrid + * hierarchy. See the other function with the same name. */ template void @@ -1100,28 +1100,6 @@ namespace DoFRenumbering DeclException0 (ExcNotDGFEM); } -/* ------------------------- inline functions -------------- */ - -#ifndef DOXYGEN -namespace DoFRenumbering -{ - template - void - inline - downstream (DoFHandlerType &dof, - const Point &direction, - const bool dof_wise_renumbering) - { - std::vector renumbering(dof.n_dofs()); - std::vector reverse(dof.n_dofs()); - compute_downstream(renumbering, reverse, dof, direction, - dof_wise_renumbering); - - dof.renumber_dofs(renumbering); - } -} -#endif - DEAL_II_NAMESPACE_CLOSE diff --git a/source/dofs/dof_renumbering.cc b/source/dofs/dof_renumbering.cc index 0786896e6a..2788416f46 100644 --- a/source/dofs/dof_renumbering.cc +++ b/source/dofs/dof_renumbering.cc @@ -1487,18 +1487,30 @@ namespace DoFRenumbering + template + void + downstream (DoFHandlerType &dof, + const Tensor<1,DoFHandlerType::space_dimension> &direction, + const bool dof_wise_renumbering) + { + std::vector renumbering(dof.n_dofs()); + std::vector reverse(dof.n_dofs()); + compute_downstream(renumbering, reverse, dof, direction, + dof_wise_renumbering); + dof.renumber_dofs(renumbering); + } template void compute_downstream - (std::vector &new_indices, - std::vector &reverse, - const DoFHandlerType &dof, - const Point &direction, - const bool dof_wise_renumbering) + (std::vector &new_indices, + std::vector &reverse, + const DoFHandlerType &dof, + const Tensor<1,DoFHandlerType::space_dimension> &direction, + const bool dof_wise_renumbering) { if (dof_wise_renumbering == false) { @@ -1583,10 +1595,10 @@ namespace DoFRenumbering template - void downstream (DoFHandlerType &dof, - const unsigned int level, - const Point &direction, - const bool dof_wise_renumbering) + void downstream (DoFHandlerType &dof, + const unsigned int level, + const Tensor<1,DoFHandlerType::space_dimension> &direction, + const bool dof_wise_renumbering) { std::vector renumbering(dof.n_dofs(level)); std::vector reverse(dof.n_dofs(level)); @@ -1601,12 +1613,12 @@ namespace DoFRenumbering template void compute_downstream - (std::vector &new_indices, - std::vector &reverse, - const DoFHandlerType &dof, - const unsigned int level, - const Point &direction, - const bool dof_wise_renumbering) + (std::vector &new_indices, + std::vector &reverse, + const DoFHandlerType &dof, + const unsigned int level, + const Tensor<1,DoFHandlerType::space_dimension> &direction, + const bool dof_wise_renumbering) { if (dof_wise_renumbering == false) { diff --git a/source/dofs/dof_renumbering.inst.in b/source/dofs/dof_renumbering.inst.in index 8ba908e2e5..b76ea6a0b6 100644 --- a/source/dofs/dof_renumbering.inst.in +++ b/source/dofs/dof_renumbering.inst.in @@ -198,7 +198,7 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS template void compute_downstream > (std::vector&,std::vector&, - const DoFHandler&, const Point&, + const DoFHandler&, const Tensor<1,deal_II_dimension>&, const bool); template @@ -229,7 +229,7 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS compute_downstream > (std::vector&,std::vector&, const hp::DoFHandler&, - const Point&, + const Tensor<1,deal_II_dimension>&, const bool); template @@ -252,7 +252,7 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS void downstream (DoFHandler&, const unsigned int, - const Point&, + const Tensor<1,deal_II_dimension>&, const bool); template -- 2.39.5