sixDoFRigidBodyMotionStateIO.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-2014 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 
29 #include "IOstreams.H"
30 
31 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
32 
34 {
35  dict.add("centreOfRotation", centreOfRotation_);
36  dict.add("orientation", Q_);
37  dict.add("velocity", v_);
38  dict.add("acceleration", a_);
39  dict.add("angularMomentum", pi_);
40  dict.add("torque", tau_);
41 }
42 
43 
45 {
46  os.writeEntry("centreOfRotation", centreOfRotation_);
47  os.writeEntry("orientation", Q_);
48  os.writeEntry("velocity", v_);
49  os.writeEntry("acceleration", a_);
50  os.writeEntry("angularMomentum", pi_);
51  os.writeEntry("torque", tau_);
52 }
53 
54 
55 // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
56 
57 Foam::Istream& Foam::operator>>
58 (
59  Istream& is, sixDoFRigidBodyMotionState& sDoFRBMS
60 )
61 {
62  is >> sDoFRBMS.centreOfRotation_
63  >> sDoFRBMS.Q_
64  >> sDoFRBMS.v_
65  >> sDoFRBMS.a_
66  >> sDoFRBMS.pi_
67  >> sDoFRBMS.tau_;
68 
69  is.check(FUNCTION_NAME);
70  return is;
71 }
72 
73 
74 Foam::Ostream& Foam::operator<<
75 (
76  Ostream& os,
77  const sixDoFRigidBodyMotionState& sDoFRBMS
78 )
79 {
80  os << token::SPACE << sDoFRBMS.centreOfRotation()
81  << token::SPACE << sDoFRBMS.Q()
82  << token::SPACE << sDoFRBMS.v()
83  << token::SPACE << sDoFRBMS.a()
84  << token::SPACE << sDoFRBMS.pi()
85  << token::SPACE << sDoFRBMS.tau();
86 
88  return os;
89 }
90 
91 
92 // ************************************************************************* //
IOstreams.H
Useful combination of include files which define Sin, Sout and Serr and the use of IO streams general...
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::IOstream::check
virtual bool check(const char *operation) const
Check IOstream status for given operation.
Definition: IOstream.C:58
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
os
OBJstream os(runTime.globalPath()/outputName)
Foam::sixDoFRigidBodyMotionState
Holds the motion state of sixDoF object. Wrapped up together to allow rapid scatter to other processo...
Definition: sixDoFRigidBodyMotionState.H:67
Foam::sixDoFRigidBodyMotionState::write
void write(dictionary &dict) const
Write to dictionary.
Definition: sixDoFRigidBodyMotionStateIO.C:33
Foam::token::SPACE
Space [isspace].
Definition: token.H:125
FUNCTION_NAME
#define FUNCTION_NAME
Definition: messageStream.H:295
Foam::Ostream::writeEntry
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/value entry.
Definition: Ostream.H:236
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
sixDoFRigidBodyMotionState.H