diff --git a/src/OpenFOAM/primitives/DiagTensor/DiagTensor.H b/src/OpenFOAM/primitives/DiagTensor/DiagTensor.H index 2d64825ed773b75333672f07f0f1e34251f677f7..0a2138cea44f88d0efb5fce81352f69e83265bf6 100644 --- a/src/OpenFOAM/primitives/DiagTensor/DiagTensor.H +++ b/src/OpenFOAM/primitives/DiagTensor/DiagTensor.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 @@ -58,6 +58,10 @@ class DiagTensor public: + //- Equivalent type of labels used for valid component indexing + typedef DiagTensor<label> labelType; + + // Member constants enum @@ -66,16 +70,6 @@ public: }; - // Static data members - - static const char* const typeName; - static const char* componentNames[]; - static const DiagTensor zero; - static const DiagTensor one; - static const DiagTensor max; - static const DiagTensor min; - - //- Component labeling enumeration enum components { XX, YY, ZZ }; diff --git a/src/OpenFOAM/primitives/DiagTensor/DiagTensorI.H b/src/OpenFOAM/primitives/DiagTensor/DiagTensorI.H index 63497e7a2463e8e51125504c24eb10f1d8afb58d..49ed7b8998e7314a57210c3847bc5f76d6dd0e52 100644 --- a/src/OpenFOAM/primitives/DiagTensor/DiagTensorI.H +++ b/src/OpenFOAM/primitives/DiagTensor/DiagTensorI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -26,21 +26,16 @@ License #include "SphericalTensor.H" #include "SymmTensor.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template<class Cmpt> -inline DiagTensor<Cmpt>::DiagTensor() +inline Foam::DiagTensor<Cmpt>::DiagTensor() {} template<class Cmpt> template<class Cmpt2> -inline DiagTensor<Cmpt>::DiagTensor +inline Foam::DiagTensor<Cmpt>::DiagTensor ( const VectorSpace<DiagTensor<Cmpt2>, Cmpt2, 3>& vs ) @@ -50,7 +45,7 @@ inline DiagTensor<Cmpt>::DiagTensor template<class Cmpt> -inline DiagTensor<Cmpt>::DiagTensor +inline Foam::DiagTensor<Cmpt>::DiagTensor ( const Cmpt& vxx, const Cmpt& vyy, @@ -64,7 +59,7 @@ inline DiagTensor<Cmpt>::DiagTensor template<class Cmpt> -inline DiagTensor<Cmpt>::DiagTensor(Istream& is) +inline Foam::DiagTensor<Cmpt>::DiagTensor(Istream& is) : VectorSpace<DiagTensor<Cmpt>, Cmpt, 3>(is) {} @@ -73,43 +68,48 @@ inline DiagTensor<Cmpt>::DiagTensor(Istream& is) // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class Cmpt> -inline const Cmpt& DiagTensor<Cmpt>::xx() const +inline const Cmpt& Foam::DiagTensor<Cmpt>::xx() const { return this->v_[XX]; } template<class Cmpt> -inline const Cmpt& DiagTensor<Cmpt>::yy() const +inline const Cmpt& Foam::DiagTensor<Cmpt>::yy() const { return this->v_[YY]; } template<class Cmpt> -inline const Cmpt& DiagTensor<Cmpt>::zz() const +inline const Cmpt& Foam::DiagTensor<Cmpt>::zz() const { return this->v_[ZZ]; } template<class Cmpt> -inline Cmpt& DiagTensor<Cmpt>::xx() +inline Cmpt& Foam::DiagTensor<Cmpt>::xx() { return this->v_[XX]; } template<class Cmpt> -inline Cmpt& DiagTensor<Cmpt>::yy() +inline Cmpt& Foam::DiagTensor<Cmpt>::yy() { return this->v_[YY]; } template<class Cmpt> -inline Cmpt& DiagTensor<Cmpt>::zz() +inline Cmpt& Foam::DiagTensor<Cmpt>::zz() { return this->v_[ZZ]; } +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + // * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * // template<class Cmpt> diff --git a/src/OpenFOAM/primitives/DiagTensor/diagTensor/diagTensor.C b/src/OpenFOAM/primitives/DiagTensor/diagTensor/diagTensor.C index f5fe69dedc3115b402e07dfa4a91f62550e15da3..bcc9c1af3df8c690e75a8fd9241e39c23a9ce821 100644 --- a/src/OpenFOAM/primitives/DiagTensor/diagTensor/diagTensor.C +++ b/src/OpenFOAM/primitives/DiagTensor/diagTensor/diagTensor.C @@ -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 @@ -28,34 +28,52 @@ Description #include "diagTensor.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // template<> -const char* const diagTensor::typeName = "diagTensor"; +const char* const Foam::diagTensor::vsType::typeName = "diagTensor"; template<> -const char* diagTensor::componentNames[] = {"xx", "yy", "zz"}; +const char* const Foam::diagTensor::vsType::componentNames[] = +{ + "xx", "yy", "zz" +}; template<> -const diagTensor diagTensor::zero(0, 0, 0); +const Foam::diagTensor Foam::diagTensor::vsType::vsType::zero +( + diagTensor::uniform(0) +); template<> -const diagTensor diagTensor::one(1, 1, 1); +const Foam::diagTensor Foam::diagTensor::vsType::one +( + diagTensor::uniform(1) +); template<> -const diagTensor diagTensor::max(VGREAT, VGREAT, VGREAT); +const Foam::diagTensor Foam::diagTensor::vsType::max +( + diagTensor::uniform(VGREAT) +); template<> -const diagTensor diagTensor::min(-VGREAT, -VGREAT, -VGREAT); +const Foam::diagTensor Foam::diagTensor::vsType::min +( + diagTensor::uniform(-VGREAT) +); +template<> +const Foam::diagTensor Foam::diagTensor::vsType::rootMax +( + diagTensor::uniform(ROOTVGREAT) +); -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +template<> +const Foam::diagTensor Foam::diagTensor::vsType::rootMin +( + diagTensor::uniform(-ROOTVGREAT) +); -} // End namespace Foam // ************************************************************************* // diff --git a/src/OpenFOAM/primitives/Scalar/Scalar.C b/src/OpenFOAM/primitives/Scalar/Scalar.C index 05db9a2d80da376fbbe5f95e1f744ebf49023ba5..0a3e09b0b18cb83fcd3e6546bdeab23d888249e1 100644 --- a/src/OpenFOAM/primitives/Scalar/Scalar.C +++ b/src/OpenFOAM/primitives/Scalar/Scalar.C @@ -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 @@ -38,7 +38,7 @@ const Scalar pTraits<Scalar>::max = ScalarVGREAT; const Scalar pTraits<Scalar>::rootMin = -ScalarROOTVGREAT; const Scalar pTraits<Scalar>::rootMax = ScalarROOTVGREAT; -const char* pTraits<Scalar>::componentNames[] = { "" }; +const char* const pTraits<Scalar>::componentNames[] = { "" }; pTraits<Scalar>::pTraits(const Scalar& p) : diff --git a/src/OpenFOAM/primitives/Scalar/Scalar.H b/src/OpenFOAM/primitives/Scalar/Scalar.H index c25a92b2097ee2b5cc7234c092961c9dda6c7d2b..54b8ec5785038829ea6af2d66d3dfb7c8a2bf221 100644 --- a/src/OpenFOAM/primitives/Scalar/Scalar.H +++ b/src/OpenFOAM/primitives/Scalar/Scalar.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 @@ -65,7 +65,7 @@ public: // Static data members static const char* const typeName; - static const char* componentNames[]; + static const char* const componentNames[]; static const Scalar zero; static const Scalar one; static const Scalar max; diff --git a/src/OpenFOAM/primitives/SphericalTensor/SphericalTensor.H b/src/OpenFOAM/primitives/SphericalTensor/SphericalTensor.H index a2bb56e3f4c96a0398b6ab2ac724fae9af36ff96..cd16d3026ebfd808031f4d0b07bf443184f3955c 100644 --- a/src/OpenFOAM/primitives/SphericalTensor/SphericalTensor.H +++ b/src/OpenFOAM/primitives/SphericalTensor/SphericalTensor.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 @@ -70,12 +70,6 @@ public: // Static data members - static const char* const typeName; - static const char* componentNames[]; - static const SphericalTensor zero; - static const SphericalTensor one; - static const SphericalTensor max; - static const SphericalTensor min; static const SphericalTensor I; static const SphericalTensor oneThirdI; static const SphericalTensor twoThirdsI; diff --git a/src/OpenFOAM/primitives/SphericalTensor/SphericalTensorI.H b/src/OpenFOAM/primitives/SphericalTensor/SphericalTensorI.H index c22f547895015e0c1711d8c90d84b95ac1d921a8..409b3961b29138966d034cd831263af45b46bf9a 100644 --- a/src/OpenFOAM/primitives/SphericalTensor/SphericalTensorI.H +++ b/src/OpenFOAM/primitives/SphericalTensor/SphericalTensorI.H @@ -25,21 +25,16 @@ License #include "Vector.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template<class Cmpt> -inline SphericalTensor<Cmpt>::SphericalTensor() +inline Foam::SphericalTensor<Cmpt>::SphericalTensor() {} template<class Cmpt> template<class Cmpt2> -inline SphericalTensor<Cmpt>::SphericalTensor +inline Foam::SphericalTensor<Cmpt>::SphericalTensor ( const VectorSpace<SphericalTensor<Cmpt2>, Cmpt2, 1>& vs ) @@ -49,14 +44,14 @@ inline SphericalTensor<Cmpt>::SphericalTensor template<class Cmpt> -inline SphericalTensor<Cmpt>::SphericalTensor(const Cmpt& stii) +inline Foam::SphericalTensor<Cmpt>::SphericalTensor(const Cmpt& stii) { this->v_[II] = stii; } template<class Cmpt> -inline SphericalTensor<Cmpt>::SphericalTensor(Istream& is) +inline Foam::SphericalTensor<Cmpt>::SphericalTensor(Istream& is) : VectorSpace<SphericalTensor<Cmpt>, Cmpt, 1>(is) {} @@ -65,26 +60,32 @@ inline SphericalTensor<Cmpt>::SphericalTensor(Istream& is) // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class Cmpt> -inline const Cmpt& SphericalTensor<Cmpt>::ii() const +inline const Cmpt& Foam::SphericalTensor<Cmpt>::ii() const { return this->v_[II]; } template<class Cmpt> -inline Cmpt& SphericalTensor<Cmpt>::ii() +inline Cmpt& Foam::SphericalTensor<Cmpt>::ii() { return this->v_[II]; } template<class Cmpt> -inline const SphericalTensor<Cmpt>& SphericalTensor<Cmpt>::T() const +inline const Foam::SphericalTensor<Cmpt>& +Foam::SphericalTensor<Cmpt>::T() const { return *this; } +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + // * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * // //- Inner-product between two spherical tensors diff --git a/src/OpenFOAM/primitives/SphericalTensor/labelSphericalTensor/labelSphericalTensor.C b/src/OpenFOAM/primitives/SphericalTensor/labelSphericalTensor/labelSphericalTensor.C index 59f01c61925df370651ebf078865523616f673ae..c7ce40447fd58b897d1695c6e218d32e9d73ef06 100644 --- a/src/OpenFOAM/primitives/SphericalTensor/labelSphericalTensor/labelSphericalTensor.C +++ b/src/OpenFOAM/primitives/SphericalTensor/labelSphericalTensor/labelSphericalTensor.C @@ -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 @@ -25,31 +25,59 @@ License #include "labelSphericalTensor.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -namespace Foam -{ +template<> +const char* const Foam::labelSphericalTensor::vsType::typeName +( + "labelSphericalTensor" +); -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // +template<> +const char* const Foam::labelSphericalTensor::vsType::componentNames[] = +{ + "ii" +}; template<> -const char* const labelSphericalTensor::typeName = "labelSphericalTensor"; +const Foam::labelSphericalTensor +Foam::labelSphericalTensor::vsType::vsType::zero +( + labelSphericalTensor::uniform(0) +); template<> -const char* labelSphericalTensor::componentNames[] = {"ii"}; +const Foam::labelSphericalTensor Foam::labelSphericalTensor::vsType::one +( + labelSphericalTensor::uniform(1) +); template<> -const labelSphericalTensor labelSphericalTensor::zero(0); +const Foam::labelSphericalTensor Foam::labelSphericalTensor::vsType::max +( + labelSphericalTensor::uniform(labelMax) +); template<> -const labelSphericalTensor labelSphericalTensor::one(1); +const Foam::labelSphericalTensor Foam::labelSphericalTensor::vsType::min +( + labelSphericalTensor::uniform(-labelMax) +); template<> -const labelSphericalTensor labelSphericalTensor::I(1); +const Foam::labelSphericalTensor Foam::labelSphericalTensor::vsType::rootMax +( + labelSphericalTensor::uniform(sqrt(scalar(labelMax))) +); +template<> +const Foam::labelSphericalTensor Foam::labelSphericalTensor::vsType::rootMin +( + labelSphericalTensor::uniform(-sqrt(scalar(labelMax))) +); -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +template<> +const Foam::labelSphericalTensor Foam::labelSphericalTensor::I(1); -} // End namespace Foam // ************************************************************************* // diff --git a/src/OpenFOAM/primitives/SphericalTensor/sphericalTensor/sphericalTensor.C b/src/OpenFOAM/primitives/SphericalTensor/sphericalTensor/sphericalTensor.C index b5d3bc59fc86c44d3448e905c42e9a24f180c474..826fb0cc222a0a404c7c0aa46021a55e65baaef5 100644 --- a/src/OpenFOAM/primitives/SphericalTensor/sphericalTensor/sphericalTensor.C +++ b/src/OpenFOAM/primitives/SphericalTensor/sphericalTensor/sphericalTensor.C @@ -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 @@ -25,42 +25,57 @@ License #include "sphericalTensor.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // template<> -const char* const sphericalTensor::typeName = "sphericalTensor"; +const char* const Foam::sphericalTensor::vsType::typeName = "sphericalTensor"; template<> -const char* sphericalTensor::componentNames[] = {"ii"}; +const char* const Foam::sphericalTensor::vsType::componentNames[] = {"ii"}; template<> -const sphericalTensor sphericalTensor::zero(0); +const Foam::sphericalTensor Foam::sphericalTensor::vsType::zero +( + sphericalTensor::uniform(0) +); template<> -const sphericalTensor sphericalTensor::one(1); +const Foam::sphericalTensor Foam::sphericalTensor::vsType::one +( + sphericalTensor::uniform(1) +); template<> -const sphericalTensor sphericalTensor::max(VGREAT); +const Foam::sphericalTensor Foam::sphericalTensor::vsType::max +( + sphericalTensor::uniform(VGREAT) +); template<> -const sphericalTensor sphericalTensor::min(-VGREAT); +const Foam::sphericalTensor Foam::sphericalTensor::vsType::min +( + sphericalTensor::uniform(-VGREAT) +); template<> -const sphericalTensor sphericalTensor::I(1); +const Foam::sphericalTensor Foam::sphericalTensor::vsType::rootMax +( + sphericalTensor::uniform(ROOTVGREAT) +); template<> -const sphericalTensor sphericalTensor::oneThirdI(1.0/3.0); +const Foam::sphericalTensor Foam::sphericalTensor::vsType::rootMin +( + sphericalTensor::uniform(-ROOTVGREAT) +); template<> -const sphericalTensor sphericalTensor::twoThirdsI(2.0/3.0); +const Foam::sphericalTensor Foam::sphericalTensor::I(1); -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +template<> +const Foam::sphericalTensor Foam::sphericalTensor::oneThirdI(1.0/3.0); -} // End namespace Foam +template<> +const Foam::sphericalTensor Foam::sphericalTensor::twoThirdsI(2.0/3.0); // ************************************************************************* // diff --git a/src/OpenFOAM/primitives/SphericalTensor2D/SphericalTensor2D.H b/src/OpenFOAM/primitives/SphericalTensor2D/SphericalTensor2D.H index 0ecae53a584022d33c49025830ccd22f7950011c..474777c1c3db374561c7355af4b0746520b9c617 100644 --- a/src/OpenFOAM/primitives/SphericalTensor2D/SphericalTensor2D.H +++ b/src/OpenFOAM/primitives/SphericalTensor2D/SphericalTensor2D.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 @@ -66,12 +66,6 @@ public: // Static data members - static const char* const typeName; - static const char* componentNames[]; - static const SphericalTensor2D zero; - static const SphericalTensor2D one; - static const SphericalTensor2D max; - static const SphericalTensor2D min; static const SphericalTensor2D I; static const SphericalTensor2D oneThirdI; static const SphericalTensor2D twoThirdsI; diff --git a/src/OpenFOAM/primitives/SphericalTensor2D/SphericalTensor2DI.H b/src/OpenFOAM/primitives/SphericalTensor2D/SphericalTensor2DI.H index 18bf88f0a562e0df4c082dee3a99711b05f3229d..9a8b6daff73c8b0c9013cf01d60e12554f445182 100644 --- a/src/OpenFOAM/primitives/SphericalTensor2D/SphericalTensor2DI.H +++ b/src/OpenFOAM/primitives/SphericalTensor2D/SphericalTensor2DI.H @@ -25,22 +25,15 @@ License #include "Vector2D.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -// Construct null template<class Cmpt> -inline SphericalTensor2D<Cmpt>::SphericalTensor2D() +inline Foam::SphericalTensor2D<Cmpt>::SphericalTensor2D() {} -// Construct given VectorSpace template<class Cmpt> -inline SphericalTensor2D<Cmpt>::SphericalTensor2D +inline Foam::SphericalTensor2D<Cmpt>::SphericalTensor2D ( const VectorSpace<SphericalTensor2D<Cmpt>, Cmpt, 1>& vs ) @@ -49,17 +42,15 @@ inline SphericalTensor2D<Cmpt>::SphericalTensor2D {} -// Construct given three Cmpts template<class Cmpt> -inline SphericalTensor2D<Cmpt>::SphericalTensor2D(const Cmpt& stii) +inline Foam::SphericalTensor2D<Cmpt>::SphericalTensor2D(const Cmpt& stii) { this->v_[II] = stii; } -// Construct from Istream template<class Cmpt> -inline SphericalTensor2D<Cmpt>::SphericalTensor2D(Istream& is) +inline Foam::SphericalTensor2D<Cmpt>::SphericalTensor2D(Istream& is) : VectorSpace<SphericalTensor2D<Cmpt>, Cmpt, 1>(is) {} @@ -68,19 +59,24 @@ inline SphericalTensor2D<Cmpt>::SphericalTensor2D(Istream& is) // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class Cmpt> -inline const Cmpt& SphericalTensor2D<Cmpt>::ii() const +inline const Cmpt& Foam::SphericalTensor2D<Cmpt>::ii() const { return this->v_[II]; } template<class Cmpt> -inline Cmpt& SphericalTensor2D<Cmpt>::ii() +inline Cmpt& Foam::SphericalTensor2D<Cmpt>::ii() { return this->v_[II]; } +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + // * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * // //- Inner-product between two spherical tensors diff --git a/src/OpenFOAM/primitives/SphericalTensor2D/sphericalTensor2D/sphericalTensor2D.C b/src/OpenFOAM/primitives/SphericalTensor2D/sphericalTensor2D/sphericalTensor2D.C index c8c597f32c96c0ae6e0c7ed0563a1b9bda791d39..538e9d437f30f0dff9ddf26b7d68aa477b546f9d 100644 --- a/src/OpenFOAM/primitives/SphericalTensor2D/sphericalTensor2D/sphericalTensor2D.C +++ b/src/OpenFOAM/primitives/SphericalTensor2D/sphericalTensor2D/sphericalTensor2D.C @@ -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 @@ -25,42 +25,64 @@ License #include "sphericalTensor2D.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // template<> -const char* const sphericalTensor2D::typeName = "sphericalTensor2D"; +const char* const Foam::sphericalTensor2D::vsType::typeName +( + "sphericalTensor2D" +); template<> -const char* sphericalTensor2D::componentNames[] = {"ii"}; +const char* const Foam::sphericalTensor2D::vsType::componentNames[] = +{ + "ii" +}; template<> -const sphericalTensor2D sphericalTensor2D::zero(0); +const Foam::sphericalTensor2D Foam::sphericalTensor2D::vsType::vsType::zero +( + sphericalTensor2D::uniform(0) +); template<> -const sphericalTensor2D sphericalTensor2D::one(1); +const Foam::sphericalTensor2D Foam::sphericalTensor2D::vsType::one +( + sphericalTensor2D::uniform(1) +); template<> -const sphericalTensor2D sphericalTensor2D::max(VGREAT); +const Foam::sphericalTensor2D Foam::sphericalTensor2D::vsType::max +( + sphericalTensor2D::uniform(VGREAT) +); template<> -const sphericalTensor2D sphericalTensor2D::min(-VGREAT); +const Foam::sphericalTensor2D Foam::sphericalTensor2D::vsType::min +( + sphericalTensor2D::uniform(-VGREAT) +); template<> -const sphericalTensor2D sphericalTensor2D::I(1); +const Foam::sphericalTensor2D Foam::sphericalTensor2D::vsType::rootMax +( + sphericalTensor2D::uniform(ROOTVGREAT) +); template<> -const sphericalTensor2D sphericalTensor2D::oneThirdI(1.0/3.0); +const Foam::sphericalTensor2D Foam::sphericalTensor2D::vsType::rootMin +( + sphericalTensor2D::uniform(-ROOTVGREAT) +); template<> -const sphericalTensor2D sphericalTensor2D::twoThirdsI(2.0/3.0); +const Foam::sphericalTensor2D Foam::sphericalTensor2D::I(1); -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +template<> +const Foam::sphericalTensor2D Foam::sphericalTensor2D::oneThirdI(1.0/3.0); + +template<> +const Foam::sphericalTensor2D Foam::sphericalTensor2D::twoThirdsI(2.0/3.0); -} // End namespace Foam // ************************************************************************* // diff --git a/src/OpenFOAM/primitives/SymmTensor/SymmTensor.H b/src/OpenFOAM/primitives/SymmTensor/SymmTensor.H index afa1dbb622f14964f1e1390071699166444ec9cb..952536ac8ccebe77fc4e599d12a7f1338ec2279f 100644 --- a/src/OpenFOAM/primitives/SymmTensor/SymmTensor.H +++ b/src/OpenFOAM/primitives/SymmTensor/SymmTensor.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 @@ -72,13 +72,6 @@ public: // Static data members - static const char* const typeName; - static const char* componentNames[]; - - static const SymmTensor zero; - static const SymmTensor one; - static const SymmTensor max; - static const SymmTensor min; static const SymmTensor I; diff --git a/src/OpenFOAM/primitives/SymmTensor/SymmTensorI.H b/src/OpenFOAM/primitives/SymmTensor/SymmTensorI.H index b0e64c90091c2d737c05e209b4fd3ca22ac407a5..6caa6aec265570edc0c76509110ffbf1f38802d7 100644 --- a/src/OpenFOAM/primitives/SymmTensor/SymmTensorI.H +++ b/src/OpenFOAM/primitives/SymmTensor/SymmTensorI.H @@ -26,21 +26,16 @@ License #include "Vector.H" #include "Tensor.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template<class Cmpt> -inline SymmTensor<Cmpt>::SymmTensor() +inline Foam::SymmTensor<Cmpt>::SymmTensor() {} template<class Cmpt> template<class Cmpt2> -inline SymmTensor<Cmpt>::SymmTensor +inline Foam::SymmTensor<Cmpt>::SymmTensor ( const VectorSpace<SymmTensor<Cmpt2>, Cmpt2, 6>& vs ) @@ -50,7 +45,7 @@ inline SymmTensor<Cmpt>::SymmTensor template<class Cmpt> -inline SymmTensor<Cmpt>::SymmTensor(const SphericalTensor<Cmpt>& st) +inline Foam::SymmTensor<Cmpt>::SymmTensor(const SphericalTensor<Cmpt>& st) { this->v_[XX] = st.ii(); this->v_[XY] = 0; this->v_[XZ] = 0; this->v_[YY] = st.ii(); this->v_[YZ] = 0; @@ -59,7 +54,7 @@ inline SymmTensor<Cmpt>::SymmTensor(const SphericalTensor<Cmpt>& st) template<class Cmpt> -inline SymmTensor<Cmpt>::SymmTensor +inline Foam::SymmTensor<Cmpt>::SymmTensor ( const Cmpt txx, const Cmpt txy, const Cmpt txz, const Cmpt tyy, const Cmpt tyz, @@ -73,7 +68,7 @@ inline SymmTensor<Cmpt>::SymmTensor template<class Cmpt> -inline SymmTensor<Cmpt>::SymmTensor(Istream& is) +inline Foam::SymmTensor<Cmpt>::SymmTensor(Istream& is) : VectorSpace<SymmTensor<Cmpt>, Cmpt, 6>(is) {} @@ -82,81 +77,81 @@ inline SymmTensor<Cmpt>::SymmTensor(Istream& is) // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class Cmpt> -inline const Cmpt& SymmTensor<Cmpt>::xx() const +inline const Cmpt& Foam::SymmTensor<Cmpt>::xx() const { return this->v_[XX]; } template<class Cmpt> -inline const Cmpt& SymmTensor<Cmpt>::xy() const +inline const Cmpt& Foam::SymmTensor<Cmpt>::xy() const { return this->v_[XY]; } template<class Cmpt> -inline const Cmpt& SymmTensor<Cmpt>::xz() const +inline const Cmpt& Foam::SymmTensor<Cmpt>::xz() const { return this->v_[XZ]; } template<class Cmpt> -inline const Cmpt& SymmTensor<Cmpt>::yy() const +inline const Cmpt& Foam::SymmTensor<Cmpt>::yy() const { return this->v_[YY]; } template<class Cmpt> -inline const Cmpt& SymmTensor<Cmpt>::yz() const +inline const Cmpt& Foam::SymmTensor<Cmpt>::yz() const { return this->v_[YZ]; } template<class Cmpt> -inline const Cmpt& SymmTensor<Cmpt>::zz() const +inline const Cmpt& Foam::SymmTensor<Cmpt>::zz() const { return this->v_[ZZ]; } template<class Cmpt> -inline Cmpt& SymmTensor<Cmpt>::xx() +inline Cmpt& Foam::SymmTensor<Cmpt>::xx() { return this->v_[XX]; } template<class Cmpt> -inline Cmpt& SymmTensor<Cmpt>::xy() +inline Cmpt& Foam::SymmTensor<Cmpt>::xy() { return this->v_[XY]; } template<class Cmpt> -inline Cmpt& SymmTensor<Cmpt>::xz() +inline Cmpt& Foam::SymmTensor<Cmpt>::xz() { return this->v_[XZ]; } template<class Cmpt> -inline Cmpt& SymmTensor<Cmpt>::yy() +inline Cmpt& Foam::SymmTensor<Cmpt>::yy() { return this->v_[YY]; } template<class Cmpt> -inline Cmpt& SymmTensor<Cmpt>::yz() +inline Cmpt& Foam::SymmTensor<Cmpt>::yz() { return this->v_[YZ]; } template<class Cmpt> -inline Cmpt& SymmTensor<Cmpt>::zz() +inline Cmpt& Foam::SymmTensor<Cmpt>::zz() { return this->v_[ZZ]; } template<class Cmpt> -inline const SymmTensor<Cmpt>& SymmTensor<Cmpt>::T() const +inline const Foam::SymmTensor<Cmpt>& Foam::SymmTensor<Cmpt>::T() const { return *this; } @@ -165,7 +160,7 @@ inline const SymmTensor<Cmpt>& SymmTensor<Cmpt>::T() const // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class Cmpt> -inline void SymmTensor<Cmpt>::operator=(const SphericalTensor<Cmpt>& st) +inline void Foam::SymmTensor<Cmpt>::operator=(const SphericalTensor<Cmpt>& st) { this->v_[XX] = st.ii(); this->v_[XY] = 0; this->v_[XZ] = 0; this->v_[YY] = st.ii(); this->v_[YZ] = 0; @@ -173,6 +168,10 @@ inline void SymmTensor<Cmpt>::operator=(const SphericalTensor<Cmpt>& st) } +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ // * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/primitives/SymmTensor/labelSymmTensor/labelSymmTensor.C b/src/OpenFOAM/primitives/SymmTensor/labelSymmTensor/labelSymmTensor.C index 0e5deb2705ead4dfabe206f52fc433adc7af4c4a..ea20917f261784ed605c0638fd634ee23d817b40 100644 --- a/src/OpenFOAM/primitives/SymmTensor/labelSymmTensor/labelSymmTensor.C +++ b/src/OpenFOAM/primitives/SymmTensor/labelSymmTensor/labelSymmTensor.C @@ -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 @@ -25,18 +25,13 @@ License #include "labelSymmTensor.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // template<> -const char* const labelSymmTensor::typeName = "labelSymmTensor"; +const char* const Foam::labelSymmTensor::vsType::typeName = "labelSymmTensor"; template<> -const char* labelSymmTensor::componentNames[] = +const char* const Foam::labelSymmTensor::vsType::componentNames[] = { "xx", "xy", "xz", "yy", "yz", @@ -44,24 +39,48 @@ const char* labelSymmTensor::componentNames[] = }; template<> -const labelSymmTensor labelSymmTensor::zero +const Foam::labelSymmTensor Foam::labelSymmTensor::vsType::vsType::zero ( - 0, 0, 0, - 0, 0, - 0 + labelSymmTensor::uniform(0) ); template<> -const labelSymmTensor labelSymmTensor::one +const Foam::labelSymmTensor Foam::labelSymmTensor::vsType::one ( - 1, 1, 1, - 1, 1, - 1 + labelSymmTensor::uniform(1) +); + +template<> +const Foam::labelSymmTensor Foam::labelSymmTensor::vsType::max +( + labelSymmTensor::uniform(labelMax) ); +template<> +const Foam::labelSymmTensor Foam::labelSymmTensor::vsType::min +( + labelSymmTensor::uniform(-labelMax) +); -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +template<> +const Foam::labelSymmTensor Foam::labelSymmTensor::vsType::rootMax +( + labelSymmTensor::uniform(sqrt(scalar(labelMax))) +); + +template<> +const Foam::labelSymmTensor Foam::labelSymmTensor::vsType::rootMin +( + labelSymmTensor::uniform(-sqrt(scalar(labelMax))) +); + +template<> +const Foam::labelSymmTensor Foam::labelSymmTensor::I +( + 1, 0, 0, + 1, 0, + 1 +); -} // End namespace Foam // ************************************************************************* // diff --git a/src/OpenFOAM/primitives/SymmTensor/symmTensor/symmTensor.C b/src/OpenFOAM/primitives/SymmTensor/symmTensor/symmTensor.C index 22f2b9eb8dbf0c9e50ca0c41ca4ad4e4fe311a88..cc5b6975e0ca09ab16ad9e90c968dc2328fa41b0 100644 --- a/src/OpenFOAM/primitives/SymmTensor/symmTensor/symmTensor.C +++ b/src/OpenFOAM/primitives/SymmTensor/symmTensor/symmTensor.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,18 +25,13 @@ License #include "symmTensor.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // template<> -const char* const symmTensor::typeName = "symmTensor"; +const char* const Foam::symmTensor::vsType::typeName = "symmTensor"; template<> -const char* symmTensor::componentNames[] = +const char* const Foam::symmTensor::vsType::componentNames[] = { "xx", "xy", "xz", "yy", "yz", @@ -44,39 +39,43 @@ const char* symmTensor::componentNames[] = }; template<> -const symmTensor symmTensor::zero +const Foam::symmTensor Foam::symmTensor::vsType::vsType::zero ( - 0, 0, 0, - 0, 0, - 0 + symmTensor::uniform(0) ); template<> -const symmTensor symmTensor::one +const Foam::symmTensor Foam::symmTensor::vsType::one ( - 1, 1, 1, - 1, 1, - 1 + symmTensor::uniform(1) +); + +template<> +const Foam::symmTensor Foam::symmTensor::vsType::max +( + symmTensor::uniform(VGREAT) ); template<> -const symmTensor symmTensor::max +const Foam::symmTensor Foam::symmTensor::vsType::min ( - VGREAT, VGREAT, VGREAT, - VGREAT, VGREAT, - VGREAT + symmTensor::uniform(-VGREAT) ); template<> -const symmTensor symmTensor::min +const Foam::symmTensor Foam::symmTensor::vsType::rootMax ( - -VGREAT, -VGREAT, -VGREAT, - -VGREAT, -VGREAT, - -VGREAT + symmTensor::uniform(ROOTVGREAT) ); template<> -const symmTensor symmTensor::I +const Foam::symmTensor Foam::symmTensor::vsType::rootMin +( + symmTensor::uniform(-ROOTVGREAT) +); + +template<> +const Foam::symmTensor Foam::symmTensor::I ( 1, 0, 0, 1, 0, @@ -84,8 +83,4 @@ const symmTensor symmTensor::I ); -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // ************************************************************************* // diff --git a/src/OpenFOAM/primitives/SymmTensor2D/SymmTensor2D.H b/src/OpenFOAM/primitives/SymmTensor2D/SymmTensor2D.H index 550e9bfec077a685430de6a61551bfe02addbff9..1d747caa2d01937f372fa3e7ab05a262929e9e3f 100644 --- a/src/OpenFOAM/primitives/SymmTensor2D/SymmTensor2D.H +++ b/src/OpenFOAM/primitives/SymmTensor2D/SymmTensor2D.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 @@ -72,13 +72,6 @@ public: // Static data members - static const char* const typeName; - static const char* componentNames[]; - - static const SymmTensor2D zero; - static const SymmTensor2D one; - static const SymmTensor2D max; - static const SymmTensor2D min; static const SymmTensor2D I; diff --git a/src/OpenFOAM/primitives/SymmTensor2D/SymmTensor2DI.H b/src/OpenFOAM/primitives/SymmTensor2D/SymmTensor2DI.H index 2212a6f13d0c0bc6bba90dcb1925048bc8fb6f32..674a6a6975f5456629abd21e864d559d4dc3c89c 100644 --- a/src/OpenFOAM/primitives/SymmTensor2D/SymmTensor2DI.H +++ b/src/OpenFOAM/primitives/SymmTensor2D/SymmTensor2DI.H @@ -26,20 +26,15 @@ License #include "Vector2D.H" #include "Tensor2D.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template<class Cmpt> -inline SymmTensor2D<Cmpt>::SymmTensor2D() +inline Foam::SymmTensor2D<Cmpt>::SymmTensor2D() {} template<class Cmpt> -inline SymmTensor2D<Cmpt>::SymmTensor2D +inline Foam::SymmTensor2D<Cmpt>::SymmTensor2D ( const VectorSpace<SymmTensor2D<Cmpt>, Cmpt, 3>& vs ) @@ -49,7 +44,7 @@ inline SymmTensor2D<Cmpt>::SymmTensor2D template<class Cmpt> -inline SymmTensor2D<Cmpt>::SymmTensor2D(const SphericalTensor2D<Cmpt>& st) +inline Foam::SymmTensor2D<Cmpt>::SymmTensor2D(const SphericalTensor2D<Cmpt>& st) { this->v_[XX] = st.ii(); this->v_[XY] = 0; this->v_[YY] = st.ii(); @@ -57,7 +52,7 @@ inline SymmTensor2D<Cmpt>::SymmTensor2D(const SphericalTensor2D<Cmpt>& st) template<class Cmpt> -inline SymmTensor2D<Cmpt>::SymmTensor2D +inline Foam::SymmTensor2D<Cmpt>::SymmTensor2D ( const Cmpt txx, const Cmpt txy, const Cmpt tyy @@ -69,7 +64,7 @@ inline SymmTensor2D<Cmpt>::SymmTensor2D template<class Cmpt> -inline SymmTensor2D<Cmpt>::SymmTensor2D(Istream& is) +inline Foam::SymmTensor2D<Cmpt>::SymmTensor2D(Istream& is) : VectorSpace<SymmTensor2D<Cmpt>, Cmpt, 3>(is) {} @@ -78,45 +73,45 @@ inline SymmTensor2D<Cmpt>::SymmTensor2D(Istream& is) // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class Cmpt> -inline const Cmpt& SymmTensor2D<Cmpt>::xx() const +inline const Cmpt& Foam::SymmTensor2D<Cmpt>::xx() const { return this->v_[XX]; } template<class Cmpt> -inline const Cmpt& SymmTensor2D<Cmpt>::xy() const +inline const Cmpt& Foam::SymmTensor2D<Cmpt>::xy() const { return this->v_[XY]; } template<class Cmpt> -inline const Cmpt& SymmTensor2D<Cmpt>::yy() const +inline const Cmpt& Foam::SymmTensor2D<Cmpt>::yy() const { return this->v_[YY]; } template<class Cmpt> -inline Cmpt& SymmTensor2D<Cmpt>::xx() +inline Cmpt& Foam::SymmTensor2D<Cmpt>::xx() { return this->v_[XX]; } template<class Cmpt> -inline Cmpt& SymmTensor2D<Cmpt>::xy() +inline Cmpt& Foam::SymmTensor2D<Cmpt>::xy() { return this->v_[XY]; } template<class Cmpt> -inline Cmpt& SymmTensor2D<Cmpt>::yy() +inline Cmpt& Foam::SymmTensor2D<Cmpt>::yy() { return this->v_[YY]; } template<class Cmpt> -inline const SymmTensor2D<Cmpt>& SymmTensor2D<Cmpt>::T() const +inline const Foam::SymmTensor2D<Cmpt>& Foam::SymmTensor2D<Cmpt>::T() const { return *this; } @@ -125,13 +120,21 @@ inline const SymmTensor2D<Cmpt>& SymmTensor2D<Cmpt>::T() const // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class Cmpt> -inline void SymmTensor2D<Cmpt>::operator=(const SphericalTensor2D<Cmpt>& st) +inline void Foam::SymmTensor2D<Cmpt>::operator= +( + const SphericalTensor2D<Cmpt>& st +) { this->v_[XX] = st.ii(); this->v_[XY] = 0; this->v_[YY] = st.ii(); } +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + // * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * // //- Inner-product between two symmetric tensors diff --git a/src/OpenFOAM/primitives/SymmTensor2D/symmTensor2D/symmTensor2D.C b/src/OpenFOAM/primitives/SymmTensor2D/symmTensor2D/symmTensor2D.C index 32f6d9ca6a2198cd8c9d0ff5d1488ff2a854634e..f2d870261bafe3445971fb4cf8e333fd3d4c535e 100644 --- a/src/OpenFOAM/primitives/SymmTensor2D/symmTensor2D/symmTensor2D.C +++ b/src/OpenFOAM/primitives/SymmTensor2D/symmTensor2D/symmTensor2D.C @@ -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 @@ -25,61 +25,60 @@ License #include "symmTensor2D.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // template<> -const char* const symmTensor2D::typeName = "symmTensor2D"; +const char* const Foam::symmTensor2D::vsType::typeName = "symmTensor2D"; template<> -const char* symmTensor2D::componentNames[] = +const char* const Foam::symmTensor2D::vsType::componentNames[] = { "xx", "xy", "yy" }; template<> -const symmTensor2D symmTensor2D::zero +const Foam::symmTensor2D Foam::symmTensor2D::vsType::vsType::zero ( - 0, 0, - 0 + symmTensor2D::uniform(0) ); template<> -const symmTensor2D symmTensor2D::one +const Foam::symmTensor2D Foam::symmTensor2D::vsType::one ( - 1, 1, - 1 + symmTensor2D::uniform(1) ); template<> -const symmTensor2D symmTensor2D::max +const Foam::symmTensor2D Foam::symmTensor2D::vsType::max ( - VGREAT, VGREAT, - VGREAT + symmTensor2D::uniform(VGREAT) ); template<> -const symmTensor2D symmTensor2D::min +const Foam::symmTensor2D Foam::symmTensor2D::vsType::min ( - -VGREAT, -VGREAT, - -VGREAT + symmTensor2D::uniform(-VGREAT) ); template<> -const symmTensor2D symmTensor2D::I +const Foam::symmTensor2D Foam::symmTensor2D::vsType::rootMax ( - 1, 0, - 1 + symmTensor2D::uniform(ROOTVGREAT) ); +template<> +const Foam::symmTensor2D Foam::symmTensor2D::vsType::rootMin +( + symmTensor2D::uniform(-ROOTVGREAT) +); -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +template<> +const Foam::symmTensor2D Foam::symmTensor2D::I +( + 1, 0, + 1 +); -} // End namespace Foam // ************************************************************************* // diff --git a/src/OpenFOAM/primitives/Tensor/Tensor.H b/src/OpenFOAM/primitives/Tensor/Tensor.H index 0d0ba7e04dd56cffb315c463638e12997ba34043..9cd83fd09b047e861e25e6c1d37f8ee24da92f9f 100644 --- a/src/OpenFOAM/primitives/Tensor/Tensor.H +++ b/src/OpenFOAM/primitives/Tensor/Tensor.H @@ -75,13 +75,6 @@ public: // Static data members - static const char* const typeName; - static const char* componentNames[]; - - static const Tensor zero; - static const Tensor one; - static const Tensor max; - static const Tensor min; static const Tensor I; diff --git a/src/OpenFOAM/primitives/Tensor/TensorI.H b/src/OpenFOAM/primitives/Tensor/TensorI.H index 85b33a4952b3d0536653bdab1dc96d6bc2b827b8..35bfdef0c469f823a546c9b796e9798f06f5daa6 100644 --- a/src/OpenFOAM/primitives/Tensor/TensorI.H +++ b/src/OpenFOAM/primitives/Tensor/TensorI.H @@ -25,28 +25,26 @@ License #include "SymmTensor.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template<class Cmpt> -inline Tensor<Cmpt>::Tensor() +inline Foam::Tensor<Cmpt>::Tensor() {} template<class Cmpt> template<class Cmpt2> -inline Tensor<Cmpt>::Tensor(const VectorSpace<Tensor<Cmpt2>, Cmpt2, 9>& vs) +inline Foam::Tensor<Cmpt>::Tensor +( + const VectorSpace<Tensor<Cmpt2>, Cmpt2, 9>& vs +) : VectorSpace<Tensor<Cmpt>, Cmpt, 9>(vs) {} template<class Cmpt> -inline Tensor<Cmpt>::Tensor(const SphericalTensor<Cmpt>& st) +inline Foam::Tensor<Cmpt>::Tensor(const SphericalTensor<Cmpt>& st) { this->v_[XX] = st.ii(); this->v_[XY] = 0; this->v_[XZ] = 0; this->v_[YX] = 0; this->v_[YY] = st.ii(); this->v_[YZ] = 0; @@ -55,7 +53,7 @@ inline Tensor<Cmpt>::Tensor(const SphericalTensor<Cmpt>& st) template<class Cmpt> -inline Tensor<Cmpt>::Tensor(const SymmTensor<Cmpt>& st) +inline Foam::Tensor<Cmpt>::Tensor(const SymmTensor<Cmpt>& st) { this->v_[XX] = st.xx(); this->v_[XY] = st.xy(); this->v_[XZ] = st.xz(); this->v_[YX] = st.xy(); this->v_[YY] = st.yy(); this->v_[YZ] = st.yz(); @@ -64,7 +62,7 @@ inline Tensor<Cmpt>::Tensor(const SymmTensor<Cmpt>& st) template<class Cmpt> -inline Tensor<Cmpt>::Tensor(const Vector<Vector<Cmpt>>& tr) +inline Foam::Tensor<Cmpt>::Tensor(const Vector<Vector<Cmpt>>& tr) { this->v_[XX] = tr.x().x(); this->v_[XY] = tr.x().y(); @@ -81,7 +79,7 @@ inline Tensor<Cmpt>::Tensor(const Vector<Vector<Cmpt>>& tr) template<class Cmpt> -inline Tensor<Cmpt>::Tensor +inline Foam::Tensor<Cmpt>::Tensor ( const Vector<Cmpt>& x, const Vector<Cmpt>& y, @@ -95,7 +93,7 @@ inline Tensor<Cmpt>::Tensor template<class Cmpt> -inline Tensor<Cmpt>::Tensor +inline Foam::Tensor<Cmpt>::Tensor ( const Cmpt txx, const Cmpt txy, const Cmpt txz, const Cmpt tyx, const Cmpt tyy, const Cmpt tyz, @@ -109,7 +107,7 @@ inline Tensor<Cmpt>::Tensor template<class Cmpt> -inline Tensor<Cmpt>::Tensor(Istream& is) +inline Foam::Tensor<Cmpt>::Tensor(Istream& is) : VectorSpace<Tensor<Cmpt>, Cmpt, 9>(is) {} @@ -118,28 +116,31 @@ inline Tensor<Cmpt>::Tensor(Istream& is) // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class Cmpt> -inline Vector<Cmpt> Tensor<Cmpt>::x() const +inline Foam::Vector<Cmpt> Foam::Tensor<Cmpt>::x() const { return Vector<Cmpt>(this->v_[XX], this->v_[XY], this->v_[XZ]); } template<class Cmpt> -inline Vector<Cmpt> Tensor<Cmpt>::y() const +inline Foam::Vector<Cmpt> Foam::Tensor<Cmpt>::y() const { return Vector<Cmpt>(this->v_[YX], this->v_[YY], this->v_[YZ]); } template<class Cmpt> -inline Vector<Cmpt> Tensor<Cmpt>::z() const +inline Foam::Vector<Cmpt> Foam::Tensor<Cmpt>::z() const { return Vector<Cmpt>(this->v_[ZX], this->v_[ZY], this->v_[ZZ]); } template<class Cmpt> -inline Vector<Cmpt> Tensor<Cmpt>::vectorComponent(const direction cmpt) const +inline Foam::Vector<Cmpt> Foam::Tensor<Cmpt>::vectorComponent +( + const direction cmpt +) const { switch (cmpt) { @@ -157,133 +158,133 @@ inline Vector<Cmpt> Tensor<Cmpt>::vectorComponent(const direction cmpt) const template<class Cmpt> -inline const Cmpt& Tensor<Cmpt>::xx() const +inline const Cmpt& Foam::Tensor<Cmpt>::xx() const { return this->v_[XX]; } template<class Cmpt> -inline const Cmpt& Tensor<Cmpt>::xy() const +inline const Cmpt& Foam::Tensor<Cmpt>::xy() const { return this->v_[XY]; } template<class Cmpt> -inline const Cmpt& Tensor<Cmpt>::xz() const +inline const Cmpt& Foam::Tensor<Cmpt>::xz() const { return this->v_[XZ]; } template<class Cmpt> -inline const Cmpt& Tensor<Cmpt>::yx() const +inline const Cmpt& Foam::Tensor<Cmpt>::yx() const { return this->v_[YX]; } template<class Cmpt> -inline const Cmpt& Tensor<Cmpt>::yy() const +inline const Cmpt& Foam::Tensor<Cmpt>::yy() const { return this->v_[YY]; } template<class Cmpt> -inline const Cmpt& Tensor<Cmpt>::yz() const +inline const Cmpt& Foam::Tensor<Cmpt>::yz() const { return this->v_[YZ]; } template<class Cmpt> -inline const Cmpt& Tensor<Cmpt>::zx() const +inline const Cmpt& Foam::Tensor<Cmpt>::zx() const { return this->v_[ZX]; } template<class Cmpt> -inline const Cmpt& Tensor<Cmpt>::zy() const +inline const Cmpt& Foam::Tensor<Cmpt>::zy() const { return this->v_[ZY]; } template<class Cmpt> -inline const Cmpt& Tensor<Cmpt>::zz() const +inline const Cmpt& Foam::Tensor<Cmpt>::zz() const { return this->v_[ZZ]; } template<class Cmpt> -inline Cmpt& Tensor<Cmpt>::xx() +inline Cmpt& Foam::Tensor<Cmpt>::xx() { return this->v_[XX]; } template<class Cmpt> -inline Cmpt& Tensor<Cmpt>::xy() +inline Cmpt& Foam::Tensor<Cmpt>::xy() { return this->v_[XY]; } template<class Cmpt> -inline Cmpt& Tensor<Cmpt>::xz() +inline Cmpt& Foam::Tensor<Cmpt>::xz() { return this->v_[XZ]; } template<class Cmpt> -inline Cmpt& Tensor<Cmpt>::yx() +inline Cmpt& Foam::Tensor<Cmpt>::yx() { return this->v_[YX]; } template<class Cmpt> -inline Cmpt& Tensor<Cmpt>::yy() +inline Cmpt& Foam::Tensor<Cmpt>::yy() { return this->v_[YY]; } template<class Cmpt> -inline Cmpt& Tensor<Cmpt>::yz() +inline Cmpt& Foam::Tensor<Cmpt>::yz() { return this->v_[YZ]; } template<class Cmpt> -inline Cmpt& Tensor<Cmpt>::zx() +inline Cmpt& Foam::Tensor<Cmpt>::zx() { return this->v_[ZX]; } template<class Cmpt> -inline Cmpt& Tensor<Cmpt>::zy() +inline Cmpt& Foam::Tensor<Cmpt>::zy() { return this->v_[ZY]; } template<class Cmpt> -inline Cmpt& Tensor<Cmpt>::zz() +inline Cmpt& Foam::Tensor<Cmpt>::zz() { return this->v_[ZZ]; } template<class Cmpt> -inline Tensor<Cmpt> Tensor<Cmpt>::T() const +inline Foam::Tensor<Cmpt> Foam::Tensor<Cmpt>::T() const { return Tensor<Cmpt> ( @@ -297,7 +298,7 @@ inline Tensor<Cmpt> Tensor<Cmpt>::T() const // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class Cmpt> -inline void Tensor<Cmpt>::operator&=(const Tensor<Cmpt>& t) +inline void Foam::Tensor<Cmpt>::operator&=(const Tensor<Cmpt>& t) { *this = ( @@ -320,7 +321,7 @@ inline void Tensor<Cmpt>::operator&=(const Tensor<Cmpt>& t) template<class Cmpt> -inline void Tensor<Cmpt>::operator=(const SphericalTensor<Cmpt>& st) +inline void Foam::Tensor<Cmpt>::operator=(const SphericalTensor<Cmpt>& st) { this->v_[XX] = st.ii(); this->v_[XY] = 0; this->v_[XZ] = 0; this->v_[YX] = 0; this->v_[YY] = st.ii(); this->v_[YZ] = 0; @@ -329,7 +330,7 @@ inline void Tensor<Cmpt>::operator=(const SphericalTensor<Cmpt>& st) template<class Cmpt> -inline void Tensor<Cmpt>::operator=(const SymmTensor<Cmpt>& st) +inline void Foam::Tensor<Cmpt>::operator=(const SymmTensor<Cmpt>& st) { this->v_[XX] = st.xx(); this->v_[XY] = st.xy(); this->v_[XZ] = st.xz(); this->v_[YX] = st.xy(); this->v_[YY] = st.yy(); this->v_[YZ] = st.yz(); @@ -338,7 +339,7 @@ inline void Tensor<Cmpt>::operator=(const SymmTensor<Cmpt>& st) template<class Cmpt> -inline void Tensor<Cmpt>::operator=(const Vector<Vector<Cmpt>>& tr) +inline void Foam::Tensor<Cmpt>::operator=(const Vector<Vector<Cmpt>>& tr) { this->v_[XX] = tr.x().x(); this->v_[XY] = tr.x().y(); @@ -354,6 +355,11 @@ inline void Tensor<Cmpt>::operator=(const Vector<Vector<Cmpt>>& tr) } +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + // * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * // template<class Cmpt> diff --git a/src/OpenFOAM/primitives/Tensor/labelTensor/labelTensor.C b/src/OpenFOAM/primitives/Tensor/labelTensor/labelTensor.C index 4274e78a3e4c493d431ec784f24795d22a492dfa..4f15ceda59f16f60e3044ca72005bc08c921a2ab 100644 --- a/src/OpenFOAM/primitives/Tensor/labelTensor/labelTensor.C +++ b/src/OpenFOAM/primitives/Tensor/labelTensor/labelTensor.C @@ -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 @@ -28,35 +28,52 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -namespace Foam +template<> +const char* const Foam::labelTensor::vsType::typeName = "labelTensor"; + +template<> +const char* const Foam::labelTensor::vsType::componentNames[] = { - template<> - const char* const Foam::labelTensor::typeName = "labelTensor"; - - template<> - const char* Foam::labelTensor::componentNames[] = - { - "xx", "xy", "xz", - "yx", "yy", "yz", - "zx", "zy", "zz" - }; - - template<> - const Foam::labelTensor Foam::labelTensor::zero - ( - 0, 0, 0, - 0, 0, 0, - 0, 0, 0 - ); - - template<> - const Foam::labelTensor Foam::labelTensor::one - ( - 1, 1, 1, - 1, 1, 1, - 1, 1, 1 - ); -} + "xx", "xy", "xz", + "yx", "yy", "yz", + "zx", "zy", "zz" +}; + +template<> +const Foam::labelTensor Foam::labelTensor::vsType::zero +( + labelTensor::uniform(0) +); + +template<> +const Foam::labelTensor Foam::labelTensor::vsType::one +( + labelTensor::uniform(1) +); + +template<> +const Foam::labelTensor Foam::labelTensor::vsType::max +( + labelTensor::uniform(labelMax) +); + +template<> +const Foam::labelTensor Foam::labelTensor::vsType::min +( + labelTensor::uniform(-labelMax) +); + +template<> +const Foam::labelTensor Foam::labelTensor::vsType::rootMax +( + labelTensor::uniform(sqrt(scalar(labelMax))) +); + +template<> +const Foam::labelTensor Foam::labelTensor::vsType::rootMin +( + labelTensor::uniform(-sqrt(scalar(labelMax))) +); // ************************************************************************* // diff --git a/src/OpenFOAM/primitives/Tensor/tensor/tensor.C b/src/OpenFOAM/primitives/Tensor/tensor/tensor.C index fd636a2529a93f130c6d1ee8fc9dc22816abd11d..cadbef6a9b3a731e731de9ff51dbe07c43c5e55b 100644 --- a/src/OpenFOAM/primitives/Tensor/tensor/tensor.C +++ b/src/OpenFOAM/primitives/Tensor/tensor/tensor.C @@ -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 @@ -30,59 +30,42 @@ using namespace Foam::constant::mathematical; // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -namespace Foam +template<> +const char* const Foam::tensor::vsType::typeName = "tensor"; + +template<> +const char* const Foam::tensor::vsType::componentNames[] = { - template<> - const char* const tensor::typeName = "tensor"; + "xx", "xy", "xz", + "yx", "yy", "yz", + "zx", "zy", "zz" +}; - template<> - const char* tensor::componentNames[] = - { - "xx", "xy", "xz", - "yx", "yy", "yz", - "zx", "zy", "zz" - }; +template<> +const Foam::tensor Foam::tensor::vsType::zero(tensor::uniform(0)); - template<> - const tensor tensor::zero - ( - 0, 0, 0, - 0, 0, 0, - 0, 0, 0 - ); +template<> +const Foam::tensor Foam::tensor::vsType::one(tensor::uniform(1)); - template<> - const tensor tensor::one - ( - 1, 1, 1, - 1, 1, 1, - 1, 1, 1 - ); +template<> +const Foam::tensor Foam::tensor::vsType::max(tensor::uniform(VGREAT)); - template<> - const tensor tensor::max - ( - VGREAT, VGREAT, VGREAT, - VGREAT, VGREAT, VGREAT, - VGREAT, VGREAT, VGREAT - ); +template<> +const Foam::tensor Foam::tensor::vsType::min(tensor::uniform(-VGREAT)); - template<> - const tensor tensor::min - ( - -VGREAT, -VGREAT, -VGREAT, - -VGREAT, -VGREAT, -VGREAT, - -VGREAT, -VGREAT, -VGREAT - ); +template<> +const Foam::tensor Foam::tensor::vsType::rootMax(tensor::uniform(ROOTVGREAT)); - template<> - const tensor tensor::I - ( - 1, 0, 0, - 0, 1, 0, - 0, 0, 1 - ); -} +template<> +const Foam::tensor Foam::tensor::vsType::rootMin(tensor::uniform(-ROOTVGREAT)); + +template<> +const Foam::tensor Foam::tensor::I +( + 1, 0, 0, + 0, 1, 0, + 0, 0, 1 +); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/primitives/Tensor2D/Tensor2D.H b/src/OpenFOAM/primitives/Tensor2D/Tensor2D.H index ac49d74d53aac23fadc6b8b243a52dadbe46e59e..bc1f3906e56b68f9b8de502b126233f57d1f44d9 100644 --- a/src/OpenFOAM/primitives/Tensor2D/Tensor2D.H +++ b/src/OpenFOAM/primitives/Tensor2D/Tensor2D.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 @@ -61,6 +61,10 @@ class Tensor2D public: + //- Equivalent type of labels used for valid component indexing + typedef Tensor2D<label> labelType; + + // Member constants enum @@ -71,13 +75,6 @@ public: // Static data members - static const char* const typeName; - static const char* componentNames[]; - - static const Tensor2D zero; - static const Tensor2D one; - static const Tensor2D max; - static const Tensor2D min; static const Tensor2D I; diff --git a/src/OpenFOAM/primitives/Tensor2D/Tensor2DI.H b/src/OpenFOAM/primitives/Tensor2D/Tensor2DI.H index 230ebe70052282da6343ad1d5af2842714a92039..bc68f00ad3e2841e93908ede0af302f4b0c0bc56 100644 --- a/src/OpenFOAM/primitives/Tensor2D/Tensor2DI.H +++ b/src/OpenFOAM/primitives/Tensor2D/Tensor2DI.H @@ -23,27 +23,25 @@ License \*---------------------------------------------------------------------------*/ -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template<class Cmpt> -inline Tensor2D<Cmpt>::Tensor2D() +inline Foam::Tensor2D<Cmpt>::Tensor2D() {} template<class Cmpt> -inline Tensor2D<Cmpt>::Tensor2D(const VectorSpace<Tensor2D<Cmpt>, Cmpt, 4>& vs) +inline Foam::Tensor2D<Cmpt>::Tensor2D +( + const VectorSpace<Tensor2D<Cmpt>, Cmpt, 4>& vs +) : VectorSpace<Tensor2D<Cmpt>, Cmpt, 4>(vs) {} template<class Cmpt> -inline Tensor2D<Cmpt>::Tensor2D(const SymmTensor2D<Cmpt>& st) +inline Foam::Tensor2D<Cmpt>::Tensor2D(const SymmTensor2D<Cmpt>& st) { this->v_[XX] = st.xx(); this->v_[XY] = st.xy(); this->v_[YX] = st.xy(); this->v_[YY] = st.yy(); @@ -51,7 +49,7 @@ inline Tensor2D<Cmpt>::Tensor2D(const SymmTensor2D<Cmpt>& st) template<class Cmpt> -inline Tensor2D<Cmpt>::Tensor2D(const SphericalTensor2D<Cmpt>& st) +inline Foam::Tensor2D<Cmpt>::Tensor2D(const SphericalTensor2D<Cmpt>& st) { this->v_[XX] = st.ii(); this->v_[XY] = 0; this->v_[YX] = 0; this->v_[YY] = st.ii(); @@ -59,7 +57,7 @@ inline Tensor2D<Cmpt>::Tensor2D(const SphericalTensor2D<Cmpt>& st) template<class Cmpt> -inline Tensor2D<Cmpt>::Tensor2D +inline Foam::Tensor2D<Cmpt>::Tensor2D ( const Vector2D<Cmpt>& x, const Vector2D<Cmpt>& y @@ -71,7 +69,7 @@ inline Tensor2D<Cmpt>::Tensor2D template<class Cmpt> -inline Tensor2D<Cmpt>::Tensor2D +inline Foam::Tensor2D<Cmpt>::Tensor2D ( const Cmpt txx, const Cmpt txy, const Cmpt tyx, const Cmpt tyy @@ -83,7 +81,7 @@ inline Tensor2D<Cmpt>::Tensor2D template<class Cmpt> -inline Tensor2D<Cmpt>::Tensor2D(Istream& is) +inline Foam::Tensor2D<Cmpt>::Tensor2D(Istream& is) : VectorSpace<Tensor2D<Cmpt>, Cmpt, 4>(is) {} @@ -92,70 +90,70 @@ inline Tensor2D<Cmpt>::Tensor2D(Istream& is) // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class Cmpt> -inline Vector2D<Cmpt> Tensor2D<Cmpt>::x() const +inline Foam::Vector2D<Cmpt> Foam::Tensor2D<Cmpt>::x() const { return Vector2D<Cmpt>(this->v_[XX], this->v_[XY]); } template<class Cmpt> -inline Vector2D<Cmpt> Tensor2D<Cmpt>::y() const +inline Foam::Vector2D<Cmpt> Foam::Tensor2D<Cmpt>::y() const { return Vector2D<Cmpt>(this->v_[YX], this->v_[YY]); } template<class Cmpt> -inline const Cmpt& Tensor2D<Cmpt>::xx() const +inline const Cmpt& Foam::Tensor2D<Cmpt>::xx() const { return this->v_[XX]; } template<class Cmpt> -inline const Cmpt& Tensor2D<Cmpt>::xy() const +inline const Cmpt& Foam::Tensor2D<Cmpt>::xy() const { return this->v_[XY]; } template<class Cmpt> -inline const Cmpt& Tensor2D<Cmpt>::yx() const +inline const Cmpt& Foam::Tensor2D<Cmpt>::yx() const { return this->v_[YX]; } template<class Cmpt> -inline const Cmpt& Tensor2D<Cmpt>::yy() const +inline const Cmpt& Foam::Tensor2D<Cmpt>::yy() const { return this->v_[YY]; } template<class Cmpt> -inline Cmpt& Tensor2D<Cmpt>::xx() +inline Cmpt& Foam::Tensor2D<Cmpt>::xx() { return this->v_[XX]; } template<class Cmpt> -inline Cmpt& Tensor2D<Cmpt>::xy() +inline Cmpt& Foam::Tensor2D<Cmpt>::xy() { return this->v_[XY]; } template<class Cmpt> -inline Cmpt& Tensor2D<Cmpt>::yx() +inline Cmpt& Foam::Tensor2D<Cmpt>::yx() { return this->v_[YX]; } template<class Cmpt> -inline Cmpt& Tensor2D<Cmpt>::yy() +inline Cmpt& Foam::Tensor2D<Cmpt>::yy() { return this->v_[YY]; } template<class Cmpt> -inline Tensor2D<Cmpt> Tensor2D<Cmpt>::T() const +inline Foam::Tensor2D<Cmpt> Foam::Tensor2D<Cmpt>::T() const { return Tensor2D<Cmpt> ( @@ -168,7 +166,7 @@ inline Tensor2D<Cmpt> Tensor2D<Cmpt>::T() const // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class Cmpt> -inline void Tensor2D<Cmpt>::operator=(const SymmTensor2D<Cmpt>& st) +inline void Foam::Tensor2D<Cmpt>::operator=(const SymmTensor2D<Cmpt>& st) { this->v_[XX] = st.xx(); this->v_[XY] = st.xy(); this->v_[YX] = st.xy(); this->v_[YY] = st.yy(); @@ -176,13 +174,17 @@ inline void Tensor2D<Cmpt>::operator=(const SymmTensor2D<Cmpt>& st) template<class Cmpt> -inline void Tensor2D<Cmpt>::operator=(const SphericalTensor2D<Cmpt>& st) +inline void Foam::Tensor2D<Cmpt>::operator=(const SphericalTensor2D<Cmpt>& st) { this->v_[XX] = st.ii(); this->v_[XY] = 0; this->v_[YX] = 0; this->v_[YY] = st.ii(); } +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ // * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/primitives/Tensor2D/tensor2D/tensor2D.C b/src/OpenFOAM/primitives/Tensor2D/tensor2D/tensor2D.C index 96ff1a3194384d32acb9dc6e5077862f128aa802..36f972525588a4e2e79a92a0be5902e73ffcc9b3 100644 --- a/src/OpenFOAM/primitives/Tensor2D/tensor2D/tensor2D.C +++ b/src/OpenFOAM/primitives/Tensor2D/tensor2D/tensor2D.C @@ -28,41 +28,49 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // template<> -const char* const Foam::tensor2D::typeName = "tensor2D"; +const char* const Foam::tensor2D::vsType::typeName = "tensor2D"; template<> -const char* Foam::tensor2D::componentNames[] = +const char* const Foam::tensor2D::vsType::componentNames[] = { "xx", "xy", "yx", "yy" }; template<> -const Foam::tensor2D Foam::tensor2D::zero +const Foam::tensor2D Foam::tensor2D::vsType::vsType::zero ( - 0, 0, - 0, 0 + tensor2D::uniform(0) ); template<> -const Foam::tensor2D Foam::tensor2D::one +const Foam::tensor2D Foam::tensor2D::vsType::one ( - 1, 1, - 1, 1 + tensor2D::uniform(1) ); template<> -const Foam::tensor2D Foam::tensor2D::max +const Foam::tensor2D Foam::tensor2D::vsType::max ( - VGREAT, VGREAT, - VGREAT, VGREAT + tensor2D::uniform(VGREAT) ); template<> -const Foam::tensor2D Foam::tensor2D::min +const Foam::tensor2D Foam::tensor2D::vsType::min ( - -VGREAT, -VGREAT, - -VGREAT, -VGREAT + tensor2D::uniform(-VGREAT) +); + +template<> +const Foam::tensor2D Foam::tensor2D::vsType::rootMax +( + tensor2D::uniform(ROOTVGREAT) +); + +template<> +const Foam::tensor2D Foam::tensor2D::vsType::rootMin +( + tensor2D::uniform(-ROOTVGREAT) ); template<> diff --git a/src/OpenFOAM/primitives/Vector/Vector.H b/src/OpenFOAM/primitives/Vector/Vector.H index b79dd8d6f7ef91b9b1af40c696ec0707269e251c..e4ba4c1fedaaaf05e17452dddfef6afacc78d926 100644 --- a/src/OpenFOAM/primitives/Vector/Vector.H +++ b/src/OpenFOAM/primitives/Vector/Vector.H @@ -74,18 +74,6 @@ public: }; - // Static data members - - static const char* const typeName; - static const char* componentNames[]; - static const Vector zero; - static const Vector one; - static const Vector max; - static const Vector min; - static const Vector rootMax; - static const Vector rootMin; - - //- Component labeling enumeration enum components { X, Y, Z }; @@ -127,7 +115,7 @@ public: // Member Operators - inline void operator=(const scalar); + inline void operator=(const Foam::zero); }; diff --git a/src/OpenFOAM/primitives/Vector/VectorI.H b/src/OpenFOAM/primitives/Vector/VectorI.H index 3133057461069dd2bffb0c959e3d4d5d37c73316..4d598dea3682b9aa491520a4876f5f41a6248ac8 100644 --- a/src/OpenFOAM/primitives/Vector/VectorI.H +++ b/src/OpenFOAM/primitives/Vector/VectorI.H @@ -23,28 +23,31 @@ License \*---------------------------------------------------------------------------*/ -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template<class Cmpt> -inline Vector<Cmpt>::Vector() +inline Foam::Vector<Cmpt>::Vector() {} template<class Cmpt> template<class Cmpt2> -inline Vector<Cmpt>::Vector(const VectorSpace<Vector<Cmpt2>, Cmpt2, 3>& vs) +inline Foam::Vector<Cmpt>::Vector +( + const VectorSpace<Vector<Cmpt2>, Cmpt2, 3>& vs +) : VectorSpace<Vector<Cmpt>, Cmpt, 3>(vs) {} template<class Cmpt> -inline Vector<Cmpt>::Vector(const Cmpt& vx, const Cmpt& vy, const Cmpt& vz) +inline Foam::Vector<Cmpt>::Vector +( + const Cmpt& vx, + const Cmpt& vy, + const Cmpt& vz +) { this->v_[X] = vx; this->v_[Y] = vy; @@ -53,7 +56,7 @@ inline Vector<Cmpt>::Vector(const Cmpt& vx, const Cmpt& vy, const Cmpt& vz) template<class Cmpt> -inline Vector<Cmpt>::Vector(Istream& is) +inline Foam::Vector<Cmpt>::Vector(Istream& is) : VectorSpace<Vector<Cmpt>, Cmpt, 3>(is) {} @@ -62,38 +65,38 @@ inline Vector<Cmpt>::Vector(Istream& is) // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class Cmpt> -inline const Cmpt& Vector<Cmpt>::x() const +inline const Cmpt& Foam::Vector<Cmpt>::x() const { return this->v_[X]; } template<class Cmpt> -inline const Cmpt& Vector<Cmpt>::y() const +inline const Cmpt& Foam::Vector<Cmpt>::y() const { return this->v_[Y]; } template<class Cmpt> -inline const Cmpt& Vector<Cmpt>::z() const +inline const Cmpt& Foam::Vector<Cmpt>::z() const { return this->v_[Z]; } template<class Cmpt> -inline Cmpt& Vector<Cmpt>::x() +inline Cmpt& Foam::Vector<Cmpt>::x() { return this->v_[X]; } template<class Cmpt> -inline Cmpt& Vector<Cmpt>::y() +inline Cmpt& Foam::Vector<Cmpt>::y() { return this->v_[Y]; } template<class Cmpt> -inline Cmpt& Vector<Cmpt>::z() +inline Cmpt& Foam::Vector<Cmpt>::z() { return this->v_[Z]; } @@ -102,7 +105,7 @@ inline Cmpt& Vector<Cmpt>::z() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class Cmpt> -inline const Vector<Cmpt>& Vector<Cmpt>::centre +inline const Foam::Vector<Cmpt>& Foam::Vector<Cmpt>::centre ( const Foam::List<Vector<Cmpt>>& )const @@ -114,17 +117,19 @@ inline const Vector<Cmpt>& Vector<Cmpt>::centre // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // template<class Cmpt> -inline void Vector<Cmpt>::operator= -( - const scalar s -) +inline void Foam::Vector<Cmpt>::operator=(const Foam::zero z) { - VectorSpace<Vector<Cmpt>, Cmpt, 3>::operator=(s); + VectorSpace<Vector<Cmpt>, Cmpt, 3>::operator=(z); } // * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * // +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + template<class Cmpt> inline typename innerProduct<Vector<Cmpt>, Vector<Cmpt>>::type operator&(const Vector<Cmpt>& v1, const Vector<Cmpt>& v2) diff --git a/src/OpenFOAM/primitives/Vector/complexVector/complexVector.C b/src/OpenFOAM/primitives/Vector/complexVector/complexVector.C index 7e5d04144beb91fbb81bc1d23f2c2b739e8e47f4..f3241df6961f820aacbe11879eea6ab96e028a06 100644 --- a/src/OpenFOAM/primitives/Vector/complexVector/complexVector.C +++ b/src/OpenFOAM/primitives/Vector/complexVector/complexVector.C @@ -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 @@ -28,37 +28,52 @@ Description #include "complexVector.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +template<> +const char* const Foam::complexVector::vsType::typeName = "complexVector"; -namespace Foam +template<> +const char* const Foam::complexVector::vsType::componentNames[] = { + "x", "y", "z" +}; -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // +template<> +const Foam::complexVector Foam::complexVector::vsType::zero +( + complexVector::uniform(complex(0, 0)) +); template<> -const char* const complexVector::typeName = "complexVector"; +const Foam::complexVector Foam::complexVector::vsType::one +( + complexVector::uniform(complex(1, 1)) +); template<> -const char* complexVector::componentNames[] = {"x", "y", "z"}; +const Foam::complexVector Foam::complexVector::vsType::max +( + complexVector::uniform(complex(VGREAT, VGREAT)) +); template<> -const complexVector complexVector::zero +const Foam::complexVector Foam::complexVector::vsType::min ( - complex(0, 0), - complex(0, 0), - complex(0, 0) + complexVector::uniform(complex(-VGREAT, -VGREAT)) ); template<> -const complexVector complexVector::one +const Foam::complexVector Foam::complexVector::vsType::rootMax ( - complex(1, 1), - complex(1, 1), - complex(1, 1) + complexVector::uniform(complex(ROOTVGREAT, ROOTVGREAT)) ); -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +template<> +const Foam::complexVector Foam::complexVector::vsType::rootMin +( + complexVector::uniform(complex(-ROOTVGREAT, -ROOTVGREAT)) +); -} // End namespace Foam // ************************************************************************* // diff --git a/src/OpenFOAM/primitives/Vector/floatVector/floatVector.C b/src/OpenFOAM/primitives/Vector/floatVector/floatVector.C index d88ac70f1f4afc6e25a6a7694155a671d48f7c66..13ab567ba41708cd4f7edfa4034e6e6c4524bb28 100644 --- a/src/OpenFOAM/primitives/Vector/floatVector/floatVector.C +++ b/src/OpenFOAM/primitives/Vector/floatVector/floatVector.C @@ -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 @@ -28,43 +28,52 @@ Description #include "floatVector.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // template<> -const char* const floatVector::typeName = "floatVector"; +const char* const Foam::floatVector::vsType::typeName = "floatVector"; template<> -const char* floatVector::componentNames[] = {"x", "y", "z"}; +const char* const Foam::floatVector::vsType::componentNames[] = +{ + "x", "y", "z" +}; template<> -const floatVector floatVector::zero(0, 0, 0); +const Foam::floatVector Foam::floatVector::vsType::zero +( + floatVector::uniform(0) +); template<> -const floatVector floatVector::one(1, 1, 1); +const Foam::floatVector Foam::floatVector::vsType::one +( + floatVector::uniform(1) +); template<> -const floatVector floatVector::max +const Foam::floatVector Foam::floatVector::vsType::max ( - floatScalarVGREAT, - floatScalarVGREAT, - floatScalarVGREAT + floatVector::uniform(floatScalarVGREAT) ); template<> -const floatVector floatVector::min +const Foam::floatVector Foam::floatVector::vsType::min ( - -floatScalarVGREAT, - -floatScalarVGREAT, - -floatScalarVGREAT + floatVector::uniform(-floatScalarVGREAT) ); -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +template<> +const Foam::floatVector Foam::floatVector::vsType::rootMax +( + floatVector::uniform(floatScalarROOTVGREAT) +); + +template<> +const Foam::floatVector Foam::floatVector::vsType::rootMin +( + floatVector::uniform(-floatScalarROOTVGREAT) +); -} // End namespace Foam // ************************************************************************* // diff --git a/src/OpenFOAM/primitives/Vector/labelVector/labelVector.C b/src/OpenFOAM/primitives/Vector/labelVector/labelVector.C index 248f6601defdab5ef0fff82410b8eb03f4d1be98..231c3a69ef1b90fff6ef781d7eae49e112887763 100644 --- a/src/OpenFOAM/primitives/Vector/labelVector/labelVector.C +++ b/src/OpenFOAM/primitives/Vector/labelVector/labelVector.C @@ -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 @@ -27,19 +27,50 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -namespace Foam +template<> +const char* const Foam::labelVector::vsType::typeName = "labelVector"; + +template<> +const char* const Foam::labelVector::vsType::componentNames[] = { - template<> - const char* const Foam::labelVector::typeName = "labelVector"; + "x", "y", "z" +}; + +template<> +const Foam::labelVector Foam::labelVector::vsType::zero +( + labelVector::uniform(0) +); + +template<> +const Foam::labelVector Foam::labelVector::vsType::one +( + labelVector::uniform(1) +); + +template<> +const Foam::labelVector Foam::labelVector::vsType::max +( + labelVector::uniform(labelMax) +); + +template<> +const Foam::labelVector Foam::labelVector::vsType::min +( + labelVector::uniform(-labelMax) +); - template<> - const char* Foam::labelVector::componentNames[] = {"x", "y", "z"}; +template<> +const Foam::labelVector Foam::labelVector::vsType::rootMax +( + labelVector::uniform(sqrt(scalar(labelMax))) +); - template<> - const Foam::labelVector Foam::labelVector::zero(0, 0, 0); +template<> +const Foam::labelVector Foam::labelVector::vsType::rootMin +( + labelVector::uniform(-sqrt(scalar(labelMax))) +); - template<> - const Foam::labelVector Foam::labelVector::one(1, 1, 1); -} // ************************************************************************* // diff --git a/src/OpenFOAM/primitives/Vector/vector/vector.C b/src/OpenFOAM/primitives/Vector/vector/vector.C index 40b6e79c31ac1d84a5bb791825183bb023008124..646f34c35de2418cba068a218e92d36149a6f7bc 100644 --- a/src/OpenFOAM/primitives/Vector/vector/vector.C +++ b/src/OpenFOAM/primitives/Vector/vector/vector.C @@ -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 @@ -28,39 +28,31 @@ Description #include "vector.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // template<> -const char* const vector::typeName = "vector"; +const char* const Foam::vector::vsType::typeName = "vector"; template<> -const char* vector::componentNames[] = {"x", "y", "z"}; +const char* const Foam::vector::vsType::componentNames[] = {"x", "y", "z"}; template<> -const vector vector::zero(0, 0, 0); +const Foam::vector Foam::vector::vsType::vsType::zero(vector::uniform(0)); template<> -const vector vector::one(1, 1, 1); +const Foam::vector Foam::vector::vsType::one(vector::uniform(1)); template<> -const vector vector::max(VGREAT, VGREAT, VGREAT); +const Foam::vector Foam::vector::vsType::max(vector::uniform(VGREAT)); template<> -const vector vector::min(-VGREAT, -VGREAT, -VGREAT); +const Foam::vector Foam::vector::vsType::min(vector::uniform(-VGREAT)); template<> -const vector vector::rootMax(ROOTVGREAT, ROOTVGREAT, ROOTVGREAT); +const Foam::vector Foam::vector::vsType::rootMax(vector::uniform(ROOTVGREAT)); template<> -const vector vector::rootMin(-ROOTVGREAT, -ROOTVGREAT, -ROOTVGREAT); - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +const Foam::vector Foam::vector::vsType::rootMin(vector::uniform(-ROOTVGREAT)); -} // End namespace Foam // ************************************************************************* // diff --git a/src/OpenFOAM/primitives/Vector2D/Vector2D.H b/src/OpenFOAM/primitives/Vector2D/Vector2D.H index e63fbad951bad563dbde3a710668091ff0e9d8cc..ca77ed8ce105b8468ba83c95f672edd2ec3f4aef 100644 --- a/src/OpenFOAM/primitives/Vector2D/Vector2D.H +++ b/src/OpenFOAM/primitives/Vector2D/Vector2D.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 @@ -56,6 +56,10 @@ class Vector2D public: + //- Equivalent type of labels used for valid component indexing + typedef Vector2D<label> labelType; + + // Member constants enum @@ -64,16 +68,6 @@ public: }; - // Static data members - - static const char* const typeName; - static const char* componentNames[]; - static const Vector2D zero; - static const Vector2D one; - static const Vector2D max; - static const Vector2D min; - - //- Component labeling enumeration enum components { X, Y }; diff --git a/src/OpenFOAM/primitives/Vector2D/Vector2DI.H b/src/OpenFOAM/primitives/Vector2D/Vector2DI.H index b3e5f6c63a55afe8235b5e5bfd1d7ca8008455fe..8ccf067c26e2dc57f071101414520922592cdd3f 100644 --- a/src/OpenFOAM/primitives/Vector2D/Vector2DI.H +++ b/src/OpenFOAM/primitives/Vector2D/Vector2DI.H @@ -23,39 +23,33 @@ License \*---------------------------------------------------------------------------*/ -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -// Construct null template<class Cmpt> -inline Vector2D<Cmpt>::Vector2D() +inline Foam::Vector2D<Cmpt>::Vector2D() {} -// Construct given VectorSpace template<class Cmpt> -inline Vector2D<Cmpt>::Vector2D(const VectorSpace<Vector2D<Cmpt>, Cmpt, 2>& vs) +inline Foam::Vector2D<Cmpt>::Vector2D +( + const VectorSpace<Vector2D<Cmpt>, Cmpt, 2>& vs +) : VectorSpace<Vector2D<Cmpt>, Cmpt, 2>(vs) {} -// Construct given three Cmpts template<class Cmpt> -inline Vector2D<Cmpt>::Vector2D(const Cmpt& vx, const Cmpt& vy) +inline Foam::Vector2D<Cmpt>::Vector2D(const Cmpt& vx, const Cmpt& vy) { this->v_[X] = vx; this->v_[Y] = vy; } -// Construct from Istream template<class Cmpt> -inline Vector2D<Cmpt>::Vector2D(Istream& is) +inline Foam::Vector2D<Cmpt>::Vector2D(Istream& is) : VectorSpace<Vector2D<Cmpt>, Cmpt, 2>(is) {} @@ -64,31 +58,36 @@ inline Vector2D<Cmpt>::Vector2D(Istream& is) // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class Cmpt> -inline const Cmpt& Vector2D<Cmpt>::x() const +inline const Cmpt& Foam::Vector2D<Cmpt>::x() const { return this->v_[X]; } template<class Cmpt> -inline const Cmpt& Vector2D<Cmpt>::y() const +inline const Cmpt& Foam::Vector2D<Cmpt>::y() const { return this->v_[Y]; } template<class Cmpt> -inline Cmpt& Vector2D<Cmpt>::x() +inline Cmpt& Foam::Vector2D<Cmpt>::x() { return this->v_[X]; } template<class Cmpt> -inline Cmpt& Vector2D<Cmpt>::y() +inline Cmpt& Foam::Vector2D<Cmpt>::y() { return this->v_[Y]; } +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + // * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * // template<class Cmpt> diff --git a/src/OpenFOAM/primitives/Vector2D/vector2D/vector2D.C b/src/OpenFOAM/primitives/Vector2D/vector2D/vector2D.C index e773e19608ecdb887ea4f94dc7557c2a8c1e8c26..4a73dada31b2e4bc7af3eb737c08ecea659e8ad9 100644 --- a/src/OpenFOAM/primitives/Vector2D/vector2D/vector2D.C +++ b/src/OpenFOAM/primitives/Vector2D/vector2D/vector2D.C @@ -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 @@ -28,33 +28,49 @@ Description #include "vector2D.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // template<> -const char* const vector2D::typeName = "vector2D"; +const char* const Foam::vector2D::vsType::typeName = "vector2D"; template<> -const char* vector2D::componentNames[] = {"x", "y"}; +const char* const Foam::vector2D::vsType::componentNames[] = {"x", "y"}; template<> -const vector2D vector2D::zero(0, 0); +const Foam::vector2D Foam::vector2D::vsType::vsType::zero +( + vector2D::uniform(0) +); template<> -const vector2D vector2D::one(1, 1); +const Foam::vector2D Foam::vector2D::vsType::one +( + vector2D::uniform(1) +); template<> -const vector2D vector2D::max(VGREAT, VGREAT); +const Foam::vector2D Foam::vector2D::vsType::max +( + vector2D::uniform(VGREAT) +); template<> -const vector2D vector2D::min(-VGREAT, -VGREAT); +const Foam::vector2D Foam::vector2D::vsType::min +( + vector2D::uniform(-VGREAT) +); -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +template<> +const Foam::vector2D Foam::vector2D::vsType::rootMax +( + vector2D::uniform(ROOTVGREAT) +); + +template<> +const Foam::vector2D Foam::vector2D::vsType::rootMin +( + vector2D::uniform(-ROOTVGREAT) +); -} // End namespace Foam // ************************************************************************* // diff --git a/src/OpenFOAM/primitives/VectorSpace/VectorSpace.H b/src/OpenFOAM/primitives/VectorSpace/VectorSpace.H index 05822b0fb86b3ef844a8aa747202b338eb33d1d6..2d650f43ae5c908003083ce31f4015cab85f432b 100644 --- a/src/OpenFOAM/primitives/VectorSpace/VectorSpace.H +++ b/src/OpenFOAM/primitives/VectorSpace/VectorSpace.H @@ -42,6 +42,7 @@ SourceFiles #include "direction.H" #include "scalar.H" #include "word.H" +#include "zero.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -77,6 +78,13 @@ class VectorSpace public: + //- The components of this vector space + Cmpt v_[nCmpt]; + + + //- VectorSpace type + typedef VectorSpace<Form, Cmpt, nCmpt> vsType; + //- Component type typedef Cmpt cmptType; @@ -92,8 +100,14 @@ public: // Static data members - //- The components of this vector space - Cmpt v_[nCmpt]; + static const char* const typeName; + static const char* const componentNames[]; + static const Form zero; + static const Form one; + static const Form max; + static const Form min; + static const Form rootMax; + static const Form rootMin; // Constructors @@ -123,6 +137,9 @@ public: inline void component(Cmpt&, const direction) const; inline void replace(const direction, const Cmpt&); + //- Return a VectorSpace with all elements = s + inline static Form uniform(const Cmpt& s); + // Member Operators @@ -133,7 +150,7 @@ public: inline void operator+=(const VectorSpace<Form, Cmpt, nCmpt>&); inline void operator-=(const VectorSpace<Form, Cmpt, nCmpt>&); - inline void operator=(const scalar); + inline void operator=(const Foam::zero); inline void operator*=(const scalar); inline void operator/=(const scalar); diff --git a/src/OpenFOAM/primitives/VectorSpace/VectorSpaceI.H b/src/OpenFOAM/primitives/VectorSpace/VectorSpaceI.H index 846c6e7f56c9c798cc9a035876f94a85321500d4..e1c88e61d869dd335cc11c959b443e823bc16e55 100644 --- a/src/OpenFOAM/primitives/VectorSpace/VectorSpaceI.H +++ b/src/OpenFOAM/primitives/VectorSpace/VectorSpaceI.H @@ -148,6 +148,15 @@ inline void VectorSpace<Form, Cmpt, nCmpt>::replace } +template<class Form, class Cmpt, int nCmpt> +inline Form VectorSpace<Form, Cmpt, nCmpt>::uniform(const Cmpt& s) +{ + Form v; + VectorSpaceOps<nCmpt,0>::eqOpS(v, s, eqOp<Cmpt>()); + return v; +} + + // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // template<class Form, class Cmpt, int nCmpt> @@ -219,12 +228,9 @@ inline void VectorSpace<Form, Cmpt, nCmpt>::operator-= template<class Form, class Cmpt, int nCmpt> -inline void VectorSpace<Form, Cmpt, nCmpt>::operator= -( - const scalar s -) +inline void VectorSpace<Form, Cmpt, nCmpt>::operator=(const Foam::zero) { - VectorSpaceOps<nCmpt,0>::eqOpS(*this, s, eqOp<Cmpt>()); + VectorSpaceOps<nCmpt,0>::eqOpS(*this, 0, eqOp<Cmpt>()); } diff --git a/src/OpenFOAM/primitives/bools/bool/bool.C b/src/OpenFOAM/primitives/bools/bool/bool.C index 5969cadcea37682ab506b53037a25ced700a9ace..267a8c16111e75df006b798f697a144766686076 100644 --- a/src/OpenFOAM/primitives/bools/bool/bool.C +++ b/src/OpenFOAM/primitives/bools/bool/bool.C @@ -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 @@ -31,7 +31,7 @@ const char* const Foam::pTraits<bool>::typeName = "bool"; const bool Foam::pTraits<bool>::zero = false; const bool Foam::pTraits<bool>::one = true; -const char* Foam::pTraits<bool>::componentNames[] = { "" }; +const char* const Foam::pTraits<bool>::componentNames[] = { "" }; Foam::pTraits<bool>::pTraits(const bool& p) : diff --git a/src/OpenFOAM/primitives/bools/bool/bool.H b/src/OpenFOAM/primitives/bools/bool/bool.H index a7de5ecf469fa155f5d25b1de482f2284ab11793..b1638ec05414ba300586d76f946a44950c185204 100644 --- a/src/OpenFOAM/primitives/bools/bool/bool.H +++ b/src/OpenFOAM/primitives/bools/bool/bool.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 @@ -84,7 +84,7 @@ public: // Static data members static const char* const typeName; - static const char* componentNames[]; + static const char* const componentNames[]; static const bool zero; static const bool one; diff --git a/src/OpenFOAM/primitives/ints/int32/int32.C b/src/OpenFOAM/primitives/ints/int32/int32.C index 4883be46d5293674a9f9dac707abf9f23b81f748..4a209fc50b9d0b011bd62b58221cdf5378160821 100644 --- a/src/OpenFOAM/primitives/ints/int32/int32.C +++ b/src/OpenFOAM/primitives/ints/int32/int32.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2014-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2014-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -34,7 +34,7 @@ const int32_t Foam::pTraits<int32_t>::max = INT32_MAX; const int32_t Foam::pTraits<int32_t>::rootMin = pTraits<int32_t>::min; const int32_t Foam::pTraits<int32_t>::rootMax = pTraits<int32_t>::max; -const char* Foam::pTraits<int32_t>::componentNames[] = { "" }; +const char* const Foam::pTraits<int32_t>::componentNames[] = { "" }; Foam::pTraits<int32_t>::pTraits(const int32_t& p) : diff --git a/src/OpenFOAM/primitives/ints/int32/int32.H b/src/OpenFOAM/primitives/ints/int32/int32.H index 694bfb57f74ae6db62689479ef7ca5c196f18717..0602a8e3458ebc53f138efe177f47466723caef7 100644 --- a/src/OpenFOAM/primitives/ints/int32/int32.H +++ b/src/OpenFOAM/primitives/ints/int32/int32.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2014-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2014-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -102,7 +102,7 @@ public: // Static data members static const char* const typeName; - static const char* componentNames[]; + static const char* const componentNames[]; static const int32_t zero; static const int32_t one; static const int32_t min; diff --git a/src/OpenFOAM/primitives/ints/int64/int64.C b/src/OpenFOAM/primitives/ints/int64/int64.C index 5b58fad539b3ec36227ffa7289b322724d867a73..f182c9d2760e453509428fe8980214541941d191 100644 --- a/src/OpenFOAM/primitives/ints/int64/int64.C +++ b/src/OpenFOAM/primitives/ints/int64/int64.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2014-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2014-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -34,7 +34,7 @@ const int64_t Foam::pTraits<int64_t>::max = INT64_MAX; const int64_t Foam::pTraits<int64_t>::rootMin = pTraits<int64_t>::min; const int64_t Foam::pTraits<int64_t>::rootMax = pTraits<int64_t>::max; -const char* Foam::pTraits<int64_t>::componentNames[] = { "" }; +const char* const Foam::pTraits<int64_t>::componentNames[] = { "" }; Foam::pTraits<int64_t>::pTraits(const int64_t& p) : diff --git a/src/OpenFOAM/primitives/ints/int64/int64.H b/src/OpenFOAM/primitives/ints/int64/int64.H index 38cd1057860e0788653b17a94f591e8f9744be10..6006321a2880ef4b816d21c2926d55dfe90ed8aa 100644 --- a/src/OpenFOAM/primitives/ints/int64/int64.H +++ b/src/OpenFOAM/primitives/ints/int64/int64.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2014-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2014-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -93,7 +93,7 @@ public: // Static data members static const char* const typeName; - static const char* componentNames[]; + static const char* const componentNames[]; static const int64_t zero; static const int64_t one; static const int64_t min; diff --git a/src/OpenFOAM/primitives/ints/uint32/uint32.C b/src/OpenFOAM/primitives/ints/uint32/uint32.C index 2ffe5445dc4369a73dea0e06175d16c44bbb5bd5..c195b355a457f57fab6d6c88824fca23282988a3 100644 --- a/src/OpenFOAM/primitives/ints/uint32/uint32.C +++ b/src/OpenFOAM/primitives/ints/uint32/uint32.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2014-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2014-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -34,7 +34,7 @@ const uint32_t Foam::pTraits<uint32_t>::max = INT32_MAX; const uint32_t Foam::pTraits<uint32_t>::rootMin = pTraits<uint32_t>::min; const uint32_t Foam::pTraits<uint32_t>::rootMax = pTraits<uint32_t>::max; -const char* Foam::pTraits<uint32_t>::componentNames[] = { "" }; +const char* const Foam::pTraits<uint32_t>::componentNames[] = { "" }; Foam::pTraits<uint32_t>::pTraits(const uint32_t& p) : diff --git a/src/OpenFOAM/primitives/ints/uint32/uint32.H b/src/OpenFOAM/primitives/ints/uint32/uint32.H index 3b0ad01c7a289e92368e9e68ecb98215a1e4be61..9c2a3b6833dd27f4d27330834e094dde5b34147f 100644 --- a/src/OpenFOAM/primitives/ints/uint32/uint32.H +++ b/src/OpenFOAM/primitives/ints/uint32/uint32.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2014-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2014-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -93,7 +93,7 @@ public: // Static data members static const char* const typeName; - static const char* componentNames[]; + static const char* const componentNames[]; static const uint32_t zero; static const uint32_t one; static const uint32_t min; diff --git a/src/OpenFOAM/primitives/ints/uint64/uint64.C b/src/OpenFOAM/primitives/ints/uint64/uint64.C index 63fd8b319429227bbb6f351fc6a40925f796ad35..b099c4b4e03fa2c2ff417025cf0aac20f51686b5 100644 --- a/src/OpenFOAM/primitives/ints/uint64/uint64.C +++ b/src/OpenFOAM/primitives/ints/uint64/uint64.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2014-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2014-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -34,7 +34,7 @@ const uint64_t Foam::pTraits<uint64_t>::max = INT64_MAX; const uint64_t Foam::pTraits<uint64_t>::rootMin = pTraits<uint64_t>::min; const uint64_t Foam::pTraits<uint64_t>::rootMax = pTraits<uint64_t>::max; -const char* Foam::pTraits<uint64_t>::componentNames[] = { "" }; +const char* const Foam::pTraits<uint64_t>::componentNames[] = { "" }; Foam::pTraits<uint64_t>::pTraits(const uint64_t& p) : diff --git a/src/OpenFOAM/primitives/ints/uint64/uint64.H b/src/OpenFOAM/primitives/ints/uint64/uint64.H index dc196594626d255b5600038bb894e4cfaaa8aa85..2d2e31f802f250f305a070939e53d8fb18d34db5 100644 --- a/src/OpenFOAM/primitives/ints/uint64/uint64.H +++ b/src/OpenFOAM/primitives/ints/uint64/uint64.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2014-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2014-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -93,7 +93,7 @@ public: // Static data members static const char* const typeName; - static const char* componentNames[]; + static const char* const componentNames[]; static const uint64_t zero; static const uint64_t one; static const uint64_t min; diff --git a/src/OpenFOAM/primitives/triad/triad.C b/src/OpenFOAM/primitives/triad/triad.C index 8bb2f7cd73c30fb8096ad3d5b9c5c89ab414d0b4..f73e82f4d4b9be30ac216f82e261bac5eaab99ff 100644 --- a/src/OpenFOAM/primitives/triad/triad.C +++ b/src/OpenFOAM/primitives/triad/triad.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2012-2014 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -29,73 +29,60 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -namespace Foam -{ - template<> -const char* const triad::Vector<vector>::typeName = "triad"; +const char* const Foam::triad::vsType::typeName = "triad"; template<> -const char* triad::Vector<vector>::componentNames[] = {"x", "y", "z"}; +const char* const Foam::triad::vsType::componentNames[] = {"x", "y", "z"}; -const triad triad::zero +template<> +const Foam::Vector<Foam::vector> Foam::triad::vsType::zero ( - vector(0, 0, 0), - vector(0, 0, 0), - vector(0, 0, 0) + triad::uniform(vector::uniform(0)) ); -const triad triad::one +template<> +const Foam::Vector<Foam::vector> Foam::triad::vsType::one ( - vector(1, 1, 1), - vector(1, 1, 1), - vector(1, 1, 1) + triad::uniform(vector::uniform(1)) ); -const triad triad::max +template<> +const Foam::Vector<Foam::vector> Foam::triad::vsType::max ( - vector(VGREAT, VGREAT, VGREAT), - vector(VGREAT, VGREAT, VGREAT), - vector(VGREAT, VGREAT, VGREAT) + triad::uniform(vector::uniform(VGREAT)) ); -const triad triad::min +template<> +const Foam::Vector<Foam::vector> Foam::triad::vsType::min ( - vector(-VGREAT, -VGREAT, -VGREAT), - vector(-VGREAT, -VGREAT, -VGREAT), - vector(-VGREAT, -VGREAT, -VGREAT) + triad::uniform(vector::uniform(-VGREAT)) ); -const triad triad::rootMax +template<> +const Foam::Vector<Foam::vector> Foam::triad::vsType::rootMax ( - vector(ROOTVGREAT, ROOTVGREAT, ROOTVGREAT), - vector(ROOTVGREAT, ROOTVGREAT, ROOTVGREAT), - vector(ROOTVGREAT, ROOTVGREAT, ROOTVGREAT) + triad::uniform(vector::uniform(ROOTVGREAT)) ); -const triad triad::rootMin +template<> +const Foam::Vector<Foam::vector> Foam::triad::vsType::rootMin ( - vector(-ROOTVGREAT, -ROOTVGREAT, -ROOTVGREAT), - vector(-ROOTVGREAT, -ROOTVGREAT, -ROOTVGREAT), - vector(-ROOTVGREAT, -ROOTVGREAT, -ROOTVGREAT) + triad::uniform(vector::uniform(-ROOTVGREAT)) ); -const triad triad::I +const Foam::triad Foam::triad::I ( vector(1, 0, 0), vector(0, 1, 0), vector(0, 0, 1) ); -const triad triad::unset +const Foam::triad Foam::triad::unset ( - vector(VGREAT, VGREAT, VGREAT), - vector(VGREAT, VGREAT, VGREAT), - vector(VGREAT, VGREAT, VGREAT) + triad::uniform(vector::uniform(VGREAT)) ); -} - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/primitives/triad/triad.H b/src/OpenFOAM/primitives/triad/triad.H index 8755b60bc13dec9ca076a526f6a22c84ee69d1a2..abe8ad0d27f72b28cb8fd69e43a2f0b809832a13 100644 --- a/src/OpenFOAM/primitives/triad/triad.H +++ b/src/OpenFOAM/primitives/triad/triad.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -96,12 +96,6 @@ public: // Static data members - static const triad zero; - static const triad one; - static const triad max; - static const triad min; - static const triad rootMax; - static const triad rootMin; static const triad I; static const triad unset;