Vector2DI.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) 2011-2016 OpenFOAM Foundation
9  Copyright (C) 2018 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  ANY 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 {}
34 
35 
36 template<class Cmpt>
38 :
40 {}
41 
42 
43 template<class Cmpt>
45 (
46  const VectorSpace<Vector2D<Cmpt>, Cmpt, 2>& vs
47 )
48 :
50 {}
51 
52 
53 template<class Cmpt>
54 inline Foam::Vector2D<Cmpt>::Vector2D(const Cmpt& vx, const Cmpt& vy)
55 {
56  this->v_[X] = vx;
57  this->v_[Y] = vy;
58 }
59 
60 
61 template<class Cmpt>
63 :
64  Vector2D::vsType(is)
65 {}
66 
67 
68 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
69 
70 template<class Cmpt>
71 inline const Cmpt& Foam::Vector2D<Cmpt>::x() const
72 {
73  return this->v_[X];
74 }
75 
76 
77 template<class Cmpt>
78 inline const Cmpt& Foam::Vector2D<Cmpt>::y() const
79 {
80  return this->v_[Y];
81 }
82 
83 
84 template<class Cmpt>
86 {
87  return this->v_[X];
88 }
89 
90 
91 template<class Cmpt>
93 {
94  return this->v_[Y];
95 }
96 
97 
98 template<class Cmpt>
100 {
101  const scalar s(Foam::mag(*this));
102 
103  if (s < ROOTVSMALL)
104  {
105  *this = Zero;
106  }
107  else
108  {
109  *this /= s;
110  }
111 
112  return *this;
113 }
114 
115 
116 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
117 
118 namespace Foam
119 {
120 
121 // * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
122 
123 template<class Cmpt>
126 {
127  return Cmpt(v1.x()*v2.x() + v1.y()*v2.y());
128 }
129 
130 
131 template<class Cmpt>
132 inline scalar Vector2D<Cmpt>::perp(const Vector2D<Cmpt>& b) const
133 {
134  return x()*b.y()-y()*b.x();
135 }
136 
137 
138 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
139 
140 } // End namespace Foam
141 
142 // ************************************************************************* //
s
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
Definition: gmvOutputSpray.H:25
Foam::operator&
tmp< GeometricField< Type, fvPatchField, volMesh > > operator&(const fvMatrix< Type > &, const DimensionedField< Type, volMesh > &)
Foam::Zero
static constexpr const zero Zero
Global zero.
Definition: zero.H:128
Foam::innerProduct
Definition: products.H:141
Foam::Vector2D::Vector2D
Vector2D()
Construct null.
Definition: Vector2DI.H:32
Foam::Vector2D
Templated 2D Vector derived from VectorSpace adding construction from 2 components,...
Definition: Vector2D.H:55
Foam::VectorSpace
Templated vector space.
Definition: VectorSpace.H:56
Foam::constant::physicoChemical::b
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
Definition: createFields.H:27
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Y
PtrList< volScalarField > & Y
Definition: createFieldRefs.H:7
Foam::mag
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
Foam::Vector2D::normalise
Vector2D< Cmpt > & normalise()
Normalise the vector by its magnitude.
Definition: Vector2DI.H:99
Foam::type
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition: MSwindows.C:590
x
x
Definition: LISASMDCalcMethod2.H:52
Foam::Vector2D::y
const Cmpt & y() const
Access to the vector y component.
Definition: Vector2DI.H:78
Foam::Vector2D::perp
scalar perp(const Vector2D< Cmpt > &b) const
Perp dot product (dot product with perpendicular vector)
Definition: Vector2DI.H:132
Foam::Vector2D::x
const Cmpt & x() const
Access to the vector x component.
Definition: Vector2DI.H:71
y
scalar y
Definition: LISASMDCalcMethod1.H:14
Foam::zero
A class representing the concept of 0 (zero), which can be used to avoid manipulating objects that ar...
Definition: zero.H:61