SphericalTensor2D.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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2016 OpenFOAM Foundation
9  Copyright (C) 2019-2020 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::SphericalTensor2D
29 
30 Description
31  A templated (2 x 2) diagonal tensor of objects of <T>, effectively
32  containing 1 element, derived from VectorSpace.
33 
34 See also
35  Test-SphericalTensor2D.C
36 
37 SourceFiles
38  SphericalTensor2DI.H
39 
40 \*---------------------------------------------------------------------------*/
41 
42 #ifndef SphericalTensor2D_H
43 #define SphericalTensor2D_H
44 
45 #include "contiguous.H"
46 #include "VectorSpace.H"
47 
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 
50 namespace Foam
51 {
52 
53 /*---------------------------------------------------------------------------*\
54  Class SphericalTensor2D Declaration
55 \*---------------------------------------------------------------------------*/
56 
57 template<class Cmpt>
59 :
60  public VectorSpace<SphericalTensor2D<Cmpt>, Cmpt, 1>
61 {
62 public:
63 
64  // Typedefs
65 
66  //- Equivalent type of labels used for valid component indexing
68 
69 
70  // Member Constants
71 
72  //- Rank of SphericalTensor2D is 2
73  static constexpr direction rank = 2;
74 
75 
76  // Static Data Members
77 
78  static const SphericalTensor2D I;
80  static const SphericalTensor2D twoThirdsI;
81 
82 
83  //- Component labeling enumeration
84  enum components { II };
85 
86 
87  // Generated Methods
88 
89  //- Default construct
90  SphericalTensor2D() = default;
91 
92  //- Copy construct
93  SphericalTensor2D(const SphericalTensor2D&) = default;
94 
95  //- Copy assignment
97 
98 
99  // Constructors
100 
101  //- Construct initialized to zero
102  inline SphericalTensor2D(const Foam::zero);
103 
104  //- Construct given VectorSpace
105  inline SphericalTensor2D
106  (
107  const VectorSpace<SphericalTensor2D<Cmpt>, Cmpt, 1>&
108  );
109 
110  //- Construct given the component
111  inline explicit SphericalTensor2D(const Cmpt& tii);
112 
113  //- Construct from Istream
114  inline explicit SphericalTensor2D(Istream& is);
115 
116 
117  // Member Functions
118 
119  // Access
120 
121  inline const Cmpt& ii() const;
122  inline Cmpt& ii();
123 };
124 
125 
126 // * * * * * * * * * * * * * * * * * Traits * * * * * * * * * * * * * * * * //
127 
128 //- Data are contiguous if component type is contiguous
129 template<class Cmpt>
130 struct is_contiguous<SphericalTensor2D<Cmpt>> : is_contiguous<Cmpt> {};
131 
132 //- Data are contiguous label if component type is label
133 template<class Cmpt>
135 :
136  is_contiguous_label<Cmpt>
137 {};
138 
139 //- Data are contiguous scalar if component type is scalar
140 template<class Cmpt>
142 :
144 {};
145 
146 
147 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
148 
149 } // End namespace Foam
150 
151 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
152 
153 #include "SphericalTensor2DI.H"
154 
155 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
156 
157 #endif
158 
159 // ************************************************************************* //
VectorSpace.H
SphericalTensor2DI.H
Foam::SphericalTensor2D::II
Definition: SphericalTensor2D.H:83
Foam::SphericalTensor2D::rank
static constexpr direction rank
Rank of SphericalTensor2D is 2.
Definition: SphericalTensor2D.H:72
Foam::SphericalTensor2D::ii
const Cmpt & ii() const
Definition: SphericalTensor2DI.H:67
Foam::is_contiguous_label
A template class to specify if a data type is composed solely of Foam::label elements.
Definition: contiguous.H:83
Foam::VectorSpace
Templated vector space.
Definition: VectorSpace.H:56
Foam::SphericalTensor2D::twoThirdsI
static const SphericalTensor2D twoThirdsI
Definition: SphericalTensor2D.H:79
Foam::SphericalTensor2D::I
static const SphericalTensor2D I
Definition: SphericalTensor2D.H:77
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::SphericalTensor2D::SphericalTensor2D
SphericalTensor2D()=default
Default construct.
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::SphericalTensor2D::components
components
Component labeling enumeration.
Definition: SphericalTensor2D.H:83
Foam::SphericalTensor2D::operator=
SphericalTensor2D & operator=(const SphericalTensor2D &)=default
Copy assignment.
Foam::is_contiguous_scalar
A template class to specify if a data type is composed solely of Foam::scalar elements.
Definition: contiguous.H:91
Foam::SphericalTensor2D::labelType
SphericalTensor2D< label > labelType
Equivalent type of labels used for valid component indexing.
Definition: SphericalTensor2D.H:66
contiguous.H
Foam::direction
uint8_t direction
Definition: direction.H:52
Foam::SphericalTensor2D::oneThirdI
static const SphericalTensor2D oneThirdI
Definition: SphericalTensor2D.H:78
Foam::is_contiguous
A template class to specify that a data type can be considered as being contiguous in memory.
Definition: contiguous.H:75
Foam::SphericalTensor2D
A templated (2 x 2) diagonal tensor of objects of <T>, effectively containing 1 element,...
Definition: SphericalTensor2D.H:57
Foam::zero
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
Definition: zero.H:62