From f504a8759ed41ca1a79f77da806d9292f646ad12 Mon Sep 17 00:00:00 2001 From: Christoph Lehmann <christoph.lehmann@ufz.de> Date: Wed, 2 Sep 2015 09:50:59 +0200 Subject: [PATCH] changed element access, added assertion --- NumLib/Function/Interpolation.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/NumLib/Function/Interpolation.h b/NumLib/Function/Interpolation.h index d1dbfca3037..5e2a8a71d6d 100644 --- a/NumLib/Function/Interpolation.h +++ b/NumLib/Function/Interpolation.h @@ -11,6 +11,7 @@ #define NUMLIB_INTERPOLATION_H #include<array> +#include<cassert> namespace NumLib { @@ -34,13 +35,15 @@ void shapeFunctionInterpolate( { auto const num_nodes = shape_matrix_N.size(); + assert(num_nodes*NodalDOF == nodal_values.size()); + for (unsigned d=0; d<NodalDOF; ++d) { *interpolated_values[d] = 0.0; for (unsigned n=0; n<num_nodes; ++n) { - *interpolated_values[d] += nodal_values[d*num_nodes+n] * shape_matrix_N(n); + *interpolated_values[d] += nodal_values[d*num_nodes+n] * shape_matrix_N[n]; } } } -- GitLab