vectorTensorTransform.C
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 \*---------------------------------------------------------------------------*/
27 
28 #include "vectorTensorTransform.H"
29 #include "IOstreams.H"
30 #include "StringStream.H"
31 
32 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
33 
34 const char* const Foam::vectorTensorTransform::typeName =
35  "vectorTensorTransform";
36 
38 (
39  Zero,
40  Zero,
41  false
42 );
43 
44 
46 (
47  Zero,
49  false
50 );
51 
52 
53 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
54 
56 {
57  is >> *this;
58 }
59 
60 
61 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
62 
63 Foam::word Foam::name(const vectorTensorTransform& s)
64 {
65  OStringStream buf;
66 
67  buf << '(' << s.t() << ',' << s.R() << ')';
68 
69  return buf.str();
70 }
71 
72 
73 template<>
75 (
77 ) const
78 {
79  return fld;
80 }
81 template<>
83 (
85 ) const
86 {
87  return fld;
88 }
89 template<>
91 (
92  const Field<scalar>& fld
93 ) const
94 {
95  return fld;
96 }
97 
98 
99 // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
100 
101 Foam::Istream& Foam::operator>>(Istream& is, vectorTensorTransform& tr)
102 {
103  is.readBegin("vectorTensorTransform");
104 
105  is >> tr.t_ >> tr.R_ >> tr.hasR_;
106 
107  is.readEnd("vectorTensorTransform");
109  is.check(FUNCTION_NAME);
110 
111  return is;
112 }
113 
114 
115 Foam::Ostream& Foam::operator<<(Ostream& os, const vectorTensorTransform& tr)
116 {
118  << tr.t() << token::SPACE << tr.R() << token::SPACE << tr.hasR()
119  << token::END_LIST;
120 
121  return os;
122 }
123 
124 
125 // ************************************************************************* //
static const char *const typeName
bool readBegin(const char *funcName)
Begin read of data chunk, starts with &#39;(&#39;.
Definition: Istream.C:134
Input/output from string buffers.
Vector-tensor class used to perform translations and rotations in 3D space.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
Begin list [isseparator].
Definition: token.H:161
Useful combination of include files which define Sin, Sout and Serr and the use of IO streams general...
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition: exprTraits.C:127
static const Identity< scalar > I
Definition: Identity.H:100
A class for handling words, derived from Foam::string.
Definition: word.H:63
Istream & operator>>(Istream &, directionInfo &)
Space [isspace].
Definition: token.H:131
dimensionedScalar tr(const dimensionedSphericalTensor &dt)
End list [isseparator].
Definition: token.H:162
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
static const vectorTensorTransform I
OBJstream os(runTime.globalPath()/outputName)
#define FUNCTION_NAME
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;for(const word &name :lagrangianScalarNames){ IOField< scalar > fld(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:77
static const vectorTensorTransform zero
A class for managing temporary objects.
Definition: HashPtrTable.H:50
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))
tmp< Field< Type > > transform(const Field< Type > &) const
Transform the given field.
vectorTensorTransform()
Default construct - no translation, identity rotation.
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:127