Barycentric2DI.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) 2017 OpenFOAM Foundation
9  Copyright (C) 2019-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 )
45 {
46  this->v_[A] = va;
47  this->v_[B] = vb;
48  this->v_[C] = vc;
49 }
50 
51 
52 template<class Cmpt>
54 (
55  const Cmpt& va,
56  const Cmpt& vb
57 )
58 :
59  Barycentric2D<Cmpt>(va, vb, (pTraits<Cmpt>::one - va - vb))
60 {}
61 
62 
63 // * * * * * * * * * * * * * * * Member Operations * * * * * * * * * * * * * //
64 
65 template<class Cmpt>
67 (
68  const Barycentric2D<Cmpt>& b2
69 ) const
70 {
71  const Barycentric2D<Cmpt>& b1 = *this;
72 
73  return (b1.a()*b2.a() + b1.b()*b2.b() + b1.c()*b2.c());
74 }
75 
76 
77 template<class Cmpt>
78 inline bool Foam::Barycentric2D<Cmpt>::outside() const
79 {
80  return ((this->v_[A] < 0) || (this->v_[B]) < 0 || (this->v_[C] < 0));
81 }
82 
83 
84 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
85 
86 namespace Foam
87 {
88 
89 // * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
90 
91 template<class Cmpt>
92 inline Cmpt operator&
93 (
94  const Barycentric2D<Cmpt>& b1,
95  const Barycentric2D<Cmpt>& b2
96 )
97 {
98  return b1.inner(b2);
99 }
100 
101 
102 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
103 
104 } // End namespace Foam
105 
106 // ************************************************************************* //
Graphite solid properties.
Definition: C.H:46
const Cmpt & b() const noexcept
bool outside() const
True if any coordinate is negative.
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 & a() const noexcept
Cmpt inner(const Barycentric2D< Cmpt > &b2) const
Scalar-product of this with another Barycentric2D.
Templated 2D Barycentric derived from VectorSpace. Has 3 components, one of which is redundant...
Definition: Barycentric2D.H:50
volScalarField & C
const Cmpt & c() const noexcept
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
Definition: zero.H:57
static const Foam::dimensionedScalar A("", Foam::dimPressure, 611.21)
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
Barycentric2D()=default
Default construct.