Loading...
Searching...
No Matches
BarycentricI.H
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2016-2017 OpenFOAM Foundation
9 Copyright (C) 2022 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANB WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27\*---------------------------------------------------------------------------*/
28
29// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
30
31template<class Cmpt>
33:
35{}
36
37
38template<class Cmpt>
40(
41 const Cmpt& va,
42 const Cmpt& vb,
43 const Cmpt& vc,
44 const Cmpt& vd
45)
46{
47 this->v_[A] = va;
48 this->v_[B] = vb;
49 this->v_[C] = vc;
50 this->v_[D] = vd;
51}
52
53
54template<class Cmpt>
56(
57 const Cmpt& va,
58 const Cmpt& vb,
59 const Cmpt& vc
60)
61:
62 Barycentric<Cmpt>(va, vb, vc, (pTraits<Cmpt>::one - va - vb - vc))
63{}
64
65
66// * * * * * * * * * * * * * * * Member Operations * * * * * * * * * * * * * //
67
68template<class Cmpt>
69inline Cmpt Foam::Barycentric<Cmpt>::inner(const Barycentric<Cmpt>& b2) const
70{
71 const Barycentric<Cmpt>& b1 = *this;
72
73 return (b1.a()*b2.a() + b1.b()*b2.b() + b1.c()*b2.c() + b1.d()*b2.d());
74}
75
76
77// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
79namespace Foam
80{
81
82// * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
83
84template<class Cmpt>
85inline Cmpt operator&(const Barycentric<Cmpt>& b1, const Barycentric<Cmpt>& b2)
86{
87 return b1.inner(b2);
88}
89
90
91// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
92
93} // End namespace Foam
94
95// ************************************************************************* //
static const Foam::dimensionedScalar A("", Foam::dimPressure, 611.21)
Templated 3D Barycentric derived from VectorSpace. Has 4 components, one of which is redundant.
Definition Barycentric.H:53
Barycentric()=default
Default construct.
Cmpt inner(const Barycentric< Cmpt > &b2) const
Scalar-product of this with another Barycentric.
const Cmpt & b() const noexcept
const Cmpt & d() const noexcept
const Cmpt & a() const noexcept
const Cmpt & c() const noexcept
VectorSpace< Barycentric< Cmpt >, Cmpt, Ncmpts > vsType
Definition VectorSpace.H:86
A traits class, which is primarily used for primitives and vector-space.
Definition pTraits.H:64
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
Definition zero.H:58
Namespace for OpenFOAM.
tmp< GeometricField< Type, faPatchField, areaMesh > > operator&(const faMatrix< Type > &, const DimensionedField< Type, areaMesh > &)
static constexpr const zero Zero
Global zero (0).
Definition zero.H:127