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