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 | Copyright (C) 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 "rigidBodyModelState.H"
27 #include "IOstreams.H"
28 
29 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
30 
32 {
33  dict.add("q", q_);
34  dict.add("qDot", qDot_);
35  dict.add("qDdot", qDdot_);
36  dict.add("deltaT", deltaT_);
37 }
38 
39 
41 {
42  os.writeKeyword("q") << q_ << token::END_STATEMENT << nl;
43  os.writeKeyword("qDot") << qDot_ << token::END_STATEMENT << nl;
44  os.writeKeyword("qDdot") << qDdot_ << token::END_STATEMENT << nl;
45  os.writeKeyword("deltaT") << deltaT_ << token::END_STATEMENT << nl;
46 }
47 
48 
49 // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
50 
51 Foam::Istream& Foam::RBD::operator>>
52 (
53  Istream& is,
54  rigidBodyModelState& state
55 )
56 {
57  is >> state.q_
58  >> state.qDot_
59  >> state.qDdot_
60  >> state.deltaT_;
61 
62  // Check state of Istream
63  is.check
64  (
65  "Foam::Istream& Foam::operator>>"
66  "(Foam::Istream&, Foam::RBD::rigidBodyModelState&)"
67  );
68 
69  return is;
70 }
71 
72 
73 Foam::Ostream& Foam::RBD::operator<<
74 (
75  Ostream& os,
76  const rigidBodyModelState& state
77 )
78 {
79  os << state.q_
80  << token::SPACE << state.qDot_
81  << token::SPACE << state.qDdot_
82  << token::SPACE << state.deltaT_;
83 
84  // Check state of Ostream
85  os.check
86  (
87  "Foam::Ostream& Foam::operator<<(Foam::Ostream&, "
88  "const Foam::RBD::rigidBodyModelState&)"
89  );
90 
91  return os;
92 }
93 
94 
95 // ************************************************************************* //
dictionary dict
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
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
bool add(entry *, bool mergeEntry=false)
Add a new entry.
Definition: dictionary.C:737
Useful combination of include files which define Sin, Sout and Serr and the use of IO streams general...
Holds the motion state of rigid-body model.
void write(dictionary &dict) const
Write to dictionary.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
static const char nl
Definition: Ostream.H:262
Ostream & writeKeyword(const keyType &)
Write the keyword followed by an appropriate indentation.
Definition: Ostream.C:54