FreeFOAM The Cross-Platform CFD Toolkit
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 | Copyright (C) 2009-2010 OpenCFD Ltd.
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 
27 #include <OpenFOAM/IOstreams.H>
28 
29 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
30 
32 {
33  os.writeKeyword("centreOfMass")
34  << centreOfMass_ << token::END_STATEMENT << nl;
35  os.writeKeyword("orientation")
36  << Q_ << token::END_STATEMENT << nl;
37  os.writeKeyword("velocity")
38  << v_ << token::END_STATEMENT << nl;
39  os.writeKeyword("acceleration")
40  << a_ << token::END_STATEMENT << nl;
41  os.writeKeyword("angularMomentum")
42  << pi_ << token::END_STATEMENT << nl;
43  os.writeKeyword("torque")
44  << tau_ << token::END_STATEMENT << nl;
45 }
46 
47 
48 // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
49 
50 Foam::Istream& Foam::operator>>
51 (
52  Istream& is, sixDoFRigidBodyMotionState& sDoFRBMS
53 )
54 {
55  is >> sDoFRBMS.centreOfMass_
56  >> sDoFRBMS.Q_
57  >> sDoFRBMS.v_
58  >> sDoFRBMS.a_
59  >> sDoFRBMS.pi_
60  >> sDoFRBMS.tau_;
61 
62  // Check state of Istream
63  is.check
64  (
65  "Foam::Istream& Foam::operator>>"
66  "(Foam::Istream&, Foam::sixDoFRigidBodyMotionState&)"
67  );
68 
69  return is;
70 }
71 
72 
73 Foam::Ostream& Foam::operator<<
74 (
75  Ostream& os,
76  const sixDoFRigidBodyMotionState& sDoFRBMS
77 )
78 {
79  os << token::SPACE << sDoFRBMS.centreOfMass()
80  << token::SPACE << sDoFRBMS.Q()
81  << token::SPACE << sDoFRBMS.v()
82  << token::SPACE << sDoFRBMS.a()
83  << token::SPACE << sDoFRBMS.pi()
84  << token::SPACE << sDoFRBMS.tau();
85 
86  // Check state of Ostream
87  os.check
88  (
89  "Foam::Ostream& Foam::operator<<(Foam::Ostream&, "
90  "const Foam::sixDoFRigidBodyMotionState&)"
91  );
92 
93  return os;
94 }
95 
96 
97 // ************************ vim: set sw=4 sts=4 et: ************************ //