00001 /*---------------------------------------------------------------------------*\ 00002 ========= | 00003 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 00004 \\ / O peration | 00005 \\ / A nd | Copyright (C) 1991-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 Class 00025 Foam::SymmTensor 00026 00027 Description 00028 Templated 3D symmetric tensor derived from VectorSpace adding construction 00029 from 6 components, element access using xx(), xy() etc. member functions 00030 and the inner-product (dot-product) and outer-product of two Vectors 00031 (tensor-product) operators. 00032 00033 SourceFiles 00034 SymmTensorI.H 00035 00036 \*---------------------------------------------------------------------------*/ 00037 00038 #ifndef SymmTensor_H 00039 #define SymmTensor_H 00040 00041 #include <OpenFOAM/VectorSpace.H> 00042 #include <OpenFOAM/SphericalTensor_.H> 00043 00044 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00045 00046 namespace Foam 00047 { 00048 00049 /*---------------------------------------------------------------------------*\ 00050 Class SymmTensor Declaration 00051 \*---------------------------------------------------------------------------*/ 00052 00053 template <class Cmpt> 00054 class SymmTensor 00055 : 00056 public VectorSpace<SymmTensor<Cmpt>, Cmpt, 6> 00057 { 00058 00059 public: 00060 00061 //- Equivalent type of labels used for valid component indexing 00062 typedef SymmTensor<label> labelType; 00063 00064 00065 // Member constants 00066 00067 enum 00068 { 00069 rank = 2 // Rank of SymmTensor is 2 00070 }; 00071 00072 00073 // Static data members 00074 00075 static const char* const typeName; 00076 static const char* componentNames[]; 00077 00078 static const SymmTensor zero; 00079 static const SymmTensor one; 00080 static const SymmTensor max; 00081 static const SymmTensor min; 00082 00083 00084 //- Component labeling enumeration 00085 enum components { XX, XY, XZ, YY, YZ, ZZ }; 00086 00087 00088 // Constructors 00089 00090 //- Construct null 00091 inline SymmTensor(); 00092 00093 //- Construct given VectorSpace 00094 inline SymmTensor(const VectorSpace<SymmTensor<Cmpt>, Cmpt, 6>&); 00095 00096 //- Construct given SphericalTensor 00097 inline SymmTensor(const SphericalTensor<Cmpt>&); 00098 00099 //- Construct given the six components 00100 inline SymmTensor 00101 ( 00102 const Cmpt txx, const Cmpt txy, const Cmpt txz, 00103 const Cmpt tyy, const Cmpt tyz, 00104 const Cmpt tzz 00105 ); 00106 00107 //- Construct from Istream 00108 SymmTensor(Istream&); 00109 00110 00111 // Member Functions 00112 00113 // Access 00114 00115 inline const Cmpt& xx() const; 00116 inline const Cmpt& xy() const; 00117 inline const Cmpt& xz() const; 00118 inline const Cmpt& yy() const; 00119 inline const Cmpt& yz() const; 00120 inline const Cmpt& zz() const; 00121 00122 inline Cmpt& xx(); 00123 inline Cmpt& xy(); 00124 inline Cmpt& xz(); 00125 inline Cmpt& yy(); 00126 inline Cmpt& yz(); 00127 inline Cmpt& zz(); 00128 00129 //- Transpose 00130 inline const SymmTensor<Cmpt>& T() const; 00131 00132 00133 // Member Operators 00134 00135 //- Construct given SphericalTensor 00136 inline void operator=(const SphericalTensor<Cmpt>&); 00137 }; 00138 00139 00140 template<class Cmpt> 00141 class symmTypeOfRank<Cmpt, 2> 00142 { 00143 public: 00144 00145 typedef SymmTensor<Cmpt> type; 00146 }; 00147 00148 00149 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00150 00151 } // End namespace Foam 00152 00153 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00154 00155 // Include inline implementations 00156 #include "SymmTensorI_.H" 00157 00158 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00159 00160 #endif 00161 00162 // ************************ vim: set sw=4 sts=4 et: ************************ //