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 
64 {
65  OStringStream buf;
66 
67  buf << '(' << s.t() << ',' << s.R() << ')';
68 
69  return buf.str();
70 }
71 
72 
73 template<>
75 (
76  const Field<bool>& fld
77 ) const
78 {
79  return fld;
80 }
81 template<>
83 (
84  const Field<label>& fld
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 
102 {
103  is.readBegin("vectorTensorTransform");
104 
105  is >> tr.t_ >> tr.R_ >> tr.hasR_;
106 
107  is.readEnd("vectorTensorTransform");
108 
109  is.check(FUNCTION_NAME);
110 
111  return is;
112 }
113 
114 
116 {
118  << tr.t() << token::SPACE << tr.R() << token::SPACE << tr.hasR()
119  << token::END_LIST;
120 
121  return os;
122 }
123 
124 
125 // ************************************************************************* //
Foam::vectorTensorTransform::zero
static const vectorTensorTransform zero
Definition: vectorTensorTransform.H:85
IOstreams.H
Useful combination of include files which define Sin, Sout and Serr and the use of IO streams general...
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
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::vectorTensorTransform::vectorTensorTransform
vectorTensorTransform()
Default construct - no translation, identity rotation.
Definition: vectorTensorTransformI.H:30
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::Zero
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:131
Foam::vectorTensorTransform::transform
tmp< Field< Type > > transform(const Field< Type > &) const
Transform the given field.
StringStream.H
Input/output from string buffers.
Foam::operator>>
Istream & operator>>(Istream &, directionInfo &)
Definition: directionInfo.C:230
Foam::Istream::readEnd
bool readEnd(const char *funcName)
End read of data chunk, ends with ')'.
Definition: Istream.C:129
Foam::vectorTensorTransform::typeName
static const char *const typeName
Definition: vectorTensorTransform.H:83
Foam::Istream::readBegin
bool readBegin(const char *funcName)
Begin read of data chunk, starts with '('.
Definition: Istream.C:111
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
Foam::Field< bool >
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
fld
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))
Definition: gmvOutputLagrangian.H:23
Foam::IOstream::check
virtual bool check(const char *operation) const
Check IOstream status for given operation.
Definition: IOstream.C:58
os
OBJstream os(runTime.globalPath()/outputName)
Foam::Detail::StringStreamAllocator::str
Foam::string str() const
Get the string - as Foam::string rather than std::string.
Definition: StringStream.H:88
Foam::OStringStream
Output to string buffer, using a OSstream. Always UNCOMPRESSED.
Definition: StringStream.H:227
Foam::vectorTensorTransform::I
static const vectorTensorTransform I
Definition: vectorTensorTransform.H:87
Foam::vectorTensorTransform
Vector-tensor class used to perform translations and rotations in 3D space.
Definition: vectorTensorTransform.H:63
Foam::token::SPACE
Space [isspace].
Definition: token.H:125
FUNCTION_NAME
#define FUNCTION_NAME
Definition: messageStream.H:295
Foam::token::END_LIST
End list [isseparator].
Definition: token.H:156
Foam::name
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59
Foam::tr
dimensionedScalar tr(const dimensionedSphericalTensor &dt)
Definition: dimensionedSphericalTensor.C:51
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
vectorTensorTransform.H
Foam::token::BEGIN_LIST
Begin list [isseparator].
Definition: token.H:155
Foam::I
static const Identity< scalar > I
Definition: Identity.H:95