src/OpenFOAM/primitives: Moved the standard static data members for vector and tensor types into VectorSpace

This simplifies the code easing maintenance and the addition of other
VectorSpace types.
This commit is contained in:
Henry Weller
2016-03-08 10:57:41 +00:00
parent 8a93701ef2
commit 93285d5fe1
49 changed files with 771 additions and 649 deletions

View File

@ -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 };

View File

@ -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>

View File

@ -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
// ************************************************************************* //

View File

@ -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)
:

View File

@ -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;

View File

@ -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;

View File

@ -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

View File

@ -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"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
template<>
const char* const labelSphericalTensor::typeName = "labelSphericalTensor";
const char* const Foam::labelSphericalTensor::vsType::typeName
(
"labelSphericalTensor"
);
template<>
const char* labelSphericalTensor::componentNames[] = {"ii"};
const char* const Foam::labelSphericalTensor::vsType::componentNames[] =
{
"ii"
};
template<>
const labelSphericalTensor labelSphericalTensor::zero(0);
const Foam::labelSphericalTensor
Foam::labelSphericalTensor::vsType::vsType::zero
(
labelSphericalTensor::uniform(0)
);
template<>
const labelSphericalTensor labelSphericalTensor::one(1);
const Foam::labelSphericalTensor Foam::labelSphericalTensor::vsType::one
(
labelSphericalTensor::uniform(1)
);
template<>
const labelSphericalTensor labelSphericalTensor::I(1);
const Foam::labelSphericalTensor Foam::labelSphericalTensor::vsType::max
(
labelSphericalTensor::uniform(labelMax)
);
template<>
const Foam::labelSphericalTensor Foam::labelSphericalTensor::vsType::min
(
labelSphericalTensor::uniform(-labelMax)
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<>
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
// ************************************************************************* //

View File

@ -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);
// ************************************************************************* //

View File

@ -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;

View File

@ -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

View File

@ -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
// ************************************************************************* //

View File

@ -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;

View File

@ -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 * * * * * * * * * * * * * //

View File

@ -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,
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
// ************************************************************************* //

View File

@ -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 symmTensor symmTensor::max
const Foam::symmTensor Foam::symmTensor::vsType::max
(
VGREAT, VGREAT, VGREAT,
VGREAT, VGREAT,
VGREAT
symmTensor::uniform(VGREAT)
);
template<>
const symmTensor symmTensor::min
const Foam::symmTensor Foam::symmTensor::vsType::min
(
-VGREAT, -VGREAT, -VGREAT,
-VGREAT, -VGREAT,
-VGREAT
symmTensor::uniform(-VGREAT)
);
template<>
const symmTensor symmTensor::I
const Foam::symmTensor Foam::symmTensor::vsType::rootMax
(
symmTensor::uniform(ROOTVGREAT)
);
template<>
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
// ************************************************************************* //

View File

@ -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;

View File

@ -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

View File

@ -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
(
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
// ************************************************************************* //

View File

@ -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;

View File

@ -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>

View File

@ -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::typeName = "labelTensor";
template<>
const char* const Foam::labelTensor::vsType::typeName = "labelTensor";
template<>
const char* Foam::labelTensor::componentNames[] =
{
template<>
const char* const Foam::labelTensor::vsType::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::vsType::zero
(
labelTensor::uniform(0)
);
template<>
const Foam::labelTensor Foam::labelTensor::one
(
1, 1, 1,
1, 1, 1,
1, 1, 1
);
}
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)))
);
// ************************************************************************* //

View File

@ -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 tensor::typeName = "tensor";
template<>
const char* const Foam::tensor::vsType::typeName = "tensor";
template<>
const char* tensor::componentNames[] =
{
template<>
const char* const Foam::tensor::vsType::componentNames[] =
{
"xx", "xy", "xz",
"yx", "yy", "yz",
"zx", "zy", "zz"
};
};
template<>
const tensor tensor::zero
(
0, 0, 0,
0, 0, 0,
0, 0, 0
);
template<>
const Foam::tensor Foam::tensor::vsType::zero(tensor::uniform(0));
template<>
const tensor tensor::one
(
1, 1, 1,
1, 1, 1,
1, 1, 1
);
template<>
const Foam::tensor Foam::tensor::vsType::one(tensor::uniform(1));
template<>
const tensor tensor::max
(
VGREAT, VGREAT, VGREAT,
VGREAT, VGREAT, VGREAT,
VGREAT, VGREAT, VGREAT
);
template<>
const Foam::tensor Foam::tensor::vsType::max(tensor::uniform(VGREAT));
template<>
const tensor tensor::min
(
-VGREAT, -VGREAT, -VGREAT,
-VGREAT, -VGREAT, -VGREAT,
-VGREAT, -VGREAT, -VGREAT
);
template<>
const Foam::tensor Foam::tensor::vsType::min(tensor::uniform(-VGREAT));
template<>
const tensor tensor::I
(
template<>
const Foam::tensor Foam::tensor::vsType::rootMax(tensor::uniform(ROOTVGREAT));
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
);
}
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -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;

