/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2013 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 . \*---------------------------------------------------------------------------*/ #include "Vector2D.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // Construct null template inline SphericalTensor2D::SphericalTensor2D() {} // Construct given VectorSpace template inline SphericalTensor2D::SphericalTensor2D ( const VectorSpace, Cmpt, 1>& vs ) : VectorSpace, Cmpt, 1>(vs) {} // Construct given three Cmpts template inline SphericalTensor2D::SphericalTensor2D(const Cmpt& stii) { this->v_[II] = stii; } // Construct from Istream template inline SphericalTensor2D::SphericalTensor2D(Istream& is) : VectorSpace, Cmpt, 1>(is) {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template inline const Cmpt& SphericalTensor2D::ii() const { return this->v_[II]; } template inline Cmpt& SphericalTensor2D::ii() { return this->v_[II]; } // * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * // //- Inner-product between two spherical tensors template inline SphericalTensor2D operator& ( const SphericalTensor2D& st1, const SphericalTensor2D& st2 ) { return SphericalTensor2D(st1.ii()*st2.ii()); } //- Inner-product between a spherical tensor and a vector template inline Vector2D operator&(const SphericalTensor2D& st, const Vector2D& v) { return Vector2D ( st.ii()*v.x(), st.ii()*v.y() ); } //- Inner-product between a vector and a spherical tensor template inline Vector2D operator&(const Vector2D& v, const SphericalTensor2D& st) { return Vector2D ( v.x()*st.ii(), v.y()*st.ii() ); } //- Division of a scalar by a sphericalTensor2D template inline SphericalTensor2D operator/(const scalar s, const SphericalTensor2D& st) { return SphericalTensor2D(s/st.ii()); } //- Return the trace of a spherical tensor template inline Cmpt tr(const SphericalTensor2D& st) { return 2*st.ii(); } //- Return the spherical part of a spherical tensor, i.e. itself template inline SphericalTensor2D sph(const SphericalTensor2D& st) { return st; } //- Return the determinant of a spherical tensor template inline Cmpt det(const SphericalTensor2D& st) { return st.ii()*st.ii(); } //- Return the inverse of a symmetric tensor template inline SphericalTensor2D inv(const SphericalTensor2D& st) { return SphericalTensor2D(1.0/st.ii()); } template class outerProduct, Cmpt> { public: typedef SphericalTensor2D type; }; template class outerProduct > { public: typedef SphericalTensor2D type; }; template class innerProduct, SphericalTensor2D > { public: typedef SphericalTensor2D type; }; template class innerProduct, Vector2D > { public: typedef Vector2D type; }; template class innerProduct, SphericalTensor2D > { public: typedef Vector2D type; }; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam // ************************************************************************* //