STYLE: expand use of ListLoop macros (#2624)

- the old List_FOR_ALL macro only remained in use in relatively few
  places. Replace with the expanded equivalent and move the looping
  parameter out of the macro and give an explicit name (eg, loopLen)
  which simplifies the addition of any loop pragmas in the various
  TFOR_ALL... macros (for example).
This commit is contained in:
Mark Olesen
2022-10-28 18:38:24 +02:00
parent 9db3547bd3
commit 454f7960b0
7 changed files with 203 additions and 94 deletions

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2017-2020 OpenCFD Ltd. Copyright (C) 2017-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -38,7 +38,7 @@ Foam::label Foam::IndirectListBase<T, Addr>::find
if (pos >= 0 && len) if (pos >= 0 && len)
{ {
List_CONST_ACCESS(T, values_, vals); const T* const vals = values_.begin();
while (pos < len) while (pos < len)
{ {
@ -69,7 +69,7 @@ Foam::label Foam::IndirectListBase<T, Addr>::rfind
pos = addr_.size()-1; pos = addr_.size()-1;
} }
List_CONST_ACCESS(T, values_, vals); const T* const vals = values_.begin();
while (pos >= 0) while (pos >= 0)
{ {

View File

@ -29,8 +29,8 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef ListLoopM_H #ifndef Foam_ListLoopM_H
#define ListLoopM_H #define Foam_ListLoopM_H
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Element access looping // Element access looping
@ -43,6 +43,7 @@ Description
#define List_CONST_ACCESS(type, f, fp) \ #define List_CONST_ACCESS(type, f, fp) \
const type* const __restrict__ fp = (f).begin() const type* const __restrict__ fp = (f).begin()
// Loop over all elements
#define List_FOR_ALL(f, i) \ #define List_FOR_ALL(f, i) \
const label _n##i = (f).size(); \ const label _n##i = (f).size(); \
for (label i=0; i<_n##i; ++i) for (label i=0; i<_n##i; ++i)

View File

@ -26,10 +26,6 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include <utility>
#include "ListOps.H"
#include "ListLoopM.H"
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
template<class IntListType> template<class IntListType>
@ -1324,16 +1320,15 @@ Foam::List<T> Foam::ListOps::create
List<T> output(len); List<T> output(len);
if (len) // ie, std::transform(input.begin(), input.end(), output.begin(), op);
{
List_ACCESS(T, output, out); const T2* in = input.begin();
List_CONST_ACCESS(T2, input, in); T* out = output.begin();
for (label i = 0; i < len; ++i) for (label i = 0; i < len; ++i)
{ {
out[i] = op(in[i]); out[i] = op(in[i]);
} }
}
return output; return output;
} }
@ -1351,8 +1346,8 @@ Foam::List<T> Foam::ListOps::create
List<T> output(len); List<T> output(len);
if (len) // ie, std::transform(first, last, output.begin(), op);
{
T* out = output.begin(); T* out = output.begin();
while (first != last) while (first != last)
@ -1361,7 +1356,6 @@ Foam::List<T> Foam::ListOps::create
++first; ++first;
++out; ++out;
} }
}
return output; return output;
} }

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -47,7 +47,9 @@ void component
const direction d const direction d
) )
{ {
forAll(sf, i) const label loopLen = (sf).size();
for (label i = 0; i < loopLen; ++i)
{ {
component(sf[i], f[i], d); component(sf[i], f[i], d);
} }
@ -57,7 +59,9 @@ void component
template<template<class> class Field, class Type> template<template<class> class Field, class Type>
void T(FieldField<Field, Type>& f1, const FieldField<Field, Type>& f2) void T(FieldField<Field, Type>& f1, const FieldField<Field, Type>& f2)
{ {
forAll(f1, i) const label loopLen = (f1).size();
for (label i = 0; i < loopLen; ++i)
{ {
T(f1[i], f2[i]); T(f1[i], f2[i]);
} }
@ -71,7 +75,9 @@ void pow
const FieldField<Field, Type>& vf const FieldField<Field, Type>& vf
) )
{ {
forAll(f, i) const label loopLen = (f).size();
for (label i = 0; i < loopLen; ++i)
{ {
pow(f[i], vf[i]); pow(f[i], vf[i]);
} }
@ -122,7 +128,9 @@ void sqr
const FieldField<Field, Type>& vf const FieldField<Field, Type>& vf
) )
{ {
forAll(f, i) const label loopLen = (f).size();
for (label i = 0; i < loopLen; ++i)
{ {
sqr(f[i], vf[i]); sqr(f[i], vf[i]);
} }
@ -165,7 +173,9 @@ void magSqr
const FieldField<Field, Type>& f const FieldField<Field, Type>& f
) )
{ {
forAll(sf, i) const label loopLen = (sf).size();
for (label i = 0; i < loopLen; ++i)
{ {
magSqr(sf[i], f[i]); magSqr(sf[i], f[i]);
} }
@ -210,7 +220,9 @@ void mag
const FieldField<Field, Type>& f const FieldField<Field, Type>& f
) )
{ {
forAll(sf, i) const label loopLen = (sf).size();
for (label i = 0; i < loopLen; ++i)
{ {
mag(sf[i], f[i]); mag(sf[i], f[i]);
} }
@ -255,7 +267,9 @@ void cmptMax
const FieldField<Field, Type>& f const FieldField<Field, Type>& f
) )
{ {
forAll(cf, i) const label loopLen = (cf).size();
for (label i = 0; i < loopLen; ++i)
{ {
cmptMax(cf[i], f[i]); cmptMax(cf[i], f[i]);
} }
@ -304,7 +318,9 @@ void cmptMin
const FieldField<Field, Type>& f const FieldField<Field, Type>& f
) )
{ {
forAll(cf, i) const label loopLen = (cf).size();
for (label i = 0; i < loopLen; ++i)
{ {
cmptMin(cf[i], f[i]); cmptMin(cf[i], f[i]);
} }
@ -353,7 +369,9 @@ void cmptAv
const FieldField<Field, Type>& f const FieldField<Field, Type>& f
) )
{ {
forAll(cf, i) const label loopLen = (cf).size();
for (label i = 0; i < loopLen; ++i)
{ {
cmptAv(cf[i], f[i]); cmptAv(cf[i], f[i]);
} }
@ -402,7 +420,9 @@ void cmptMag
const FieldField<Field, Type>& f const FieldField<Field, Type>& f
) )
{ {
forAll(cf, i) const label loopLen = (cf).size();
for (label i = 0; i < loopLen; ++i)
{ {
cmptMag(cf[i], f[i]); cmptMag(cf[i], f[i]);
} }
@ -451,7 +471,9 @@ Type max(const FieldField<Field, Type>& f)
{ {
Type result = pTraits<Type>::min; Type result = pTraits<Type>::min;
forAll(f, i) const label loopLen = (f).size();
for (label i = 0; i < loopLen; ++i)
{ {
if (f[i].size()) if (f[i].size())
{ {
@ -471,7 +493,9 @@ Type min(const FieldField<Field, Type>& f)
{ {
Type result = pTraits<Type>::max; Type result = pTraits<Type>::max;
forAll(f, i) const label loopLen = (f).size();
for (label i = 0; i < loopLen; ++i)
{ {
if (f[i].size()) if (f[i].size())
{ {
@ -488,14 +512,16 @@ TMP_UNARY_FUNCTION(Type, min)
template<template<class> class Field, class Type> template<template<class> class Field, class Type>
Type sum(const FieldField<Field, Type>& f) Type sum(const FieldField<Field, Type>& f)
{ {
Type Sum = Zero; Type result = Zero;
forAll(f, i) const label loopLen = (f).size();
for (label i = 0; i < loopLen; ++i)
{ {
Sum += sum(f[i]); result += sum(f[i]);
} }
return Sum; return result;
} }
TMP_UNARY_FUNCTION(Type, sum) TMP_UNARY_FUNCTION(Type, sum)
@ -507,7 +533,9 @@ typename typeOfMag<Type>::type sumMag(const FieldField<Field, Type>& f)
magType result = Zero; magType result = Zero;
forAll(f, i) const label loopLen = (f).size();
for (label i = 0; i < loopLen; ++i)
{ {
result += sumMag(f[i]); result += sumMag(f[i]);
} }
@ -519,12 +547,12 @@ TMP_UNARY_FUNCTION(typename typeOfMag<Type>::type, sumMag)
template<template<class> class Field, class Type> template<template<class> class Field, class Type>
Type average(const FieldField<Field, Type>& f) Type average(const FieldField<Field, Type>& f)
{
if (f.size())
{ {
label n = 0; label n = 0;
forAll(f, i) const label loopLen = (f).size();
for (label i = 0; i < loopLen; ++i)
{ {
n += f[i].size(); n += f[i].size();
} }
@ -535,7 +563,6 @@ Type average(const FieldField<Field, Type>& f)
return avrg; return avrg;
} }
}
WarningInFunction WarningInFunction
<< "empty fieldField, returning zero" << endl; << "empty fieldField, returning zero" << endl;
@ -551,7 +578,9 @@ MinMax<Type> minMax(const FieldField<Field, Type>& f)
{ {
MinMax<Type> result; MinMax<Type> result;
forAll(f, i) const label loopLen = (f).size();
for (label i = 0; i < loopLen; ++i)
{ {
result += minMax(f[i]); result += minMax(f[i]);
} }
@ -566,7 +595,9 @@ scalarMinMax minMaxMag(const FieldField<Field, Type>& f)
{ {
scalarMinMax result; scalarMinMax result;
forAll(f, i) const label loopLen = (f).size();
for (label i = 0; i < loopLen; ++i)
{ {
result += minMaxMag(f[i]); result += minMaxMag(f[i]);
} }
@ -605,7 +636,9 @@ Type gAverage(const FieldField<Field, Type>& f)
{ {
label n = 0; label n = 0;
forAll(f, i) const label loopLen = (f).size();
for (label i = 0; i < loopLen; ++i)
{ {
n += f[i].size(); n += f[i].size();
} }
@ -675,7 +708,9 @@ void opFunc \
const FieldField<Field2, Type2>& f2 \ const FieldField<Field2, Type2>& f2 \
) \ ) \
{ \ { \
forAll(f, i) \ const label loopLen = (f).size(); \
\
for (label i = 0; i < loopLen; ++i) \
{ \ { \
opFunc(f[i], f1[i], f2[i]); \ opFunc(f[i], f1[i], f2[i]); \
} \ } \
@ -811,7 +846,9 @@ void opFunc \
const VectorSpace<Form,Cmpt,nCmpt>& vs \ const VectorSpace<Form,Cmpt,nCmpt>& vs \
) \ ) \
{ \ { \
forAll(f, i) \ const label loopLen = (f).size(); \
\
for (label i = 0; i < loopLen; ++i) \
{ \ { \
opFunc(f[i], f1[i], vs); \ opFunc(f[i], f1[i], vs); \
} \ } \
@ -881,7 +918,9 @@ void opFunc \
const FieldField<Field, Type>& f1 \ const FieldField<Field, Type>& f1 \
) \ ) \
{ \ { \
forAll(f, i) \ const label loopLen = (f).size(); \
\
for (label i = 0; i < loopLen; ++i) \
{ \ { \
opFunc(f[i], vs, f1[i]); \ opFunc(f[i], vs, f1[i]); \
} \ } \

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -39,7 +40,9 @@ void Func \
const FieldField<Field, Type>& f \ const FieldField<Field, Type>& f \
) \ ) \
{ \ { \
forAll(res, i) \ const label loopLen = (res).size(); \
\
for (label i = 0; i < loopLen; ++i) \
{ \ { \
Func(res[i], f[i]); \ Func(res[i], f[i]); \
} \ } \
@ -83,7 +86,9 @@ void OpFunc \
const FieldField<Field, Type>& f \ const FieldField<Field, Type>& f \
) \ ) \
{ \ { \
forAll(res, i) \ const label loopLen = (res).size(); \
\
for (label i = 0; i < loopLen; ++i) \
{ \ { \
OpFunc(res[i], f[i]); \ OpFunc(res[i], f[i]); \
} \ } \
@ -128,7 +133,9 @@ void Func \
const FieldField<Field, Type2>& f2 \ const FieldField<Field, Type2>& f2 \
) \ ) \
{ \ { \
forAll(f, i) \ const label loopLen = (f).size(); \
\
for (label i = 0; i < loopLen; ++i) \
{ \ { \
Func(f[i], f1[i], f2[i]); \ Func(f[i], f1[i], f2[i]); \
} \ } \
@ -212,7 +219,9 @@ void Func \
const FieldField<Field, Type2>& f2 \ const FieldField<Field, Type2>& f2 \
) \ ) \
{ \ { \
forAll(f, i) \ const label loopLen = (f).size(); \
\
for (label i = 0; i < loopLen; ++i) \
{ \ { \
Func(f[i], s, f2[i]); \ Func(f[i], s, f2[i]); \
} \ } \
@ -260,7 +269,9 @@ void Func \
const Type2& s \ const Type2& s \
) \ ) \
{ \ { \
forAll(f, i) \ const label loopLen = (f).size(); \
\
for (label i = 0; i < loopLen; ++i) \
{ \ { \
Func(f[i], f1[i], s); \ Func(f[i], f1[i], s); \
} \ } \
@ -315,7 +326,9 @@ void OpFunc \
const FieldField<Field, Type2>& f2 \ const FieldField<Field, Type2>& f2 \
) \ ) \
{ \ { \
forAll(f, i) \ const label loopLen = (f).size(); \
\
for (label i = 0; i < loopLen; ++i) \
{ \ { \
OpFunc(f[i], f1[i], f2[i]); \ OpFunc(f[i], f1[i], f2[i]); \
} \ } \
@ -399,7 +412,9 @@ void OpFunc \
const FieldField<Field, Type2>& f2 \ const FieldField<Field, Type2>& f2 \
) \ ) \
{ \ { \
forAll(f, i) \ const label loopLen = (f).size(); \
\
for (label i = 0; i < loopLen; ++i) \
{ \ { \
OpFunc(f[i], s, f2[i]); \ OpFunc(f[i], s, f2[i]); \
} \ } \
@ -447,7 +462,9 @@ void OpFunc \
const Type2& s \ const Type2& s \
) \ ) \
{ \ { \
forAll(f, i) \ const label loopLen = (f).size(); \
\
for (label i = 0; i < loopLen; ++i) \
{ \ { \
OpFunc(f[i], f1[i], s); \ OpFunc(f[i], f1[i], s); \
} \ } \

View File

@ -481,13 +481,13 @@ sumProd(const UList<Type>& f1, const UList<Type>& f2)
template<class Type> template<class Type>
Type sumCmptProd(const UList<Type>& f1, const UList<Type>& f2) Type sumCmptProd(const UList<Type>& f1, const UList<Type>& f2)
{ {
Type SumProd = Zero; Type result = Zero;
if (f1.size() && (f1.size() == f2.size())) if (f1.size() && (f1.size() == f2.size()))
{ {
TFOR_ALL_S_OP_FUNC_F_F TFOR_ALL_S_OP_FUNC_F_F
( (
Type, Type,
SumProd, result,
+=, +=,
cmptMultiply, cmptMultiply,
Type, Type,
@ -496,7 +496,7 @@ Type sumCmptProd(const UList<Type>& f1, const UList<Type>& f2)
f2 f2
) )
} }
return SumProd; return result;
} }

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -30,8 +31,8 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef FieldM_H #ifndef Foam_FieldM_H
#define FieldM_H #define Foam_FieldM_H
#include "error.H" #include "error.H"
#include "ListLoopM.H" #include "ListLoopM.H"
@ -123,12 +124,17 @@ void checkFields
List_CONST_ACCESS(typeF2, f2, f2P); \ List_CONST_ACCESS(typeF2, f2, f2P); \
\ \
/* Loop: f1 OP FUNC(f2) */ \ /* Loop: f1 OP FUNC(f2) */ \
List_FOR_ALL(f1, i) \ const label loopLen = (f1).size(); \
\
/* pragmas... */ \
for (label i = 0; i < loopLen; ++i) \
{ \ { \
(f1P[i]) OP FUNC(f2P[i]); \ (f1P[i]) OP FUNC(f2P[i]); \
} }
// Member function : this f1 OP f2.FUNC()
#define TFOR_ALL_F_OP_F_FUNC(typeF1, f1, OP, typeF2, f2, FUNC) \ #define TFOR_ALL_F_OP_F_FUNC(typeF1, f1, OP, typeF2, f2, FUNC) \
\ \
/* Check fields have same size */ \ /* Check fields have same size */ \
@ -139,7 +145,10 @@ void checkFields
List_CONST_ACCESS(typeF2, f2, f2P); \ List_CONST_ACCESS(typeF2, f2, f2P); \
\ \
/* Loop: f1 OP f2.FUNC() */ \ /* Loop: f1 OP f2.FUNC() */ \
List_FOR_ALL(f1, i) \ const label loopLen = (f1).size(); \
\
/* pragmas... */ \
for (label i = 0; i < loopLen; ++i) \
{ \ { \
(f1P[i]) OP (f2P[i]).FUNC(); \ (f1P[i]) OP (f2P[i]).FUNC(); \
} }
@ -158,7 +167,10 @@ void checkFields
List_CONST_ACCESS(typeF3, f3, f3P); \ List_CONST_ACCESS(typeF3, f3, f3P); \
\ \
/* Loop: f1 OP FUNC(f2, f3) */ \ /* Loop: f1 OP FUNC(f2, f3) */ \
List_FOR_ALL(f1, i) \ const label loopLen = (f1).size(); \
\
/* pragmas... */ \
for (label i = 0; i < loopLen; ++i) \
{ \ { \
(f1P[i]) OP FUNC((f2P[i]), (f3P[i])); \ (f1P[i]) OP FUNC((f2P[i]), (f3P[i])); \
} }
@ -176,7 +188,10 @@ void checkFields
List_CONST_ACCESS(typeF2, f2, f2P); \ List_CONST_ACCESS(typeF2, f2, f2P); \
\ \
/* Loop: s OP FUNC(f1, f2) */ \ /* Loop: s OP FUNC(f1, f2) */ \
List_FOR_ALL(f1, i) \ const label loopLen = (f1).size(); \
\
/* pragmas, reduction... */ \
for (label i = 0; i < loopLen; ++i) \
{ \ { \
(s) OP FUNC((f1P[i]), (f2P[i])); \ (s) OP FUNC((f1P[i]), (f2P[i])); \
} }
@ -194,7 +209,10 @@ void checkFields
List_CONST_ACCESS(typeF2, f2, f2P); \ List_CONST_ACCESS(typeF2, f2, f2P); \
\ \
/* Loop: f1 OP FUNC(f2, s) */ \ /* Loop: f1 OP FUNC(f2, s) */ \
List_FOR_ALL(f1, i) \ const label loopLen = (f1).size(); \
\
/* pragmas... */ \
for (label i = 0; i < loopLen; ++i) \
{ \ { \
(f1P[i]) OP FUNC((f2P[i]), (s)); \ (f1P[i]) OP FUNC((f2P[i]), (s)); \
} }
@ -208,7 +226,10 @@ void checkFields
List_CONST_ACCESS(typeF, f, fP); \ List_CONST_ACCESS(typeF, f, fP); \
\ \
/* Loop: s1 OP FUNC(f, s2) */ \ /* Loop: s1 OP FUNC(f, s2) */ \
List_FOR_ALL(f, i) \ const label loopLen = (f).size(); \
\
/* pragmas, reduction... */ \
for (label i = 0; i < loopLen; ++i) \
{ \ { \
(s1) OP FUNC((fP[i]), (s2)); \ (s1) OP FUNC((fP[i]), (s2)); \
} }
@ -226,7 +247,10 @@ void checkFields
List_CONST_ACCESS(typeF2, f2, f2P); \ List_CONST_ACCESS(typeF2, f2, f2P); \
\ \
/* Loop: f1 OP1 f2 OP2 f3 */ \ /* Loop: f1 OP1 f2 OP2 f3 */ \
List_FOR_ALL(f1, i) \ const label loopLen = (f1).size(); \
\
/* pragmas... */ \
for (label i = 0; i < loopLen; ++i) \
{ \ { \
(f1P[i]) OP FUNC((s), (f2P[i])); \ (f1P[i]) OP FUNC((s), (f2P[i])); \
} }
@ -240,7 +264,10 @@ void checkFields
List_ACCESS(typeF1, f1, f1P); \ List_ACCESS(typeF1, f1, f1P); \
\ \
/* Loop: f1 OP FUNC(s1, s2) */ \ /* Loop: f1 OP FUNC(s1, s2) */ \
List_FOR_ALL(f1, i) \ const label loopLen = (f1).size(); \
\
/* pragmas... */ \
for (label i = 0; i < loopLen; ++i) \
{ \ { \
(f1P[i]) OP FUNC((s1), (s2)); \ (f1P[i]) OP FUNC((s1), (s2)); \
} }
@ -258,7 +285,10 @@ void checkFields
List_CONST_ACCESS(typeF2, f2, f2P); \ List_CONST_ACCESS(typeF2, f2, f2P); \
\ \
/* Loop: f1 OP f2 FUNC(s) */ \ /* Loop: f1 OP f2 FUNC(s) */ \
List_FOR_ALL(f1, i) \ const label loopLen = (f1).size(); \
\
/* pragmas... */ \
for (label i = 0; i < loopLen; ++i) \
{ \ { \
(f1P[i]) OP (f2P[i]) FUNC((s)); \ (f1P[i]) OP (f2P[i]) FUNC((s)); \
} }
@ -277,7 +307,10 @@ void checkFields
List_CONST_ACCESS(typeF3, f3, f3P); \ List_CONST_ACCESS(typeF3, f3, f3P); \
\ \
/* Loop: f1 OP1 f2 OP2 f3 */ \ /* Loop: f1 OP1 f2 OP2 f3 */ \
List_FOR_ALL(f1, i) \ const label loopLen = (f1).size(); \
\
/* pragmas... */ \
for (label i = 0; i < loopLen; ++i) \
{ \ { \
(f1P[i]) OP1 (f2P[i]) OP2 (f3P[i]); \ (f1P[i]) OP1 (f2P[i]) OP2 (f3P[i]); \
} }
@ -295,7 +328,10 @@ void checkFields
List_CONST_ACCESS(typeF2, f2, f2P); \ List_CONST_ACCESS(typeF2, f2, f2P); \
\ \
/* Loop: f1 OP1 s OP2 f2 */ \ /* Loop: f1 OP1 s OP2 f2 */ \
List_FOR_ALL(f1, i) \ const label loopLen = (f1).size(); \
\
/* pragmas... */ \
for (label i = 0; i < loopLen; ++i) \
{ \ { \
(f1P[i]) OP1 (s) OP2 (f2P[i]); \ (f1P[i]) OP1 (s) OP2 (f2P[i]); \
} }
@ -313,7 +349,10 @@ void checkFields
List_CONST_ACCESS(typeF2, f2, f2P); \ List_CONST_ACCESS(typeF2, f2, f2P); \
\ \
/* Loop f1 OP1 s OP2 f2 */ \ /* Loop f1 OP1 s OP2 f2 */ \
List_FOR_ALL(f1, i) \ const label loopLen = (f1).size(); \
\
/* pragmas... */ \
for (label i = 0; i < loopLen; ++i) \
{ \ { \
(f1P[i]) OP1 (f2P[i]) OP2 (s); \ (f1P[i]) OP1 (f2P[i]) OP2 (s); \
} }
@ -331,11 +370,15 @@ void checkFields
List_CONST_ACCESS(typeF2, f2, f2P); \ List_CONST_ACCESS(typeF2, f2, f2P); \
\ \
/* Loop: f1 OP f2 */ \ /* Loop: f1 OP f2 */ \
List_FOR_ALL(f1, i) \ const label loopLen = (f1).size(); \
\
/* pragmas... */ \
for (label i = 0; i < loopLen; ++i) \
{ \ { \
(f1P[i]) OP (f2P[i]); \ (f1P[i]) OP (f2P[i]); \
} }
// Member operator : this field f1 OP1 OP2 f2 // Member operator : this field f1 OP1 OP2 f2
#define TFOR_ALL_F_OP_OP_F(typeF1, f1, OP1, OP2, typeF2, f2) \ #define TFOR_ALL_F_OP_OP_F(typeF1, f1, OP1, OP2, typeF2, f2) \
@ -348,7 +391,10 @@ void checkFields
List_CONST_ACCESS(typeF2, f2, f2P); \ List_CONST_ACCESS(typeF2, f2, f2P); \
\ \
/* Loop: f1 OP1 OP2 f2 */ \ /* Loop: f1 OP1 OP2 f2 */ \
List_FOR_ALL(f1, i) \ const label loopLen = (f1).size(); \
\
/* pragmas... */ \
for (label i = 0; i < loopLen; ++i) \
{ \ { \
(f1P[i]) OP1 OP2 (f2P[i]); \ (f1P[i]) OP1 OP2 (f2P[i]); \
} }
@ -362,7 +408,10 @@ void checkFields
List_ACCESS(typeF, f, fP); \ List_ACCESS(typeF, f, fP); \
\ \
/* Loop: f OP s */ \ /* Loop: f OP s */ \
List_FOR_ALL(f, i) \ const label loopLen = (f).size(); \
\
/* pragmas... */ \
for (label i = 0; i < loopLen; ++i) \
{ \ { \
(fP[i]) OP (s); \ (fP[i]) OP (s); \
} }
@ -378,7 +427,10 @@ void checkFields
List_CONST_ACCESS(typeF, f, fP); \ List_CONST_ACCESS(typeF, f, fP); \
\ \
/* Loop: s OP f */ \ /* Loop: s OP f */ \
List_FOR_ALL(f, i) \ const label loopLen = (f).size(); \
\
/* pragmas, reduction... */ \
for (label i = 0; i < loopLen; ++i) \
{ \ { \
(s) OP (fP[i]); \ (s) OP (fP[i]); \
} }
@ -392,8 +444,11 @@ void checkFields
List_CONST_ACCESS(typeF1, f1, f1P); \ List_CONST_ACCESS(typeF1, f1, f1P); \
List_CONST_ACCESS(typeF2, f2, f2P); \ List_CONST_ACCESS(typeF2, f2, f2P); \
\ \
/* Loop: s OP f */ \ /* Loop: s OP1 f1 OP2 f2 */ \
List_FOR_ALL(f1, i) \ const label loopLen = (f1).size(); \
\
/* pragmas, reduction... */ \
for (label i = 0; i < loopLen; ++i) \
{ \ { \
(s) OP1 (f1P[i]) OP2 (f2P[i]); \ (s) OP1 (f1P[i]) OP2 (f2P[i]); \
} }
@ -407,7 +462,10 @@ void checkFields
List_CONST_ACCESS(typeF, f, fP); \ List_CONST_ACCESS(typeF, f, fP); \
\ \
/* Loop: s OP FUNC(f) */ \ /* Loop: s OP FUNC(f) */ \
List_FOR_ALL(f, i) \ const label loopLen = (f).size(); \
\
/* pragmas, reduction... */ \
for (label i = 0; i < loopLen; ++i) \
{ \ { \
(s) OP FUNC(fP[i]); \ (s) OP FUNC(fP[i]); \
} }