/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org \\ / A nd | Copyright (C) 2011-2026 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 "Vector.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template inline Foam::SphericalTensor::SphericalTensor() {} template inline Foam::SphericalTensor::SphericalTensor(const Foam::zero) : SphericalTensor::vsType(Zero) {} template template inline Foam::SphericalTensor::SphericalTensor ( const VectorSpace, Cmpt2, 1>& vs ) : SphericalTensor::vsType(vs) {} template inline Foam::SphericalTensor::SphericalTensor(const Cmpt& stii) { this->v_[II] = stii; } template inline Foam::SphericalTensor::SphericalTensor(Istream& is) : SphericalTensor::vsType(is) {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template inline const Cmpt& Foam::SphericalTensor::ii() const { return this->v_[II]; } template inline Cmpt& Foam::SphericalTensor::ii() { return this->v_[II]; } template inline const Foam::SphericalTensor& Foam::SphericalTensor::T() const { return *this; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { // * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * // //- Inner-product between two spherical tensors template inline SphericalTensor operator&(const SphericalTensor& st1, const SphericalTensor& st2) { return SphericalTensor(st1.ii()*st2.ii()); } //- Inner-product between a spherical tensor and a vector template inline Vector operator&(const SphericalTensor& st, const Vector& v) { return Vector ( st.ii()*v.x(), st.ii()*v.y(), st.ii()*v.z() ); } //- Inner-product between a vector and a spherical tensor template inline Vector operator&(const Vector& v, const SphericalTensor& st) { return Vector ( v.x()*st.ii(), v.y()*st.ii(), v.z()*st.ii() ); } //- Double-dot-product between a spherical tensor and a spherical tensor template inline Cmpt operator&&(const SphericalTensor& st1, const SphericalTensor& st2) { return 3*st1.ii()*st2.ii(); } //- Division of a scalar by a sphericalTensor template inline SphericalTensor operator/(const scalar s, const SphericalTensor& st) { return SphericalTensor(s/st.ii()); } template inline Cmpt magSqr(const SphericalTensor& st) { return 3*magSqr(st.ii()); } //- Return the transpose of a spherical tensor template inline const SphericalTensor& T(const SphericalTensor& st) { return st; } //- Return the trace of a spherical tensor template inline Cmpt tr(const SphericalTensor& st) { return 3*st.ii(); } //- Return the spherical part of a spherical tensor, i.e. itself template inline SphericalTensor sph(const SphericalTensor& st) { return st; } //- Return the determinant of a spherical tensor template inline Cmpt det(const SphericalTensor& st) { return st.ii()*st.ii()*st.ii(); } //- Return the inverse of a spherical tensor template inline SphericalTensor inv(const SphericalTensor& st) { return SphericalTensor(1.0/st.ii()); } template class outerProduct, Cmpt> { public: typedef SphericalTensor type; }; template class outerProduct> { public: typedef SphericalTensor type; }; template class innerProduct, SphericalTensor> { public: typedef SphericalTensor type; }; template class innerProduct, Vector> { public: typedef Vector type; }; template class innerProduct, SphericalTensor> { public: typedef Vector type; }; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam // ************************************************************************* //