From 974c730ceda18a5e6396c62ac8c9a1484fc03b99 Mon Sep 17 00:00:00 2001 From: Niklas Wik Date: Fri, 1 Apr 2022 17:32:52 +0200 Subject: [PATCH] Bug fix - renumbering points FERaviartThomasNodal --- source/fe/fe_raviart_thomas_nodal.cc | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/source/fe/fe_raviart_thomas_nodal.cc b/source/fe/fe_raviart_thomas_nodal.cc index 08ecfed20f..4acde3a11d 100644 --- a/source/fe/fe_raviart_thomas_nodal.cc +++ b/source/fe/fe_raviart_thomas_nodal.cc @@ -231,19 +231,25 @@ namespace renumber_aniso[0].resize(n_pols); for (unsigned int i = 0; i < n_pols; ++i) renumber_aniso[0][i] = i; - if (dim > 1) + if (dim == 2) { // switch x and y component (i and j loops) renumber_aniso[1].resize(n_pols); - for (unsigned int k = 0; k < (dim > 2 ? degree + 1 : 1); ++k) + for (unsigned int j = 0; j < degree + 2; ++j) + for (unsigned int i = 0; i < degree + 1; ++i) + renumber_aniso[1][j * (degree + 1) + i] = j + i * (degree + 2); + } + if (dim == 3) + { + // switch x, y, and z component (i, j, k) -> (j, k, i) + renumber_aniso[1].resize(n_pols); + for (unsigned int k = 0; k < degree + 1; ++k) for (unsigned int j = 0; j < degree + 2; ++j) for (unsigned int i = 0; i < degree + 1; ++i) renumber_aniso[1][(k * (degree + 2) + j) * (degree + 1) + i] = - j + i * (degree + 2) + k * (degree + 2) * (degree + 1); - } - if (dim > 2) - { - // switch x and z component (i and k loops) + j + k * (degree + 2) + i * (degree + 2) * (degree + 1); + + // switch x, y, and z component (i, j, k) -> (k, i, j) renumber_aniso[2].resize(n_pols); for (unsigned int k = 0; k < degree + 2; ++k) for (unsigned int j = 0; j < degree + 1; ++j) -- 2.39.5