/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License This file is part of OpenFOAM. OpenFOAM is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. OpenFOAM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see . \*---------------------------------------------------------------------------*/ // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template inline Foam::SpatialVector::SpatialVector() {} template inline Foam::SpatialVector::SpatialVector(const Foam::zero) : SpatialVector::vsType(Zero) {} template inline Foam::SpatialVector::SpatialVector ( const typename SpatialVector::vsType& vs ) : SpatialVector::vsType(vs) {} template inline Foam::SpatialVector::SpatialVector ( const Vector& w, const Vector& l ) { this->v_[0] = w.x(); this->v_[1] = w.y(); this->v_[2] = w.z(); this->v_[3] = l.x(); this->v_[4] = l.y(); this->v_[5] = l.z(); } template inline Foam::SpatialVector::SpatialVector ( const Cmpt& v0, const Cmpt& v1, const Cmpt& v2, const Cmpt& v3, const Cmpt& v4, const Cmpt& v5 ) { this->v_[0] = v0; this->v_[1] = v1; this->v_[2] = v2; this->v_[3] = v3; this->v_[4] = v4; this->v_[5] = v5; } template inline Foam::SpatialVector::SpatialVector(Istream& is) : SpatialVector::vsType(is) {} template inline Foam::SpatialVector::dual::dual(const SpatialVector& v) : v_(v) {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template inline const Cmpt& Foam::SpatialVector::wx() const { return this->v_[WX]; } template inline const Cmpt& Foam::SpatialVector::wy() const { return this->v_[WY]; } template inline const Cmpt& Foam::SpatialVector::wz() const { return this->v_[WZ]; } template inline const Cmpt& Foam::SpatialVector::lx() const { return this->v_[LX]; } template inline const Cmpt& Foam::SpatialVector::ly() const { return this->v_[LY]; } template inline const Cmpt& Foam::SpatialVector::lz() const { return this->v_[LZ]; } template inline Cmpt& Foam::SpatialVector::wx() { return this->v_[WX]; } template inline Cmpt& Foam::SpatialVector::wy() { return this->v_[WY]; } template inline Cmpt& Foam::SpatialVector::wz() { return this->v_[WZ]; } template inline Cmpt& Foam::SpatialVector::lx() { return this->v_[LX]; } template inline Cmpt& Foam::SpatialVector::ly() { return this->v_[LY]; } template inline Cmpt& Foam::SpatialVector::lz() { return this->v_[LZ]; } template inline Foam::Vector Foam::SpatialVector::w() const { return Vector(this->v_[0], this->v_[1], this->v_[2]); } template inline Foam::Vector Foam::SpatialVector::l() const { return Vector(this->v_[3], this->v_[4], this->v_[5]); } template const Foam::SpatialVector& Foam::SpatialVector::dual::v() const { return v_; } // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // template inline void Foam::SpatialVector::operator=(const Foam::zero) { SpatialVector::vsType::operator=(Zero); } template inline typename Foam::SpatialVector::dual Foam::SpatialVector::operator*() const { return dual(*this); } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { // * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * // //- Return the cross-product between two spatial vectors template inline SpatialVector operator^ ( const SpatialVector& u, const SpatialVector& v ) { return SpatialVector ( -u.wz()*v.wy() + u.wy()*v.wz(), u.wz()*v.wx() - u.wx()*v.wz(), -u.wy()*v.wx() + u.wx()*v.wy(), -u.lz()*v.wy() + u.ly()*v.wz() - u.wz()*v.ly() + u.wy()*v.lz(), u.lz()*v.wx() - u.lx()*v.wz() + u.wz()*v.lx() - u.wx()*v.lz(), -u.ly()*v.wx() + u.lx()*v.wy() - u.wy()*v.lx() + u.wx()*v.ly() ); } //- Return the dual cross-product between two spatial vectors template inline SpatialVector operator^ ( const SpatialVector& v, const typename SpatialVector::dual& df ) { const SpatialVector& f = df.v(); return SpatialVector ( -v.wz()*f.wy() + v.wy()*f.wz() - v.lz()*f.ly() + v.ly()*f.lz(), v.wz()*f.wx() - v.wx()*f.wz() + v.lz()*f.lx() - v.lx()*f.lz(), -v.wy()*f.wx() + v.wx()*f.wy() - v.ly()*f.lx() + v.lx()*f.ly(), -v.wz()*f.ly() + v.wy()*f.lz(), v.wz()*f.lx() - v.wx()*f.lz(), -v.wy()*f.lx() + v.wx()*f.ly() ); } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam // ************************************************************************* //