DiagTensor.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2018 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::DiagTensor
26 
27 Description
28  Templated 3D DiagTensor derived from VectorSpace.
29 
30  Adding construction from 3 components, element access using xx(), yy()
31  and zz() member functions and the inner-product (dot-product) and
32  outer-product operators.
33 
34 SourceFiles
35  DiagTensorI.H
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef DiagTensor_H
40 #define DiagTensor_H
41 
42 #include "Tensor.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 /*---------------------------------------------------------------------------*\
50  Class DiagTensor Declaration
51 \*---------------------------------------------------------------------------*/
52 
53 template<class Cmpt>
54 class DiagTensor
55 :
56  public VectorSpace<DiagTensor<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 DiagTensor is 2
68  static const direction rank = 2;
69 
70 
71  //- Component labeling enumeration
72  enum components { XX, YY, ZZ };
73 
74 
75  // Constructors
76 
77  //- Construct null
78  inline DiagTensor();
79 
80  //- Construct initialized to zero
81  inline DiagTensor(const Foam::zero);
82 
83  //- Construct given VectorSpace
84  template<class Cmpt2>
85  inline DiagTensor(const VectorSpace<DiagTensor<Cmpt2>, Cmpt2, 3>&);
86 
87  //- Construct given three components
88  inline DiagTensor(const Cmpt& txx, const Cmpt& tyy, const Cmpt& tzz);
89 
90  //- Construct from Istream
91  inline DiagTensor(Istream&);
92 
93 
94  // Member Functions
95 
96  // Access
97 
98  inline const Cmpt& xx() const;
99  inline const Cmpt& yy() const;
100  inline const Cmpt& zz() const;
101 
102  inline Cmpt& xx();
103  inline Cmpt& yy();
104  inline Cmpt& zz();
105 };
106 
107 
108 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
109 
110 } // End namespace Foam
111 
112 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
113 
114 // Include inline implementations
115 #include "DiagTensorI.H"
116 
117 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
118 
119 #endif
120 
121 // ************************************************************************* //
const Cmpt & xx() const
Definition: DiagTensorI.H:78
const Cmpt & yy() const
Definition: DiagTensorI.H:84
uint8_t direction
Definition: direction.H:45
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
const Cmpt & zz() const
Definition: DiagTensorI.H:90
Templated vector space.
Definition: VectorSpace.H:53
components
Component labeling enumeration.
Definition: DiagTensor.H:71
DiagTensor< label > labelType
Equivalent type of labels used for valid component indexing.
Definition: DiagTensor.H:61
Templated 3D DiagTensor derived from VectorSpace.
Definition: DiagTensor.H:53
DiagTensor()
Construct null.
Definition: DiagTensorI.H:32
static const direction rank
Rank of DiagTensor is 2.
Definition: DiagTensor.H:67
A class representing the concept of 0 used to avoid unnecessary manipulations for objects that are kn...
Definition: zero.H:49
Namespace for OpenFOAM.