Loading...
Searching...
No Matches
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-------------------------------------------------------------------------------
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)
45{
46 this->v_[A] = va;
47 this->v_[B] = vb;
48 this->v_[C] = vc;
49}
50
51
52template<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
65template<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
77template<class Cmpt>
78inline 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// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
86namespace Foam
87{
88
89// * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
90
91template<class Cmpt>
92inline 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// ************************************************************************* //
static const Foam::dimensionedScalar A("", Foam::dimPressure, 611.21)
static const Foam::dimensionedScalar B("", Foam::dimless, 18.678)
Templated 2D Barycentric derived from VectorSpace. Has 3 components, one of which is redundant.
Barycentric2D()=default
Default construct.
const Cmpt & b() const noexcept
Cmpt inner(const Barycentric2D< Cmpt > &b2) const
Scalar-product of this with another Barycentric2D.
bool outside() const
True if any coordinate is negative.
const Cmpt & a() const noexcept
const Cmpt & c() const noexcept
Graphite solid properties.
Definition C.H:49
static const Barycentric2D< Cmpt > one
VectorSpace< Barycentric2D< 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.
static constexpr const zero Zero
Global zero (0).
Definition zero.H:127