diff --git a/src/containers/piercedKernelIterator.hpp b/src/containers/piercedKernelIterator.hpp index 8fbd63bd6b..428eaa76b9 100644 --- a/src/containers/piercedKernelIterator.hpp +++ b/src/containers/piercedKernelIterator.hpp @@ -130,8 +130,7 @@ friend class PiercedStorageIterator; /** * Two-way comparison. */ - template - bool operator==(const PiercedKernelIterator& rhs) const + bool operator==(const PiercedKernelIterator &rhs) const { return (m_kernel == rhs.m_kernel) && (m_pos == rhs.m_pos); } @@ -139,8 +138,7 @@ friend class PiercedStorageIterator; /** * Two-way comparison. */ - template - bool operator!=(const PiercedKernelIterator& rhs) const + bool operator!=(const PiercedKernelIterator &rhs) const { return (m_kernel != rhs.m_kernel) || (m_pos != rhs.m_pos); } diff --git a/src/containers/piercedStorageIterator.hpp b/src/containers/piercedStorageIterator.hpp index 27a3872791..5f8b40a532 100644 --- a/src/containers/piercedStorageIterator.hpp +++ b/src/containers/piercedStorageIterator.hpp @@ -160,9 +160,7 @@ friend class PiercedStorage; /** * Two-way comparison. */ - template::type> - bool operator==(const PiercedStorageIterator& rhs) const + bool operator==(const PiercedStorageIterator &rhs) const { return (PiercedKernelIterator::operator==(rhs) && m_storage == rhs.m_storage); } @@ -170,9 +168,7 @@ friend class PiercedStorage; /** * Two-way comparison. */ - template::type> - bool operator!=(const PiercedStorageIterator& rhs) const + bool operator!=(const PiercedStorageIterator &rhs) const { return (PiercedKernelIterator::operator!=(rhs) || m_storage != rhs.m_storage); } diff --git a/src/discretization/reconstruction.cpp b/src/discretization/reconstruction.cpp index 8f497047c1..4b26dd5958 100644 --- a/src/discretization/reconstruction.cpp +++ b/src/discretization/reconstruction.cpp @@ -2673,51 +2673,34 @@ void ReconstructionKernel::computeGradientLimitedWeights(uint8_t degree, const s int nCoeffs = ReconstructionPolynomial::getCoefficientCount(degree, dimensions); BITPIT_CREATE_WORKSPACE(dcsi, double, nCoeffs, MAX_STACK_WORKSPACE_SIZE); - BITPIT_CREATE_WORKSPACE(directionalStencilWeights, double, nEquations, MAX_STACK_WORKSPACE_SIZE); const double *polynomialWeights = getPolynomialWeights(); - // Evalaute weights in x-direction - ReconstructionPolynomial::evalPointBasisDerivatives(degree, dimensions, origin, point, {{1., 0., 0.}}, dcsi); - if (limiters) { - applyLimiter(degree, limiters, dcsi); - } - - cblas_dgemv(CBLAS_ORDER::CblasColMajor, CBLAS_TRANSPOSE::CblasNoTrans, - nEquations, nCoeffs, 1., polynomialWeights, nEquations, - dcsi, 1, 0, directionalStencilWeights, 1); - - for (int i = 0; i < nEquations; ++i) { - gradientWeights[i][0] = directionalStencilWeights[i]; - } - - // Evalaute weights in y-direction - ReconstructionPolynomial::evalPointBasisDerivatives(degree, getDimensions(), origin, point, {{0., 1., 0.}}, dcsi); - if (limiters) { - applyLimiter(degree, limiters, dcsi); - } + std::array direction = {{0., 0., 0.}}; + for (int d = 0; d < dimensions; ++d) { + direction[d] = 1.; - cblas_dgemv(CBLAS_ORDER::CblasColMajor, CBLAS_TRANSPOSE::CblasNoTrans, - nEquations, nCoeffs, 1., polynomialWeights, nEquations, - dcsi, 1, 0, directionalStencilWeights, 1); - - for (int i = 0; i < nEquations; ++i) { - gradientWeights[i][1] = directionalStencilWeights[i]; - } - - // Evalaute weights in z-direction - if (dimensions == 3) { - ReconstructionPolynomial::evalPointBasisDerivatives(degree, getDimensions(), origin, point, {{0., 0., 1.}}, dcsi); + ReconstructionPolynomial::evalPointBasisDerivatives(degree, dimensions, origin, point, direction, dcsi); if (limiters) { applyLimiter(degree, limiters, dcsi); } + // Weights are stored in contiguous three-dimensional arrays, this + // means we can access the weights of the current dimensions using + // the dimension as offset and a stride of three elements cblas_dgemv(CBLAS_ORDER::CblasColMajor, CBLAS_TRANSPOSE::CblasNoTrans, nEquations, nCoeffs, 1., polynomialWeights, nEquations, - dcsi, 1, 0, directionalStencilWeights, 1); + dcsi, 1, 0, gradientWeights->data() + d, 3); + + direction[d] = 0.; + } + // Explicitly zero unused components + if (dimensions != ReconstructionPolynomial::MAX_DIMENSIONS) { for (int i = 0; i < nEquations; ++i) { - gradientWeights[i][2] = directionalStencilWeights[i]; + for (int d = dimensions; d < ReconstructionPolynomial::MAX_DIMENSIONS; ++d) { + gradientWeights[i][d] = 0.; + } } } }