From b2494e7c79a3d975b9a6692571e040d026a6919c Mon Sep 17 00:00:00 2001 From: Martin Kronbichler Date: Sat, 10 Nov 2018 22:23:32 +0100 Subject: [PATCH] Avoid negative index offsets. --- include/deal.II/matrix_free/dof_info.templates.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/include/deal.II/matrix_free/dof_info.templates.h b/include/deal.II/matrix_free/dof_info.templates.h index a3400b2b50..2987edf8cd 100644 --- a/include/deal.II/matrix_free/dof_info.templates.h +++ b/include/deal.II/matrix_free/dof_info.templates.h @@ -817,8 +817,11 @@ namespace internal dof_indices[j * ndofs + 1] - dof_indices[j * ndofs]; for (unsigned int k = 0; k < ndofs; ++k) for (unsigned int j = 0; j < n_comp; ++j) - if (dof_indices[j * ndofs + k] != - dof_indices[j * ndofs] + k * offsets[j]) + // the first if case is to avoid negative offsets + // (invalid) + if (dof_indices[j * ndofs + 1] < dof_indices[j * ndofs] || + dof_indices[j * ndofs + k] != + dof_indices[j * ndofs] + k * offsets[j]) { indices_are_interleaved_and_mixed = 0; break; -- 2.39.5