OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

dimensionedTensor.C

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2009 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 the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     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, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024     Dimensioned tensor obtained from generic dimensioned type.
00025 
00026 \*---------------------------------------------------------------------------*/
00027 
00028 #include "dimensionedTensor.H"
00029 
00030 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00031 
00032 namespace Foam
00033 {
00034 
00035 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00036 
00037 template<>
00038 dimensionedTensor dimensionedTensor::T() const
00039 {
00040     return dimensionedTensor
00041     (
00042         name()+".T()",
00043         dimensions(),
00044         value().T()
00045     );
00046 }
00047 
00048 
00049 // * * * * * * * * * * * * * * * Friend Functions  * * * * * * * * * * * * * //
00050 
00051 dimensionedScalar tr(const dimensionedTensor& dt)
00052 {
00053     return dimensionedScalar
00054     (
00055         "tr("+dt.name()+')',
00056         dt.dimensions(),
00057         tr(dt.value())
00058     );
00059 }
00060 
00061 
00062 dimensionedTensor dev(const dimensionedTensor& dt)
00063 {
00064     return dimensionedTensor
00065     (
00066         "dev("+dt.name()+')',
00067         dt.dimensions(),
00068         dev(dt.value())
00069     );
00070 }
00071 
00072 
00073 dimensionedTensor dev2(const dimensionedTensor& dt)
00074 {
00075     return dimensionedTensor
00076     (
00077         "dev2("+dt.name()+')',
00078         dt.dimensions(),
00079         dev2(dt.value())
00080     );
00081 }
00082 
00083 
00084 dimensionedScalar det(const dimensionedTensor& dt)
00085 {
00086     return dimensionedScalar
00087     (
00088         "det("+dt.name()+')',
00089         pow(dt.dimensions(), tensor::dim),
00090         det(dt.value())
00091     );
00092 }
00093 
00094 
00095 dimensionedTensor cof(const dimensionedTensor& dt)
00096 {
00097     return dimensionedTensor
00098     (
00099         "cof("+dt.name()+')',
00100         dt.dimensions(),
00101         cof(dt.value())
00102     );
00103 }
00104 
00105 
00106 dimensionedTensor inv(const dimensionedTensor& dt)
00107 {
00108     return dimensionedTensor
00109     (
00110         "inv("+dt.name()+')',
00111         dimless/dt.dimensions(),
00112         inv(dt.value())
00113     );
00114 }
00115 
00116 
00117 dimensionedSymmTensor symm(const dimensionedTensor& dt)
00118 {
00119     return dimensionedSymmTensor
00120     (
00121         "symm("+dt.name()+')',
00122         dt.dimensions(),
00123         symm(dt.value())
00124     );
00125 }
00126 
00127 dimensionedSymmTensor twoSymm(const dimensionedTensor& dt)
00128 {
00129     return dimensionedSymmTensor
00130     (
00131         "twoSymm("+dt.name()+')',
00132         dt.dimensions(),
00133         twoSymm(dt.value())
00134     );
00135 }
00136 
00137 dimensionedTensor skew(const dimensionedTensor& dt)
00138 {
00139     return dimensionedTensor
00140     (
00141         "skew("+dt.name()+')',
00142         dt.dimensions(),
00143         skew(dt.value())
00144     );
00145 }
00146 
00147 
00148 dimensionedVector eigenValues(const dimensionedTensor& dt)
00149 {
00150     return dimensionedVector
00151     (
00152         "eigenValues("+dt.name()+')',
00153         dt.dimensions(),
00154         eigenValues(dt.value())
00155     );
00156 }
00157 
00158 
00159 dimensionedTensor eigenVectors(const dimensionedTensor& dt)
00160 {
00161     return dimensionedTensor
00162     (
00163         "eigenVectors("+dt.name()+')',
00164         dimless,
00165         eigenVectors(dt.value())
00166     );
00167 }
00168 
00169 
00170 dimensionedVector eigenValues(const dimensionedSymmTensor& dt)
00171 {
00172     return dimensionedVector
00173     (
00174         "eigenValues("+dt.name()+')',
00175         dt.dimensions(),
00176         eigenValues(dt.value())
00177     );
00178 }
00179 
00180 
00181 dimensionedTensor eigenVectors(const dimensionedSymmTensor& dt)
00182 {
00183     return dimensionedTensor
00184     (
00185         "eigenVectors("+dt.name()+')',
00186         dimless,
00187         eigenVectors(dt.value())
00188     );
00189 }
00190 
00191 
00192 // * * * * * * * * * * * * * * * Friend Operators  * * * * * * * * * * * * * //
00193 
00194 dimensionedVector operator*(const dimensionedTensor& dt)
00195 {
00196     return dimensionedVector
00197     (
00198         "*"+dt.name(),
00199         dt.dimensions(),
00200         *dt.value()
00201     );
00202 }
00203 
00204 
00205 dimensionedTensor operator*(const dimensionedVector& dv)
00206 {
00207     return dimensionedTensor
00208     (
00209         "*"+dv.name(),
00210         dv.dimensions(),
00211         *dv.value()
00212     );
00213 }
00214 
00215 
00216 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00217 
00218 } // End namespace Foam
00219 
00220 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd