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 | Copyright (C) 2011-2015 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 Class
25  Foam::VectorSpaceOps
26 
27 Description
28  Operator functions for VectorSpace.
29 
30 \*---------------------------------------------------------------------------*/
31 
32 #ifndef VectorSpaceOps_H
33 #define VectorSpaceOps_H
34 
35 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
36 
37 namespace Foam
38 {
39 
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 
42 template<int N, int I>
43 class VectorSpaceOps
44 {
45 public:
46 
47  static const int endLoop = (I < N-1) ? 1 : 0;
48 
49  template<class V, class S, class EqOp>
50  static inline void eqOpS(V& vs, const S& s, EqOp eo)
51  {
52  eo(vs.v_[I], s);
54  }
55 
56  template<class S, class V, class EqOp>
57  static inline void SeqOp(S& s, const V& vs, EqOp eo)
58  {
59  eo(s, vs.v_[I]);
61  }
62 
63  template<class V1, class V2, class EqOp>
64  static inline void eqOp(V1& vs1, const V2& vs2, EqOp eo)
65  {
66  eo(vs1.v_[I], vs2.v_[I]);
68  }
69 
70 
71  template<class V, class V1, class S, class Op>
72  static inline void opVS(V& vs, const V1& vs1, const S& s, Op o)
73  {
74  vs.v_[I] = o(vs1.v_[I], s);
76  }
77 
78  template<class V, class S, class V1, class Op>
79  static inline void opSV(V& vs, const S& s, const V1& vs1, Op o)
80  {
81  vs.v_[I] = o(s, vs1.v_[I]);
83  }
84 
85  template<class V, class V1, class Op>
86  static inline void op(V& vs, const V1& vs1, const V1& vs2, Op o)
87  {
88  vs.v_[I] = o(vs1.v_[I], vs2.v_[I]);
90  }
91 };
92 
93 
94 template<>
95 class VectorSpaceOps<0, 0>
96 {
97 public:
98 
99  template<class V, class S, class EqOp>
100  static inline void eqOpS(V&, const S&, EqOp)
101  {}
102 
103  template<class S, class V, class EqOp>
104  static inline void SeqOp(S&, const V&, EqOp)
105  {}
106 
107  template<class V1, class V2, class EqOp>
108  static inline void eqOp(V1&, const V2&, EqOp)
109  {}
110 
111 
112  template<class V, class V1, class S, class Op>
113  static inline void opVS(V& vs, const V1&, const S&, Op)
114  {}
115 
116  template<class V, class S, class V1, class Op>
117  static inline void opSV(V& vs, const S&, const V1&, Op)
118  {}
119 
120  template<class V, class V1, class Op>
121  static inline void op(V& vs, const V1&, const V1&, Op)
122  {}
123 };
124 
125 
126 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
127 
128 } // End namespace Foam
129 
130 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
131 
132 #endif
133 
134 // ************************************************************************* //
static void opVS(V &vs, const V1 &vs1, const S &s, Op o)
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){gmvFile<< iter().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 ))
static void eqOpS(V &vs, const S &s, EqOp eo)
static const sphericalTensor I(1)
#define Op(opName, op)
Definition: ops.H:99
static void op(V &vs, const V1 &vs1, const V1 &vs2, Op o)
Namespace for OpenFOAM.
Operator functions for VectorSpace.
label N
Definition: createFields.H:22
static const int endLoop
#define EqOp(opName, op)
Definition: ops.H:46
static void opSV(V &vs, const S &s, const V1 &vs1, Op o)
static void eqOp(V1 &vs1, const V2 &vs2, EqOp eo)
static void SeqOp(S &s, const V &vs, EqOp eo)