From d5b785ab8cd895784993b8d09b16f65a24880255 Mon Sep 17 00:00:00 2001 From: Martin Kronbichler Date: Thu, 22 Jun 2023 11:54:06 +0200 Subject: [PATCH] Fix bug in MatrixFree setup for FE_Nothing --- source/matrix_free/dof_info.cc | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/source/matrix_free/dof_info.cc b/source/matrix_free/dof_info.cc index 8c7c34e433..d6f12cd6fb 100644 --- a/source/matrix_free/dof_info.cc +++ b/source/matrix_free/dof_info.cc @@ -588,7 +588,7 @@ namespace internal IndexStorageVariants::full; else { - bool indices_are_contiguous = true; + bool indices_are_contiguous = (ndofs > 0); for (unsigned int j = 0; j < n_comp; ++j) { const unsigned int cell_no = i * vectorization_length + j; @@ -630,14 +630,18 @@ namespace internal indices_are_interleaved_and_contiguous) { for (unsigned int j = 0; j < n_comp; ++j) - dof_indices_contiguous - [dof_access_cell][i * vectorization_length + j] = - this->dof_indices.size() == 0 ? - 0 : - this->dof_indices - [row_starts[(i * vectorization_length + j) * - n_components] - .first]; + { + const unsigned int start_index = + row_starts[(i * vectorization_length + j) * + n_components] + .first; + AssertIndexRange(start_index, dof_indices.size()); + dof_indices_contiguous[dof_access_cell] + [i * vectorization_length + j] = + this->dof_indices.size() == 0 ? + 0 : + this->dof_indices[start_index]; + } } if (indices_are_interleaved_and_contiguous) @@ -657,7 +661,7 @@ namespace internal dof_indices_interleave_strides[2][i * vectorization_length + j] = 1; } - else + else if (ndofs > 0) { int indices_are_interleaved_and_mixed = 2; const unsigned int *dof_indices = @@ -750,6 +754,9 @@ namespace internal } } } + else // ndofs == 0 + index_storage_variants[dof_access_cell][i] = + IndexStorageVariants::full; } index_kinds[static_cast( index_storage_variants[dof_access_cell][i])]++; -- 2.39.5