From 35f6867dcde253f8308b104de40ccb50cf7e1215 Mon Sep 17 00:00:00 2001 From: wolf Date: Thu, 17 Oct 2002 20:12:09 +0000 Subject: [PATCH] The order in which components are to be sorted in DoFRenumbering::component_wise was not honored. Fix this. git-svn-id: https://svn.dealii.org/trunk@6685 0785d39b-7218-0410-832d-ea1e28bc413d --- .../deal.II/source/dofs/dof_renumbering.cc | 60 ++++++++++++++----- deal.II/doc/news/2002/c-3-4.html | 11 ++++ 2 files changed, 57 insertions(+), 14 deletions(-) diff --git a/deal.II/deal.II/source/dofs/dof_renumbering.cc b/deal.II/deal.II/source/dofs/dof_renumbering.cc index 76d6fab4bd..33b179ac3f 100644 --- a/deal.II/deal.II/source/dofs/dof_renumbering.cc +++ b/deal.II/deal.II/source/dofs/dof_renumbering.cc @@ -538,6 +538,16 @@ DoFRenumbering::component_wise (DoFHandler &dof_handler, // within each component and during // this also remove duplicate // entries + // + // note that we no + // longer have to care about + // non-primitive shape functions + // since the buckets corresponding + // to the second and following + // vector components of a + // non-primitive FE will simply be + // empty, everything being shoved + // into the first one for (unsigned int component=0; component &dof_handler, component_to_dof_map[component].end()), component_to_dof_map[component].end()); }; - + + // now concatenate all the + // components in the order the user + // desired to see unsigned int next_free_index = 0; std::vector new_indices (dof_handler.n_dofs(), DoFHandler::invalid_dof_index); - for (unsigned int component=0; component::const_iterator begin_of_component = component_to_dof_map[component].begin(), end_of_component = component_to_dof_map[component].end(); @@ -602,8 +617,7 @@ void DoFRenumbering::component_wise (MGDoFHandler& dof_handler, // vector to hold the dof indices on // the cell we visit at a time std::vector local_dof_indices(dofs_per_cell); - // prebuilt list to which component - // a given dof on a cell belongs + // prebuilt list to which component // a given dof on a cell // belongs. note that we get into @@ -637,7 +651,7 @@ void DoFRenumbering::component_wise (MGDoFHandler& dof_handler, // of freedom with this // component component_list[i] = c; - }; + }; // set up a map where for each // component the respective degrees @@ -651,7 +665,8 @@ void DoFRenumbering::component_wise (MGDoFHandler& dof_handler, // multiply, so we will have to // take care of that std::vector > component_to_dof_map (fe.n_components()); - for (typename MGDoFHandler::cell_iterator cell=dof_handler.begin(level); + for (typename MGDoFHandler::cell_iterator + cell=dof_handler.begin(level); cell!=dof_handler.end(level); ++cell) { // on each cell: get dof indices @@ -674,31 +689,48 @@ void DoFRenumbering::component_wise (MGDoFHandler& dof_handler, // within each component and during // this also remove duplicate // entries + // + // note that we no + // longer have to care about + // non-primitive shape functions + // since the buckets corresponding + // to the second and following + // vector components of a + // non-primitive FE will simply be + // empty, everything being shoved + // into the first one for (unsigned int component=0; component new_indices (dof_handler.n_dofs(level), DoFHandler::invalid_dof_index); - for (unsigned int component=0; component::const_iterator begin_of_component = component_to_dof_map[component].begin(), end_of_component = component_to_dof_map[component].end(); - for (typename std::vector::const_iterator dof_index = begin_of_component; + for (typename std::vector::const_iterator + dof_index = begin_of_component; dof_index != end_of_component; ++dof_index) new_indices[*dof_index] = next_free_index++; }; -// Assert (next_free_index == dof_handler.n_dofs(level), -// ExcInternalError()); + Assert (next_free_index == dof_handler.n_dofs(level), + ExcInternalError()); dof_handler.renumber_dofs (level, new_indices); }; diff --git a/deal.II/doc/news/2002/c-3-4.html b/deal.II/doc/news/2002/c-3-4.html index 340ac498c9..e57bbb5ce6 100644 --- a/deal.II/doc/news/2002/c-3-4.html +++ b/deal.II/doc/news/2002/c-3-4.html @@ -402,6 +402,17 @@ contributor's names are abbreviated by WB (Wolfgang Bangerth), GK

deal.II

    +
  1. + Fixed: The DoFRenumbering::component_wise function accepts a + parameter indicating the order in which the degrees of freedom + corresponding to one vector component are to be sorted. However, it did + not honor this order, but always sorted them in the order in which the + components appear. This is now fixed. +
    + (WB 2002/10/17) +

    +
  2. New: The FiniteElement::system_to_base_index function now -- 2.39.5