From 7937aece8f247057038a7324273cc7c7d0e9e84d Mon Sep 17 00:00:00 2001 From: Timo Heister Date: Tue, 26 Jan 2021 13:47:24 -0500 Subject: [PATCH] fix array bounds warning --- source/fe/mapping_fe_field.cc | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/source/fe/mapping_fe_field.cc b/source/fe/mapping_fe_field.cc index 0cad06d6f4..1d6cff0836 100644 --- a/source/fe/mapping_fe_field.cc +++ b/source/fe/mapping_fe_field.cc @@ -1571,9 +1571,15 @@ MappingFEField::fill_fe_values( if (dim == 1) output_data.normal_vectors[point] = cross_product_2d(-DX_t[0]); - else // dim == 2 - output_data.normal_vectors[point] = - cross_product_3d(DX_t[0], DX_t[1]); + else + { + Assert(dim == 2, ExcInternalError()); + + // dim-1==1 for the second argument, but this + // avoids a compiler warning about array bounds: + output_data.normal_vectors[point] = + cross_product_3d(DX_t[0], DX_t[dim - 1]); + } output_data.normal_vectors[point] /= output_data.normal_vectors[point].norm(); -- 2.39.5