SphericalTensor.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::SphericalTensor
29 
30 Description
31  A templated (3 x 3) diagonal tensor of objects of <T>, effectively
32  containing 1 element, derived from VectorSpace.
33 
34 See also
35  Test-SphericalTensor.C
36 
37 SourceFiles
38  SphericalTensorI.H
39 
40 \*---------------------------------------------------------------------------*/
41 
42 #ifndef SphericalTensor_H
43 #define SphericalTensor_H
44 
45 #include "contiguous.H"
46 #include "VectorSpace.H"
47 
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 
50 namespace Foam
51 {
52 
53 /*---------------------------------------------------------------------------*\
54  Class SphericalTensor Declaration
55 \*---------------------------------------------------------------------------*/
56 
57 template<class Cmpt>
58 class SphericalTensor
59 :
60  public VectorSpace<SphericalTensor<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 SphericalTensor is 2
73  static constexpr direction rank = 2;
74 
75 
76  // Static Data Members
77 
78  static const SphericalTensor I;
79  static const SphericalTensor oneThirdI;
80  static const SphericalTensor twoThirdsI;
81 
82 
83  //- Component labeling enumeration
84  enum components { II };
85 
86 
87  // Generated Methods
88 
89  //- Default construct
90  SphericalTensor() = default;
91 
92  //- Copy construct
93  SphericalTensor(const SphericalTensor&) = default;
94 
95  //- Copy assignment
96  SphericalTensor& operator=(const SphericalTensor&) = default;
97 
98 
99  // Constructors
100 
101  //- Construct initialized to zero
102  inline SphericalTensor(const Foam::zero);
103 
104  //- Construct given VectorSpace
105  template<class Cmpt2>
106  inline SphericalTensor
107  (
108  const VectorSpace<SphericalTensor<Cmpt2>, Cmpt2, 1>&
109  );
110 
111  //- Construct given the component
112  inline explicit SphericalTensor(const Cmpt& tii);
113 
114  //- Construct from Istream
115  inline explicit SphericalTensor(Istream& is);
116 
117 
118  // Member Functions
119 
120  // Access
121 
122  inline const Cmpt& ii() const;
123  inline Cmpt& ii();
124 
125 
126  //- Return non-Hermitian transpose (no-op)
127  inline const SphericalTensor<Cmpt>& T() const;
128 };
129 
130 
131 // * * * * * * * * * * * * * * * * * Traits * * * * * * * * * * * * * * * * //
132 
133 //- Data are contiguous if component type is contiguous
134 template<class Cmpt>
135 struct is_contiguous<SphericalTensor<Cmpt>> : is_contiguous<Cmpt> {};
136 
137 //- Data are contiguous label if component type is label
138 template<class Cmpt>
140 :
141  is_contiguous_label<Cmpt>
142 {};
143 
144 //- Data are contiguous scalar if component type is scalar
145 template<class Cmpt>
147 :
149 {};
150 
151 
152 template<class Cmpt>
153 class typeOfSolve<SphericalTensor<Cmpt>>
154 {
155 public:
156 
158 };
159 
160 
161 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
162 
163 } // End namespace Foam
164 
165 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
166 
167 #include "SphericalTensorI.H"
168 
169 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
170 
171 #endif
172 
173 // ************************************************************************* //
VectorSpace.H
Foam::SphericalTensor::T
const SphericalTensor< Cmpt > & T() const
Return non-Hermitian transpose (no-op)
Definition: SphericalTensorI.H:83
Foam::SphericalTensor::operator=
SphericalTensor & operator=(const SphericalTensor &)=default
Copy assignment.
Foam::typeOfSolve
The extended precision type (solveScalar for float)
Definition: products.H:78
Foam::SphericalTensor::rank
static constexpr direction rank
Rank of SphericalTensor is 2.
Definition: SphericalTensor.H:72
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::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::SphericalTensor::oneThirdI
static const SphericalTensor oneThirdI
Definition: SphericalTensor.H:78
Foam::SphericalTensor::II
Definition: SphericalTensor.H:83
SphericalTensorI.H
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::SphericalTensor::ii
const Cmpt & ii() const
Definition: SphericalTensorI.H:68
Foam::SphericalTensor
A templated (3 x 3) diagonal tensor of objects of <T>, effectively containing 1 element,...
Definition: SphericalTensor.H:57
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::SphericalTensor::labelType
SphericalTensor< label > labelType
Equivalent type of labels used for valid component indexing.
Definition: SphericalTensor.H:66
Foam::SphericalTensor::SphericalTensor
SphericalTensor()=default
Default construct.
contiguous.H
Foam::direction
uint8_t direction
Definition: direction.H:47
Foam::typeOfSolve::type
Type type
Definition: products.H:82
Foam::SphericalTensor< scalar >::components
components
Component labeling enumeration.
Definition: SphericalTensor.H:83
Foam::SphericalTensor::twoThirdsI
static const SphericalTensor twoThirdsI
Definition: SphericalTensor.H:79
Foam::typeOfSolve< SphericalTensor< Cmpt > >::type
SphericalTensor< solveScalar > type
Definition: SphericalTensor.H:156
Foam::SphericalTensor::I
static const SphericalTensor I
Definition: SphericalTensor.H:77
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::zero
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
Definition: zero.H:62