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 -------------------------------------------------------------------------------
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 Typedef
28  Foam::doubleScalar
29 
30 Description
31  Floating-point double precision scalar type.
32 
33 SourceFiles
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 
50 namespace 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()
57 constexpr doubleScalar doubleScalarGREAT = 1.0e+15;
59 constexpr doubleScalar doubleScalarVGREAT = 1.0e+300;
60 constexpr doubleScalar doubleScalarROOTVGREAT = 1.0e+150;
61 constexpr doubleScalar doubleScalarSMALL = 1.0e-15;
63 constexpr doubleScalar doubleScalarVSMALL = 1.0e-300;
64 constexpr doubleScalar doubleScalarROOTVSMALL = 1.0e-150;
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 
75 inline Scalar mag(const Scalar s)
76 {
77  return ::fabs(s);
78 }
79 
80 inline Scalar hypot(const Scalar x, const Scalar y)
81 {
82  return ::hypot(x, y);
83 }
84 
85 inline 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) \
93 inline 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 // ************************************************************************* //
Foam::doubleScalarROOTGREAT
constexpr doubleScalar doubleScalarROOTGREAT
Definition: doubleScalar.H:58
Foam::doubleScalar
double doubleScalar
A typedef for double.
Definition: scalarFwd.H:48
Foam::doubleScalarROOTVGREAT
constexpr doubleScalar doubleScalarROOTVGREAT
Definition: doubleScalar.H:60
s
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))
Definition: gmvOutputSpray.H:25
doubleFloat.H
Foam::atan2
dimensionedScalar atan2(const dimensionedScalar &x, const dimensionedScalar &y)
Definition: dimensionedScalar.C:312
Foam::doubleScalarROOTSMALL
constexpr doubleScalar doubleScalarROOTSMALL
Definition: doubleScalar.H:62
Foam::doubleScalarSMALL
constexpr doubleScalar doubleScalarSMALL
Definition: doubleScalar.H:61
Foam::hypot
doubleScalar hypot(const doubleScalar x, const doubleScalar y)
Definition: doubleScalar.H:80
Foam::hypot
dimensionedScalar hypot(const dimensionedScalar &x, const dimensionedScalar &y)
Definition: dimensionedScalar.C:327
Foam::doubleScalarVGREAT
constexpr doubleScalar doubleScalarVGREAT
Definition: doubleScalar.H:59
scalarFwd.H
Typedefs for float/double/scalar without requiring scalar.H.
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::doubleScalarVSMALL
constexpr doubleScalar doubleScalarVSMALL
Definition: doubleScalar.H:63
direction.H
Direction is an 8-bit unsigned integer type used to represent Cartesian directions,...
Scalar
#define Scalar
Definition: doubleScalar.H:67
Foam::mag
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
x
x
Definition: LISASMDCalcMethod2.H:52
Foam::atan2
doubleScalar atan2(const doubleScalar y, const doubleScalar x)
Definition: doubleScalar.H:85
Foam::doubleScalarROOTVSMALL
constexpr doubleScalar doubleScalarROOTVSMALL
Definition: doubleScalar.H:64
word.H
Foam::doubleScalarGREAT
constexpr doubleScalar doubleScalarGREAT
Definition: doubleScalar.H:57
Scalar.H
y
scalar y
Definition: LISASMDCalcMethod1.H:14