mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: declare generated methods for vector-space, primitives
- make read construct from Istream explicit BUG: sph(const SymmTensor2D<Cmpt>&) - had incorrect constant, but the 2D routines still need more attention (#1575)
This commit is contained in:
committed by
Andrew Heather
parent
6953760460
commit
4ecc6ccfca
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2018-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -67,20 +67,21 @@ class Tensor
|
||||
:
|
||||
public MatrixSpace<Tensor<Cmpt>, Cmpt, 3, 3>
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
//- Equivalent type of labels used for valid component indexing
|
||||
typedef Tensor<label> labelType;
|
||||
// Typedefs
|
||||
|
||||
//- Equivalent type of labels used for valid component indexing
|
||||
typedef Tensor<label> labelType;
|
||||
|
||||
|
||||
// Member constants
|
||||
// Member Constants
|
||||
|
||||
//- Rank of Tensor is 2
|
||||
static constexpr direction rank = 2;
|
||||
|
||||
|
||||
// Static data members
|
||||
// Static Data Members
|
||||
|
||||
static const Tensor I;
|
||||
|
||||
@ -89,10 +90,19 @@ public:
|
||||
enum components { XX, XY, XZ, YX, YY, YZ, ZX, ZY, ZZ };
|
||||
|
||||
|
||||
// Constructors
|
||||
// Generated Methods
|
||||
|
||||
//- Construct null
|
||||
inline Tensor();
|
||||
//- Default construct
|
||||
Tensor() = default;
|
||||
|
||||
//- Copy construct
|
||||
Tensor(const Tensor&) = default;
|
||||
|
||||
//- Copy assignment
|
||||
Tensor& operator=(const Tensor&) = default;
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct initialized to zero
|
||||
inline Tensor(const Foam::zero);
|
||||
@ -150,7 +160,7 @@ public:
|
||||
);
|
||||
|
||||
//- Construct from Istream
|
||||
inline Tensor(Istream& is);
|
||||
inline explicit Tensor(Istream& is);
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
@ -30,11 +30,6 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Cmpt>
|
||||
inline Foam::Tensor<Cmpt>::Tensor()
|
||||
{}
|
||||
|
||||
|
||||
template<class Cmpt>
|
||||
inline Foam::Tensor<Cmpt>::Tensor(const Foam::zero)
|
||||
:
|
||||
@ -66,12 +61,10 @@ inline Foam::Tensor<Cmpt>::Tensor
|
||||
|
||||
template<class Cmpt>
|
||||
inline Foam::Tensor<Cmpt>::Tensor(const SphericalTensor<Cmpt>& st)
|
||||
:
|
||||
Tensor::msType(Zero)
|
||||
{
|
||||
this->v_[XX] = st.ii();
|
||||
this->v_[YY] = st.ii();
|
||||
this->v_[ZZ] = st.ii();
|
||||
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;
|
||||
this->v_[ZX] = 0; this->v_[ZY] = 0; this->v_[ZZ] = st.ii();
|
||||
}
|
||||
|
||||
|
||||
@ -706,7 +699,10 @@ inline Cmpt tr(const Tensor<Cmpt>& t)
|
||||
template<class Cmpt>
|
||||
inline SphericalTensor<Cmpt> sph(const Tensor<Cmpt>& t)
|
||||
{
|
||||
return (1.0/3.0)*tr(t);
|
||||
return SphericalTensor<Cmpt>
|
||||
(
|
||||
(1.0/3.0)*tr(t)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user