VectorSpaceOps.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-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26Class
27 Foam::VectorSpaceOps
28
29Description
30 Operator functions for VectorSpace.
31
32\*---------------------------------------------------------------------------*/
33
34#ifndef VectorSpaceOps_H
35#define VectorSpaceOps_H
36
37// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
38
39namespace Foam
40{
41
42// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43
44//- General looping form. Executing at index <I> with termination at <N>
45template<direction N, direction I>
46struct VectorSpaceOps
47{
48 template<class V, class S, class EqOp>
49 static inline void eqOpS(V& vs, const S& s, EqOp eo)
50 {
51 eo(vs.v_[I], s);
53 }
54
55 template<class S, class V, class EqOp>
56 static inline void SeqOp(S& s, const V& vs, EqOp eo)
57 {
58 eo(s, vs.v_[I]);
60 }
61
62 template<class V1, class V2, class EqOp>
63 static inline void eqOp(V1& vs1, const V2& vs2, EqOp eo)
64 {
65 eo(vs1.v_[I], vs2.v_[I]);
66 VectorSpaceOps<N, I+1>::eqOp(vs1, vs2, eo);
67 }
68
69
70 template<class V, class V1, class S, class Op>
71 static inline void opVS(V& vs, const V1& vs1, const S& s, Op o)
72 {
73 vs.v_[I] = o(vs1.v_[I], s);
75 }
76
77 template<class V, class S, class V1, class Op>
78 static inline void opSV(V& vs, const S& s, const V1& vs1, Op o)
79 {
80 vs.v_[I] = o(s, vs1.v_[I]);
82 }
83
84 template<class V, class V1, class Op>
85 static inline void op(V& vs, const V1& vs1, const V1& vs2, Op o)
86 {
87 vs.v_[I] = o(vs1.v_[I], vs2.v_[I]);
88 VectorSpaceOps<N, I+1>::op(vs, vs1, vs2, o);
89 }
90};
91
92
93//- Loop termination form, when index and loop count <N> are identical
94template<direction N>
95struct VectorSpaceOps<N, N>
96{
97 template<class V, class S, class EqOp>
98 static inline void eqOpS(V&, const S&, EqOp) {}
99
100 template<class S, class V, class EqOp>
101 static inline void SeqOp(S&, const V&, EqOp) {}
102
103 template<class V1, class V2, class EqOp>
104 static inline void eqOp(V1&, const V2&, EqOp) {}
105
106 template<class V, class V1, class S, class Op>
107 static inline void opVS(V& vs, const V1&, const S&, Op) {}
108
109 template<class V, class S, class V1, class Op>
110 static inline void opSV(V& vs, const S&, const V1&, Op) {}
111
112 template<class V, class V1, class Op>
113 static inline void op(V& vs, const V1&, const V1&, Op) {}
114};
115
116
117// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
118
119} // End namespace Foam
120
121// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
122
123#endif
124
125// ************************************************************************* //
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))
Namespace for OpenFOAM.
static const Identity< scalar > I
Definition: Identity.H:94
#define Op(opName, op)
Definition: ops.H:112
#define EqOp(opName, op)
Definition: ops.H:50
static void SeqOp(S &, const V &, EqOp)
static void opVS(V &vs, const V1 &, const S &, Op)
static void op(V &vs, const V1 &, const V1 &, Op)
static void eqOpS(V &, const S &, EqOp)
static void opSV(V &vs, const S &, const V1 &, Op)
static void eqOp(V1 &, const V2 &, EqOp)
General looping form. Executing at index <I> with termination at <N>
static void opVS(V &vs, const V1 &vs1, const S &s, Op o)
static void opSV(V &vs, const S &s, const V1 &vs1, Op o)
static void SeqOp(S &s, const V &vs, EqOp eo)
static void eqOpS(V &vs, const S &s, EqOp eo)
static void eqOp(V1 &vs1, const V2 &vs2, EqOp eo)
static void op(V &vs, const V1 &vs1, const V1 &vs2, Op o)
Definition: ops.H:71
const Vector< label > N(dict.get< Vector< label > >("N"))