Initial commit for version 2.0.x patch release
[OpenFOAM-2.0.x.git] / src / postProcessing / functionObjects / forces / pointPatchFields / derived / sixDoFRigidBodyMotion / sixDoFRigidBodyMotionStateIO.C
blob0e180017a503a255c46038d5c2858176dfdac23d
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.
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.
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.
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/>.
24 \*---------------------------------------------------------------------------*/
26 #include "sixDoFRigidBodyMotionState.H"
27 #include "IOstreams.H"
29 // * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * * //
31 void Foam::sixDoFRigidBodyMotionState::write(Ostream& os) const
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;
48 // * * * * * * * * * * * * * * * IOstream Operators  * * * * * * * * * * * * //
50 Foam::Istream& Foam::operator>>
52     Istream& is, sixDoFRigidBodyMotionState& sDoFRBMS
55     is  >> sDoFRBMS.centreOfMass_
56         >> sDoFRBMS.Q_
57         >> sDoFRBMS.v_
58         >> sDoFRBMS.a_
59         >> sDoFRBMS.pi_
60         >> sDoFRBMS.tau_;
62     // Check state of Istream
63     is.check
64     (
65         "Foam::Istream& Foam::operator>>"
66         "(Foam::Istream&, Foam::sixDoFRigidBodyMotionState&)"
67     );
69     return is;
73 Foam::Ostream& Foam::operator<<
75     Ostream& os,
76     const sixDoFRigidBodyMotionState& sDoFRBMS
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();
86     // Check state of Ostream
87     os.check
88     (
89         "Foam::Ostream& Foam::operator<<(Foam::Ostream&, "
90         "const Foam::sixDoFRigidBodyMotionState&)"
91     );
93     return os;
97 // ************************************************************************* //