Loading...
Searching...
No Matches
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.cxx
35
36\*---------------------------------------------------------------------------*/
37
38#ifndef Foam_primitives_double_H
39#define Foam_primitives_double_H
40
41#include "scalarFwd.H"
42#include "doubleFloat.H"
43#include "direction.H"
44#include "pTraits.H"
45#include "word.H"
46
47// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48
49// Typedef (doubleScalar) in scalarFwd.H
50
51namespace Foam
52{
53
54// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
56// Largest and smallest scalar values allowed in certain parts of the code.
57// See std::numeric_limits max(), min(), epsilon()
58constexpr doubleScalar doubleScalarGREAT = 1.0e+15;
60constexpr doubleScalar doubleScalarVGREAT = 1.0e+300;
62constexpr doubleScalar doubleScalarSMALL = 1.0e-15;
63constexpr doubleScalar doubleScalarROOTSMALL = 3.0e-8;
64constexpr doubleScalar doubleScalarVSMALL = 1.0e-300;
68#define Scalar doubleScalar
69#define ScalarVGREAT doubleScalarVGREAT
70#define ScalarVSMALL doubleScalarVSMALL
71#define ScalarROOTVGREAT doubleScalarROOTVGREAT
72#define ScalarROOTVSMALL doubleScalarROOTVSMALL
73#define ScalarRead readDouble
74
75
76inline Scalar mag(const Scalar s)
78 return ::fabs(s);
79}
80
81inline Scalar hypot(const Scalar x, const Scalar y)
83 return ::hypot(x, y);
84}
85
86inline Scalar atan2(const Scalar y, const Scalar x)
87{
88 return ::atan2(y, x);
90
91
92// Normal (double-precision) transcendental functions
93#define transFunc(func) \
94inline Scalar func(const Scalar s) \
95{ \
96 return ::func(s); \
97}
98
99// Normal (double-precision) bessel functions.
100// May not be available on all systems
101#ifdef Foam_no_besselFunc
102 // Not available
103 #define besselFunc(func) \
104 inline Scalar func(const Scalar s) \
105 { \
106 std::cerr<< "No '" << #func << "' function\n"; \
107 return 0; \
108 }
109 #define besselFunc2(func) \
110 inline Scalar func(const int n, const Scalar s) \
111 { \
112 std::cerr<< "No '" << #func << "' function\n"; \
113 return 0; \
114 }
115#elif defined(__MINGW32__)
116 // Mingw: with '_' prefix
117 #define besselFunc(func) \
118 inline Scalar func(const Scalar s) \
119 { \
120 return _##func(s); \
121 }
122 #define besselFunc2(func) \
123 inline Scalar func(const int n, const Scalar s) \
124 { \
125 return _##func(n, s); \
126 }
127#else
128 #define besselFunc(func) \
129 inline Scalar func(const Scalar s) \
130 { \
131 return ::func(s); \
132 }
133 #define besselFunc2(func) \
134 inline Scalar func(const int n, const Scalar s) \
135 { \
136 return ::func(n, s); \
137 }
138#endif
139
140
141// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
142
143} // End namespace Foam
144
145// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
146
147// scalarImpl.H is used for template-like substitution (but using macros)
148
149#define Foam_use_scalarImpl_header
150#include "scalarImpl.H"
151#undef Foam_use_scalarImpl_header
152
153#undef Scalar
154#undef ScalarVGREAT
155#undef ScalarVSMALL
156#undef ScalarROOTVGREAT
157#undef ScalarROOTVSMALL
158#undef ScalarRead
159#undef transFunc
160#undef besselFunc
161#undef besselFunc2
162
163
164// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
165
166#endif
167
168// ************************************************************************* //
scalar y
Direction is an 8-bit unsigned integer type used to represent Cartesian directions,...
#define Scalar
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.
constexpr doubleScalar doubleScalarROOTVGREAT
constexpr doubleScalar doubleScalarROOTSMALL
dimensionedScalar atan2(const dimensionedScalar &x, const dimensionedScalar &y)
double doubleScalar
A typedef for double.
Definition scalarFwd.H:48
constexpr doubleScalar doubleScalarVGREAT
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
dimensionedScalar hypot(const dimensionedScalar &x, const dimensionedScalar &y)
constexpr doubleScalar doubleScalarGREAT
constexpr doubleScalar doubleScalarROOTGREAT
constexpr doubleScalar doubleScalarVSMALL
constexpr doubleScalar doubleScalarSMALL
constexpr doubleScalar doubleScalarROOTVSMALL
Typedefs for float/double/scalar without requiring scalar.H.