floatTensors.C
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) 2016 OpenFOAM Foundation
9 Copyright (C) 2018-2022 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
27\*---------------------------------------------------------------------------*/
28
29#include "tensor.H"
30
31// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
32
33#if defined(WM_DP)
34
35template<>
36const char* const Foam::Tensor<float>::vsType::typeName = "floatTensor";
37
38template<>
39const char* const Foam::Tensor<double>::vsType::typeName = "tensor";
40
41#else
42// WM_SP, WM_SPDP
43
44template<>
45const char* const Foam::Tensor<float>::vsType::typeName = "tensor";
46
47template<>
48const char* const Foam::Tensor<double>::vsType::typeName = "doubleTensor";
49
50#endif
51
52// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53
54#undef defineTraits
55#define defineTraits(Type, Prefix) \
56 \
57 template<> \
58 const char* const Foam::Tensor<Type>::vsType::componentNames[] = \
59 { \
60 "xx", "xy", "xz", \
61 "yx", "yy", "yz", \
62 "zx", "zy", "zz" \
63 }; \
64 \
65 template<> \
66 const Foam::Tensor<Type> Foam::Tensor<Type>::vsType::zero \
67 ( \
68 Tensor<Type>::uniform(0) \
69 ); \
70 \
71 template<> \
72 const Foam::Tensor<Type> Foam::Tensor<Type>::vsType::one \
73 ( \
74 Tensor<Type>::uniform(1) \
75 ); \
76 \
77 template<> \
78 const Foam::Tensor<Type> Foam::Tensor<Type>::vsType::max \
79 ( \
80 Tensor<Type>::uniform(Prefix##VGREAT) \
81 ); \
82 \
83 template<> \
84 const Foam::Tensor<Type> Foam::Tensor<Type>::vsType::min \
85 ( \
86 Tensor<Type>::uniform(-Prefix##VGREAT) \
87 ); \
88 \
89 template<> \
90 const Foam::Tensor<Type> Foam::Tensor<Type>::vsType::rootMax \
91 ( \
92 Tensor<Type>::uniform(Prefix##ROOTVGREAT) \
93 ); \
94 \
95 template<> \
96 const Foam::Tensor<Type> Foam::Tensor<Type>::vsType::rootMin \
97 ( \
98 Tensor<Type>::uniform(-Prefix##ROOTVGREAT) \
99 ); \
100 \
101 template<> \
102 const Foam::Tensor<Type> Foam::Tensor<Type>::I \
103 ( \
104 1, 0, 0, \
105 0, 1, 0, \
106 0, 0, 1 \
107 ); \
108
109
112
113#undef defineTraits
114
115// ************************************************************************* //
A templated (3 x 3) tensor of objects of <T> derived from MatrixSpace.
Definition: Tensor.H:64
#define defineTraits(Type, Prefix)
Definition: floatTensors.C:55
double doubleScalar
A typedef for double.
Definition: scalarFwd.H:48
float floatScalar
A typedef for float.
Definition: scalarFwd.H:45