]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Avoid negative index offsets.
authorMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Sat, 10 Nov 2018 21:23:32 +0000 (22:23 +0100)
committerMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Sat, 10 Nov 2018 21:23:32 +0000 (22:23 +0100)
include/deal.II/matrix_free/dof_info.templates.h

index a3400b2b506a01db4bf42de0ba140dce3bc52b1b..2987edf8cd5fe6dad1d73601a1d753c3d2def374 100644 (file)
@@ -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;

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.