Commit 2027059b authored by Henry Weller's avatar Henry Weller
Browse files

src/OpenFOAM: changed template rank type from int to Foam::direction

Foam::direction is an unsigned type which makes it easier for the
compiler to pickup and report errors in the instantiation of
VectorSpaces and associated types.
parent c28a0c0d
......@@ -447,7 +447,7 @@ void Foam::dimensioned<Type>::operator/=
// * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * //
template<class Type, int r>
template<class Type, Foam::direction r>
Foam::dimensioned<typename Foam::powProduct<Type, r>::type>
Foam::pow(const dimensioned<Type>& dt, typename powProduct<Type, r>::type)
{
......@@ -747,7 +747,7 @@ Foam::operator op \
); \
} \
\
template<class Type, class Form, class Cmpt, int nCmpt> \
template<class Type, class Form, class Cmpt, Foam::direction nCmpt> \
Foam::dimensioned<typename Foam::product<Type, Form>::type> \
Foam::operator op \
( \
......@@ -763,7 +763,7 @@ Foam::operator op \
); \
} \
\
template<class Type, class Form, class Cmpt, int nCmpt> \
template<class Type, class Form, class Cmpt, Foam::direction nCmpt> \
Foam::dimensioned<typename Foam::product<Form, Type>::type> \
Foam::operator op \
( \
......
......@@ -231,7 +231,7 @@ public:
// * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
template<class Type, int r>
template<class Type, direction r>
dimensioned<typename powProduct<Type, r>::type>
pow
(
......@@ -306,7 +306,7 @@ template<class Type1, class Type2> \
dimensioned<typename product<Type1, Type2>::type> \
operator op(const dimensioned<Type1>&, const dimensioned<Type2>&); \
\
template<class Type, class Form, class Cmpt, int nCmpt> \
template<class Type, class Form, class Cmpt, direction nCmpt> \
dimensioned<typename product<Type, Form>::type> \
operator op \
( \
......@@ -314,7 +314,7 @@ operator op \
const VectorSpace<Form,Cmpt,nCmpt>& \
); \
\
template<class Type, class Form, class Cmpt, int nCmpt> \
template<class Type, class Form, class Cmpt, direction nCmpt> \
dimensioned<typename product<Form, Type>::type> \
operator op \
( \
......
......@@ -35,7 +35,7 @@ namespace Foam
// * * * * * * * * * * * * * * * Global functions * * * * * * * * * * * * * //
template<class Type, class GeoMesh, int r>
template<class Type, class GeoMesh, direction r>
tmp<DimensionedField<typename powProduct<Type, r>::type, GeoMesh>>
pow
(
......@@ -66,7 +66,7 @@ pow
}
template<class Type, class GeoMesh, int r>
template<class Type, class GeoMesh, direction r>
tmp<DimensionedField<typename powProduct<Type, r>::type, GeoMesh>>
pow
(
......@@ -510,7 +510,7 @@ operator op \
return tRes; \
} \
\
template<class Form, class Cmpt, int nCmpt, class Type, class GeoMesh> \
template<class Form, class Cmpt, direction nCmpt, class Type, class GeoMesh> \
tmp<DimensionedField<typename product<Form, Type>::type, GeoMesh>> \
operator op \
( \
......@@ -549,7 +549,7 @@ operator op \
return tRes; \
} \
\
template<class Form, class Cmpt, int nCmpt, class Type, class GeoMesh> \
template<class Form, class Cmpt, direction nCmpt, class Type, class GeoMesh> \
tmp<DimensionedField<typename product<Form, Type>::type, GeoMesh>> \
operator op \
( \
......@@ -590,7 +590,7 @@ operator op \
return tRes; \
} \
\
template<class Form, class Cmpt, int nCmpt, class Type, class GeoMesh> \
template<class Form, class Cmpt, direction nCmpt, class Type, class GeoMesh> \
tmp<DimensionedField<typename product<Form, Type>::type, GeoMesh>> \
operator op \
( \
......@@ -628,7 +628,7 @@ operator op \
return tRes; \
} \
\
template<class Form, class Cmpt, int nCmpt, class Type, class GeoMesh> \
template<class Form, class Cmpt, direction nCmpt, class Type, class GeoMesh> \
tmp<DimensionedField<typename product<Form, Type>::type, GeoMesh>> \
operator op \
( \
......
......@@ -35,7 +35,7 @@ namespace Foam
// * * * * * * * * * * * * * * * Global functions * * * * * * * * * * * * * //
template<class Type, class GeoMesh, int r>
template<class Type, class GeoMesh, direction r>
tmp<DimensionedField<typename powProduct<Type, r>::type, GeoMesh>>
pow
(
......@@ -43,7 +43,7 @@ pow
typename powProduct<Type, r>::type
);
template<class Type, class GeoMesh, int r>
template<class Type, class GeoMesh, direction r>
tmp<DimensionedField<typename powProduct<Type, r>::type, GeoMesh>>
pow
(
......@@ -191,7 +191,7 @@ operator op \
const dimensioned<Form>& dvs \
); \
\
template<class Form, class Cmpt, int nCmpt, class Type, class GeoMesh> \
template<class Form, class Cmpt, direction nCmpt, class Type, class GeoMesh> \
tmp<DimensionedField<typename product<Form, Type>::type, GeoMesh>> \
operator op \
( \
......@@ -207,7 +207,7 @@ operator op \
const dimensioned<Form>& dvs \
); \
\
template<class Form, class Cmpt, int nCmpt, class Type, class GeoMesh> \
template<class Form, class Cmpt, direction nCmpt, class Type, class GeoMesh> \
tmp<DimensionedField<typename product<Form, Type>::type, GeoMesh>> \
operator op \
( \
......@@ -223,7 +223,7 @@ operator op \
const DimensionedField<Type, GeoMesh>& df1 \
); \
\
template<class Form, class Cmpt, int nCmpt, class Type, class GeoMesh> \
template<class Form, class Cmpt, direction nCmpt, class Type, class GeoMesh> \
tmp<DimensionedField<typename product<Form, Type>::type, GeoMesh>> \
operator op \
( \
......@@ -239,7 +239,7 @@ operator op \
const tmp<DimensionedField<Type, GeoMesh>>& tdf1 \
); \
\
template<class Form, class Cmpt, int nCmpt, class Type, class GeoMesh> \
template<class Form, class Cmpt, direction nCmpt, class Type, class GeoMesh> \
tmp<DimensionedField<typename product<Form, Type>::type, GeoMesh>> \
operator op \
( \
......
......@@ -61,7 +61,7 @@ void T(FieldField<Field, Type>& f1, const FieldField<Field, Type>& f2)
}
template<template<class> class Field, class Type, int r>
template<template<class> class Field, class Type, direction r>
void pow
(
FieldField<Field, typename powProduct<Type, r>::type>& f,
......@@ -74,7 +74,7 @@ void pow
}
}
template<template<class> class Field, class Type, int r>
template<template<class> class Field, class Type, direction r>
tmp<FieldField<Field, typename powProduct<Type, r>::type>>
pow
(
......@@ -90,7 +90,7 @@ pow
return tRes;
}
template<template<class> class Field, class Type, int r>
template<template<class> class Field, class Type, direction r>
tmp<FieldField<Field, typename powProduct<Type, r>::type>>
pow
(
......@@ -761,7 +761,13 @@ operator op \
} \
\
template \
<template<class> class Field, class Type, class Form, class Cmpt, int nCmpt> \
< \
template<class> class Field, \
class Type, \
class Form, \
class Cmpt, \
direction nCmpt \
> \
void opFunc \
( \
FieldField<Field, typename product<Type, Form>::type>& f, \
......@@ -776,7 +782,13 @@ void opFunc \
} \
\
template \
<template<class> class Field, class Type, class Form, class Cmpt, int nCmpt> \
< \
template<class> class Field, \
class Type, \
class Form, \
class Cmpt, \
direction nCmpt \
> \
tmp<FieldField<Field, typename product<Type, Form>::type>> \
operator op \
( \
......@@ -794,7 +806,13 @@ operator op \
} \
\
template \
<template<class> class Field, class Type, class Form, class Cmpt, int nCmpt> \
< \
template<class> class Field, \
class Type, \
class Form, \
class Cmpt, \
direction nCmpt \
> \
tmp<FieldField<Field, typename product<Type, Form>::type>> \
operator op \
( \
......@@ -813,7 +831,13 @@ operator op \
} \
\
template \
<template<class> class Field, class Form, class Cmpt, int nCmpt, class Type> \
< \
template<class> class Field, \
class Type, \
class Form, \
class Cmpt, \
direction nCmpt \
> \
void opFunc \
( \
FieldField<Field, typename product<Form, Type>::type>& f, \
......@@ -828,7 +852,13 @@ void opFunc \
} \
\
template \
<template<class> class Field, class Form, class Cmpt, int nCmpt, class Type> \
< \
template<class> class Field, \
class Type, \
class Form, \
class Cmpt, \
direction nCmpt \
> \
tmp<FieldField<Field, typename product<Form, Type>::type>> \
operator op \
( \
......@@ -846,7 +876,13 @@ operator op \
} \
\
template \
<template<class> class Field, class Form, class Cmpt, int nCmpt, class Type> \
< \
template<class> class Field, \
class Type, \
class Form, \
class Cmpt, \
direction nCmpt \
> \
tmp<FieldField<Field, typename product<Form, Type>::type>> \
operator op \
( \
......
......@@ -47,14 +47,14 @@ template<template<class> class Field, class Type>
void T(FieldField<Field, Type>& f1, const FieldField<Field, Type>& f2);
template<template<class> class Field, class Type, int r>
template<template<class> class Field, class Type, direction r>
void pow
(
FieldField<Field, typename powProduct<Type, r>::type>& f,
const FieldField<Field, Type>& vf
);
template<template<class> class Field, class Type, int r>
template<template<class> class Field, class Type, direction r>
tmp<FieldField<Field, typename powProduct<Type, r>::type>>
pow
(
......@@ -62,7 +62,7 @@ pow
= pTraits<typename powProduct<Type, r>::type>::zero
);
template<template<class> class Field, class Type, int r>
template<template<class> class Field, class Type, direction r>
tmp<FieldField<Field, typename powProduct<Type, r>::type>>
pow
(
......@@ -346,7 +346,13 @@ operator op \
); \
\
template \
<template<class> class Field, class Type, class Form, class Cmpt, int nCmpt> \
< \
template<class> class Field, \
class Type, \
class Form, \
class Cmpt, \
direction nCmpt \
> \
void opFunc \
( \
FieldField<Field, typename product<Type, Form>::type>& f, \
......@@ -355,7 +361,13 @@ void opFunc \
); \
\
template \
<template<class> class Field, class Type, class Form, class Cmpt, int nCmpt> \
< \
template<class> class Field, \
class Type, \
class Form, \
class Cmpt, \
direction nCmpt \
> \
tmp<FieldField<Field, typename product<Type, Form>::type>> \
operator op \
( \
......@@ -364,7 +376,13 @@ operator op \
); \
\
template \
<template<class> class Field, class Type, class Form, class Cmpt, int nCmpt> \
< \
template<class> class Field, \
class Type, \
class Form, \
class Cmpt, \
direction nCmpt \
> \
tmp<FieldField<Field, typename product<Type, Form>::type>> \
operator op \
( \
......@@ -373,7 +391,13 @@ operator op \
); \
\
template \
<template<class> class Field, class Form, class Cmpt, int nCmpt, class Type> \
< \
template<class> class Field, \
class Type, \
class Form, \
class Cmpt, \
direction nCmpt \
> \
void opFunc \
( \
FieldField<Field, typename product<Form, Type>::type>& f, \
......@@ -382,7 +406,13 @@ void opFunc \
); \
\
template \
<template<class> class Field, class Form, class Cmpt, int nCmpt, class Type> \
< \
template<class> class Field, \
class Type, \
class Form, \
class Cmpt, \
direction nCmpt \
> \
tmp<FieldField<Field, typename product<Form, Type>::type>> \
operator op \
( \
......@@ -391,7 +421,13 @@ operator op \
); \
\
template \
<template<class> class Field, class Form, class Cmpt, int nCmpt, class Type> \
< \
template<class> class Field, \
class Type, \
class Form, \
class Cmpt, \
direction nCmpt \
> \
tmp<FieldField<Field, typename product<Form, Type>::type>> \
operator op \
( \
......
......@@ -701,7 +701,7 @@ void Foam::Field<Type>::operator=(const Type& t)
template<class Type>
template<class Form, class Cmpt, int nCmpt>
template<class Form, class Cmpt, Foam::direction nCmpt>
void Foam::Field<Type>::operator=(const VectorSpace<Form,Cmpt,nCmpt>& vs)
{
TFOR_ALL_F_OP_S(Type, *this, =, VSType, vs)
......
......@@ -345,7 +345,7 @@ public:
void operator=(const tmp<Field<Type>>&);
void operator=(const Type&);
template<class Form, class Cmpt, int nCmpt>
template<class Form, class Cmpt, direction nCmpt>
void operator=(const VectorSpace<Form,Cmpt,nCmpt>&);
void operator+=(const UList<Type>&);
......
......@@ -59,7 +59,7 @@ void T(Field<Type>& res, const UList<Type>& f)
}
template<class Type, int r>
template<class Type, direction r>
void pow
(
Field<typename powProduct<Type, r>::type>& res,
......@@ -74,7 +74,7 @@ void pow
)
}
template<class Type, int r>
template<class Type, direction r>
tmp<Field<typename powProduct<Type, r>::type>>
pow
(
......@@ -91,7 +91,7 @@ pow
return tRes;
}
template<class Type, int r>
template<class Type, direction r>
tmp<Field<typename powProduct<Type, r>::type>>
pow
(
......@@ -692,7 +692,7 @@ operator Op(const tmp<Field<Type1>>& tf1, const tmp<Field<Type2>>& tf2) \
return tRes; \
} \
\
template<class Type, class Form, class Cmpt, int nCmpt> \
template<class Type, class Form, class Cmpt, direction nCmpt> \
void OpFunc \
( \
Field<typename product<Type, Form>::type>& res, \
......@@ -705,7 +705,7 @@ void OpFunc \
(productType, res, =,Type, f1, Op, Form, static_cast<const Form&>(vs)) \
} \
\
template<class Type, class Form, class Cmpt, int nCmpt> \
template<class Type, class Form, class Cmpt, direction nCmpt> \
tmp<Field<typename product<Type, Form>::type>> \
operator Op(const UList<Type>& f1, const VectorSpace<Form,Cmpt,nCmpt>& vs) \
{ \
......@@ -715,7 +715,7 @@ operator Op(const UList<Type>& f1, const VectorSpace<Form,Cmpt,nCmpt>& vs) \
return tRes; \
} \
\
template<class Type, class Form, class Cmpt, int nCmpt> \
template<class Type, class Form, class Cmpt, direction nCmpt> \
tmp<Field<typename product<Type, Form>::type>> \
operator Op \
( \
......@@ -730,7 +730,7 @@ operator Op \
return tRes; \
} \
\
template<class Form, class Cmpt, int nCmpt, class Type> \
template<class Form, class Cmpt, direction nCmpt, class Type> \
void OpFunc \
( \
Field<typename product<Form, Type>::type>& res, \
......@@ -743,7 +743,7 @@ void OpFunc \
(productType, res, =,Form,static_cast<const Form&>(vs), Op, Type, f1) \
} \
\
template<class Form, class Cmpt, int nCmpt, class Type> \
template<class Form, class Cmpt, direction nCmpt, class Type> \
tmp<Field<typename product<Form, Type>::type>> \
operator Op(const VectorSpace<Form,Cmpt,nCmpt>& vs, const UList<Type>& f1) \
{ \
......@@ -753,7 +753,7 @@ operator Op(const VectorSpace<Form,Cmpt,nCmpt>& vs, const UList<Type>& f1) \
return tRes; \
} \
\
template<class Form, class Cmpt, int nCmpt, class Type> \
template<class Form, class Cmpt, direction nCmpt, class Type> \
tmp<Field<typename product<Form, Type>::type>> \
operator Op \
( \
......
......@@ -47,7 +47,7 @@ template<class Type>
void T(Field<Type>& res, const UList<Type>& f);
template<class Type, int r>
template<class Type, direction r>
void pow
(
Field<typename powProduct<Type, r>::type>& res,
......@@ -55,7 +55,7 @@ void pow
);
template<class Type, int r>
template<class Type, direction r>
tmp<Field<typename powProduct<Type, r>::type>>
pow
(
......@@ -64,7 +64,7 @@ pow
= pTraits<typename powProduct<Type, r>::type>::zero
);
template<class Type, int r>
template<class Type, direction r>
tmp<Field<typename powProduct<Type, r>::type>>
pow
(
......@@ -307,7 +307,7 @@ template<class Type1, class Type2> \
tmp<Field<typename product<Type1, Type2>::type>> \
operator Op(const tmp<Field<Type1>>& tf1, const tmp<Field<Type2>>& tf2); \
\
template<class Type, class Form, class Cmpt, int nCmpt> \
template<class Type, class Form, class Cmpt, direction nCmpt> \
void OpFunc \
( \
Field<typename product<Type, Form>::type>& res, \
......@@ -315,15 +315,15 @@ void OpFunc \
const VectorSpace<Form,Cmpt,nCmpt>& vs \
); \
\
template<class Type, class Form, class Cmpt, int nCmpt> \
template<class Type, class Form, class Cmpt, direction nCmpt> \
tmp<Field<typename product<Type, Form>::type>> \
operator Op(const UList<Type>& f1, const VectorSpace<Form,Cmpt,nCmpt>& vs); \
\
template<class Type, class Form, class Cmpt, int nCmpt> \
template<class Type, class Form, class Cmpt, direction nCmpt> \
tmp<Field<typename product<Type, Form>::type>> \
operator Op(const tmp<Field<Type>>&tf1,const VectorSpace<Form,Cmpt,nCmpt>&vs);\
operator Op(const tmp<Field<Type>>&tf1,const VectorSpace<Form,Cmpt,nCmpt>&vs); \
\
template<class Form, class Cmpt, int nCmpt, class Type> \
template<class Form, class Cmpt, direction nCmpt, class Type> \
void OpFunc \
( \
Field<typename product<Form, Type>::type>& res, \
......@@ -331,11 +331,11 @@ void OpFunc \
const UList<Type>& f1 \
); \
\
template<class Form, class Cmpt, int nCmpt, class Type> \
template<class Form, class Cmpt, direction nCmpt, class Type> \
tmp<Field<typename product<Form, Type>::type>> \
operator Op(const VectorSpace<Form,Cmpt,nCmpt>& vs, const UList<Type>& f1); \
\
template<class Form, class Cmpt, int nCmpt, class Type> \
template<class Form, class Cmpt, direction nCmpt, class Type> \
tmp<Field<typename product<Form, Type>::type>> \
operator Op(const VectorSpace<Form,Cmpt,nCmpt>&vs,const tmp<Field<Type>>&tf1);
......
......@@ -66,7 +66,13 @@ void T
}
template<class Type, template<class> class PatchField, class GeoMesh, int r>
template
<
class Type,
template<class> class PatchField,
class GeoMesh,
direction r
>
void pow
(
GeometricField<typename powProduct<Type, r>::type, PatchField, GeoMesh>& gf,
......@@ -77,7 +83,13 @@ void pow
pow(gf.boundaryField(), gf1.boundaryField(), r);
}
template<class Type, template<class> class PatchField, class GeoMesh, int r>
template
<
class Type,
template<class> class PatchField,
class GeoMesh,
direction r
>
tmp<GeometricField<typename powProduct<Type, r>::type, PatchField, GeoMesh>>
pow
(
......@@ -110,7 +122,13 @@ pow
}
template<class Type, template<class> class PatchField, class GeoMesh, int r>
template
<
class Type,
template<class> class PatchField,
class GeoMesh,
direction r
>
tmp<GeometricField<typename powProduct<Type, r>::type, PatchField, GeoMesh>>
pow
(
......@@ -768,7 +786,7 @@ template \
< \
class Form, \
class Cmpt, \
int nCmpt, \
direction nCmpt, \
class Type, template<class> class PatchField, \