VectorSpaceOps.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 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<direction N, direction I>
43 class VectorSpaceOps
44 {
45 public:
46 
47  template<class V, class S, class EqOp>
48  static inline void eqOpS(V& vs, const S& s, EqOp eo)
49  {
50  eo(vs.v_[I], s);
52  }
53 
54  template<class S, class V, class EqOp>
55  static inline void SeqOp(S& s, const V& vs, EqOp eo)
56  {
57  eo(s, vs.v_[I]);
59  }
60 
61  template<class V1, class V2, class EqOp>
62  static inline void eqOp(V1& vs1, const V2& vs2, EqOp eo)
63  {
64  eo(vs1.v_[I], vs2.v_[I]);
65  VectorSpaceOps<N, I + 1>::eqOp(vs1, vs2, eo);
66  }
67 
68 
69  template<class V, class V1, class S, class Op>
70  static inline void opVS(V& vs, const V1& vs1, const S& s, Op o)
71  {
72  vs.v_[I] = o(vs1.v_[I], s);
73  VectorSpaceOps<N, I + 1>::opVS(vs, vs1, s, o);
74  }
75 
76  template<class V, class S, class V1, class Op>
77  static inline void opSV(V& vs, const S& s, const V1& vs1, Op o)
78  {
79  vs.v_[I] = o(s, vs1.v_[I]);
80  VectorSpaceOps<N, I + 1>::opSV(vs, s, vs1, o);
81  }
82 
83  template<class V, class V1, class Op>
84  static inline void op(V& vs, const V1& vs1, const V1& vs2, Op o)
85  {
86  vs.v_[I] = o(vs1.v_[I], vs2.v_[I]);
87  VectorSpaceOps<N, I + 1>::op(vs, vs1, vs2, o);
88  }
89 };
90 
91 
92 template<direction N>
93 class VectorSpaceOps<N, N>
94 {
95 public:
96 
97  template<class V, class S, class EqOp>
98  static inline void eqOpS(V&, const S&, EqOp)
99  {}
100 
101  template<class S, class V, class EqOp>
102  static inline void SeqOp(S&, const V&, EqOp)
103  {}
104 
105  template<class V1, class V2, class EqOp>
106  static inline void eqOp(V1&, const V2&, EqOp)
107  {}
108 
109 
110  template<class V, class V1, class S, class Op>
111  static inline void opVS(V& vs, const V1&, const S&, Op)
112  {}
113 
114  template<class V, class S, class V1, class Op>
115  static inline void opSV(V& vs, const S&, const V1&, Op)
116  {}
117 
118  template<class V, class V1, class Op>
119  static inline void op(V& vs, const V1&, const V1&, Op)
120  {}
121 };
122 
123 
124 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
125 
126 } // End namespace Foam
127 
128 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
129 
130 #endif
131 
132 // ************************************************************************* //
Operator functions for VectorSpace.
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)
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.name(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
tmp< fvMatrix< Type > > S(const Pair< tmp< volScalarField::Internal >> &, const VolField< Type > &)
Namespace for OpenFOAM.
static const Identity< scalar > I
Definition: Identity.H:93
#define Op(opName, op)
Definition: ops.H:100
#define EqOp(opName, op)
Definition: ops.H:46