doubleScalar.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-2015 OpenFOAM Foundation
9 Copyright (C) 2017-2020 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
27Typedef
28 Foam::doubleScalar
29
30Description
31 Floating-point double precision scalar type.
32
33SourceFiles
34 doubleScalar.C
35
36\*---------------------------------------------------------------------------*/
37
38#ifndef doubleScalar_H
39#define doubleScalar_H
40
41#include "scalarFwd.H"
42#include "doubleFloat.H"
43#include "direction.H"
44#include "word.H"
45
46// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47
48// Typedef (doubleScalar) in scalarFwd.H
49
50namespace Foam
51{
52
53// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
54
55// Largest and smallest scalar values allowed in certain parts of the code.
56// See std::numeric_limits max(), min(), epsilon()
57constexpr doubleScalar doubleScalarGREAT = 1.0e+15;
59constexpr doubleScalar doubleScalarVGREAT = 1.0e+300;
61constexpr doubleScalar doubleScalarSMALL = 1.0e-15;
63constexpr doubleScalar doubleScalarVSMALL = 1.0e-300;
65
66
67#define Scalar doubleScalar
68#define ScalarVGREAT doubleScalarVGREAT
69#define ScalarVSMALL doubleScalarVSMALL
70#define ScalarROOTVGREAT doubleScalarROOTVGREAT
71#define ScalarROOTVSMALL doubleScalarROOTVSMALL
72#define ScalarRead readDouble
73
74
75inline Scalar mag(const Scalar s)
76{
77 return ::fabs(s);
78}
79
80inline Scalar hypot(const Scalar x, const Scalar y)
81{
82 return ::hypot(x, y);
83}
84
85inline Scalar atan2(const Scalar y, const Scalar x)
86{
87 return ::atan2(y, x);
88}
89
90
91// Normal (double-precision) transcendental functions
92#define transFunc(func) \
93inline Scalar func(const Scalar s) \
94{ \
95 return ::func(s); \
96}
97
98// Normal (double-precision) bessel functions.
99// May not be available on all systems
100#ifdef Foam_no_besselFunc
101 // Not available
102 #define besselFunc(func) \
103 inline Scalar func(const Scalar s) \
104 { \
105 std::cerr<< "No '" << #func << "' function\n"; \
106 return 0; \
107 }
108 #define besselFunc2(func) \
109 inline Scalar func(const int n, const Scalar s) \
110 { \
111 std::cerr<< "No '" << #func << "' function\n"; \
112 return 0; \
113 }
114#elif defined(__MINGW32__)
115 // Mingw: with '_' prefix
116 #define besselFunc(func) \
117 inline Scalar func(const Scalar s) \
118 { \
119 return _##func(s); \
120 }
121 #define besselFunc2(func) \
122 inline Scalar func(const int n, const Scalar s) \
123 { \
124 return _##func(n, s); \
125 }
126#else
127 #define besselFunc(func) \
128 inline Scalar func(const Scalar s) \
129 { \
130 return ::func(s); \
131 }
132 #define besselFunc2(func) \
133 inline Scalar func(const int n, const Scalar s) \
134 { \
135 return ::func(n, s); \
136 }
137#endif
138
139
140// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
141
142} // End namespace Foam
143
144// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
145
146#include "Scalar.H"
147
148#undef Scalar
149#undef ScalarVGREAT
150#undef ScalarVSMALL
151#undef ScalarROOTVGREAT
152#undef ScalarROOTVSMALL
153#undef ScalarRead
154#undef transFunc
155#undef besselFunc
156#undef besselFunc2
157
158
159// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
160
161#endif
162
163// ************************************************************************* //
scalar y
Direction is an 8-bit unsigned integer type used to represent Cartesian directions,...
#define Scalar
Definition: doubleScalar.C:41
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
Namespace for OpenFOAM.
double doubleScalar
A typedef for double.
Definition: scalarFwd.H:48
constexpr doubleScalar doubleScalarROOTVGREAT
Definition: doubleScalar.H:60
constexpr doubleScalar doubleScalarROOTSMALL
Definition: doubleScalar.H:62
dimensionedScalar atan2(const dimensionedScalar &x, const dimensionedScalar &y)
constexpr doubleScalar doubleScalarVGREAT
Definition: doubleScalar.H:59
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
dimensionedScalar hypot(const dimensionedScalar &x, const dimensionedScalar &y)
constexpr doubleScalar doubleScalarGREAT
Definition: doubleScalar.H:57
constexpr doubleScalar doubleScalarROOTGREAT
Definition: doubleScalar.H:58
constexpr doubleScalar doubleScalarVSMALL
Definition: doubleScalar.H:63
constexpr doubleScalar doubleScalarSMALL
Definition: doubleScalar.H:61
constexpr doubleScalar doubleScalarROOTVSMALL
Definition: doubleScalar.H:64
Typedefs for float/double/scalar without requiring scalar.H.