FreeFOAM The Cross-Platform CFD Toolkit
SymmTensor_.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::SymmTensor
26 
27 Description
28  Templated 3D symmetric tensor derived from VectorSpace adding construction
29  from 6 components, element access using xx(), xy() etc. member functions
30  and the inner-product (dot-product) and outer-product of two Vectors
31  (tensor-product) operators.
32 
33 SourceFiles
34  SymmTensorI.H
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef SymmTensor_H
39 #define SymmTensor_H
40 
41 #include <OpenFOAM/VectorSpace.H>
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 /*---------------------------------------------------------------------------*\
50  Class SymmTensor Declaration
51 \*---------------------------------------------------------------------------*/
52 
53 template <class Cmpt>
55 :
56  public VectorSpace<SymmTensor<Cmpt>, Cmpt, 6>
57 {
58 
59 public:
60 
61  //- Equivalent type of labels used for valid component indexing
63 
64 
65  // Member constants
66 
67  enum
68  {
69  rank = 2 // Rank of SymmTensor is 2
70  };
71 
72 
73  // Static data members
74 
75  static const char* const typeName;
76  static const char* componentNames[];
77 
78  static const SymmTensor zero;
79  static const SymmTensor one;
80  static const SymmTensor max;
81  static const SymmTensor min;
82 
83 
84  //- Component labeling enumeration
85  enum components { XX, XY, XZ, YY, YZ, ZZ };
86 
87 
88  // Constructors
89 
90  //- Construct null
91  inline SymmTensor();
92 
93  //- Construct given VectorSpace
94  inline SymmTensor(const VectorSpace<SymmTensor<Cmpt>, Cmpt, 6>&);
95 
96  //- Construct given SphericalTensor
97  inline SymmTensor(const SphericalTensor<Cmpt>&);
98 
99  //- Construct given the six components
100  inline SymmTensor
101  (
102  const Cmpt txx, const Cmpt txy, const Cmpt txz,
103  const Cmpt tyy, const Cmpt tyz,
104  const Cmpt tzz
105  );
106 
107  //- Construct from Istream
109 
110 
111  // Member Functions
112 
113  // Access
114 
115  inline const Cmpt& xx() const;
116  inline const Cmpt& xy() const;
117  inline const Cmpt& xz() const;
118  inline const Cmpt& yy() const;
119  inline const Cmpt& yz() const;
120  inline const Cmpt& zz() const;
121 
122  inline Cmpt& xx();
123  inline Cmpt& xy();
124  inline Cmpt& xz();
125  inline Cmpt& yy();
126  inline Cmpt& yz();
127  inline Cmpt& zz();
128 
129  //- Transpose
130  inline const SymmTensor<Cmpt>& T() const;
131 
132 
133  // Member Operators
134 
135  //- Construct given SphericalTensor
136  inline void operator=(const SphericalTensor<Cmpt>&);
137 };
138 
139 
140 template<class Cmpt>
141 class symmTypeOfRank<Cmpt, 2>
142 {
143 public:
144 
146 };
147 
148 
149 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
150 
151 } // End namespace Foam
152 
153 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
154 
155 // Include inline implementations
156 #include "SymmTensorI_.H"
157 
158 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
159 
160 #endif
161 
162 // ************************ vim: set sw=4 sts=4 et: ************************ //