Loading...
Searching...
No Matches
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 Copyright (C) 2025 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27\*---------------------------------------------------------------------------*/
28
30#include "IOstreams.H"
31#include "StringStream.H"
32
33// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
34
36 "vectorTensorTransform";
37
39(
40 Zero,
41 Zero,
42 false
43);
44
45
47(
48 Zero,
50 false
51);
52
53
54// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
55
58 is >> *this;
59}
60
61
62// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
63
65{
66 // Detect identity and zero rotations
67 hasR_ = !(R_.is_identity(tol) || Foam::mag(R_) < tol);
68}
69
70
71Foam::word Foam::name(const vectorTensorTransform& s)
72{
73 OStringStream buf;
74
75 buf << '(' << s.t() << ',' << s.R() << ')';
77 return buf.str();
78}
79
80
81// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
82
83Foam::Istream& Foam::operator>>(Istream& is, vectorTensorTransform& tr)
84{
85 is.readBegin("vectorTensorTransform");
86
87 is >> tr.t_ >> tr.R_ >> tr.hasR_;
88
89 is.readEnd("vectorTensorTransform");
91 is.check(FUNCTION_NAME);
92
93 return is;
94}
95
96
97Foam::Ostream& Foam::operator<<(Ostream& os, const vectorTensorTransform& tr)
98{
100 << tr.t() << token::SPACE << tr.R() << token::SPACE << tr.hasR()
102
103 return os;
104}
105
106
107// ************************************************************************* //
Useful combination of include files which define Sin, Sout and Serr and the use of IO streams general...
Input/output from string buffers.
virtual bool check(const char *operation) const
Check IOstream status for given operation.
Definition IOstream.C:45
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition Istream.H:60
bool readEnd(const char *funcName)
End read of data chunk, ends with ')'.
Definition Istream.C:152
bool readBegin(const char *funcName)
Begin read of data chunk, starts with '('.
Definition Istream.C:134
Output to string buffer, using a OSstream. Always UNCOMPRESSED.
Foam::string str() const
Get the string. As Foam::string instead of std::string (may change in future).
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
static const SphericalTensor I
@ BEGIN_LIST
Begin list [isseparator].
Definition token.H:174
@ END_LIST
End list [isseparator].
Definition token.H:175
@ SPACE
Space [isspace].
Definition token.H:144
Vector-tensor class used to perform translations and rotations in 3D space.
void checkRotation(const scalar tol=ROOTVSMALL)
Test for identity rotation and set hasR accordingly.
static const vectorTensorTransform I
static const vectorTensorTransform zero
vectorTensorTransform()
Default construct - no translation, identity rotation.
static const char *const typeName
A class for handling words, derived from Foam::string.
Definition word.H:66
OBJstream os(runTime.globalPath()/outputName)
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))
#define FUNCTION_NAME
dimensionedScalar tr(const dimensionedSphericalTensor &dt)
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces).
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
Istream & operator>>(Istream &, directionInfo &)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition exprTraits.C:127