sixDoFMotion: Adding restraints and constraints to the motion of objects.
[OpenFOAM-1.6.x.git] / src / postProcessing / functionObjects / forces / pointPatchFields / derived / sixDoFRigidBodyMotion / sixDoFRigidBodyMotionStateIO.C
blobfb70e1a28c2411e600de011187a22c4080962689
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2009-2009 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 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
19     for more details.
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_
57         >> sDoFRBMS.Q_
58         >> sDoFRBMS.v_
59         >> sDoFRBMS.a_
60         >> sDoFRBMS.pi_
61         >> sDoFRBMS.tau_;
63     // Check state of Istream
64     is.check
65     (
66         "Foam::Istream& Foam::operator>>"
67         "(Foam::Istream&, Foam::sixDoFRigidBodyMotionState&)"
68     );
70     return is;
74 Foam::Ostream& Foam::operator<<
76     Ostream& os,
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
88     os.check
89     (
90         "Foam::Ostream& Foam::operator<<(Foam::Ostream&, "
91         "const Foam::sixDoFRigidBodyMotionState&)"
92     );
94     return os;
98 // ************************************************************************* //