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 | Copyright (C) 2011-2016 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 \*---------------------------------------------------------------------------*/
25 
26 #include "vectorTensorTransform.H"
27 #include "IOstreams.H"
28 #include "OStringStream.H"
29 
30 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
31 
32 const char* const Foam::vectorTensorTransform::typeName =
33  "vectorTensorTransform";
34 
36 (
37  Zero,
38  Zero,
39  false
40 );
41 
42 
44 (
45  Zero,
47  false
48 );
49 
50 
51 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
52 
54 {
55  is >> *this;
56 }
57 
58 
59 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
60 
62 {
63  OStringStream buf;
64 
65  buf << '(' << s.t() << ',' << s.R() << ')';
66 
67  return buf.str();
68 }
69 
70 
71 template<>
73 (
74  const Field<bool>& fld
75 ) const
76 {
77  return fld;
78 }
79 template<>
81 (
82  const Field<label>& fld
83 ) const
84 {
85  return fld;
86 }
87 template<>
89 (
90  const Field<scalar>& fld
91 ) const
92 {
93  return fld;
94 }
95 
96 
97 // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
98 
100 {
101  // Read beginning of vectorTensorTransform
102  is.readBegin("vectorTensorTransform");
103 
104  is >> tr.t_ >> tr.R_ >> tr.hasR_;
105 
106  // Read end of vectorTensorTransform
107  is.readEnd("vectorTensorTransform");
108 
109  // Check state of Istream
110  is.check("operator>>(Istream&, vectorTensorTransform&)");
111 
112  return is;
113 }
114 
115 
117 {
118  os << token::BEGIN_LIST
119  << tr.t() << token::SPACE << tr.R() << token::SPACE << tr.hasR()
120  << token::END_LIST;
121 
122  return os;
123 }
124 
125 
126 // ************************************************************************* //
Istream & readBegin(const char *funcName)
Definition: Istream.C:86
string str() const
Return the string.
static const char *const typeName
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
virtual bool check(const char *operation) const
Check IOstream status for given operation.
Definition: IOstream.C:92
Useful combination of include files which define Sin, Sout and Serr and the use of IO streams general...
Istream & readEnd(const char *funcName)
Definition: Istream.C:103
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))
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){const word &name=lagrangianScalarNames[i];IOField< scalar > fld(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
static const Identity< scalar > I
Definition: Identity.H:93
Pre-declare SubField and related Field type.
Definition: Field.H:57
A class for handling words, derived from string.
Definition: word.H:59
Istream & operator>>(Istream &, directionInfo &)
static const zero Zero
Definition: zero.H:91
dimensionedScalar tr(const dimensionedSphericalTensor &dt)
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
static const vectorTensorTransform I
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
Ostream & operator<<(Ostream &, const ensightPart &)
tmp< Field< Type > > transform(const Field< Type > &) const
Transform the given field.
static const vectorTensorTransform zero
A class for managing temporary objects.
Definition: PtrList.H:54
Output to memory buffer stream.
Definition: OStringStream.H:49