SymmTensor2D.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) 2011-2013 OpenFOAM Foundation
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::SymmTensor2D
26 
27 Description
28  Templated 2D symmetric tensor derived from VectorSpace adding construction
29  from 4 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  SymmTensor2DI.H
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef SymmTensor2D_H
39 #define SymmTensor2D_H
40 
41 #include "VectorSpace.H"
42 #include "SphericalTensor2D.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 /*---------------------------------------------------------------------------*\
50  Class SymmTensor2D Declaration
51 \*---------------------------------------------------------------------------*/
52 
53 template<class Cmpt>
54 class SymmTensor2D
55 :
56  public VectorSpace<SymmTensor2D<Cmpt>, Cmpt, 3>
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 SymmTensor2D 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 SymmTensor2D zero;
79  static const SymmTensor2D one;
80  static const SymmTensor2D max;
81  static const SymmTensor2D min;
82  static const SymmTensor2D I;
83 
84 
85  //- Component labeling enumeration
86  enum components { XX, XY, YY };
87 
88 
89  // Constructors
90 
91  //- Construct null
92  inline SymmTensor2D();
93 
94  //- Construct given VectorSpace
95  inline SymmTensor2D(const VectorSpace<SymmTensor2D<Cmpt>, Cmpt, 3>&);
96 
97  //- Construct given SphericalTensor
99 
100  //- Construct given the three components
101  inline SymmTensor2D
102  (
103  const Cmpt txx, const Cmpt txy,
104  const Cmpt tyy
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& yy() const;
118 
119  inline Cmpt& xx();
120  inline Cmpt& xy();
121  inline Cmpt& yy();
122 
123  //- Transpose
124  inline const SymmTensor2D<Cmpt>& T() const;
125 
126 
127  // Member Operators
128 
129  //- Construct given SphericalTensor2D
130  inline void operator=(const SphericalTensor2D<Cmpt>&);
131 };
132 
133 
134 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
135 
136 } // End namespace Foam
137 
138 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
139 
140 // Include inline implementations
141 #include "SymmTensor2DI.H"
142 
143 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
144 
145 #endif
146 
147 // ************************************************************************* //
VectorSpace.H
Foam::SymmTensor2D::XY
@ XY
Definition: SymmTensor2D.H:85
Foam::SymmTensor2D::SymmTensor2D
SymmTensor2D()
Construct null.
Definition: SymmTensor2DI.H:37
Foam::SymmTensor2D::one
static const SymmTensor2D one
Definition: SymmTensor2D.H:78
Foam::SymmTensor2D::I
static const SymmTensor2D I
Definition: SymmTensor2D.H:81
Foam::SymmTensor2D::operator=
void operator=(const SphericalTensor2D< Cmpt > &)
Construct given SphericalTensor2D.
Definition: SymmTensor2DI.H:128
Foam::SymmTensor2D
Templated 2D symmetric tensor derived from VectorSpace adding construction from 4 components,...
Definition: SymmTensor2D.H:53
Foam::VectorSpace
Templated vector space.
Definition: VectorSpace.H:52
Foam::SymmTensor2D::zero
static const SymmTensor2D zero
Definition: SymmTensor2D.H:77
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:57
Foam::SymmTensor2D::typeName
static const char *const typeName
Definition: SymmTensor2D.H:74
Foam::SymmTensor2D::componentNames
static const char * componentNames[]
Definition: SymmTensor2D.H:75
Foam::SymmTensor2D::max
static const SymmTensor2D max
Definition: SymmTensor2D.H:79
SymmTensor2DI.H
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::SymmTensor2D::rank
@ rank
Definition: SymmTensor2D.H:68
Foam::SymmTensor2D::yy
const Cmpt & yy() const
Definition: SymmTensor2DI.H:93
Foam::SymmTensor2D::labelType
SymmTensor2D< label > labelType
Equivalent type of labels used for valid component indexing.
Definition: SymmTensor2D.H:61
Foam::SymmTensor2D::xx
const Cmpt & xx() const
Definition: SymmTensor2DI.H:81
Foam::SymmTensor2D::YY
@ YY
Definition: SymmTensor2D.H:85
Foam::SymmTensor2D::min
static const SymmTensor2D min
Definition: SymmTensor2D.H:80
Foam::SymmTensor2D::xy
const Cmpt & xy() const
Definition: SymmTensor2DI.H:87
Foam::SymmTensor2D::T
const SymmTensor2D< Cmpt > & T() const
Transpose.
Definition: SymmTensor2DI.H:119
Foam::SymmTensor2D::XX
@ XX
Definition: SymmTensor2D.H:85
Foam::SymmTensor2D::components
components
Component labeling enumeration.
Definition: SymmTensor2D.H:85
SphericalTensor2D.H
Foam::SphericalTensor2D
Templated 2D sphericalTensor derived from VectorSpace adding construction from 1 component,...
Definition: SphericalTensor2D.H:51