00001 /*---------------------------------------------------------------------------*\ 00002 ========= | 00003 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 00004 \\ / O peration | 00005 \\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd. 00006 \\/ M anipulation | 00007 ------------------------------------------------------------------------------- 00008 License 00009 This file is part of OpenFOAM. 00010 00011 OpenFOAM is free software: you can redistribute it and/or modify it 00012 under the terms of the GNU General Public License as published by 00013 the Free Software Foundation, either version 3 of the License, or 00014 (at your option) any later version. 00015 00016 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT 00017 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00018 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 00019 for more details. 00020 00021 You should have received a copy of the GNU General Public License 00022 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. 00023 00024 \*---------------------------------------------------------------------------*/ 00025 00026 #include "sixDoFRigidBodyMotionState.H" 00027 #include <OpenFOAM/IOstreams.H> 00028 00029 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // 00030 00031 void Foam::sixDoFRigidBodyMotionState::write(Ostream& os) const 00032 { 00033 os.writeKeyword("centreOfMass") 00034 << centreOfMass_ << token::END_STATEMENT << nl; 00035 os.writeKeyword("orientation") 00036 << Q_ << token::END_STATEMENT << nl; 00037 os.writeKeyword("velocity") 00038 << v_ << token::END_STATEMENT << nl; 00039 os.writeKeyword("acceleration") 00040 << a_ << token::END_STATEMENT << nl; 00041 os.writeKeyword("angularMomentum") 00042 << pi_ << token::END_STATEMENT << nl; 00043 os.writeKeyword("torque") 00044 << tau_ << token::END_STATEMENT << nl; 00045 } 00046 00047 00048 // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // 00049 00050 Foam::Istream& Foam::operator>> 00051 ( 00052 Istream& is, sixDoFRigidBodyMotionState& sDoFRBMS 00053 ) 00054 { 00055 is >> sDoFRBMS.centreOfMass_ 00056 >> sDoFRBMS.Q_ 00057 >> sDoFRBMS.v_ 00058 >> sDoFRBMS.a_ 00059 >> sDoFRBMS.pi_ 00060 >> sDoFRBMS.tau_; 00061 00062 // Check state of Istream 00063 is.check 00064 ( 00065 "Foam::Istream& Foam::operator>>" 00066 "(Foam::Istream&, Foam::sixDoFRigidBodyMotionState&)" 00067 ); 00068 00069 return is; 00070 } 00071 00072 00073 Foam::Ostream& Foam::operator<< 00074 ( 00075 Ostream& os, 00076 const sixDoFRigidBodyMotionState& sDoFRBMS 00077 ) 00078 { 00079 os << token::SPACE << sDoFRBMS.centreOfMass() 00080 << token::SPACE << sDoFRBMS.Q() 00081 << token::SPACE << sDoFRBMS.v() 00082 << token::SPACE << sDoFRBMS.a() 00083 << token::SPACE << sDoFRBMS.pi() 00084 << token::SPACE << sDoFRBMS.tau(); 00085 00086 // Check state of Ostream 00087 os.check 00088 ( 00089 "Foam::Ostream& Foam::operator<<(Foam::Ostream&, " 00090 "const Foam::sixDoFRigidBodyMotionState&)" 00091 ); 00092 00093 return os; 00094 } 00095 00096 00097 // ************************ vim: set sw=4 sts=4 et: ************************ //