View File

@ -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 * * * * * * * * * * * * * //

View File

@ -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<>

View File

@ -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);
};

View File

@ -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)

View File

@ -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"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
template<>
const char* const complexVector::typeName = "complexVector";
const char* const Foam::complexVector::vsType::typeName = "complexVector";
template<>
const char* complexVector::componentNames[] = {"x", "y", "z"};
const char* const Foam::complexVector::vsType::componentNames[] =
{
"x", "y", "z"
};
template<>
const complexVector complexVector::zero
const Foam::complexVector Foam::complexVector::vsType::zero
(
complex(0, 0),
complex(0, 0),
complex(0, 0)
complexVector::uniform(complex(0, 0))
);
template<>
const complexVector complexVector::one
const Foam::complexVector Foam::complexVector::vsType::one
(
complex(1, 1),
complex(1, 1),
complex(1, 1)
complexVector::uniform(complex(1, 1))
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<>
const Foam::complexVector Foam::complexVector::vsType::max
(
complexVector::uniform(complex(VGREAT, VGREAT))
);
template<>
const Foam::complexVector Foam::complexVector::vsType::min
(
complexVector::uniform(complex(-VGREAT, -VGREAT))
);
template<>
const Foam::complexVector Foam::complexVector::vsType::rootMax
(
complexVector::uniform(complex(ROOTVGREAT, ROOTVGREAT))
);
template<>
const Foam::complexVector Foam::complexVector::vsType::rootMin
(
complexVector::uniform(complex(-ROOTVGREAT, -ROOTVGREAT))
);
} // End namespace Foam
// ************************************************************************* //

View File

@ -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);
template<>
const floatVector floatVector::one(1, 1, 1);
template<>
const floatVector floatVector::max
const Foam::floatVector Foam::floatVector::vsType::zero
(
floatScalarVGREAT,
floatScalarVGREAT,
floatScalarVGREAT
floatVector::uniform(0)
);
template<>
const floatVector floatVector::min
const Foam::floatVector Foam::floatVector::vsType::one
(
-floatScalarVGREAT,
-floatScalarVGREAT,
-floatScalarVGREAT
floatVector::uniform(1)
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<>
const Foam::floatVector Foam::floatVector::vsType::max
(
floatVector::uniform(floatScalarVGREAT)
);
template<>
const Foam::floatVector Foam::floatVector::vsType::min
(
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
// ************************************************************************* //

View File

@ -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 char* Foam::labelVector::componentNames[] = {"x", "y", "z"};
template<>
const Foam::labelVector Foam::labelVector::vsType::zero
(
labelVector::uniform(0)
);
template<>
const Foam::labelVector Foam::labelVector::zero(0, 0, 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 Foam::labelVector Foam::labelVector::vsType::rootMax
(
labelVector::uniform(sqrt(scalar(labelMax)))
);
template<>
const Foam::labelVector Foam::labelVector::vsType::rootMin
(
labelVector::uniform(-sqrt(scalar(labelMax)))
);
template<>
const Foam::labelVector Foam::labelVector::one(1, 1, 1);
}
// ************************************************************************* //

View File

@ -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
// ************************************************************************* //

View File

@ -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 };

View File

@ -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>

View File

@ -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
// ************************************************************************* //

View File

@ -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);

View File

@ -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>());
}

View File

@ -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)
:

View File

@ -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;

View File

@ -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)
:

View File

@ -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;

View File

@ -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)
:

View File

@ -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;

View File

@ -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)
:

View File

@ -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;

View File

@ -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)
:

View File

@ -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;

View File

@ -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 Foam::triad::vsType::typeName = "triad";
template<>
const char* const triad::Vector<vector>::typeName = "triad";
const char* const Foam::triad::vsType::componentNames[] = {"x", "y", "z"};
template<>
const char* triad::Vector<vector>::componentNames[] = {"x", "y", "z"};
const triad triad::zero
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 * * * * * * * * * * * * * * //

View File

@ -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;