From 2feb5a12a39528cb6d9e9685ece708b4f37425cd Mon Sep 17 00:00:00 2001 From: Will Bainbridge Date: Mon, 5 Feb 2018 08:19:27 +0000 Subject: [PATCH] VectorSpaceOps: Generalised loops for single-element vector spaces Fixes out-of-bounds warnings generated when vector operations are applied to spherical tensors. --- .../primitives/VectorSpace/VectorSpaceOps.H | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/OpenFOAM/primitives/VectorSpace/VectorSpaceOps.H b/src/OpenFOAM/primitives/VectorSpace/VectorSpaceOps.H index 5df70b1e5..c41f2aab3 100644 --- a/src/OpenFOAM/primitives/VectorSpace/VectorSpaceOps.H +++ b/src/OpenFOAM/primitives/VectorSpace/VectorSpaceOps.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -44,27 +44,25 @@ class VectorSpaceOps { public: - static const int endLoop = (I < N-1) ? 1 : 0; - template static inline void eqOpS(V& vs, const S& s, EqOp eo) { eo(vs.v_[I], s); - VectorSpaceOps::eqOpS(vs, s, eo); + VectorSpaceOps::eqOpS(vs, s, eo); } template static inline void SeqOp(S& s, const V& vs, EqOp eo) { eo(s, vs.v_[I]); - VectorSpaceOps::SeqOp(s, vs, eo); + VectorSpaceOps::SeqOp(s, vs, eo); } template static inline void eqOp(V1& vs1, const V2& vs2, EqOp eo) { eo(vs1.v_[I], vs2.v_[I]); - VectorSpaceOps::eqOp(vs1, vs2, eo); + VectorSpaceOps::eqOp(vs1, vs2, eo); } @@ -72,27 +70,27 @@ public: static inline void opVS(V& vs, const V1& vs1, const S& s, Op o) { vs.v_[I] = o(vs1.v_[I], s); - VectorSpaceOps::opVS(vs, vs1, s, o); + VectorSpaceOps::opVS(vs, vs1, s, o); } template static inline void opSV(V& vs, const S& s, const V1& vs1, Op o) { vs.v_[I] = o(s, vs1.v_[I]); - VectorSpaceOps::opSV(vs, s, vs1, o); + VectorSpaceOps::opSV(vs, s, vs1, o); } template static inline void op(V& vs, const V1& vs1, const V1& vs2, Op o) { vs.v_[I] = o(vs1.v_[I], vs2.v_[I]); - VectorSpaceOps::op(vs, vs1, vs2, o); + VectorSpaceOps::op(vs, vs1, vs2, o); } }; -template<> -class VectorSpaceOps<0, 0> +template +class VectorSpaceOps { public: