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.
This commit is contained in:
Henry Weller
2016-03-09 10:10:28 +00:00
parent c28a0c0d94
commit 2027059b63
34 changed files with 355 additions and 237 deletions

View File

@ -447,7 +447,7 @@ void Foam::dimensioned<Type>::operator/=
// * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * //
template<class Type, int r> template<class Type, Foam::direction r>
Foam::dimensioned<typename Foam::powProduct<Type, r>::type> Foam::dimensioned<typename Foam::powProduct<Type, r>::type>
Foam::pow(const dimensioned<Type>& dt, typename 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::dimensioned<typename Foam::product<Type, Form>::type> \
Foam::operator op \ 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::dimensioned<typename Foam::product<Form, Type>::type> \
Foam::operator op \ Foam::operator op \
( \ ( \

View File

@ -231,7 +231,7 @@ public:
// * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
template<class Type, int r> template<class Type, direction r>
dimensioned<typename powProduct<Type, r>::type> dimensioned<typename powProduct<Type, r>::type>
pow pow
( (
@ -306,7 +306,7 @@ template<class Type1, class Type2> \
dimensioned<typename product<Type1, Type2>::type> \ dimensioned<typename product<Type1, Type2>::type> \
operator op(const dimensioned<Type1>&, const dimensioned<Type2>&); \ 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> \ dimensioned<typename product<Type, Form>::type> \
operator op \ operator op \
( \ ( \
@ -314,7 +314,7 @@ operator op \
const VectorSpace<Form,Cmpt,nCmpt>& \ 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> \ dimensioned<typename product<Form, Type>::type> \
operator op \ operator op \
( \ ( \

View File

@ -35,7 +35,7 @@ namespace Foam
// * * * * * * * * * * * * * * * Global functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Global functions * * * * * * * * * * * * * //
template<class Type, class GeoMesh, int r> template<class Type, class GeoMesh, direction r>
tmp<DimensionedField<typename powProduct<Type, r>::type, GeoMesh>> tmp<DimensionedField<typename powProduct<Type, r>::type, GeoMesh>>
pow 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>> tmp<DimensionedField<typename powProduct<Type, r>::type, GeoMesh>>
pow pow
( (
@ -510,7 +510,7 @@ operator op \
return tRes; \ 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>> \ tmp<DimensionedField<typename product<Form, Type>::type, GeoMesh>> \
operator op \ operator op \
( \ ( \
@ -549,7 +549,7 @@ operator op \
return tRes; \ 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>> \ tmp<DimensionedField<typename product<Form, Type>::type, GeoMesh>> \
operator op \ operator op \
( \ ( \
@ -590,7 +590,7 @@ operator op \
return tRes; \ 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>> \ tmp<DimensionedField<typename product<Form, Type>::type, GeoMesh>> \
operator op \ operator op \
( \ ( \
@ -628,7 +628,7 @@ operator op \
return tRes; \ 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>> \ tmp<DimensionedField<typename product<Form, Type>::type, GeoMesh>> \
operator op \ operator op \
( \ ( \

View File

@ -35,7 +35,7 @@ namespace Foam
// * * * * * * * * * * * * * * * Global functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Global functions * * * * * * * * * * * * * //
template<class Type, class GeoMesh, int r> template<class Type, class GeoMesh, direction r>
tmp<DimensionedField<typename powProduct<Type, r>::type, GeoMesh>> tmp<DimensionedField<typename powProduct<Type, r>::type, GeoMesh>>
pow pow
( (
@ -43,7 +43,7 @@ pow
typename powProduct<Type, r>::type 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>> tmp<DimensionedField<typename powProduct<Type, r>::type, GeoMesh>>
pow pow
( (
@ -191,7 +191,7 @@ operator op \
const dimensioned<Form>& dvs \ 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>> \ tmp<DimensionedField<typename product<Form, Type>::type, GeoMesh>> \
operator op \ operator op \
( \ ( \
@ -207,7 +207,7 @@ operator op \
const dimensioned<Form>& dvs \ 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>> \ tmp<DimensionedField<typename product<Form, Type>::type, GeoMesh>> \
operator op \ operator op \
( \ ( \
@ -223,7 +223,7 @@ operator op \
const DimensionedField<Type, GeoMesh>& df1 \ 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>> \ tmp<DimensionedField<typename product<Form, Type>::type, GeoMesh>> \
operator op \ operator op \
( \ ( \
@ -239,7 +239,7 @@ operator op \
const tmp<DimensionedField<Type, GeoMesh>>& tdf1 \ 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>> \ tmp<DimensionedField<typename product<Form, Type>::type, GeoMesh>> \
operator op \ operator op \
( \ ( \

View File

@ -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 void pow
( (
FieldField<Field, typename powProduct<Type, r>::type>& f, 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>> tmp<FieldField<Field, typename powProduct<Type, r>::type>>
pow pow
( (
@ -90,7 +90,7 @@ pow
return tRes; 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>> tmp<FieldField<Field, typename powProduct<Type, r>::type>>
pow pow
( (
@ -761,7 +761,13 @@ operator op \
} \ } \
\ \
template \ 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 \ void opFunc \
( \ ( \
FieldField<Field, typename product<Type, Form>::type>& f, \ FieldField<Field, typename product<Type, Form>::type>& f, \
@ -776,7 +782,13 @@ void opFunc \
} \ } \
\ \
template \ 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>> \ tmp<FieldField<Field, typename product<Type, Form>::type>> \
operator op \ operator op \
( \ ( \
@ -794,7 +806,13 @@ operator op \
} \ } \
\ \
template \ 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>> \ tmp<FieldField<Field, typename product<Type, Form>::type>> \
operator op \ operator op \
( \ ( \
@ -813,7 +831,13 @@ operator op \
} \ } \
\ \
template \ 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 \ void opFunc \
( \ ( \
FieldField<Field, typename product<Form, Type>::type>& f, \ FieldField<Field, typename product<Form, Type>::type>& f, \
@ -828,7 +852,13 @@ void opFunc \
} \ } \
\ \
template \ 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>> \ tmp<FieldField<Field, typename product<Form, Type>::type>> \
operator op \ operator op \
( \ ( \
@ -846,7 +876,13 @@ operator op \
} \ } \
\ \
template \ 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>> \ tmp<FieldField<Field, typename product<Form, Type>::type>> \
operator op \ operator op \
( \ ( \

View File

@ -47,14 +47,14 @@ 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);
template<template<class> class Field, class Type, int r> template<template<class> class Field, class Type, direction r>
void pow void pow
( (
FieldField<Field, typename powProduct<Type, r>::type>& f, FieldField<Field, typename powProduct<Type, r>::type>& f,
const FieldField<Field, Type>& vf 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>> tmp<FieldField<Field, typename powProduct<Type, r>::type>>
pow pow
( (
@ -62,7 +62,7 @@ pow
= pTraits<typename powProduct<Type, r>::type>::zero = 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>> tmp<FieldField<Field, typename powProduct<Type, r>::type>>
pow pow
( (
@ -346,7 +346,13 @@ operator op \
); \ ); \
\ \
template \ 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 \ void opFunc \
( \ ( \
FieldField<Field, typename product<Type, Form>::type>& f, \ FieldField<Field, typename product<Type, Form>::type>& f, \
@ -355,7 +361,13 @@ void opFunc \
); \ ); \
\ \
template \ 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>> \ tmp<FieldField<Field, typename product<Type, Form>::type>> \
operator op \ operator op \
( \ ( \
@ -364,7 +376,13 @@ operator op \
); \ ); \
\ \
template \ 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>> \ tmp<FieldField<Field, typename product<Type, Form>::type>> \
operator op \ operator op \
( \ ( \
@ -373,7 +391,13 @@ operator op \
); \ ); \
\ \
template \ 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 \ void opFunc \
( \ ( \
FieldField<Field, typename product<Form, Type>::type>& f, \ FieldField<Field, typename product<Form, Type>::type>& f, \
@ -382,7 +406,13 @@ void opFunc \
); \ ); \
\ \
template \ 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>> \ tmp<FieldField<Field, typename product<Form, Type>::type>> \
operator op \ operator op \
( \ ( \
@ -391,7 +421,13 @@ operator op \
); \ ); \
\ \
template \ 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>> \ tmp<FieldField<Field, typename product<Form, Type>::type>> \
operator op \ operator op \
( \ ( \

View File

@ -701,7 +701,7 @@ void Foam::Field<Type>::operator=(const Type& t)
template<class Type> 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) void Foam::Field<Type>::operator=(const VectorSpace<Form,Cmpt,nCmpt>& vs)
{ {
TFOR_ALL_F_OP_S(Type, *this, =, VSType, vs) TFOR_ALL_F_OP_S(Type, *this, =, VSType, vs)

View File

@ -345,7 +345,7 @@ public:
void operator=(const tmp<Field<Type>>&); void operator=(const tmp<Field<Type>>&);
void operator=(const 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 VectorSpace<Form,Cmpt,nCmpt>&);
void operator+=(const UList<Type>&); void operator+=(const UList<Type>&);

View File

@ -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 void pow
( (
Field<typename powProduct<Type, r>::type>& res, 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>> tmp<Field<typename powProduct<Type, r>::type>>
pow pow
( (
@ -91,7 +91,7 @@ pow
return tRes; return tRes;
} }
template<class Type, int r> template<class Type, direction r>
tmp<Field<typename powProduct<Type, r>::type>> tmp<Field<typename powProduct<Type, r>::type>>
pow pow
( (
@ -692,7 +692,7 @@ operator Op(const tmp<Field<Type1>>& tf1, const tmp<Field<Type2>>& tf2) \
return tRes; \ return tRes; \
} \ } \
\ \
template<class Type, class Form, class Cmpt, int nCmpt> \ template<class Type, class Form, class Cmpt, direction nCmpt> \
void OpFunc \ void OpFunc \
( \ ( \
Field<typename product<Type, Form>::type>& res, \ Field<typename product<Type, Form>::type>& res, \
@ -705,7 +705,7 @@ void OpFunc \
(productType, res, =,Type, f1, Op, Form, static_cast<const Form&>(vs)) \ (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>> \ tmp<Field<typename product<Type, Form>::type>> \
operator Op(const UList<Type>& f1, const VectorSpace<Form,Cmpt,nCmpt>& vs) \ 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; \ 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>> \ tmp<Field<typename product<Type, Form>::type>> \
operator Op \ operator Op \
( \ ( \
@ -730,7 +730,7 @@ operator Op \
return tRes; \ return tRes; \
} \ } \
\ \
template<class Form, class Cmpt, int nCmpt, class Type> \ template<class Form, class Cmpt, direction nCmpt, class Type> \
void OpFunc \ void OpFunc \
( \ ( \
Field<typename product<Form, Type>::type>& res, \ Field<typename product<Form, Type>::type>& res, \
@ -743,7 +743,7 @@ void OpFunc \
(productType, res, =,Form,static_cast<const Form&>(vs), Op, Type, f1) \ (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>> \ tmp<Field<typename product<Form, Type>::type>> \
operator Op(const VectorSpace<Form,Cmpt,nCmpt>& vs, const UList<Type>& f1) \ 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; \ 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>> \ tmp<Field<typename product<Form, Type>::type>> \
operator Op \ operator Op \
( \ ( \

View File

@ -47,7 +47,7 @@ template<class Type>
void T(Field<Type>& res, const UList<Type>& f); void T(Field<Type>& res, const UList<Type>& f);
template<class Type, int r> template<class Type, direction r>
void pow void pow
( (
Field<typename powProduct<Type, r>::type>& res, 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>> tmp<Field<typename powProduct<Type, r>::type>>
pow pow
( (
@ -64,7 +64,7 @@ pow
= pTraits<typename powProduct<Type, r>::type>::zero = pTraits<typename powProduct<Type, r>::type>::zero
); );
template<class Type, int r> template<class Type, direction r>
tmp<Field<typename powProduct<Type, r>::type>> tmp<Field<typename powProduct<Type, r>::type>>
pow pow
( (
@ -307,7 +307,7 @@ template<class Type1, class Type2> \
tmp<Field<typename product<Type1, Type2>::type>> \ tmp<Field<typename product<Type1, Type2>::type>> \
operator Op(const tmp<Field<Type1>>& tf1, const tmp<Field<Type2>>& tf2); \ 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 \ void OpFunc \
( \ ( \
Field<typename product<Type, Form>::type>& res, \ Field<typename product<Type, Form>::type>& res, \
@ -315,15 +315,15 @@ void OpFunc \
const VectorSpace<Form,Cmpt,nCmpt>& vs \ 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>> \ tmp<Field<typename product<Type, Form>::type>> \
operator Op(const UList<Type>& f1, const VectorSpace<Form,Cmpt,nCmpt>& vs); \ 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>> \ 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 \ void OpFunc \
( \ ( \
Field<typename product<Form, Type>::type>& res, \ Field<typename product<Form, Type>::type>& res, \
@ -331,11 +331,11 @@ void OpFunc \
const UList<Type>& f1 \ 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>> \ tmp<Field<typename product<Form, Type>::type>> \
operator Op(const VectorSpace<Form,Cmpt,nCmpt>& vs, const UList<Type>& f1); \ 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>> \ tmp<Field<typename product<Form, Type>::type>> \
operator Op(const VectorSpace<Form,Cmpt,nCmpt>&vs,const tmp<Field<Type>>&tf1); operator Op(const VectorSpace<Form,Cmpt,nCmpt>&vs,const tmp<Field<Type>>&tf1);

View File

@ -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 void pow
( (
GeometricField<typename powProduct<Type, r>::type, PatchField, GeoMesh>& gf, GeometricField<typename powProduct<Type, r>::type, PatchField, GeoMesh>& gf,
@ -77,7 +83,13 @@ void pow
pow(gf.boundaryField(), gf1.boundaryField(), r); 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>> tmp<GeometricField<typename powProduct<Type, r>::type, PatchField, GeoMesh>>
pow 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>> tmp<GeometricField<typename powProduct<Type, r>::type, PatchField, GeoMesh>>
pow pow
( (
@ -768,7 +786,7 @@ template \
< \ < \
class Form, \ class Form, \
class Cmpt, \ class Cmpt, \
int nCmpt, \ direction nCmpt, \
class Type, template<class> class PatchField, \ class Type, template<class> class PatchField, \
class GeoMesh \ class GeoMesh \
> \ > \
@ -815,7 +833,7 @@ template \
< \ < \
class Form, \ class Form, \
class Cmpt, \ class Cmpt, \
int nCmpt, \ direction nCmpt, \
class Type, template<class> class PatchField, \ class Type, template<class> class PatchField, \
class GeoMesh \ class GeoMesh \
> \ > \
@ -880,7 +898,7 @@ template \
< \ < \
class Form, \ class Form, \
class Cmpt, \ class Cmpt, \
int nCmpt, \ direction nCmpt, \
class Type, template<class> class PatchField, \ class Type, template<class> class PatchField, \
class GeoMesh \ class GeoMesh \
> \ > \
@ -926,7 +944,7 @@ template \
< \ < \
class Form, \ class Form, \
class Cmpt, \ class Cmpt, \
int nCmpt, \ direction nCmpt, \
class Type, template<class> class PatchField, \ class Type, template<class> class PatchField, \
class GeoMesh \ class GeoMesh \
> \ > \

View File

@ -56,14 +56,26 @@ void T
const GeometricField<Type, PatchField, GeoMesh>& gf1 const GeometricField<Type, PatchField, GeoMesh>& gf1
); );
template<class Type, template<class> class PatchField, class GeoMesh, int r> template
<
class Type,
template<class> class PatchField,
class GeoMesh,
direction r
>
void pow void pow
( (
GeometricField<typename powProduct<Type, r>::type, PatchField, GeoMesh>& gf, GeometricField<typename powProduct<Type, r>::type, PatchField, GeoMesh>& gf,
const GeometricField<Type, PatchField, GeoMesh>& gf1 const GeometricField<Type, PatchField, GeoMesh>& gf1
); );
template<class Type, template<class> class PatchField, class GeoMesh, int r> template
<
class Type,
template<class> class PatchField,
class GeoMesh,
direction r
>
tmp tmp
< <
GeometricField GeometricField
@ -75,7 +87,13 @@ pow
typename powProduct<Type, r>::type typename powProduct<Type, r>::type
); );
template<class Type, template<class> class PatchField, class GeoMesh, int r> template
<
class Type,
template<class> class PatchField,
class GeoMesh,
direction r
>
tmp tmp
< <
GeometricField GeometricField
@ -353,7 +371,7 @@ template \
< \ < \
class Form, \ class Form, \
class Cmpt, \ class Cmpt, \
int nCmpt, \ direction nCmpt, \
class Type, template<class> class PatchField, \ class Type, template<class> class PatchField, \
class GeoMesh \ class GeoMesh \
> \ > \
@ -385,7 +403,7 @@ template \
< \ < \
class Form, \ class Form, \
class Cmpt, \ class Cmpt, \
int nCmpt, \ direction nCmpt, \
class Type, template<class> class PatchField, \ class Type, template<class> class PatchField, \
class GeoMesh \ class GeoMesh \
> \ > \
@ -427,7 +445,7 @@ template \
< \ < \
class Form, \ class Form, \
class Cmpt, \ class Cmpt, \
int nCmpt, \ direction nCmpt, \
class Type, template<class> class PatchField, \ class Type, template<class> class PatchField, \
class GeoMesh \ class GeoMesh \
> \ > \
@ -459,7 +477,7 @@ template \
< \ < \
class Form, \ class Form, \
class Cmpt, \ class Cmpt, \
int nCmpt, \ direction nCmpt, \
class Type, template<class> class PatchField, \ class Type, template<class> class PatchField, \
class GeoMesh \ class GeoMesh \
> \ > \

View File

@ -47,7 +47,7 @@ inline void T
{} {}
template<class Type, int r> template<class Type, direction r>
inline void pow inline void pow
( (
Field<typename powProduct<Type, r>::type>& f, Field<typename powProduct<Type, r>::type>& f,
@ -206,7 +206,7 @@ template \
class Type, \ class Type, \
class Form, \ class Form, \
class Cmpt, \ class Cmpt, \
int nCmpt \ direction nCmpt \
> \ > \
inline void opFunc \ inline void opFunc \
( \ ( \
@ -221,7 +221,7 @@ template \
< \ < \
class Form, \ class Form, \
class Cmpt, \ class Cmpt, \
int nCmpt, \ direction nCmpt, \
class Type \ class Type \
> \ > \
inline void opFunc \ inline void opFunc \

View File

@ -64,10 +64,8 @@ public:
// Member constants // Member constants
enum //- Rank of DiagTensor is 2
{ static const direction rank = 2;
rank = 2 // Rank of DiagTensor is 2
};
//- Component labeling enumeration //- Component labeling enumeration

View File

@ -53,14 +53,18 @@ public:
//- Equivalent type of labels used for valid component indexing //- Equivalent type of labels used for valid component indexing
typedef label labelType; typedef label labelType;
// Member constants // Member constants
enum //- Dimensionality of space
{ static const direction dim = 3;
dim = 3, //!< Dimensionality of space
rank = 0, //!< Rank of Scalar is 0 //- Rank of Scalar is 0
nComponents = 1 //!< Number of components in Scalar is 1 static const direction rank = 0;
};
//- Number of components in Scalar is 1
static const direction nComponents = 1;
// Static data members // Static data members
@ -73,6 +77,7 @@ public:
static const Scalar rootMax; static const Scalar rootMax;
static const Scalar rootMin; static const Scalar rootMin;
// Constructors // Constructors
//- Construct from primitive //- Construct from primitive

View File

@ -62,10 +62,8 @@ public:
// Member constants // Member constants
enum //- Rank of SphericalTensor is 2
{ static const direction rank = 2;
rank = 2 // Rank of SphericalTensor is 2
};
// Static data members // Static data members

View File

@ -58,10 +58,8 @@ public:
// Member constants // Member constants
enum //- Rank of SphericalTensor2D is 2
{ static const direction rank = 2;
rank = 2 // Rank of SphericalTensor2D is 2
};
// Static data members // Static data members

View File

@ -64,10 +64,8 @@ public:
// Member constants // Member constants
enum //- Rank of SymmTensor is 2
{ static const direction rank = 2;
rank = 2 // Rank of SymmTensor is 2
};
// Static data members // Static data members

View File

@ -64,10 +64,8 @@ public:
// Member constants // Member constants
enum //- Rank of SymmTensor2D is 2
{ static const direction rank = 2;
rank = 2 // Rank of SymmTensor2D is 2
};
// Static data members // Static data members

View File

@ -67,10 +67,8 @@ public:
// Member constants // Member constants
enum //- Rank of Tensor is 2
{ static const direction rank = 2;
rank = 2 // Rank of Tensor is 2
};
// Static data members // Static data members

View File

@ -67,10 +67,8 @@ public:
// Member constants // Member constants
enum //- Rank of Tensor2D is 2
{ static const direction rank = 2;
rank = 2 // Rank of Tensor2D is 2
};
// Static data members // Static data members

View File

@ -68,10 +68,8 @@ public:
// Member constants // Member constants
enum //- Rank of Vector is 1
{ static const direction rank = 1;
rank = 1 // Rank of Vector is 1
};
//- Component labeling enumeration //- Component labeling enumeration

View File

@ -62,10 +62,8 @@ public:
// Member constants // Member constants
enum //- Rank of Vector2D is 1
{ static const direction rank = 1;
rank = 1 // Rank of Vector2D is 1
};
//- Component labeling enumeration //- Component labeling enumeration

View File

@ -30,7 +30,7 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Form, class Cmpt, int nCmpt> template<class Form, class Cmpt, Foam::direction nCmpt>
Foam::VectorSpace<Form, Cmpt, nCmpt>::VectorSpace Foam::VectorSpace<Form, Cmpt, nCmpt>::VectorSpace
( (
Istream& is Istream& is
@ -39,7 +39,7 @@ Foam::VectorSpace<Form, Cmpt, nCmpt>::VectorSpace
// Read beginning of VectorSpace<Cmpt> // Read beginning of VectorSpace<Cmpt>
is.readBegin("VectorSpace<Form, Cmpt, nCmpt>"); is.readBegin("VectorSpace<Form, Cmpt, nCmpt>");
for (int i=0; i<nCmpt; i++) for (direction i=0; i<nCmpt; i++)
{ {
is >> v_[i]; is >> v_[i];
} }
@ -52,9 +52,8 @@ Foam::VectorSpace<Form, Cmpt, nCmpt>::VectorSpace
} }
template<class Form, class Cmpt, int nCmpt> template<class Form, class Cmpt, Foam::direction nCmpt>
Foam::word Foam::word Foam::name
Foam::name
( (
const VectorSpace<Form, Cmpt, nCmpt>& vs const VectorSpace<Form, Cmpt, nCmpt>& vs
) )
@ -63,7 +62,7 @@ Foam::name
buf << '('; buf << '(';
for (int i=0; i<nCmpt-1; i++) for (direction i=0; i<nCmpt-1; i++)
{ {
buf << vs.v_[i] << ','; buf << vs.v_[i] << ',';
} }
@ -76,7 +75,7 @@ Foam::name
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
template<class Form, class Cmpt, int nCmpt> template<class Form, class Cmpt, Foam::direction nCmpt>
Foam::Istream& Foam::operator>> Foam::Istream& Foam::operator>>
( (
Istream& is, Istream& is,
@ -86,7 +85,7 @@ Foam::Istream& Foam::operator>>
// Read beginning of VectorSpace<Cmpt, nCmpt> // Read beginning of VectorSpace<Cmpt, nCmpt>
is.readBegin("VectorSpace<Form, Cmpt, nCmpt>"); is.readBegin("VectorSpace<Form, Cmpt, nCmpt>");
for (int i=0; i<nCmpt; i++) for (direction i=0; i<nCmpt; i++)
{ {
is >> vs.v_[i]; is >> vs.v_[i];
} }
@ -101,21 +100,21 @@ Foam::Istream& Foam::operator>>
} }
template<class Form, class Cmpt, int nCmpt> template<class Form, class Cmpt, Foam::direction nCmpt>
Foam::Ostream& Foam::operator<< Foam::Ostream& Foam::operator<<
( (
Ostream& os, Ostream& os,
const VectorSpace<Form, Cmpt, nCmpt>& vs const VectorSpace<Form, Cmpt, nCmpt>& vs
) )
{ {
os << token::BEGIN_LIST; os << token::BEGIN_LIST << vs.v_[0];
for (int i=0; i<nCmpt-1; i++) for (direction i=1; i<nCmpt; i++)
{ {
os << vs.v_[i] << token::SPACE; os << token::SPACE << vs.v_[i];
} }
os << vs.v_[nCmpt-1] << token::END_LIST; os << token::END_LIST;
// Check state of Ostream // Check state of Ostream
os.check("operator<<(Ostream&, const VectorSpace<Form, Cmpt, nCmpt>&)"); os.check("operator<<(Ostream&, const VectorSpace<Form, Cmpt, nCmpt>&)");

View File

@ -51,16 +51,16 @@ namespace Foam
// Forward declaration of friend functions and operators // Forward declaration of friend functions and operators
template<class Form, class Cmpt, int nCmpt> class VectorSpace; template<class Form, class Cmpt, direction nCmpt> class VectorSpace;
template<class Form, class Cmpt, int nCmpt> template<class Form, class Cmpt, direction nCmpt>
Istream& operator>> Istream& operator>>
( (
Istream&, Istream&,
VectorSpace<Form, Cmpt, nCmpt>& VectorSpace<Form, Cmpt, nCmpt>&
); );
template<class Form, class Cmpt, int nCmpt> template<class Form, class Cmpt, direction nCmpt>
Ostream& operator<< Ostream& operator<<
( (
Ostream&, Ostream&,
@ -72,7 +72,7 @@ Ostream& operator<<
Class VectorSpace Declaration Class VectorSpace Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
template<class Form, class Cmpt, int nCmpt> template<class Form, class Cmpt, direction nCmpt>
class VectorSpace class VectorSpace
{ {
@ -115,6 +115,9 @@ public:
//- Construct null //- Construct null
inline VectorSpace(); inline VectorSpace();
//- Construct initialized to zero
inline VectorSpace(const Foam::zero);
//- Construct from Istream //- Construct from Istream
VectorSpace(Istream&); VectorSpace(Istream&);
@ -174,7 +177,7 @@ public:
// * * * * * * * * * * * * * * Global functions * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Global functions * * * * * * * * * * * * * * //
//- Return a string representation of a VectorSpace //- Return a string representation of a VectorSpace
template<class Form, class Cmpt, int nCmpt> template<class Form, class Cmpt, direction nCmpt>
word name(const VectorSpace<Form, Cmpt, nCmpt>&); word name(const VectorSpace<Form, Cmpt, nCmpt>&);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -35,12 +35,19 @@ namespace Foam
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Form, class Cmpt, int nCmpt> template<class Form, class Cmpt, direction nCmpt>
inline VectorSpace<Form, Cmpt, nCmpt>::VectorSpace() inline VectorSpace<Form, Cmpt, nCmpt>::VectorSpace()
{} {}
template<class Form, class Cmpt, int nCmpt> template<class Form, class Cmpt, direction nCmpt>
inline VectorSpace<Form, Cmpt, nCmpt>::VectorSpace(const Foam::zero z)
{
VectorSpaceOps<nCmpt,0>::eqOpS(*this, 0, eqOp<Cmpt>());
}
template<class Form, class Cmpt, direction nCmpt>
inline VectorSpace<Form, Cmpt, nCmpt>::VectorSpace inline VectorSpace<Form, Cmpt, nCmpt>::VectorSpace
( (
const VectorSpace<Form, Cmpt, nCmpt>& vs const VectorSpace<Form, Cmpt, nCmpt>& vs
@ -50,7 +57,7 @@ inline VectorSpace<Form, Cmpt, nCmpt>::VectorSpace
} }
template<class Form, class Cmpt, int nCmpt> template<class Form, class Cmpt, direction nCmpt>
template<class Form2, class Cmpt2> template<class Form2, class Cmpt2>
inline VectorSpace<Form, Cmpt, nCmpt>::VectorSpace inline VectorSpace<Form, Cmpt, nCmpt>::VectorSpace
( (
@ -63,14 +70,14 @@ inline VectorSpace<Form, Cmpt, nCmpt>::VectorSpace
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Form, class Cmpt, int nCmpt> template<class Form, class Cmpt, direction nCmpt>
inline label VectorSpace<Form, Cmpt, nCmpt>::size() const inline label VectorSpace<Form, Cmpt, nCmpt>::size() const
{ {
return nCmpt; return nCmpt;
} }
template<class Form, class Cmpt, int nCmpt> template<class Form, class Cmpt, direction nCmpt>
inline const Cmpt& VectorSpace<Form, Cmpt, nCmpt>::component inline const Cmpt& VectorSpace<Form, Cmpt, nCmpt>::component
( (
const direction d const direction d
@ -89,7 +96,7 @@ inline const Cmpt& VectorSpace<Form, Cmpt, nCmpt>::component
} }
template<class Form, class Cmpt, int nCmpt> template<class Form, class Cmpt, direction nCmpt>
inline Cmpt& VectorSpace<Form, Cmpt, nCmpt>::component inline Cmpt& VectorSpace<Form, Cmpt, nCmpt>::component
( (
const direction d const direction d
@ -108,7 +115,7 @@ inline Cmpt& VectorSpace<Form, Cmpt, nCmpt>::component
} }
template<class Form, class Cmpt, int nCmpt> template<class Form, class Cmpt, direction nCmpt>
inline void VectorSpace<Form, Cmpt, nCmpt>::component inline void VectorSpace<Form, Cmpt, nCmpt>::component
( (
Cmpt& c, Cmpt& c,
@ -128,7 +135,7 @@ inline void VectorSpace<Form, Cmpt, nCmpt>::component
} }
template<class Form, class Cmpt, int nCmpt> template<class Form, class Cmpt, direction nCmpt>
inline void VectorSpace<Form, Cmpt, nCmpt>::replace inline void VectorSpace<Form, Cmpt, nCmpt>::replace
( (
const direction d, const direction d,
@ -148,7 +155,7 @@ inline void VectorSpace<Form, Cmpt, nCmpt>::replace
} }
template<class Form, class Cmpt, int nCmpt> template<class Form, class Cmpt, direction nCmpt>
inline Form VectorSpace<Form, Cmpt, nCmpt>::uniform(const Cmpt& s) inline Form VectorSpace<Form, Cmpt, nCmpt>::uniform(const Cmpt& s)
{ {
Form v; Form v;
@ -159,7 +166,7 @@ inline Form VectorSpace<Form, Cmpt, nCmpt>::uniform(const Cmpt& s)
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template<class Form, class Cmpt, int nCmpt> template<class Form, class Cmpt, direction nCmpt>
inline const Cmpt& VectorSpace<Form, Cmpt, nCmpt>::operator[] inline const Cmpt& VectorSpace<Form, Cmpt, nCmpt>::operator[]
( (
const direction d const direction d
@ -178,7 +185,7 @@ inline const Cmpt& VectorSpace<Form, Cmpt, nCmpt>::operator[]
} }
template<class Form, class Cmpt, int nCmpt> template<class Form, class Cmpt, direction nCmpt>
inline Cmpt& VectorSpace<Form, Cmpt, nCmpt>::operator[] inline Cmpt& VectorSpace<Form, Cmpt, nCmpt>::operator[]
( (
const direction d const direction d
@ -197,7 +204,7 @@ inline Cmpt& VectorSpace<Form, Cmpt, nCmpt>::operator[]
} }
template<class Form, class Cmpt, int nCmpt> template<class Form, class Cmpt, direction nCmpt>
inline void VectorSpace<Form, Cmpt, nCmpt>::operator= inline void VectorSpace<Form, Cmpt, nCmpt>::operator=
( (
const VectorSpace<Form, Cmpt, nCmpt>& vs const VectorSpace<Form, Cmpt, nCmpt>& vs
@ -207,7 +214,7 @@ inline void VectorSpace<Form, Cmpt, nCmpt>::operator=
} }
template<class Form, class Cmpt, int nCmpt> template<class Form, class Cmpt, direction nCmpt>
inline void VectorSpace<Form, Cmpt, nCmpt>::operator+= inline void VectorSpace<Form, Cmpt, nCmpt>::operator+=
( (
const VectorSpace<Form, Cmpt, nCmpt>& vs const VectorSpace<Form, Cmpt, nCmpt>& vs
@ -217,7 +224,7 @@ inline void VectorSpace<Form, Cmpt, nCmpt>::operator+=
} }
template<class Form, class Cmpt, int nCmpt> template<class Form, class Cmpt, direction nCmpt>
inline void VectorSpace<Form, Cmpt, nCmpt>::operator-= inline void VectorSpace<Form, Cmpt, nCmpt>::operator-=
( (
const VectorSpace<Form, Cmpt, nCmpt>& vs const VectorSpace<Form, Cmpt, nCmpt>& vs
@ -227,14 +234,14 @@ inline void VectorSpace<Form, Cmpt, nCmpt>::operator-=
} }
template<class Form, class Cmpt, int nCmpt> template<class Form, class Cmpt, direction nCmpt>
inline void VectorSpace<Form, Cmpt, nCmpt>::operator=(const Foam::zero) inline void VectorSpace<Form, Cmpt, nCmpt>::operator=(const Foam::zero)
{ {
VectorSpaceOps<nCmpt,0>::eqOpS(*this, 0, eqOp<Cmpt>()); VectorSpaceOps<nCmpt,0>::eqOpS(*this, 0, eqOp<Cmpt>());
} }
template<class Form, class Cmpt, int nCmpt> template<class Form, class Cmpt, direction nCmpt>
inline void VectorSpace<Form, Cmpt, nCmpt>::operator*= inline void VectorSpace<Form, Cmpt, nCmpt>::operator*=
( (
const scalar s const scalar s
@ -244,7 +251,7 @@ inline void VectorSpace<Form, Cmpt, nCmpt>::operator*=
} }
template<class Form, class Cmpt, int nCmpt> template<class Form, class Cmpt, direction nCmpt>
inline void VectorSpace<Form, Cmpt, nCmpt>::operator/= inline void VectorSpace<Form, Cmpt, nCmpt>::operator/=
( (
const scalar s const scalar s
@ -256,7 +263,7 @@ inline void VectorSpace<Form, Cmpt, nCmpt>::operator/=
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
template<class Form, class Cmpt, int nCmpt> template<class Form, class Cmpt, direction nCmpt>
inline Cmpt& setComponent inline Cmpt& setComponent
( (
VectorSpace<Form, Cmpt, nCmpt>& vs, VectorSpace<Form, Cmpt, nCmpt>& vs,
@ -267,7 +274,7 @@ inline Cmpt& setComponent
} }
template<class Form, class Cmpt, int nCmpt> template<class Form, class Cmpt, direction nCmpt>
inline const Cmpt& component inline const Cmpt& component
( (
const VectorSpace<Form, Cmpt, nCmpt>& vs, const VectorSpace<Form, Cmpt, nCmpt>& vs,
@ -281,7 +288,7 @@ inline const Cmpt& component
// Powers of a Form // Powers of a Form
// Equivalent to outer-products between the Form and itself // Equivalent to outer-products between the Form and itself
// Form^0 = 1.0 // Form^0 = 1.0
template<class Form, class Cmpt, int nCmpt> template<class Form, class Cmpt, direction nCmpt>
inline typename powProduct<Form, 0>::type pow inline typename powProduct<Form, 0>::type pow
( (
const VectorSpace<Form, Cmpt, nCmpt>&, const VectorSpace<Form, Cmpt, nCmpt>&,
@ -293,7 +300,7 @@ inline typename powProduct<Form, 0>::type pow
} }
// Form^1 = Form // Form^1 = Form
template<class Form, class Cmpt, int nCmpt> template<class Form, class Cmpt, direction nCmpt>
inline typename powProduct<Form, 1>::type pow inline typename powProduct<Form, 1>::type pow
( (
const VectorSpace<Form, Cmpt, nCmpt>& v, const VectorSpace<Form, Cmpt, nCmpt>& v,
@ -306,7 +313,7 @@ inline typename powProduct<Form, 1>::type pow
// Form^2 = sqr(Form) // Form^2 = sqr(Form)
template<class Form, class Cmpt, int nCmpt> template<class Form, class Cmpt, direction nCmpt>
inline typename powProduct<Form, 2>::type pow inline typename powProduct<Form, 2>::type pow
( (
const VectorSpace<Form, Cmpt, nCmpt>& v, const VectorSpace<Form, Cmpt, nCmpt>& v,
@ -318,7 +325,7 @@ inline typename powProduct<Form, 2>::type pow
} }
template<class Form, class Cmpt, int nCmpt> template<class Form, class Cmpt, direction nCmpt>
inline scalar magSqr inline scalar magSqr
( (
const VectorSpace<Form, Cmpt, nCmpt>& vs const VectorSpace<Form, Cmpt, nCmpt>& vs
@ -330,7 +337,7 @@ inline scalar magSqr
} }
template<class Form, class Cmpt, int nCmpt> template<class Form, class Cmpt, direction nCmpt>
inline scalar mag inline scalar mag
( (
const VectorSpace<Form, Cmpt, nCmpt>& vs const VectorSpace<Form, Cmpt, nCmpt>& vs
@ -340,7 +347,7 @@ inline scalar mag
} }
template<class Form, class Cmpt, int nCmpt> template<class Form, class Cmpt, direction nCmpt>
inline VectorSpace<Form, Cmpt, nCmpt> cmptMultiply inline VectorSpace<Form, Cmpt, nCmpt> cmptMultiply
( (
const VectorSpace<Form, Cmpt, nCmpt>& vs1, const VectorSpace<Form, Cmpt, nCmpt>& vs1,
@ -353,7 +360,7 @@ inline VectorSpace<Form, Cmpt, nCmpt> cmptMultiply
} }
template<class Form, class Cmpt, int nCmpt> template<class Form, class Cmpt, direction nCmpt>
inline VectorSpace<Form, Cmpt, nCmpt> cmptPow inline VectorSpace<Form, Cmpt, nCmpt> cmptPow
( (
const VectorSpace<Form, Cmpt, nCmpt>& vs1, const VectorSpace<Form, Cmpt, nCmpt>& vs1,
@ -366,7 +373,7 @@ inline VectorSpace<Form, Cmpt, nCmpt> cmptPow
} }
template<class Form, class Cmpt, int nCmpt> template<class Form, class Cmpt, direction nCmpt>
inline VectorSpace<Form, Cmpt, nCmpt> cmptDivide inline VectorSpace<Form, Cmpt, nCmpt> cmptDivide
( (
const VectorSpace<Form, Cmpt, nCmpt>& vs1, const VectorSpace<Form, Cmpt, nCmpt>& vs1,
@ -379,7 +386,7 @@ inline VectorSpace<Form, Cmpt, nCmpt> cmptDivide
} }
template<class Form, class Cmpt, int nCmpt> template<class Form, class Cmpt, direction nCmpt>
inline VectorSpace<Form, Cmpt, nCmpt> stabilise inline VectorSpace<Form, Cmpt, nCmpt> stabilise
( (
const VectorSpace<Form, Cmpt, nCmpt>& vs, const VectorSpace<Form, Cmpt, nCmpt>& vs,
@ -392,7 +399,7 @@ inline VectorSpace<Form, Cmpt, nCmpt> stabilise
} }
template<class Form, class Cmpt, int nCmpt> template<class Form, class Cmpt, direction nCmpt>
inline Cmpt cmptMax inline Cmpt cmptMax
( (
const VectorSpace<Form, Cmpt, nCmpt>& vs const VectorSpace<Form, Cmpt, nCmpt>& vs
@ -404,7 +411,7 @@ inline Cmpt cmptMax
} }
template<class Form, class Cmpt, int nCmpt> template<class Form, class Cmpt, direction nCmpt>
inline Cmpt cmptMin inline Cmpt cmptMin
( (
const VectorSpace<Form, Cmpt, nCmpt>& vs const VectorSpace<Form, Cmpt, nCmpt>& vs
@ -416,7 +423,7 @@ inline Cmpt cmptMin
} }
template<class Form, class Cmpt, int nCmpt> template<class Form, class Cmpt, direction nCmpt>
inline Cmpt cmptSum inline Cmpt cmptSum
( (
const VectorSpace<Form, Cmpt, nCmpt>& vs const VectorSpace<Form, Cmpt, nCmpt>& vs
@ -428,7 +435,7 @@ inline Cmpt cmptSum
} }
template<class Form, class Cmpt, int nCmpt> template<class Form, class Cmpt, direction nCmpt>
inline Cmpt cmptAv inline Cmpt cmptAv
( (
const VectorSpace<Form, Cmpt, nCmpt>& vs const VectorSpace<Form, Cmpt, nCmpt>& vs
@ -437,7 +444,7 @@ inline Cmpt cmptAv
return cmptSum(vs)/nCmpt; return cmptSum(vs)/nCmpt;
} }
template<class Form, class Cmpt, int nCmpt> template<class Form, class Cmpt, direction nCmpt>
inline Cmpt cmptProduct inline Cmpt cmptProduct
( (
const VectorSpace<Form, Cmpt, nCmpt>& vs const VectorSpace<Form, Cmpt, nCmpt>& vs
@ -449,7 +456,7 @@ inline Cmpt cmptProduct
} }
template<class Form, class Cmpt, int nCmpt> template<class Form, class Cmpt, direction nCmpt>
inline Form cmptMag inline Form cmptMag
( (
const VectorSpace<Form, Cmpt, nCmpt>& vs const VectorSpace<Form, Cmpt, nCmpt>& vs
@ -461,7 +468,7 @@ inline Form cmptMag
} }
template<class Form, class Cmpt, int nCmpt> template<class Form, class Cmpt, direction nCmpt>
inline Form max inline Form max
( (
const VectorSpace<Form, Cmpt, nCmpt>& vs1, const VectorSpace<Form, Cmpt, nCmpt>& vs1,
@ -474,7 +481,7 @@ inline Form max
} }
template<class Form, class Cmpt, int nCmpt> template<class Form, class Cmpt, direction nCmpt>
inline Form min inline Form min
( (
const VectorSpace<Form, Cmpt, nCmpt>& vs1, const VectorSpace<Form, Cmpt, nCmpt>& vs1,
@ -487,7 +494,7 @@ inline Form min
} }
template<class Form, class Cmpt, int nCmpt> template<class Form, class Cmpt, direction nCmpt>
inline Form minMod inline Form minMod
( (
const VectorSpace<Form, Cmpt, nCmpt>& vs1, const VectorSpace<Form, Cmpt, nCmpt>& vs1,
@ -516,8 +523,8 @@ inline Type dot(const Type& t, const scalar s)
template template
< <
class Form1, class Cmpt1, int nCmpt1, class Form1, class Cmpt1, direction nCmpt1,
class Form2, class Cmpt2, int nCmpt2 class Form2, class Cmpt2, direction nCmpt2
> >
inline typename innerProduct<Form1, Form2>::type dot inline typename innerProduct<Form1, Form2>::type dot
( (
@ -531,7 +538,7 @@ inline typename innerProduct<Form1, Form2>::type dot
// * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
template<class Form, class Cmpt, int nCmpt> template<class Form, class Cmpt, direction nCmpt>
inline Form operator- inline Form operator-
( (
const VectorSpace<Form, Cmpt, nCmpt>& vs const VectorSpace<Form, Cmpt, nCmpt>& vs
@ -543,7 +550,7 @@ inline Form operator-
} }
template<class Form, class Cmpt, int nCmpt> template<class Form, class Cmpt, direction nCmpt>
inline Form operator+ inline Form operator+
( (
const VectorSpace<Form, Cmpt, nCmpt>& vs1, const VectorSpace<Form, Cmpt, nCmpt>& vs1,
@ -555,7 +562,7 @@ inline Form operator+
return v; return v;
} }
template<class Form, class Cmpt, int nCmpt> template<class Form, class Cmpt, direction nCmpt>
inline Form operator- inline Form operator-
( (
const VectorSpace<Form, Cmpt, nCmpt>& vs1, const VectorSpace<Form, Cmpt, nCmpt>& vs1,
@ -568,7 +575,7 @@ inline Form operator-
} }
template<class Form, class Cmpt, int nCmpt> template<class Form, class Cmpt, direction nCmpt>
inline Form operator* inline Form operator*
( (
scalar s, scalar s,
@ -581,7 +588,7 @@ inline Form operator*
} }
template<class Form, class Cmpt, int nCmpt> template<class Form, class Cmpt, direction nCmpt>
inline Form operator* inline Form operator*
( (
const VectorSpace<Form, Cmpt, nCmpt>& vs, const VectorSpace<Form, Cmpt, nCmpt>& vs,
@ -594,7 +601,7 @@ inline Form operator*
} }
template<class Form, class Cmpt, int nCmpt> template<class Form, class Cmpt, direction nCmpt>
inline Form operator/ inline Form operator/
( (
const VectorSpace<Form, Cmpt, nCmpt>& vs, const VectorSpace<Form, Cmpt, nCmpt>& vs,
@ -607,7 +614,7 @@ inline Form operator/
} }
/* /*
template<class Form, class Cmpt, int nCmpt> template<class Form, class Cmpt, direction nCmpt>
inline Form operator/ inline Form operator/
( (
const VectorSpace<Form, Cmpt, nCmpt>& vs1, const VectorSpace<Form, Cmpt, nCmpt>& vs1,
@ -620,7 +627,7 @@ inline Form operator/
} }
template<class Form, class Cmpt, int nCmpt> template<class Form, class Cmpt, direction nCmpt>
inline Form operator/ inline Form operator/
( (
scalar s, scalar s,
@ -634,7 +641,7 @@ inline Form operator/
*/ */
template<class Form, class Cmpt, int nCmpt> template<class Form, class Cmpt, direction nCmpt>
inline Cmpt operator&& inline Cmpt operator&&
( (
const VectorSpace<Form, Cmpt, nCmpt>& vs1, const VectorSpace<Form, Cmpt, nCmpt>& vs1,
@ -642,7 +649,7 @@ inline Cmpt operator&&
) )
{ {
Cmpt ddProd = vs1.v_[0]*vs2.v_[0]; Cmpt ddProd = vs1.v_[0]*vs2.v_[0];
for (int i=1; i<nCmpt; ++i) for (direction i=1; i<nCmpt; ++i)
{ {
ddProd += vs1.v_[i]*vs2.v_[i]; ddProd += vs1.v_[i]*vs2.v_[i];
} }
@ -650,7 +657,7 @@ inline Cmpt operator&&
} }
template<class Form, class Cmpt, int nCmpt> template<class Form, class Cmpt, direction nCmpt>
inline bool operator== inline bool operator==
( (
const VectorSpace<Form, Cmpt, nCmpt>& vs1, const VectorSpace<Form, Cmpt, nCmpt>& vs1,
@ -658,7 +665,7 @@ inline bool operator==
) )
{ {
bool eq = true; bool eq = true;
for (int i=0; i<nCmpt; ++i) for (direction i=0; i<nCmpt; ++i)
{ {
if (!(eq &= (equal(vs1.v_[i], vs2.v_[i])))) break; if (!(eq &= (equal(vs1.v_[i], vs2.v_[i])))) break;
} }
@ -666,7 +673,7 @@ inline bool operator==
} }
template<class Form, class Cmpt, int nCmpt> template<class Form, class Cmpt, direction nCmpt>
inline bool operator!= inline bool operator!=
( (
const VectorSpace<Form, Cmpt, nCmpt>& vs1, const VectorSpace<Form, Cmpt, nCmpt>& vs1,
@ -677,7 +684,7 @@ inline bool operator!=
} }
template<class Form, class Cmpt, int nCmpt> template<class Form, class Cmpt, direction nCmpt>
inline bool operator> inline bool operator>
( (
const VectorSpace<Form, Cmpt, nCmpt>& vs1, const VectorSpace<Form, Cmpt, nCmpt>& vs1,
@ -685,7 +692,7 @@ inline bool operator>
) )
{ {
bool gt = true; bool gt = true;
for (int i=0; i<nCmpt; ++i) for (direction i=0; i<nCmpt; ++i)
{ {
if (!(gt &= vs1.v_[i] > vs2.v_[i])) break; if (!(gt &= vs1.v_[i] > vs2.v_[i])) break;
} }
@ -693,7 +700,7 @@ inline bool operator>
} }
template<class Form, class Cmpt, int nCmpt> template<class Form, class Cmpt, direction nCmpt>
inline bool operator< inline bool operator<
( (
const VectorSpace<Form, Cmpt, nCmpt>& vs1, const VectorSpace<Form, Cmpt, nCmpt>& vs1,
@ -701,7 +708,7 @@ inline bool operator<
) )
{ {
bool lt = true; bool lt = true;
for (int i=0; i<nCmpt; ++i) for (direction i=0; i<nCmpt; ++i)
{ {
if (!(lt &= vs1.v_[i] < vs2.v_[i])) break; if (!(lt &= vs1.v_[i] < vs2.v_[i])) break;
} }
@ -709,7 +716,7 @@ inline bool operator<
} }
template<class Form, class Cmpt, int nCmpt> template<class Form, class Cmpt, direction nCmpt>
inline bool operator>= inline bool operator>=
( (
const VectorSpace<Form, Cmpt, nCmpt>& vs1, const VectorSpace<Form, Cmpt, nCmpt>& vs1,
@ -720,7 +727,7 @@ inline bool operator>=
} }
template<class Form, class Cmpt, int nCmpt> template<class Form, class Cmpt, direction nCmpt>
inline bool operator<= inline bool operator<=
( (
const VectorSpace<Form, Cmpt, nCmpt>& vs1, const VectorSpace<Form, Cmpt, nCmpt>& vs1,

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -39,7 +39,7 @@ namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<int N, int I> template<direction N, direction I>
class VectorSpaceOps class VectorSpaceOps
{ {
public: public:

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -41,12 +41,12 @@ namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Cmpt, int rank> template<class Cmpt, direction rank>
class typeOfRank class typeOfRank
{}; {};
template<class Cmpt, int rank> template<class Cmpt, direction rank>
class symmTypeOfRank class symmTypeOfRank
{}; {};
@ -68,7 +68,7 @@ public:
typedef typename typeOfRank typedef typename typeOfRank
< <
typename pTraits<arg1>::cmptType, typename pTraits<arg1>::cmptType,
int(pTraits<arg1>::rank) + int(pTraits<arg2>::rank) direction(pTraits<arg1>::rank) + direction(pTraits<arg2>::rank)
>::type type; >::type type;
}; };
@ -81,7 +81,7 @@ public:
typedef typename typeOfRank typedef typename typeOfRank
< <
typename pTraits<arg2>::cmptType, typename pTraits<arg2>::cmptType,
int(pTraits<arg1>::rank) + int(pTraits<arg2>::rank) - 1 direction(pTraits<arg1>::rank) + direction(pTraits<arg2>::rank) - 1
>::type type; >::type type;
}; };
@ -93,7 +93,7 @@ public:
typedef typename typeOfRank typedef typename typeOfRank
< <
typename pTraits<arg1>::cmptType, typename pTraits<arg1>::cmptType,
int(pTraits<arg1>::rank) + int(pTraits<arg2>::rank) - 2 direction(pTraits<arg1>::rank) + direction(pTraits<arg2>::rank) - 2
>::type type; >::type type;
}; };
@ -106,7 +106,7 @@ public:
}; };
template<class arg1, int arg2> template<class arg1, direction arg2>
class powProduct class powProduct
{ {
public: public:
@ -114,7 +114,7 @@ public:
typedef typename symmTypeOfRank typedef typename symmTypeOfRank
< <
typename pTraits<arg1>::cmptType, typename pTraits<arg1>::cmptType,
arg2*int(pTraits<arg1>::rank) arg2*direction(pTraits<arg1>::rank)
>::type type; >::type type;
}; };

View File

@ -56,6 +56,7 @@ bool readBool(Istream&);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "pTraits.H" #include "pTraits.H"
#include "direction.H"
namespace Foam namespace Foam
{ {
@ -73,12 +74,14 @@ public:
// Member constants // Member constants
enum //- Dimensionality of space
{ static const direction dim = 3;
dim = 3, //!< Dimensionality of space
rank = 0, //!< Rank of bool is 0 //- Rank of bool is 0
nComponents = 1 //!< Number of components in bool is 1 static const direction rank = 0;
};
//- Number of components in bool is 1
static const direction nComponents = 1;
// Static data members // Static data members

View File

@ -89,14 +89,17 @@ public:
//- Component type //- Component type
typedef int32_t cmptType; typedef int32_t cmptType;
// Member constants // Member constants
enum //- Dimensionality of space
{ static const direction dim = 3;
dim = 3, //!< Dimensionality of space
rank = 0, //!< Rank of int32_t is 0 //- Rank of int32_t is 0
nComponents = 1 //!< Number of components in int32_t is 1 static const direction rank = 0;
};
//- Number of components in int32_t is 1
static const direction nComponents = 1;
// Static data members // Static data members

View File

@ -80,14 +80,17 @@ public:
//- Component type //- Component type
typedef int64_t cmptType; typedef int64_t cmptType;
// Member constants // Member constants
enum //- Dimensionality of space
{ static const direction dim = 3;
dim = 3, //!< Dimensionality of space
rank = 0, //!< Rank of int64_t is 0 //- Rank of int64_t is 0
nComponents = 1 //!< Number of components in int64_t is 1 static const direction rank = 0;
};
//- Number of components in int64_t is 1
static const direction nComponents = 1;
// Static data members // Static data members

View File

@ -80,14 +80,17 @@ public:
//- Component type //- Component type
typedef uint32_t cmptType; typedef uint32_t cmptType;
// Member constants // Member constants
enum //- Dimensionality of space
{ static const direction dim = 3;
dim = 3, //!< Dimensionality of space
rank = 0, //!< Rank of uint32_t is 0 //- Rank of uint32_t is 0
nComponents = 1 //!< Number of components in uint32_t is 1 static const direction rank = 0;
};
//- Number of components in uint32_t is 1
static const direction nComponents = 1;
// Static data members // Static data members

View File

@ -80,14 +80,17 @@ public:
//- Component type //- Component type
typedef uint64_t cmptType; typedef uint64_t cmptType;
// Member constants // Member constants
enum //- Dimensionality of space
{ static const direction dim = 3;
dim = 3, //!< Dimensionality of space
rank = 0, //!< Rank of uint64_t is 0 //- Rank of uint64_t is 0
nComponents = 1 //!< Number of components in uint64_t is 1 static const direction rank = 0;
};
//- Number of components in uint64_t is 1
static const direction nComponents = 1;
// Static data members // Static data members

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -78,12 +78,11 @@ public:
//- Component type //- Component type
typedef scalar cmptType; typedef scalar cmptType;
// Member constants // Member constants
enum //- Rank of quaternion is 1
{ static const direction rank = 1;
rank = 1 // Rank of quaternion is 1
};
// Static data members // Static data members