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 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  vector::zero,
38  tensor::zero,
39  false
40 );
41 
42 
44 (
45  vector::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 // ************************************************************************* //
Foam::vectorTensorTransform::zero
static const vectorTensorTransform zero
Definition: vectorTensorTransform.H:83
Foam::Istream::readEnd
Istream & readEnd(const char *funcName)
Definition: Istream.C:105
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 string.
Definition: word.H:59
Foam::vectorTensorTransform::vectorTensorTransform
vectorTensorTransform()
Construct null.
Definition: vectorTensorTransformI.H:28
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:118
Foam::vectorTensorTransform::transform
tmp< Field< Type > > transform(const Field< Type > &) const
Transform the given field.
Foam::vectorTensorTransform::typeName
static const char *const typeName
Definition: vectorTensorTransform.H:81
Foam::OStringStream::str
string str() const
Return the string.
Definition: OStringStream.H:107
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:57
OStringStream.H
Foam::operator<<
Ostream & operator<<(Ostream &, const edgeMesh &)
Definition: edgeMeshIO.C:130
Foam::I
static const sphericalTensor I(1)
Foam::IOstream::check
virtual bool check(const char *operation) const
Check IOstream status for given operation.
Definition: IOstream.C:92
fld
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))
s
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))
Foam::token::BEGIN_LIST
@ BEGIN_LIST
Definition: token.H:100
Foam::OStringStream
Output to memory buffer stream.
Definition: OStringStream.H:49
Foam::vectorTensorTransform::I
static const vectorTensorTransform I
Definition: vectorTensorTransform.H:85
Foam::vectorTensorTransform
Vector-tensor class used to perform translations and rotations in 3D space.
Definition: vectorTensorTransform.H:61
Foam::operator>>
Istream & operator>>(Istream &, edgeMesh &)
Definition: edgeMeshIO.C:141
Foam::tr
dimensionedScalar tr(const dimensionedSphericalTensor &dt)
Definition: dimensionedSphericalTensor.C:49
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:53
Foam::Istream::readBegin
Istream & readBegin(const char *funcName)
Definition: Istream.C:88
vectorTensorTransform.H
Foam::name
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
Foam::token::END_LIST
@ END_LIST
Definition: token.H:101
Foam::token::SPACE
@ SPACE
Definition: token.H:95