Loading...
Searching...
No Matches
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-2023 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
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
27Class
28 Foam::SphericalTensor
29
30Description
31 A templated (3 x 3) diagonal tensor of objects of <T>, effectively
32 containing 1 element, derived from VectorSpace.
33
34See also
35 Test-SphericalTensor.C
36
37SourceFiles
38 SphericalTensorI.H
39
40\*---------------------------------------------------------------------------*/
41
42#ifndef Foam_SphericalTensor_H
43#define Foam_SphericalTensor_H
44
45#include "contiguous.H"
46#include "VectorSpace.H"
47
48// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49
50namespace Foam
51{
52
53/*---------------------------------------------------------------------------*\
54 Class SphericalTensor Declaration
55\*---------------------------------------------------------------------------*/
56
57template<class Cmpt>
59:
60 public VectorSpace<SphericalTensor<Cmpt>, Cmpt, 1>
61{
62public:
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
78 static const SphericalTensor I;
80 static const SphericalTensor twoThirdsI;
81
82
83 //- Component labeling enumeration
84 enum components { II };
86
87 // Generated Methods
88
89 //- Default construct
90 SphericalTensor() = default;
91
92 //- Copy construct
94
95 //- Copy assignment
96 SphericalTensor& operator=(const SphericalTensor&) = default;
97
99 // Constructors
100
101 //- Construct initialized to zero
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
118 // Member Functions
119
120 // Component Access
121
122 const Cmpt& ii() const noexcept { return this->v_[II]; }
123
124 Cmpt& ii() noexcept { return this->v_[II]; }
126
127 // Diagonal access and manipulation
128
129 //- The L2-norm squared of the diagonal
130 inline scalar diagSqr() const;
131
132
133 // Tensor Operations
134
135 //- Return non-Hermitian transpose (no-op)
136 const SphericalTensor<Cmpt>& T() const noexcept { return *this; }
138
140// * * * * * * * * * * * * * * * * * Traits * * * * * * * * * * * * * * * * //
141
142//- Data are contiguous if component type is contiguous
143template<class Cmpt>
144struct is_contiguous<SphericalTensor<Cmpt>> : is_contiguous<Cmpt> {};
145
146//- Data are contiguous label if component type is label
147template<class Cmpt>
149:
151{};
152
153//- Data are contiguous scalar if component type is scalar
154template<class Cmpt>
156:
158{};
159
160
161template<class Cmpt>
162class typeOfSolve<SphericalTensor<Cmpt>>
163{
164public:
167};
168
169
170// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
172} // End namespace Foam
173
174// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
175
176#include "SphericalTensorI.H"
177
178// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
179
180#endif
181
182// ************************************************************************* //
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition Istream.H:60
A templated (3 x 3) diagonal tensor of objects of <T>, effectively containing 1 element,...
static const SphericalTensor I
scalar diagSqr() const
The L2-norm squared of the diagonal.
SphericalTensor()=default
Default construct.
SphericalTensor(const VectorSpace< SphericalTensor< Cmpt2 >, Cmpt2, 1 > &)
Construct given VectorSpace.
static const SphericalTensor twoThirdsI
const Cmpt & ii() const noexcept
SphericalTensor< label > labelType
Cmpt & ii() noexcept
components
Component labeling enumeration.
SphericalTensor & operator=(const SphericalTensor &)=default
Copy assignment.
SphericalTensor(Istream &is)
Construct from Istream.
SphericalTensor(const SphericalTensor &)=default
Copy construct.
static const SphericalTensor oneThirdI
const SphericalTensor< Cmpt > & T() const noexcept
Return non-Hermitian transpose (no-op).
static constexpr direction rank
SphericalTensor(Foam::zero)
Construct initialized to zero.
SphericalTensor(const Cmpt &tii)
Construct given the component.
Cmpt v_[Ncmpts]
The components of this vector space.
Definition VectorSpace.H:81
The extended precision type (solveScalar for float).
Definition products.H:81
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
Definition zero.H:58
Namespace for OpenFOAM.
uint8_t direction
Definition direction.H:49
const direction noexcept
Definition scalarImpl.H:265
A template class to specify if a data type is composed solely of Foam::label elements.
Definition contiguous.H:82
A template class to specify if a data type is composed solely of Foam::scalar elements.
Definition contiguous.H:87
A template class to specify that a data type can be considered as being contiguous in memory.
Definition contiguous.H:70