From 9e1d119de35e1735f9cef757fafde7d55c0b82c0 Mon Sep 17 00:00:00 2001 From: Peter Munch Date: Tue, 3 Nov 2020 14:20:51 +0100 Subject: [PATCH] Use global_active_cell_index in MatrixFree::initialize_indices --- .../matrix_free/matrix_free.templates.h | 23 +++++++++++-------- source/grid/tria.cc | 2 +- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/include/deal.II/matrix_free/matrix_free.templates.h b/include/deal.II/matrix_free/matrix_free.templates.h index 6933925da7..76093d8817 100644 --- a/include/deal.II/matrix_free/matrix_free.templates.h +++ b/include/deal.II/matrix_free/matrix_free.templates.h @@ -1552,12 +1552,16 @@ MatrixFree::initialize_indices( { const unsigned int index = cell * n_lanes + v; + const auto cell_iterator = get_cell_iterator(cell, v, di_index); + // determine global cell index const unsigned int local_dof_index = di.dof_indices_contiguous[2][index]; + const types::global_cell_index global_cell_index = - di.vector_partitioner->local_to_global(local_dof_index) / - this->get_dofs_per_cell(di_index); + (additional_data.mg_level == numbers::invalid_unsigned_int) ? + cell_iterator->global_active_cell_index() : + cell_iterator->global_level_cell_index(); // determine sm rank unsigned int sm_rank = my_sm_pid; @@ -1570,14 +1574,13 @@ MatrixFree::initialize_indices( else { // ghost cell - const auto ptr = std::find( - sm_procs.begin(), - sm_procs.end(), - additional_data.mg_level == - numbers::invalid_unsigned_int ? - get_cell_iterator(cell, v, di_index)->subdomain_id() : - get_cell_iterator(cell, v, di_index) - ->level_subdomain_id()); + const auto ptr = + std::find(sm_procs.begin(), + sm_procs.end(), + additional_data.mg_level == + numbers::invalid_unsigned_int ? + cell_iterator->subdomain_id() : + cell_iterator->level_subdomain_id()); if (ptr != sm_procs.end()) { diff --git a/source/grid/tria.cc b/source/grid/tria.cc index 13daa80bfa..a8e053e185 100644 --- a/source/grid/tria.cc +++ b/source/grid/tria.cc @@ -12696,7 +12696,7 @@ Triangulation::reset_global_cell_indices() { types::global_cell_index cell_index = 0; for (const auto &cell : active_cell_iterators()) - cell->set_active_cell_index(cell_index++); + cell->set_global_active_cell_index(cell_index++); } for (unsigned int l = 0; l < levels.size(); ++l) -- 2.39.5