Merge branch 'master' of github.com-OpenFOAM:OpenFOAM/OpenFOAM-dev
This commit is contained in:
137
src/OpenFOAM/primitives/Barycentric2D/BarycentricTensor2D.H
Normal file
137
src/OpenFOAM/primitives/Barycentric2D/BarycentricTensor2D.H
Normal file
@ -0,0 +1,137 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration | Website: https://openfoam.org
|
||||||
|
\\ / A nd | Copyright (C) 2021 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::BarycentricTensor2D
|
||||||
|
|
||||||
|
Description
|
||||||
|
Templated 3x3 tensor derived from VectorSpace. Has 9 components. Can
|
||||||
|
represent a barycentric transformation as a matrix-barycentric inner-
|
||||||
|
product. Can alternatively represent an inverse barycentric transformation
|
||||||
|
as a vector-matrix inner-product.
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
BarycentricTensor2DI.H
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef BarycentricTensor2D_H
|
||||||
|
#define BarycentricTensor2D_H
|
||||||
|
|
||||||
|
#include "Barycentric2D.H"
|
||||||
|
#include "Tensor2D.H"
|
||||||
|
#include "Vector.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class BarycentricTensor2D Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
template<class Cmpt>
|
||||||
|
class BarycentricTensor2D
|
||||||
|
:
|
||||||
|
public MatrixSpace<BarycentricTensor2D<Cmpt>, Cmpt, 3, 3>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Equivalent type of labels used for valid component indexing
|
||||||
|
typedef Tensor2D<label> labelType;
|
||||||
|
|
||||||
|
|
||||||
|
// Member constants
|
||||||
|
|
||||||
|
//- Rank of BarycentricTensor2D is 2
|
||||||
|
static const direction rank = 2;
|
||||||
|
|
||||||
|
|
||||||
|
//- Component labeling enumeration
|
||||||
|
enum components { XA, XB, XC, YA, YB, YC, ZA, ZB, ZC };
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct null
|
||||||
|
BarycentricTensor2D();
|
||||||
|
|
||||||
|
//- Construct initialised to zero
|
||||||
|
BarycentricTensor2D(const Foam::zero);
|
||||||
|
|
||||||
|
//- Construct given three barycentric components (rows)
|
||||||
|
BarycentricTensor2D
|
||||||
|
(
|
||||||
|
const Barycentric2D<Cmpt>& x,
|
||||||
|
const Barycentric2D<Cmpt>& y,
|
||||||
|
const Barycentric2D<Cmpt>& z
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct given three vector components (columns)
|
||||||
|
BarycentricTensor2D
|
||||||
|
(
|
||||||
|
const Vector<Cmpt>& a,
|
||||||
|
const Vector<Cmpt>& b,
|
||||||
|
const Vector<Cmpt>& c
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
// Row-barycentric access
|
||||||
|
|
||||||
|
inline Barycentric2D<Cmpt> x() const;
|
||||||
|
inline Barycentric2D<Cmpt> y() const;
|
||||||
|
inline Barycentric2D<Cmpt> z() const;
|
||||||
|
|
||||||
|
// Column-vector access
|
||||||
|
|
||||||
|
inline Vector<Cmpt> a() const;
|
||||||
|
inline Vector<Cmpt> b() const;
|
||||||
|
inline Vector<Cmpt> c() const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
template<class Cmpt>
|
||||||
|
class typeOfTranspose<Cmpt, BarycentricTensor2D<Cmpt>>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
typedef void type;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#include "BarycentricTensor2DI.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
179
src/OpenFOAM/primitives/Barycentric2D/BarycentricTensor2DI.H
Normal file
179
src/OpenFOAM/primitives/Barycentric2D/BarycentricTensor2DI.H
Normal file
@ -0,0 +1,179 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration | Website: https://openfoam.org
|
||||||
|
\\ / A nd | Copyright (C) 2021 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Cmpt>
|
||||||
|
inline Foam::BarycentricTensor2D<Cmpt>::BarycentricTensor2D()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Cmpt>
|
||||||
|
inline Foam::BarycentricTensor2D<Cmpt>::BarycentricTensor2D(const Foam::zero)
|
||||||
|
:
|
||||||
|
BarycentricTensor2D::msType(Zero)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Cmpt>
|
||||||
|
inline Foam::BarycentricTensor2D<Cmpt>::BarycentricTensor2D
|
||||||
|
(
|
||||||
|
const Barycentric2D<Cmpt>& x,
|
||||||
|
const Barycentric2D<Cmpt>& y,
|
||||||
|
const Barycentric2D<Cmpt>& z
|
||||||
|
)
|
||||||
|
{
|
||||||
|
this->v_[XA] = x.a();
|
||||||
|
this->v_[XB] = x.b();
|
||||||
|
this->v_[XC] = x.c();
|
||||||
|
|
||||||
|
this->v_[YA] = y.a();
|
||||||
|
this->v_[YB] = y.b();
|
||||||
|
this->v_[YC] = y.c();
|
||||||
|
|
||||||
|
this->v_[ZA] = z.a();
|
||||||
|
this->v_[ZB] = z.b();
|
||||||
|
this->v_[ZC] = z.c();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Cmpt>
|
||||||
|
inline Foam::BarycentricTensor2D<Cmpt>::BarycentricTensor2D
|
||||||
|
(
|
||||||
|
const Vector<Cmpt>& a,
|
||||||
|
const Vector<Cmpt>& b,
|
||||||
|
const Vector<Cmpt>& c
|
||||||
|
)
|
||||||
|
{
|
||||||
|
this->v_[XA] = a.x();
|
||||||
|
this->v_[XB] = b.x();
|
||||||
|
this->v_[XC] = c.x();
|
||||||
|
|
||||||
|
this->v_[YA] = a.y();
|
||||||
|
this->v_[YB] = b.y();
|
||||||
|
this->v_[YC] = c.y();
|
||||||
|
|
||||||
|
this->v_[ZA] = a.z();
|
||||||
|
this->v_[ZB] = b.z();
|
||||||
|
this->v_[ZC] = c.z();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Cmpt>
|
||||||
|
inline Foam::Barycentric2D<Cmpt> Foam::BarycentricTensor2D<Cmpt>::x() const
|
||||||
|
{
|
||||||
|
return
|
||||||
|
Barycentric2D<Cmpt>
|
||||||
|
(
|
||||||
|
this->v_[XA],
|
||||||
|
this->v_[XB],
|
||||||
|
this->v_[XC]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Cmpt>
|
||||||
|
inline Foam::Barycentric2D<Cmpt> Foam::BarycentricTensor2D<Cmpt>::y() const
|
||||||
|
{
|
||||||
|
return
|
||||||
|
Barycentric2D<Cmpt>
|
||||||
|
(
|
||||||
|
this->v_[YA],
|
||||||
|
this->v_[YB],
|
||||||
|
this->v_[YC]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Cmpt>
|
||||||
|
inline Foam::Barycentric2D<Cmpt> Foam::BarycentricTensor2D<Cmpt>::z() const
|
||||||
|
{
|
||||||
|
return
|
||||||
|
Barycentric2D<Cmpt>
|
||||||
|
(
|
||||||
|
this->v_[ZA],
|
||||||
|
this->v_[ZB],
|
||||||
|
this->v_[ZC]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Cmpt>
|
||||||
|
inline Foam::Vector<Cmpt> Foam::BarycentricTensor2D<Cmpt>::a() const
|
||||||
|
{
|
||||||
|
return Vector<Cmpt>(this->v_[XA], this->v_[YA], this->v_[ZA]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Cmpt>
|
||||||
|
inline Foam::Vector<Cmpt> Foam::BarycentricTensor2D<Cmpt>::b() const
|
||||||
|
{
|
||||||
|
return Vector<Cmpt>(this->v_[XB], this->v_[YB], this->v_[ZB]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Cmpt>
|
||||||
|
inline Foam::Vector<Cmpt> Foam::BarycentricTensor2D<Cmpt>::c() const
|
||||||
|
{
|
||||||
|
return Vector<Cmpt>(this->v_[XC], this->v_[YC], this->v_[ZC]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Cmpt>
|
||||||
|
inline Vector<Cmpt> operator&
|
||||||
|
(
|
||||||
|
const BarycentricTensor2D<Cmpt>& T,
|
||||||
|
const Barycentric2D<Cmpt>& b
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return Vector<Cmpt>(T.x() & b, T.y() & b, T.z() & b);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Cmpt>
|
||||||
|
inline Barycentric2D<Cmpt> operator&
|
||||||
|
(
|
||||||
|
const Vector<Cmpt>& v,
|
||||||
|
const BarycentricTensor2D<Cmpt>& T
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return Barycentric2D<Cmpt>(v & T.a(), v & T.b(), v & T.c());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,64 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration | Website: https://openfoam.org
|
||||||
|
\\ / A nd | Copyright (C) 2021 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Typedef
|
||||||
|
Foam::barycentricTensor2D
|
||||||
|
|
||||||
|
Description
|
||||||
|
A scalar version of the templated BarycentricTensor2D
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef barycentricTensor2D_H
|
||||||
|
#define barycentricTensor2D_H
|
||||||
|
|
||||||
|
#include "scalar.H"
|
||||||
|
#include "BarycentricTensor2D.H"
|
||||||
|
#include "contiguous.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
typedef BarycentricTensor2D<scalar> barycentricTensor2D;
|
||||||
|
|
||||||
|
|
||||||
|
template<>
|
||||||
|
inline bool contiguous<barycentricTensor2D>()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
Reference in New Issue
Block a user