Vector2DI.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
27 
28 template<class Cmpt>
30 {}
31 
32 
33 template<class Cmpt>
35 :
37 {}
38 
39 
40 template<class Cmpt>
42 (
43  const VectorSpace<Vector2D<Cmpt>, Cmpt, 2>& vs
44 )
45 :
47 {}
48 
49 
50 template<class Cmpt>
51 inline Foam::Vector2D<Cmpt>::Vector2D(const Cmpt& vx, const Cmpt& vy)
52 {
53  this->v_[X] = vx;
54  this->v_[Y] = vy;
55 }
56 
57 
58 template<class Cmpt>
60 :
61  Vector2D::vsType(is)
62 {}
63 
64 
65 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
66 
67 template<class Cmpt>
68 inline const Cmpt& Foam::Vector2D<Cmpt>::x() const
69 {
70  return this->v_[X];
71 }
72 
73 template<class Cmpt>
74 inline const Cmpt& Foam::Vector2D<Cmpt>::y() const
75 {
76  return this->v_[Y];
77 }
78 
79 
80 template<class Cmpt>
82 {
83  return this->v_[X];
84 }
85 
86 template<class Cmpt>
88 {
89  return this->v_[Y];
90 }
91 
92 
93 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
94 
95 namespace Foam
96 {
97 
98 // * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
99 
100 template<class Cmpt>
103 {
104  return Cmpt(v1.x()*v2.x() + v1.y()*v2.y());
105 }
106 
107 
108 template<class Cmpt>
109 inline scalar Vector2D<Cmpt>::perp(const Vector2D<Cmpt>& b) const
110 {
111  return x()*b.y()-y()*b.x();
112 }
113 
114 
115 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
116 
117 } // End namespace Foam
118 
119 // ************************************************************************* //
type
Types of root.
Definition: Roots.H:52
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
Templated vector space.
Definition: VectorSpace.H:53
const Cmpt & x() const
Definition: Vector2DI.H:68
scalar y
const Cmpt & y() const
Definition: Vector2DI.H:74
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
Definition: createFields.H:27
innerProduct< Vector2D< Cmpt >, Vector2D< Cmpt > >::type operator &(const Vector2D< Cmpt > &v1, const Vector2D< Cmpt > &v2)
Definition: Vector2DI.H:102
static const zero Zero
Definition: zero.H:97
PtrList< volScalarField > & Y
A class representing the concept of 0 used to avoid unnecessary manipulations for objects that are kn...
Definition: zero.H:49
Vector2D()
Construct null.
Definition: Vector2DI.H:29
Templated 2D Vector derived from VectorSpace adding construction from 2 components, element access using x() and y() member functions and the inner-product (dot-product).
Definition: Vector2D.H:51
Namespace for OpenFOAM.