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 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  Templated 3D SphericalTensor derived from VectorSpace adding construction
32  from 1 component, element access using th ii() member function and the
33  inner-product (dot-product) and outer-product operators.
34 
35 SourceFiles
36  SphericalTensorI.H
37 
38 \*---------------------------------------------------------------------------*/
39 
40 #ifndef SphericalTensor_H
41 #define SphericalTensor_H
42 
43 #include "contiguous.H"
44 #include "VectorSpace.H"
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 namespace Foam
49 {
50 
51 /*---------------------------------------------------------------------------*\
52  Class SphericalTensor Declaration
53 \*---------------------------------------------------------------------------*/
54 
55 template<class Cmpt>
56 class SphericalTensor
57 :
58  public VectorSpace<SphericalTensor<Cmpt>, Cmpt, 1>
59 {
60 
61 public:
62 
63  //- Equivalent type of labels used for valid component indexing
65 
66 
67  // Member constants
68 
69  //- Rank of SphericalTensor is 2
70  static constexpr direction rank = 2;
71 
72 
73  // Static data members
74 
75  static const SphericalTensor I;
76  static const SphericalTensor oneThirdI;
77  static const SphericalTensor twoThirdsI;
78 
79 
80  //- Component labeling enumeration
81  enum components { II };
82 
83 
84  // Constructors
85 
86  //- Construct null
87  inline SphericalTensor();
88 
89  //- Construct initialized to zero
90  inline SphericalTensor(const Foam::zero);
91 
92  //- Construct given VectorSpace
93  template<class Cmpt2>
94  inline SphericalTensor
95  (
96  const VectorSpace<SphericalTensor<Cmpt2>, Cmpt2, 1>&
97  );
98 
99  //- Construct given the component
100  inline SphericalTensor(const Cmpt& tii);
101 
102  //- Construct from Istream
103  inline SphericalTensor(Istream&);
104 
105 
106  // Member Functions
107 
108  // Access
109 
110  inline const Cmpt& ii() const;
111  inline Cmpt& ii();
112 
113 
114  //- Transpose
115  inline const SphericalTensor<Cmpt>& T() const;
116 };
117 
118 
119 // * * * * * * * * * * * * * * * * * Traits * * * * * * * * * * * * * * * * //
120 
121 //- Data are contiguous if component type is contiguous
122 template<class Cmpt>
123 struct is_contiguous<SphericalTensor<Cmpt>> : is_contiguous<Cmpt> {};
124 
125 //- Data are contiguous label if component type is label
126 template<class Cmpt>
128 :
129  is_contiguous_label<Cmpt>
130 {};
131 
132 //- Data are contiguous scalar if component type is scalar
133 template<class Cmpt>
135 :
137 {};
138 
139 
140 template<class Cmpt>
141 class typeOfSolve<SphericalTensor<Cmpt>>
142 {
143 public:
144 
146 };
147 
148 
149 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
150 
151 } // End namespace Foam
152 
153 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
154 
155 #include "SphericalTensorI.H"
156 
157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
158 
159 #endif
160 
161 // ************************************************************************* //
VectorSpace.H
Foam::SphericalTensor::T
const SphericalTensor< Cmpt > & T() const
Transpose.
Definition: SphericalTensorI.H:87
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:69
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:75
Foam::SphericalTensor::II
Definition: SphericalTensor.H:80
SphericalTensorI.H
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::SphericalTensor::ii
const Cmpt & ii() const
Definition: SphericalTensorI.H:72
Foam::SphericalTensor
Templated 3D SphericalTensor derived from VectorSpace adding construction from 1 component,...
Definition: SphericalTensor.H:55
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:63
Foam::SphericalTensor::SphericalTensor
SphericalTensor()
Construct null.
Definition: SphericalTensorI.H:33
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:80
Foam::SphericalTensor::twoThirdsI
static const SphericalTensor twoThirdsI
Definition: SphericalTensor.H:76
Foam::typeOfSolve< SphericalTensor< Cmpt > >::type
SphericalTensor< solveScalar > type
Definition: SphericalTensor.H:144
Foam::SphericalTensor::I
static const SphericalTensor I
Definition: SphericalTensor.H:74
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), which can be used to avoid manipulating objects that ar...
Definition: zero.H:61