rigidBodyModelStateIO.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) 2016-2017 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 "rigidBodyModelState.H"
29 #include "IOstreams.H"
30 
31 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
32 
34 {
35  dict.add("q", q_);
36  dict.add("qDot", qDot_);
37  dict.add("qDdot", qDdot_);
38  dict.add("t", t_);
39  dict.add("deltaT", deltaT_);
40 }
41 
42 
44 {
45  os.writeEntry("q", q_);
46  os.writeEntry("qDot", qDot_);
47  os.writeEntry("qDdot", qDdot_);
48  os.writeEntry("t", t_);
49  os.writeEntry("deltaT", deltaT_);
50 }
51 
52 
53 // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
54 
55 Foam::Istream& Foam::RBD::operator>>
56 (
57  Istream& is,
58  rigidBodyModelState& state
59 )
60 {
61  is >> state.q_
62  >> state.qDot_
63  >> state.qDdot_
64  >> state.t_
65  >> state.deltaT_;
66 
67  is.check(FUNCTION_NAME);
68  return is;
69 }
70 
71 
72 Foam::Ostream& Foam::RBD::operator<<
73 (
74  Ostream& os,
75  const rigidBodyModelState& state
76 )
77 {
78  os << state.q_
79  << token::SPACE << state.qDot_
80  << token::SPACE << state.qDdot_
81  << token::SPACE << state.t_
82  << token::SPACE << state.deltaT_;
83 
84  os.check(FUNCTION_NAME);
85  return os;
86 }
87 
88 
89 // ************************************************************************* //
IOstreams.H
Useful combination of include files which define Sin, Sout and Serr and the use of IO streams general...
Foam::RBD::rigidBodyModelState
Holds the motion state of rigid-body model.
Definition: rigidBodyModelState.H:67
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::RBD::rigidBodyModelState::write
void write(dictionary &dict) const
Write to dictionary.
Definition: rigidBodyModelStateIO.C:33
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)
rigidBodyModelState.H
Foam::token::SPACE
Space [isspace].
Definition: token.H:125
FUNCTION_NAME
#define FUNCTION_NAME
Definition: messageStream.H:295
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56