1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 option) any later version.
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
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*---------------------------------------------------------------------------*/
27 #include "sixDoFRigidBodyMotionState.H"
28 #include "IOstreams.H"
30 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
32 void Foam::sixDoFRigidBodyMotionState::write(Ostream& os) const
34 os.writeKeyword("centreOfMass")
35 << centreOfMass_ << token::END_STATEMENT << nl;
36 os.writeKeyword("orientation")
37 << Q_ << token::END_STATEMENT << nl;
38 os.writeKeyword("velocity")
39 << v_ << token::END_STATEMENT << nl;
40 os.writeKeyword("acceleration")
41 << a_ << token::END_STATEMENT << nl;
42 os.writeKeyword("angularMomentum")
43 << pi_ << token::END_STATEMENT << nl;
44 os.writeKeyword("torque")
45 << tau_ << token::END_STATEMENT << nl;
49 // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
51 Foam::Istream& Foam::operator>>
53 Istream& is, sixDoFRigidBodyMotionState& sDoFRBMS
56 is >> sDoFRBMS.centreOfMass_
63 // Check state of Istream
66 "Foam::Istream& Foam::operator>>"
67 "(Foam::Istream&, Foam::sixDoFRigidBodyMotionState&)"
74 Foam::Ostream& Foam::operator<<
77 const sixDoFRigidBodyMotionState& sDoFRBMS
80 os << token::SPACE << sDoFRBMS.centreOfMass()
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();
87 // Check state of Ostream
90 "Foam::Ostream& Foam::operator<<(Foam::Ostream&, "
91 "const Foam::sixDoFRigidBodyMotionState&)"
98 // ************************************************************************* //