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 -------------------------------------------------------------------------------
11 License
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 
31 template<class Cmpt>
33 :
35 {}
36 
37 
38 template<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 
54 template<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 
68 template<class Cmpt>
69 inline 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 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
78 
79 namespace Foam
80 {
81 
82 // * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
83 
84 template<class Cmpt>
85 inline 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 // ************************************************************************* //
A traits class, which is primarily used for primitives and vector-space.
Definition: pTraits.H:75
Templated vector space.
Definition: VectorSpace.H:52
const Cmpt & b() const noexcept
Definition: Barycentric.H:115
const Cmpt & c() const noexcept
Definition: Barycentric.H:116
const Cmpt & d() const noexcept
Definition: Barycentric.H:117
volScalarField & C
Templated 3D Barycentric derived from VectorSpace. Has 4 components, one of which is redundant...
Definition: Barycentric.H:50
Barycentric()=default
Default construct.
tmp< GeometricField< Type, faPatchField, areaMesh > > operator &(const faMatrix< Type > &, const DimensionedField< Type, areaMesh > &)
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
Definition: zero.H:57
const dimensionedScalar & D
const Cmpt & a() const noexcept
Definition: Barycentric.H:114
static const Foam::dimensionedScalar A("", Foam::dimPressure, 611.21)
Cmpt inner(const Barycentric< Cmpt > &b2) const
Scalar-product of this with another Barycentric.
Definition: BarycentricI.H:62
static const Foam::dimensionedScalar B("", Foam::dimless, 18.678)
Namespace for OpenFOAM.
A class representing the concept of 1 (one) that can be used to avoid manipulating objects known to b...
Definition: one.H:56
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:127