DiagTensor.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::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  // Member constants
62 
63  enum
64  {
65  rank = 2 // Rank of DiagTensor is 2
66  };
67 
68 
69  // Static data members
70 
71  static const char* const typeName;
72  static const char* componentNames[];
73  static const DiagTensor zero;
74  static const DiagTensor one;
75  static const DiagTensor max;
76  static const DiagTensor min;
77 
78 
79  //- Component labeling enumeration
80  enum components { XX, YY, ZZ };
81 
82 
83  // Constructors
84 
85  //- Construct null
86  inline DiagTensor();
87 
88  //- Construct given VectorSpace
89  template<class Cmpt2>
90  inline DiagTensor(const VectorSpace<DiagTensor<Cmpt2>, Cmpt2, 3>&);
91 
92  //- Construct given three components
93  inline DiagTensor(const Cmpt& txx, const Cmpt& tyy, const Cmpt& tzz);
94 
95  //- Construct from Istream
96  inline DiagTensor(Istream&);
97 
98 
99  // Member Functions
100 
101  // Access
102 
103  inline const Cmpt& xx() const;
104  inline const Cmpt& yy() const;
105  inline const Cmpt& zz() const;
106 
107  inline Cmpt& xx();
108  inline Cmpt& yy();
109  inline Cmpt& zz();
110 };
111 
112 
113 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
114 
115 } // End namespace Foam
116 
117 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
118 
119 // Include inline implementations
120 #include "DiagTensorI.H"
121 
122 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
123 
124 #endif
125 
126 // ************************************************************************* //
static const DiagTensor one
Definition: DiagTensor.H:73
const Cmpt & xx() const
Definition: DiagTensorI.H:76
const Cmpt & yy() const
Definition: DiagTensorI.H:82
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:88
static const DiagTensor max
Definition: DiagTensor.H:74
Namespace for OpenFOAM.
static const DiagTensor min
Definition: DiagTensor.H:75
Templated 3D DiagTensor derived from VectorSpace.
Definition: DiagTensor.H:53
static const DiagTensor zero
Definition: DiagTensor.H:72
static const char * componentNames[]
Definition: DiagTensor.H:71
static const char *const typeName
Definition: DiagTensor.H:70
components
Component labeling enumeration.
Definition: DiagTensor.H:79
Templated vector space.
Definition: VectorSpace.H:52
DiagTensor()
Construct null.
Definition: DiagTensorI.H:37