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-2016 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  //- Rank of SymmTensor2D is 2
68  static const direction rank = 2;
69 
70 
71  // Static data members
72 
73  static const SymmTensor2D I;
74 
75 
76  //- Component labeling enumeration
77  enum components { XX, XY, YY };
78 
79 
80  // Constructors
81 
82  //- Construct null
83  inline SymmTensor2D();
84 
85  //- Construct initialized to zero
86  inline SymmTensor2D(const Foam::zero);
87 
88  //- Construct given VectorSpace
89  inline SymmTensor2D(const VectorSpace<SymmTensor2D<Cmpt>, Cmpt, 3>&);
90 
91  //- Construct given SphericalTensor
93 
94  //- Construct given the three components
95  inline SymmTensor2D
96  (
97  const Cmpt txx, const Cmpt txy,
98  const Cmpt tyy
99  );
100 
101  //- Construct from Istream
103 
104 
105  // Member Functions
106 
107  // Access
108 
109  inline const Cmpt& xx() const;
110  inline const Cmpt& xy() const;
111  inline const Cmpt& yy() const;
112 
113  inline Cmpt& xx();
114  inline Cmpt& xy();
115  inline Cmpt& yy();
116 
117  //- Transpose
118  inline const SymmTensor2D<Cmpt>& T() const;
119 
120 
121  // Member Operators
122 
123  //- Inherit VectorSpace assignment operators
125 
126  //- Construct given SphericalTensor2D
127  inline void operator=(const SphericalTensor2D<Cmpt>&);
128 };
129 
130 
131 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
132 
133 } // End namespace Foam
134 
135 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
136 
137 // Include inline implementations
138 #include "SymmTensor2DI.H"
139 
140 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
141 
142 #endif
143 
144 // ************************************************************************* //
SymmTensor2D< label > labelType
Equivalent type of labels used for valid component indexing.
Definition: SymmTensor2D.H:61
uint8_t direction
Definition: direction.H:46
static const SymmTensor2D I
Definition: SymmTensor2D.H:72
components
Component labeling enumeration.
Definition: SymmTensor2D.H:76
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
Templated vector space.
Definition: VectorSpace.H:53
SymmTensor2D()
Construct null.
Definition: SymmTensor2DI.H:32
const Cmpt & yy() const
Definition: SymmTensor2DI.H:95
const Cmpt & xx() const
Definition: SymmTensor2DI.H:83
void operator=(const SphericalTensor2D< Cmpt > &)
Construct given SphericalTensor2D.
const SymmTensor2D< Cmpt > & T() const
Transpose.
static const direction rank
Rank of SymmTensor2D is 2.
Definition: SymmTensor2D.H:67
const Cmpt & xy() const
Definition: SymmTensor2DI.H:89
friend Ostream & operator(Ostream &, const VectorSpace< Form, Cmpt, Ncmpts > &)
Templated 2D sphericalTensor derived from VectorSpace adding construction from 1 component, element access using ii() member function and the inner-product (dot-product) and outer-product operators.
Templated 2D symmetric tensor derived from VectorSpace adding construction from 4 components...
Definition: SymmTensor2D.H:53
A class representing the concept of 0 used to avoid unnecessary manipulations for objects that are kn...
Definition: zero.H:49
Namespace for OpenFOAM.