From 086c64b4edce64bf121b395390c948bae7756b22 Mon Sep 17 00:00:00 2001 From: Christoph Lehmann <christoph.lehmann@ufz.de> Date: Tue, 1 Sep 2015 15:49:11 +0200 Subject: [PATCH] changed method signature. The function now uses array and thus should be more error-save. --- NumLib/Function/Interpolation.h | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/NumLib/Function/Interpolation.h b/NumLib/Function/Interpolation.h index e46363ec3d5..d1dbfca3037 100644 --- a/NumLib/Function/Interpolation.h +++ b/NumLib/Function/Interpolation.h @@ -10,6 +10,8 @@ #ifndef NUMLIB_INTERPOLATION_H #define NUMLIB_INTERPOLATION_H +#include<array> + namespace NumLib { @@ -19,24 +21,20 @@ namespace NumLib * This function simply does the usual finite-element interpolation, i.e. multiplication * of nodal values with the shape function. * - * @param nodal_values vector of nodal values + * @param nodal_values vector of nodal values, ordered by component * @param shape_matrix_N shape matrix of the point to which will be interpolated - * @param num_nodal_dof number of nodal variables that will be interpolated * @param interpolated_values array of addresses to which the interpolated values will be written - * - * The size of interpolated_values must be equal to num_nodal_dof. */ -template<typename NodalValues, typename ShapeMatrix> +template<typename NodalValues, typename ShapeMatrix, std::size_t NodalDOF> void shapeFunctionInterpolate( const NodalValues& nodal_values, const ShapeMatrix& shape_matrix_N, - const unsigned num_nodal_dof, - double** interpolated_values + std::array<double*, NodalDOF> interpolated_values ) { auto const num_nodes = shape_matrix_N.size(); - for (unsigned d=0; d<num_nodal_dof; ++d) + for (unsigned d=0; d<NodalDOF; ++d) { *interpolated_values[d] = 0.0; -- GitLab