From: Peter Munch Date: Mon, 19 Jul 2021 10:29:59 +0000 (+0200) Subject: DoFInfo::read_dof_indices(): add additional index vector X-Git-Tag: v9.4.0-rc1~1136^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f42737a296181fd8a5672167458f22991e24f333;p=dealii.git DoFInfo::read_dof_indices(): add additional index vector --- diff --git a/include/deal.II/matrix_free/dof_info.h b/include/deal.II/matrix_free/dof_info.h index cd5b0344e3..90e346f031 100644 --- a/include/deal.II/matrix_free/dof_info.h +++ b/include/deal.II/matrix_free/dof_info.h @@ -184,18 +184,19 @@ namespace internal const bool with_constraints = true) const; /** - * This internal method takes the local indices on a cell and fills them - * into this class. It resolves the constraints and distributes the - * results. Ghost indices, i.e., indices that are located on another - * processor, get a temporary number by this function, and will later be - * assigned the correct index after all the ghost indices have been - * collected by the call to @p assign_ghosts. + * This internal method takes the local indices on a cell (two versions: + * hanging-node constraints resolved if possible and plain, i.e., not + * resolved) and fills them into this class. It resolves the constraints + * and distributes the results. Ghost indices, i.e., indices that are + * located on another processor, get a temporary number by this function, + * and will later be assigned the correct index after all the ghost + * indices have been collected by the call to @p assign_ghosts. */ template void read_dof_indices( + const std::vector &local_indices_resolved, const std::vector &local_indices, - const std::vector & lexicographic_inv, const dealii::AffineConstraints & constraints, const unsigned int cell_number, ConstraintValues & constraint_values, @@ -497,6 +498,12 @@ namespace internal */ std::vector dof_indices; + /** + * Masks indicating for each cell and component if the optimized + * hanging-node constraint is applicable and if yes which type. + */ + std::vector hanging_node_constraint_masks; + /** * This variable describes the position of constraints in terms of the * local numbering of degrees of freedom on a cell. The first number diff --git a/include/deal.II/matrix_free/dof_info.templates.h b/include/deal.II/matrix_free/dof_info.templates.h index 296e7d339b..bc688a086b 100644 --- a/include/deal.II/matrix_free/dof_info.templates.h +++ b/include/deal.II/matrix_free/dof_info.templates.h @@ -104,8 +104,8 @@ namespace internal template void DoFInfo::read_dof_indices( + const std::vector &local_indices_resolved, const std::vector &local_indices, - const std::vector & lexicographic_inv, const dealii::AffineConstraints & constraints, const unsigned int cell_number, ConstraintValues & constraint_values, @@ -137,9 +137,8 @@ namespace internal i < component_dof_indices_offset[fe_index][comp + 1]; i++) { - types::global_dof_index current_dof = - local_indices[lexicographic_inv[i]]; - const auto *entries_ptr = + types::global_dof_index current_dof = local_indices_resolved[i]; + const auto * entries_ptr = constraints.get_constraint_entries(current_dof); // dof is constrained @@ -253,8 +252,7 @@ namespace internal { for (unsigned int i = 0; i < dofs_this_cell; ++i) { - types::global_dof_index current_dof = - local_indices[lexicographic_inv[i]]; + types::global_dof_index current_dof = local_indices[i]; if (n_mpi_procs > 1 && (current_dof < first_owned || current_dof >= last_owned)) { diff --git a/include/deal.II/matrix_free/matrix_free.templates.h b/include/deal.II/matrix_free/matrix_free.templates.h index 0325470e71..66f560eb7c 100644 --- a/include/deal.II/matrix_free/matrix_free.templates.h +++ b/include/deal.II/matrix_free/matrix_free.templates.h @@ -1050,7 +1050,8 @@ namespace internal AssertDimension(n_dof_handlers, locally_owned_dofs.size()); AssertDimension(n_dof_handlers, constraint.size()); - std::vector local_dof_indices; + std::vector local_dof_indices_resolved; + std::vector local_dof_indices; std::vector>> lexicographic( n_dof_handlers); @@ -1196,10 +1197,18 @@ namespace internal 0; if (dofh->get_fe_collection().size() > 1) dof_info[no].cell_active_fe_index[counter] = fe_index; - local_dof_indices.resize(dof_info[no].dofs_per_cell[fe_index]); - cell_it->get_dof_indices(local_dof_indices); + local_dof_indices_resolved.resize( + dof_info[no].dofs_per_cell[fe_index]); + cell_it->get_dof_indices(local_dof_indices_resolved); + + local_dof_indices.resize(local_dof_indices_resolved.size()); + for (unsigned int i = 0; i < local_dof_indices_resolved.size(); + ++i) + local_dof_indices[i] = + local_dof_indices_resolved[lexicographic[no][fe_index][i]]; + dof_info[no].read_dof_indices(local_dof_indices, - lexicographic[no][fe_index], + local_dof_indices, *constraint[no], counter, constraint_values, @@ -1223,10 +1232,18 @@ namespace internal cell_level_index[counter].first, cell_level_index[counter].second, dofh); - local_dof_indices.resize(dof_info[no].dofs_per_cell[0]); - cell_it->get_mg_dof_indices(local_dof_indices); + local_dof_indices_resolved.resize( + dof_info[no].dofs_per_cell[0]); + cell_it->get_mg_dof_indices(local_dof_indices_resolved); + + local_dof_indices.resize(local_dof_indices_resolved.size()); + for (unsigned int i = 0; i < local_dof_indices_resolved.size(); + ++i) + local_dof_indices[i] = + local_dof_indices_resolved[lexicographic[no][0][i]]; + dof_info[no].read_dof_indices(local_dof_indices, - lexicographic[no][0], + local_dof_indices, *constraint[no], counter, constraint_values, diff --git a/source/matrix_free/dof_info.cc b/source/matrix_free/dof_info.cc index 4b2d8b925b..b6b25f2320 100644 --- a/source/matrix_free/dof_info.cc +++ b/source/matrix_free/dof_info.cc @@ -1459,7 +1459,7 @@ namespace internal template void DoFInfo::read_dof_indices( const std::vector &, - const std::vector &, + const std::vector &, const dealii::AffineConstraints &, const unsigned int, ConstraintValues &, @@ -1468,7 +1468,7 @@ namespace internal template void DoFInfo::read_dof_indices( const std::vector &, - const std::vector &, + const std::vector &, const dealii::AffineConstraints &, const unsigned int, ConstraintValues &,