diff --git a/src/OpenFOAM/dimensionedTypes/dimensionedType/dimensionedType.C b/src/OpenFOAM/dimensionedTypes/dimensionedType/dimensionedType.C index 220b7256c6..f110dd803d 100644 --- a/src/OpenFOAM/dimensionedTypes/dimensionedType/dimensionedType.C +++ b/src/OpenFOAM/dimensionedTypes/dimensionedType/dimensionedType.C @@ -447,7 +447,7 @@ void Foam::dimensioned::operator/= // * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * // -template +template Foam::dimensioned::type> Foam::pow(const dimensioned& dt, typename powProduct::type) { @@ -747,7 +747,7 @@ Foam::operator op \ ); \ } \ \ -template \ +template \ Foam::dimensioned::type> \ Foam::operator op \ ( \ @@ -763,7 +763,7 @@ Foam::operator op \ ); \ } \ \ -template \ +template \ Foam::dimensioned::type> \ Foam::operator op \ ( \ diff --git a/src/OpenFOAM/dimensionedTypes/dimensionedType/dimensionedType.H b/src/OpenFOAM/dimensionedTypes/dimensionedType/dimensionedType.H index f94aa39829..7d1549f4b2 100644 --- a/src/OpenFOAM/dimensionedTypes/dimensionedType/dimensionedType.H +++ b/src/OpenFOAM/dimensionedTypes/dimensionedType/dimensionedType.H @@ -231,7 +231,7 @@ public: // * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * // -template +template dimensioned::type> pow ( @@ -306,7 +306,7 @@ template \ dimensioned::type> \ operator op(const dimensioned&, const dimensioned&); \ \ -template \ +template \ dimensioned::type> \ operator op \ ( \ @@ -314,7 +314,7 @@ operator op \ const VectorSpace& \ ); \ \ -template \ +template \ dimensioned::type> \ operator op \ ( \ diff --git a/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedFieldFunctions.C b/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedFieldFunctions.C index dc2a68de38..f1bd35b9d2 100644 --- a/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedFieldFunctions.C +++ b/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedFieldFunctions.C @@ -35,7 +35,7 @@ namespace Foam // * * * * * * * * * * * * * * * Global functions * * * * * * * * * * * * * // -template +template tmp::type, GeoMesh>> pow ( @@ -66,7 +66,7 @@ pow } -template +template tmp::type, GeoMesh>> pow ( @@ -510,7 +510,7 @@ operator op \ return tRes; \ } \ \ -template \ +template \ tmp::type, GeoMesh>> \ operator op \ ( \ @@ -549,7 +549,7 @@ operator op \ return tRes; \ } \ \ -template \ +template \ tmp::type, GeoMesh>> \ operator op \ ( \ @@ -590,7 +590,7 @@ operator op \ return tRes; \ } \ \ -template \ +template \ tmp::type, GeoMesh>> \ operator op \ ( \ @@ -628,7 +628,7 @@ operator op \ return tRes; \ } \ \ -template \ +template \ tmp::type, GeoMesh>> \ operator op \ ( \ diff --git a/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedFieldFunctions.H b/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedFieldFunctions.H index 6501bcf51f..f39dff925d 100644 --- a/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedFieldFunctions.H +++ b/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedFieldFunctions.H @@ -35,7 +35,7 @@ namespace Foam // * * * * * * * * * * * * * * * Global functions * * * * * * * * * * * * * // -template +template tmp::type, GeoMesh>> pow ( @@ -43,7 +43,7 @@ pow typename powProduct::type ); -template +template tmp::type, GeoMesh>> pow ( @@ -191,7 +191,7 @@ operator op \ const dimensioned
& dvs \ ); \ \ -template \ +template \ tmp::type, GeoMesh>> \ operator op \ ( \ @@ -207,7 +207,7 @@ operator op \ const dimensioned& dvs \ ); \ \ -template \ +template \ tmp::type, GeoMesh>> \ operator op \ ( \ @@ -223,7 +223,7 @@ operator op \ const DimensionedField& df1 \ ); \ \ -template \ +template \ tmp::type, GeoMesh>> \ operator op \ ( \ @@ -239,7 +239,7 @@ operator op \ const tmp>& tdf1 \ ); \ \ -template \ +template \ tmp::type, GeoMesh>> \ operator op \ ( \ diff --git a/src/OpenFOAM/fields/FieldFields/FieldField/FieldFieldFunctions.C b/src/OpenFOAM/fields/FieldFields/FieldField/FieldFieldFunctions.C index 14e1d79ff3..affb77661b 100644 --- a/src/OpenFOAM/fields/FieldFields/FieldField/FieldFieldFunctions.C +++ b/src/OpenFOAM/fields/FieldFields/FieldField/FieldFieldFunctions.C @@ -61,7 +61,7 @@ void T(FieldField& f1, const FieldField& f2) } -template class Field, class Type, int r> +template class Field, class Type, direction r> void pow ( FieldField::type>& f, @@ -74,7 +74,7 @@ void pow } } -template class Field, class Type, int r> +template class Field, class Type, direction r> tmp::type>> pow ( @@ -90,7 +90,7 @@ pow return tRes; } -template class Field, class Type, int r> +template class Field, class Type, direction r> tmp::type>> pow ( @@ -761,7 +761,13 @@ operator op \ } \ \ template \ - class Field, class Type, class Form, class Cmpt, int nCmpt> \ +< \ + template class Field, \ + class Type, \ + class Form, \ + class Cmpt, \ + direction nCmpt \ +> \ void opFunc \ ( \ FieldField::type>& f, \ @@ -776,7 +782,13 @@ void opFunc \ } \ \ template \ - class Field, class Type, class Form, class Cmpt, int nCmpt> \ +< \ + template class Field, \ + class Type, \ + class Form, \ + class Cmpt, \ + direction nCmpt \ +> \ tmp::type>> \ operator op \ ( \ @@ -794,7 +806,13 @@ operator op \ } \ \ template \ - class Field, class Type, class Form, class Cmpt, int nCmpt> \ +< \ + template class Field, \ + class Type, \ + class Form, \ + class Cmpt, \ + direction nCmpt \ +> \ tmp::type>> \ operator op \ ( \ @@ -813,7 +831,13 @@ operator op \ } \ \ template \ - class Field, class Form, class Cmpt, int nCmpt, class Type> \ +< \ + template class Field, \ + class Type, \ + class Form, \ + class Cmpt, \ + direction nCmpt \ +> \ void opFunc \ ( \ FieldField::type>& f, \ @@ -828,7 +852,13 @@ void opFunc \ } \ \ template \ - class Field, class Form, class Cmpt, int nCmpt, class Type> \ +< \ + template class Field, \ + class Type, \ + class Form, \ + class Cmpt, \ + direction nCmpt \ +> \ tmp::type>> \ operator op \ ( \ @@ -846,7 +876,13 @@ operator op \ } \ \ template \ - class Field, class Form, class Cmpt, int nCmpt, class Type> \ +< \ + template class Field, \ + class Type, \ + class Form, \ + class Cmpt, \ + direction nCmpt \ +> \ tmp::type>> \ operator op \ ( \ diff --git a/src/OpenFOAM/fields/FieldFields/FieldField/FieldFieldFunctions.H b/src/OpenFOAM/fields/FieldFields/FieldField/FieldFieldFunctions.H index 0800ab9869..7934f86092 100644 --- a/src/OpenFOAM/fields/FieldFields/FieldField/FieldFieldFunctions.H +++ b/src/OpenFOAM/fields/FieldFields/FieldField/FieldFieldFunctions.H @@ -47,14 +47,14 @@ template class Field, class Type> void T(FieldField& f1, const FieldField& f2); -template class Field, class Type, int r> +template class Field, class Type, direction r> void pow ( FieldField::type>& f, const FieldField& vf ); -template class Field, class Type, int r> +template class Field, class Type, direction r> tmp::type>> pow ( @@ -62,7 +62,7 @@ pow = pTraits::type>::zero ); -template class Field, class Type, int r> +template class Field, class Type, direction r> tmp::type>> pow ( @@ -346,7 +346,13 @@ operator op \ ); \ \ template \ - class Field, class Type, class Form, class Cmpt, int nCmpt> \ +< \ + template class Field, \ + class Type, \ + class Form, \ + class Cmpt, \ + direction nCmpt \ +> \ void opFunc \ ( \ FieldField::type>& f, \ @@ -355,7 +361,13 @@ void opFunc \ ); \ \ template \ - class Field, class Type, class Form, class Cmpt, int nCmpt> \ +< \ + template class Field, \ + class Type, \ + class Form, \ + class Cmpt, \ + direction nCmpt \ +> \ tmp::type>> \ operator op \ ( \ @@ -364,7 +376,13 @@ operator op \ ); \ \ template \ - class Field, class Type, class Form, class Cmpt, int nCmpt> \ +< \ + template class Field, \ + class Type, \ + class Form, \ + class Cmpt, \ + direction nCmpt \ +> \ tmp::type>> \ operator op \ ( \ @@ -373,7 +391,13 @@ operator op \ ); \ \ template \ - class Field, class Form, class Cmpt, int nCmpt, class Type> \ +< \ + template class Field, \ + class Type, \ + class Form, \ + class Cmpt, \ + direction nCmpt \ +> \ void opFunc \ ( \ FieldField::type>& f, \ @@ -382,7 +406,13 @@ void opFunc \ ); \ \ template \ - class Field, class Form, class Cmpt, int nCmpt, class Type> \ +< \ + template class Field, \ + class Type, \ + class Form, \ + class Cmpt, \ + direction nCmpt \ +> \ tmp::type>> \ operator op \ ( \ @@ -391,7 +421,13 @@ operator op \ ); \ \ template \ - class Field, class Form, class Cmpt, int nCmpt, class Type> \ +< \ + template class Field, \ + class Type, \ + class Form, \ + class Cmpt, \ + direction nCmpt \ +> \ tmp::type>> \ operator op \ ( \ diff --git a/src/OpenFOAM/fields/Fields/Field/Field.C b/src/OpenFOAM/fields/Fields/Field/Field.C index 4a7569bc01..0ca41e54a0 100644 --- a/src/OpenFOAM/fields/Fields/Field/Field.C +++ b/src/OpenFOAM/fields/Fields/Field/Field.C @@ -701,7 +701,7 @@ void Foam::Field::operator=(const Type& t) template -template +template void Foam::Field::operator=(const VectorSpace& vs) { TFOR_ALL_F_OP_S(Type, *this, =, VSType, vs) diff --git a/src/OpenFOAM/fields/Fields/Field/Field.H b/src/OpenFOAM/fields/Fields/Field/Field.H index a5d01b47f7..6f08f05926 100644 --- a/src/OpenFOAM/fields/Fields/Field/Field.H +++ b/src/OpenFOAM/fields/Fields/Field/Field.H @@ -345,7 +345,7 @@ public: void operator=(const tmp>&); void operator=(const Type&); - template + template void operator=(const VectorSpace&); void operator+=(const UList&); diff --git a/src/OpenFOAM/fields/Fields/Field/FieldFunctions.C b/src/OpenFOAM/fields/Fields/Field/FieldFunctions.C index d2b3e2d6b1..c75a045f5d 100644 --- a/src/OpenFOAM/fields/Fields/Field/FieldFunctions.C +++ b/src/OpenFOAM/fields/Fields/Field/FieldFunctions.C @@ -59,7 +59,7 @@ void T(Field& res, const UList& f) } -template +template void pow ( Field::type>& res, @@ -74,7 +74,7 @@ void pow ) } -template +template tmp::type>> pow ( @@ -91,7 +91,7 @@ pow return tRes; } -template +template tmp::type>> pow ( @@ -692,7 +692,7 @@ operator Op(const tmp>& tf1, const tmp>& tf2) \ return tRes; \ } \ \ -template \ +template \ void OpFunc \ ( \ Field::type>& res, \ @@ -705,7 +705,7 @@ void OpFunc \ (productType, res, =,Type, f1, Op, Form, static_cast(vs)) \ } \ \ -template \ +template \ tmp::type>> \ operator Op(const UList& f1, const VectorSpace& vs) \ { \ @@ -715,7 +715,7 @@ operator Op(const UList& f1, const VectorSpace& vs) \ return tRes; \ } \ \ -template \ +template \ tmp::type>> \ operator Op \ ( \ @@ -730,7 +730,7 @@ operator Op \ return tRes; \ } \ \ -template \ +template \ void OpFunc \ ( \ Field::type>& res, \ @@ -743,7 +743,7 @@ void OpFunc \ (productType, res, =,Form,static_cast(vs), Op, Type, f1) \ } \ \ -template \ +template \ tmp::type>> \ operator Op(const VectorSpace& vs, const UList& f1) \ { \ @@ -753,7 +753,7 @@ operator Op(const VectorSpace& vs, const UList& f1) \ return tRes; \ } \ \ -template \ +template \ tmp::type>> \ operator Op \ ( \ diff --git a/src/OpenFOAM/fields/Fields/Field/FieldFunctions.H b/src/OpenFOAM/fields/Fields/Field/FieldFunctions.H index 56c422a5fd..29f52c49e0 100644 --- a/src/OpenFOAM/fields/Fields/Field/FieldFunctions.H +++ b/src/OpenFOAM/fields/Fields/Field/FieldFunctions.H @@ -47,7 +47,7 @@ template void T(Field& res, const UList& f); -template +template void pow ( Field::type>& res, @@ -55,7 +55,7 @@ void pow ); -template +template tmp::type>> pow ( @@ -64,7 +64,7 @@ pow = pTraits::type>::zero ); -template +template tmp::type>> pow ( @@ -307,7 +307,7 @@ template \ tmp::type>> \ operator Op(const tmp>& tf1, const tmp>& tf2); \ \ -template \ +template \ void OpFunc \ ( \ Field::type>& res, \ @@ -315,15 +315,15 @@ void OpFunc \ const VectorSpace& vs \ ); \ \ -template \ +template \ tmp::type>> \ operator Op(const UList& f1, const VectorSpace& vs); \ \ -template \ +template \ tmp::type>> \ -operator Op(const tmp>&tf1,const VectorSpace&vs);\ +operator Op(const tmp>&tf1,const VectorSpace&vs); \ \ -template \ +template \ void OpFunc \ ( \ Field::type>& res, \ @@ -331,11 +331,11 @@ void OpFunc \ const UList& f1 \ ); \ \ -template \ +template \ tmp::type>> \ operator Op(const VectorSpace& vs, const UList& f1); \ \ -template \ +template \ tmp::type>> \ operator Op(const VectorSpace&vs,const tmp>&tf1); diff --git a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricFieldFunctions.C b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricFieldFunctions.C index cb723b0aed..e04a1588b5 100644 --- a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricFieldFunctions.C +++ b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricFieldFunctions.C @@ -66,7 +66,13 @@ void T } -template class PatchField, class GeoMesh, int r> +template +< + class Type, + template class PatchField, + class GeoMesh, + direction r +> void pow ( GeometricField::type, PatchField, GeoMesh>& gf, @@ -77,7 +83,13 @@ void pow pow(gf.boundaryField(), gf1.boundaryField(), r); } -template class PatchField, class GeoMesh, int r> +template +< + class Type, + template class PatchField, + class GeoMesh, + direction r +> tmp::type, PatchField, GeoMesh>> pow ( @@ -110,7 +122,13 @@ pow } -template class PatchField, class GeoMesh, int r> +template +< + class Type, + template class PatchField, + class GeoMesh, + direction r +> tmp::type, PatchField, GeoMesh>> pow ( @@ -768,7 +786,7 @@ template \ < \ class Form, \ class Cmpt, \ - int nCmpt, \ + direction nCmpt, \ class Type, template class PatchField, \ class GeoMesh \ > \ @@ -815,7 +833,7 @@ template \ < \ class Form, \ class Cmpt, \ - int nCmpt, \ + direction nCmpt, \ class Type, template class PatchField, \ class GeoMesh \ > \ @@ -880,7 +898,7 @@ template \ < \ class Form, \ class Cmpt, \ - int nCmpt, \ + direction nCmpt, \ class Type, template class PatchField, \ class GeoMesh \ > \ @@ -926,7 +944,7 @@ template \ < \ class Form, \ class Cmpt, \ - int nCmpt, \ + direction nCmpt, \ class Type, template class PatchField, \ class GeoMesh \ > \ diff --git a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricFieldFunctions.H b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricFieldFunctions.H index 51205ba292..a98f4a6083 100644 --- a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricFieldFunctions.H +++ b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricFieldFunctions.H @@ -56,14 +56,26 @@ void T const GeometricField& gf1 ); -template class PatchField, class GeoMesh, int r> +template +< + class Type, + template class PatchField, + class GeoMesh, + direction r +> void pow ( GeometricField::type, PatchField, GeoMesh>& gf, const GeometricField& gf1 ); -template class PatchField, class GeoMesh, int r> +template +< + class Type, + template class PatchField, + class GeoMesh, + direction r +> tmp < GeometricField @@ -75,7 +87,13 @@ pow typename powProduct::type ); -template class PatchField, class GeoMesh, int r> +template +< + class Type, + template class PatchField, + class GeoMesh, + direction r +> tmp < GeometricField @@ -353,7 +371,7 @@ template \ < \ class Form, \ class Cmpt, \ - int nCmpt, \ + direction nCmpt, \ class Type, template class PatchField, \ class GeoMesh \ > \ @@ -385,7 +403,7 @@ template \ < \ class Form, \ class Cmpt, \ - int nCmpt, \ + direction nCmpt, \ class Type, template class PatchField, \ class GeoMesh \ > \ @@ -427,7 +445,7 @@ template \ < \ class Form, \ class Cmpt, \ - int nCmpt, \ + direction nCmpt, \ class Type, template class PatchField, \ class GeoMesh \ > \ @@ -459,7 +477,7 @@ template \ < \ class Form, \ class Cmpt, \ - int nCmpt, \ + direction nCmpt, \ class Type, template class PatchField, \ class GeoMesh \ > \ diff --git a/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchFieldFunctions.H b/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchFieldFunctions.H index 02ed0d8736..f521635546 100644 --- a/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchFieldFunctions.H +++ b/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchFieldFunctions.H @@ -47,7 +47,7 @@ inline void T {} -template +template inline void pow ( Field::type>& f, @@ -206,7 +206,7 @@ template \ class Type, \ class Form, \ class Cmpt, \ - int nCmpt \ + direction nCmpt \ > \ inline void opFunc \ ( \ @@ -221,7 +221,7 @@ template \ < \ class Form, \ class Cmpt, \ - int nCmpt, \ + direction nCmpt, \ class Type \ > \ inline void opFunc \ diff --git a/src/OpenFOAM/primitives/DiagTensor/DiagTensor.H b/src/OpenFOAM/primitives/DiagTensor/DiagTensor.H index 0a2138cea4..cd61a57988 100644 --- a/src/OpenFOAM/primitives/DiagTensor/DiagTensor.H +++ b/src/OpenFOAM/primitives/DiagTensor/DiagTensor.H @@ -64,10 +64,8 @@ public: // Member constants - enum - { - rank = 2 // Rank of DiagTensor is 2 - }; + //- Rank of DiagTensor is 2 + static const direction rank = 2; //- Component labeling enumeration diff --git a/src/OpenFOAM/primitives/Scalar/Scalar.H b/src/OpenFOAM/primitives/Scalar/Scalar.H index 54b8ec5785..502a57c3b2 100644 --- a/src/OpenFOAM/primitives/Scalar/Scalar.H +++ b/src/OpenFOAM/primitives/Scalar/Scalar.H @@ -53,14 +53,18 @@ public: //- Equivalent type of labels used for valid component indexing typedef label labelType; + // Member constants - enum - { - dim = 3, //!< Dimensionality of space - rank = 0, //!< Rank of Scalar is 0 - nComponents = 1 //!< Number of components in Scalar is 1 - }; + //- Dimensionality of space + static const direction dim = 3; + + //- Rank of Scalar is 0 + static const direction rank = 0; + + //- Number of components in Scalar is 1 + static const direction nComponents = 1; + // Static data members @@ -73,6 +77,7 @@ public: static const Scalar rootMax; static const Scalar rootMin; + // Constructors //- Construct from primitive diff --git a/src/OpenFOAM/primitives/SphericalTensor/SphericalTensor.H b/src/OpenFOAM/primitives/SphericalTensor/SphericalTensor.H index cd16d3026e..2fa7b9b4ed 100644 --- a/src/OpenFOAM/primitives/SphericalTensor/SphericalTensor.H +++ b/src/OpenFOAM/primitives/SphericalTensor/SphericalTensor.H @@ -62,10 +62,8 @@ public: // Member constants - enum - { - rank = 2 // Rank of SphericalTensor is 2 - }; + //- Rank of SphericalTensor is 2 + static const direction rank = 2; // Static data members diff --git a/src/OpenFOAM/primitives/SphericalTensor2D/SphericalTensor2D.H b/src/OpenFOAM/primitives/SphericalTensor2D/SphericalTensor2D.H index 474777c1c3..ecebdf2625 100644 --- a/src/OpenFOAM/primitives/SphericalTensor2D/SphericalTensor2D.H +++ b/src/OpenFOAM/primitives/SphericalTensor2D/SphericalTensor2D.H @@ -58,10 +58,8 @@ public: // Member constants - enum - { - rank = 2 // Rank of SphericalTensor2D is 2 - }; + //- Rank of SphericalTensor2D is 2 + static const direction rank = 2; // Static data members diff --git a/src/OpenFOAM/primitives/SymmTensor/SymmTensor.H b/src/OpenFOAM/primitives/SymmTensor/SymmTensor.H index 952536ac8c..58eca1da22 100644 --- a/src/OpenFOAM/primitives/SymmTensor/SymmTensor.H +++ b/src/OpenFOAM/primitives/SymmTensor/SymmTensor.H @@ -64,10 +64,8 @@ public: // Member constants - enum - { - rank = 2 // Rank of SymmTensor is 2 - }; + //- Rank of SymmTensor is 2 + static const direction rank = 2; // Static data members diff --git a/src/OpenFOAM/primitives/SymmTensor2D/SymmTensor2D.H b/src/OpenFOAM/primitives/SymmTensor2D/SymmTensor2D.H index 1d747caa2d..55a455ddc3 100644 --- a/src/OpenFOAM/primitives/SymmTensor2D/SymmTensor2D.H +++ b/src/OpenFOAM/primitives/SymmTensor2D/SymmTensor2D.H @@ -64,10 +64,8 @@ public: // Member constants - enum - { - rank = 2 // Rank of SymmTensor2D is 2 - }; + //- Rank of SymmTensor2D is 2 + static const direction rank = 2; // Static data members diff --git a/src/OpenFOAM/primitives/Tensor/Tensor.H b/src/OpenFOAM/primitives/Tensor/Tensor.H index 9cd83fd09b..cf92644c16 100644 --- a/src/OpenFOAM/primitives/Tensor/Tensor.H +++ b/src/OpenFOAM/primitives/Tensor/Tensor.H @@ -67,10 +67,8 @@ public: // Member constants - enum - { - rank = 2 // Rank of Tensor is 2 - }; + //- Rank of Tensor is 2 + static const direction rank = 2; // Static data members diff --git a/src/OpenFOAM/primitives/Tensor2D/Tensor2D.H b/src/OpenFOAM/primitives/Tensor2D/Tensor2D.H index bc1f3906e5..098f52ef9d 100644 --- a/src/OpenFOAM/primitives/Tensor2D/Tensor2D.H +++ b/src/OpenFOAM/primitives/Tensor2D/Tensor2D.H @@ -67,10 +67,8 @@ public: // Member constants - enum - { - rank = 2 // Rank of Tensor2D is 2 - }; + //- Rank of Tensor2D is 2 + static const direction rank = 2; // Static data members diff --git a/src/OpenFOAM/primitives/Vector/Vector.H b/src/OpenFOAM/primitives/Vector/Vector.H index e4ba4c1fed..d80e5790fc 100644 --- a/src/OpenFOAM/primitives/Vector/Vector.H +++ b/src/OpenFOAM/primitives/Vector/Vector.H @@ -68,10 +68,8 @@ public: // Member constants - enum - { - rank = 1 // Rank of Vector is 1 - }; + //- Rank of Vector is 1 + static const direction rank = 1; //- Component labeling enumeration diff --git a/src/OpenFOAM/primitives/Vector2D/Vector2D.H b/src/OpenFOAM/primitives/Vector2D/Vector2D.H index ca77ed8ce1..d1c7852b8f 100644 --- a/src/OpenFOAM/primitives/Vector2D/Vector2D.H +++ b/src/OpenFOAM/primitives/Vector2D/Vector2D.H @@ -62,10 +62,8 @@ public: // Member constants - enum - { - rank = 1 // Rank of Vector2D is 1 - }; + //- Rank of Vector2D is 1 + static const direction rank = 1; //- Component labeling enumeration diff --git a/src/OpenFOAM/primitives/VectorSpace/VectorSpace.C b/src/OpenFOAM/primitives/VectorSpace/VectorSpace.C index 49c855fcde..d634b78ade 100644 --- a/src/OpenFOAM/primitives/VectorSpace/VectorSpace.C +++ b/src/OpenFOAM/primitives/VectorSpace/VectorSpace.C @@ -30,7 +30,7 @@ License // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -template +template Foam::VectorSpace::VectorSpace ( Istream& is @@ -39,7 +39,7 @@ Foam::VectorSpace::VectorSpace // Read beginning of VectorSpace is.readBegin("VectorSpace"); - for (int i=0; i> v_[i]; } @@ -52,9 +52,8 @@ Foam::VectorSpace::VectorSpace } -template -Foam::word -Foam::name +template +Foam::word Foam::name ( const VectorSpace& vs ) @@ -63,7 +62,7 @@ Foam::name buf << '('; - for (int i=0; i +template Foam::Istream& Foam::operator>> ( Istream& is, @@ -86,7 +85,7 @@ Foam::Istream& Foam::operator>> // Read beginning of VectorSpace is.readBegin("VectorSpace"); - for (int i=0; i> vs.v_[i]; } @@ -101,21 +100,21 @@ Foam::Istream& Foam::operator>> } -template +template Foam::Ostream& Foam::operator<< ( Ostream& os, const VectorSpace& vs ) { - os << token::BEGIN_LIST; + os << token::BEGIN_LIST << vs.v_[0]; - for (int i=0; i&)"); diff --git a/src/OpenFOAM/primitives/VectorSpace/VectorSpace.H b/src/OpenFOAM/primitives/VectorSpace/VectorSpace.H index 2d650f43ae..e8c4cbf16a 100644 --- a/src/OpenFOAM/primitives/VectorSpace/VectorSpace.H +++ b/src/OpenFOAM/primitives/VectorSpace/VectorSpace.H @@ -51,16 +51,16 @@ namespace Foam // Forward declaration of friend functions and operators -template class VectorSpace; +template class VectorSpace; -template +template Istream& operator>> ( Istream&, VectorSpace& ); -template +template Ostream& operator<< ( Ostream&, @@ -72,7 +72,7 @@ Ostream& operator<< Class VectorSpace Declaration \*---------------------------------------------------------------------------*/ -template +template class VectorSpace { @@ -115,6 +115,9 @@ public: //- Construct null inline VectorSpace(); + //- Construct initialized to zero + inline VectorSpace(const Foam::zero); + //- Construct from Istream VectorSpace(Istream&); @@ -174,7 +177,7 @@ public: // * * * * * * * * * * * * * * Global functions * * * * * * * * * * * * * * // //- Return a string representation of a VectorSpace -template +template word name(const VectorSpace&); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/primitives/VectorSpace/VectorSpaceI.H b/src/OpenFOAM/primitives/VectorSpace/VectorSpaceI.H index e1c88e61d8..1b9c62798a 100644 --- a/src/OpenFOAM/primitives/VectorSpace/VectorSpaceI.H +++ b/src/OpenFOAM/primitives/VectorSpace/VectorSpaceI.H @@ -35,12 +35,19 @@ namespace Foam // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -template +template inline VectorSpace::VectorSpace() {} -template +template +inline VectorSpace::VectorSpace(const Foam::zero z) +{ + VectorSpaceOps::eqOpS(*this, 0, eqOp()); +} + + +template inline VectorSpace::VectorSpace ( const VectorSpace& vs @@ -50,7 +57,7 @@ inline VectorSpace::VectorSpace } -template +template template inline VectorSpace::VectorSpace ( @@ -63,14 +70,14 @@ inline VectorSpace::VectorSpace // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -template +template inline label VectorSpace::size() const { return nCmpt; } -template +template inline const Cmpt& VectorSpace::component ( const direction d @@ -89,7 +96,7 @@ inline const Cmpt& VectorSpace::component } -template +template inline Cmpt& VectorSpace::component ( const direction d @@ -108,7 +115,7 @@ inline Cmpt& VectorSpace::component } -template +template inline void VectorSpace::component ( Cmpt& c, @@ -128,7 +135,7 @@ inline void VectorSpace::component } -template +template inline void VectorSpace::replace ( const direction d, @@ -148,7 +155,7 @@ inline void VectorSpace::replace } -template +template inline Form VectorSpace::uniform(const Cmpt& s) { Form v; @@ -159,7 +166,7 @@ inline Form VectorSpace::uniform(const Cmpt& s) // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // -template +template inline const Cmpt& VectorSpace::operator[] ( const direction d @@ -178,7 +185,7 @@ inline const Cmpt& VectorSpace::operator[] } -template +template inline Cmpt& VectorSpace::operator[] ( const direction d @@ -197,7 +204,7 @@ inline Cmpt& VectorSpace::operator[] } -template +template inline void VectorSpace::operator= ( const VectorSpace& vs @@ -207,7 +214,7 @@ inline void VectorSpace::operator= } -template +template inline void VectorSpace::operator+= ( const VectorSpace& vs @@ -217,7 +224,7 @@ inline void VectorSpace::operator+= } -template +template inline void VectorSpace::operator-= ( const VectorSpace& vs @@ -227,14 +234,14 @@ inline void VectorSpace::operator-= } -template +template inline void VectorSpace::operator=(const Foam::zero) { VectorSpaceOps::eqOpS(*this, 0, eqOp()); } -template +template inline void VectorSpace::operator*= ( const scalar s @@ -244,7 +251,7 @@ inline void VectorSpace::operator*= } -template +template inline void VectorSpace::operator/= ( const scalar s @@ -256,7 +263,7 @@ inline void VectorSpace::operator/= // * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * // -template +template inline Cmpt& setComponent ( VectorSpace& vs, @@ -267,7 +274,7 @@ inline Cmpt& setComponent } -template +template inline const Cmpt& component ( const VectorSpace& vs, @@ -281,7 +288,7 @@ inline const Cmpt& component // Powers of a Form // Equivalent to outer-products between the Form and itself // Form^0 = 1.0 -template +template inline typename powProduct::type pow ( const VectorSpace&, @@ -293,7 +300,7 @@ inline typename powProduct::type pow } // Form^1 = Form -template +template inline typename powProduct::type pow ( const VectorSpace& v, @@ -306,7 +313,7 @@ inline typename powProduct::type pow // Form^2 = sqr(Form) -template +template inline typename powProduct::type pow ( const VectorSpace& v, @@ -318,7 +325,7 @@ inline typename powProduct::type pow } -template +template inline scalar magSqr ( const VectorSpace& vs @@ -330,7 +337,7 @@ inline scalar magSqr } -template +template inline scalar mag ( const VectorSpace& vs @@ -340,7 +347,7 @@ inline scalar mag } -template +template inline VectorSpace cmptMultiply ( const VectorSpace& vs1, @@ -353,7 +360,7 @@ inline VectorSpace cmptMultiply } -template +template inline VectorSpace cmptPow ( const VectorSpace& vs1, @@ -366,7 +373,7 @@ inline VectorSpace cmptPow } -template +template inline VectorSpace cmptDivide ( const VectorSpace& vs1, @@ -379,7 +386,7 @@ inline VectorSpace cmptDivide } -template +template inline VectorSpace stabilise ( const VectorSpace& vs, @@ -392,7 +399,7 @@ inline VectorSpace stabilise } -template +template inline Cmpt cmptMax ( const VectorSpace& vs @@ -404,7 +411,7 @@ inline Cmpt cmptMax } -template +template inline Cmpt cmptMin ( const VectorSpace& vs @@ -416,7 +423,7 @@ inline Cmpt cmptMin } -template +template inline Cmpt cmptSum ( const VectorSpace& vs @@ -428,7 +435,7 @@ inline Cmpt cmptSum } -template +template inline Cmpt cmptAv ( const VectorSpace& vs @@ -437,7 +444,7 @@ inline Cmpt cmptAv return cmptSum(vs)/nCmpt; } -template +template inline Cmpt cmptProduct ( const VectorSpace& vs @@ -449,7 +456,7 @@ inline Cmpt cmptProduct } -template +template inline Form cmptMag ( const VectorSpace& vs @@ -461,7 +468,7 @@ inline Form cmptMag } -template +template inline Form max ( const VectorSpace& vs1, @@ -474,7 +481,7 @@ inline Form max } -template +template inline Form min ( const VectorSpace& vs1, @@ -487,7 +494,7 @@ inline Form min } -template +template inline Form minMod ( const VectorSpace& vs1, @@ -516,8 +523,8 @@ inline Type dot(const Type& t, const scalar s) template < - class Form1, class Cmpt1, int nCmpt1, - class Form2, class Cmpt2, int nCmpt2 + class Form1, class Cmpt1, direction nCmpt1, + class Form2, class Cmpt2, direction nCmpt2 > inline typename innerProduct::type dot ( @@ -531,7 +538,7 @@ inline typename innerProduct::type dot // * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * // -template +template inline Form operator- ( const VectorSpace& vs @@ -543,7 +550,7 @@ inline Form operator- } -template +template inline Form operator+ ( const VectorSpace& vs1, @@ -555,7 +562,7 @@ inline Form operator+ return v; } -template +template inline Form operator- ( const VectorSpace& vs1, @@ -568,7 +575,7 @@ inline Form operator- } -template +template inline Form operator* ( scalar s, @@ -581,7 +588,7 @@ inline Form operator* } -template +template inline Form operator* ( const VectorSpace& vs, @@ -594,7 +601,7 @@ inline Form operator* } -template +template inline Form operator/ ( const VectorSpace& vs, @@ -607,7 +614,7 @@ inline Form operator/ } /* -template +template inline Form operator/ ( const VectorSpace& vs1, @@ -620,7 +627,7 @@ inline Form operator/ } -template +template inline Form operator/ ( scalar s, @@ -634,7 +641,7 @@ inline Form operator/ */ -template +template inline Cmpt operator&& ( const VectorSpace& vs1, @@ -642,7 +649,7 @@ inline Cmpt operator&& ) { Cmpt ddProd = vs1.v_[0]*vs2.v_[0]; - for (int i=1; i +template inline bool operator== ( const VectorSpace& vs1, @@ -658,7 +665,7 @@ inline bool operator== ) { bool eq = true; - for (int i=0; i +template inline bool operator!= ( const VectorSpace& vs1, @@ -677,7 +684,7 @@ inline bool operator!= } -template +template inline bool operator> ( const VectorSpace& vs1, @@ -685,7 +692,7 @@ inline bool operator> ) { bool gt = true; - for (int i=0; i vs2.v_[i])) break; } @@ -693,7 +700,7 @@ inline bool operator> } -template +template inline bool operator< ( const VectorSpace& vs1, @@ -701,7 +708,7 @@ inline bool operator< ) { bool lt = true; - for (int i=0; i +template inline bool operator>= ( const VectorSpace& vs1, @@ -720,7 +727,7 @@ inline bool operator>= } -template +template inline bool operator<= ( const VectorSpace& vs1, diff --git a/src/OpenFOAM/primitives/VectorSpace/VectorSpaceOps.H b/src/OpenFOAM/primitives/VectorSpace/VectorSpaceOps.H index 7f6d3e1199..5df70b1e5b 100644 --- a/src/OpenFOAM/primitives/VectorSpace/VectorSpaceOps.H +++ b/src/OpenFOAM/primitives/VectorSpace/VectorSpaceOps.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -39,7 +39,7 @@ namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -template +template class VectorSpaceOps { public: diff --git a/src/OpenFOAM/primitives/VectorSpace/products.H b/src/OpenFOAM/primitives/VectorSpace/products.H index 4d657874aa..4214f32f0f 100644 --- a/src/OpenFOAM/primitives/VectorSpace/products.H +++ b/src/OpenFOAM/primitives/VectorSpace/products.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -41,12 +41,12 @@ namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -template +template class typeOfRank {}; -template +template class symmTypeOfRank {}; @@ -68,7 +68,7 @@ public: typedef typename typeOfRank < typename pTraits::cmptType, - int(pTraits::rank) + int(pTraits::rank) + direction(pTraits::rank) + direction(pTraits::rank) >::type type; }; @@ -81,7 +81,7 @@ public: typedef typename typeOfRank < typename pTraits::cmptType, - int(pTraits::rank) + int(pTraits::rank) - 1 + direction(pTraits::rank) + direction(pTraits::rank) - 1 >::type type; }; @@ -93,7 +93,7 @@ public: typedef typename typeOfRank < typename pTraits::cmptType, - int(pTraits::rank) + int(pTraits::rank) - 2 + direction(pTraits::rank) + direction(pTraits::rank) - 2 >::type type; }; @@ -106,7 +106,7 @@ public: }; -template +template class powProduct { public: @@ -114,7 +114,7 @@ public: typedef typename symmTypeOfRank < typename pTraits::cmptType, - arg2*int(pTraits::rank) + arg2*direction(pTraits::rank) >::type type; }; diff --git a/src/OpenFOAM/primitives/bools/bool/bool.H b/src/OpenFOAM/primitives/bools/bool/bool.H index b1638ec054..19d8fb63de 100644 --- a/src/OpenFOAM/primitives/bools/bool/bool.H +++ b/src/OpenFOAM/primitives/bools/bool/bool.H @@ -56,6 +56,7 @@ bool readBool(Istream&); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #include "pTraits.H" +#include "direction.H" namespace Foam { @@ -73,12 +74,14 @@ public: // Member constants - enum - { - dim = 3, //!< Dimensionality of space - rank = 0, //!< Rank of bool is 0 - nComponents = 1 //!< Number of components in bool is 1 - }; + //- Dimensionality of space + static const direction dim = 3; + + //- Rank of bool is 0 + static const direction rank = 0; + + //- Number of components in bool is 1 + static const direction nComponents = 1; // Static data members diff --git a/src/OpenFOAM/primitives/ints/int32/int32.H b/src/OpenFOAM/primitives/ints/int32/int32.H index 0602a8e345..d2601ad67c 100644 --- a/src/OpenFOAM/primitives/ints/int32/int32.H +++ b/src/OpenFOAM/primitives/ints/int32/int32.H @@ -89,14 +89,17 @@ public: //- Component type typedef int32_t cmptType; + // Member constants - enum - { - dim = 3, //!< Dimensionality of space - rank = 0, //!< Rank of int32_t is 0 - nComponents = 1 //!< Number of components in int32_t is 1 - }; + //- Dimensionality of space + static const direction dim = 3; + + //- Rank of int32_t is 0 + static const direction rank = 0; + + //- Number of components in int32_t is 1 + static const direction nComponents = 1; // Static data members diff --git a/src/OpenFOAM/primitives/ints/int64/int64.H b/src/OpenFOAM/primitives/ints/int64/int64.H index 6006321a28..2bb5a05804 100644 --- a/src/OpenFOAM/primitives/ints/int64/int64.H +++ b/src/OpenFOAM/primitives/ints/int64/int64.H @@ -80,14 +80,17 @@ public: //- Component type typedef int64_t cmptType; + // Member constants - enum - { - dim = 3, //!< Dimensionality of space - rank = 0, //!< Rank of int64_t is 0 - nComponents = 1 //!< Number of components in int64_t is 1 - }; + //- Dimensionality of space + static const direction dim = 3; + + //- Rank of int64_t is 0 + static const direction rank = 0; + + //- Number of components in int64_t is 1 + static const direction nComponents = 1; // Static data members diff --git a/src/OpenFOAM/primitives/ints/uint32/uint32.H b/src/OpenFOAM/primitives/ints/uint32/uint32.H index 9c2a3b6833..83c3b18c67 100644 --- a/src/OpenFOAM/primitives/ints/uint32/uint32.H +++ b/src/OpenFOAM/primitives/ints/uint32/uint32.H @@ -80,14 +80,17 @@ public: //- Component type typedef uint32_t cmptType; + // Member constants - enum - { - dim = 3, //!< Dimensionality of space - rank = 0, //!< Rank of uint32_t is 0 - nComponents = 1 //!< Number of components in uint32_t is 1 - }; + //- Dimensionality of space + static const direction dim = 3; + + //- Rank of uint32_t is 0 + static const direction rank = 0; + + //- Number of components in uint32_t is 1 + static const direction nComponents = 1; // Static data members diff --git a/src/OpenFOAM/primitives/ints/uint64/uint64.H b/src/OpenFOAM/primitives/ints/uint64/uint64.H index 2d2e31f802..e1a742b6c2 100644 --- a/src/OpenFOAM/primitives/ints/uint64/uint64.H +++ b/src/OpenFOAM/primitives/ints/uint64/uint64.H @@ -80,14 +80,17 @@ public: //- Component type typedef uint64_t cmptType; + // Member constants - enum - { - dim = 3, //!< Dimensionality of space - rank = 0, //!< Rank of uint64_t is 0 - nComponents = 1 //!< Number of components in uint64_t is 1 - }; + //- Dimensionality of space + static const direction dim = 3; + + //- Rank of uint64_t is 0 + static const direction rank = 0; + + //- Number of components in uint64_t is 1 + static const direction nComponents = 1; // Static data members diff --git a/src/OpenFOAM/primitives/quaternion/quaternion.H b/src/OpenFOAM/primitives/quaternion/quaternion.H index 4a4b9f080f..1e67c9bbcf 100644 --- a/src/OpenFOAM/primitives/quaternion/quaternion.H +++ b/src/OpenFOAM/primitives/quaternion/quaternion.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -78,12 +78,11 @@ public: //- Component type typedef scalar cmptType; + // Member constants - enum - { - rank = 1 // Rank of quaternion is 1 - }; + //- Rank of quaternion is 1 + static const direction rank = 1; // Static data members