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 -------------------------------------------------------------------------------
10 License
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 
26 Class
27  Foam::VectorSpaceOps
28 
29 Description
30  Operator functions for VectorSpace.
31 
32 \*---------------------------------------------------------------------------*/
33 
34 #ifndef VectorSpaceOps_H
35 #define VectorSpaceOps_H
36 
37 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
38 
39 namespace Foam
40 {
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 //- General looping form. Executing at index <I> with termination at <N>
45 template<direction N, direction I>
46 struct 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);
74  VectorSpaceOps<N, I+1>::opVS(vs, vs1, s, o);
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]);
81  VectorSpaceOps<N, I+1>::opSV(vs, s, vs1, o);
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
94 template<direction N>
95 struct 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 // ************************************************************************* //
EqOp
#define EqOp(opName, op)
Definition: ops.H:50
Foam::VectorSpaceOps::opVS
static void opVS(V &vs, const V1 &vs1, const S &s, Op o)
Definition: VectorSpaceOps.H:70
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::VectorSpaceOps::eqOpS
static void eqOpS(V &vs, const S &s, EqOp eo)
Definition: VectorSpaceOps.H:48
Foam::VectorSpaceOps::SeqOp
static void SeqOp(S &s, const V &vs, EqOp eo)
Definition: VectorSpaceOps.H:55
Foam::VectorSpaceOps< N, N >::SeqOp
static void SeqOp(S &, const V &, EqOp)
Definition: VectorSpaceOps.H:100
Foam::VectorSpaceOps< N, N >::opVS
static void opVS(V &vs, const V1 &, const S &, Op)
Definition: VectorSpaceOps.H:106
Foam::VectorSpaceOps< N, N >::eqOpS
static void eqOpS(V &, const S &, EqOp)
Definition: VectorSpaceOps.H:97
Foam::VectorSpaceOps< N, N >::opSV
static void opSV(V &vs, const S &, const V1 &, Op)
Definition: VectorSpaceOps.H:109
Foam::VectorSpaceOps< N, N >::eqOp
static void eqOp(V1 &, const V2 &, EqOp)
Definition: VectorSpaceOps.H:103
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::VectorSpaceOps::eqOp
static void eqOp(V1 &vs1, const V2 &vs2, EqOp eo)
Definition: VectorSpaceOps.H:62
Foam::VectorSpaceOps::op
static void op(V &vs, const V1 &vs1, const V1 &vs2, Op o)
Definition: VectorSpaceOps.H:84
Foam::VectorSpaceOps::opSV
static void opSV(V &vs, const S &s, const V1 &vs1, Op o)
Definition: VectorSpaceOps.H:77
Foam::VectorSpaceOps< N, N >::op
static void op(V &vs, const V1 &, const V1 &, Op)
Definition: VectorSpaceOps.H:112
Foam::VectorSpaceOps
General looping form. Executing at index <I> with termination at <N>
Definition: VectorSpaceOps.H:45
N
const Vector< label > N(dict.get< Vector< label >>("N"))
Op
#define Op(opName, op)
Definition: ops.H:112
Foam::I
static const Identity< scalar > I
Definition: Identity.H:95