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;
58 constexpr doubleScalar doubleScalarVGREAT = 1.0e+300;
59 constexpr doubleScalar doubleScalarROOTVGREAT = 1.0e+150;
60 constexpr doubleScalar doubleScalarSMALL = 1.0e-15;
62 constexpr doubleScalar doubleScalarVSMALL = 1.0e-300;
63 constexpr doubleScalar doubleScalarROOTVSMALL = 1.0e-150;
64 
65 
66 #define Scalar doubleScalar
67 #define ScalarVGREAT doubleScalarVGREAT
68 #define ScalarVSMALL doubleScalarVSMALL
69 #define ScalarROOTVGREAT doubleScalarROOTVGREAT
70 #define ScalarROOTVSMALL doubleScalarROOTVSMALL
71 #define ScalarRead readDouble
72 
73 
74 inline Scalar mag(const Scalar s)
75 {
76  return ::fabs(s);
77 }
78 
79 inline Scalar hypot(const Scalar x, const Scalar y)
80 {
81  return ::hypot(x, y);
82 }
83 
84 inline Scalar atan2(const Scalar y, const Scalar x)
85 {
86  return ::atan2(y, x);
87 }
88 
89 
90 // Normal (double-precision) transcendental functions
91 #define transFunc(func) \
92 inline Scalar func(const Scalar s) \
93 { \
94  return ::func(s); \
95 }
96 
97 // Normal (double-precision) bessel functions.
98 // May not be available on all systems
99 #ifdef Foam_no_besselFunc
100  // Not available
101  #define besselFunc(func) \
102  inline Scalar func(const Scalar s) \
103  { \
104  std::cerr<< "No '" << #func << "' function\n"; \
105  return 0; \
106  }
107  #define besselFunc2(func) \
108  inline Scalar func(const int n, const Scalar s) \
109  { \
110  std::cerr<< "No '" << #func << "' function\n"; \
111  return 0; \
112  }
113 #elif defined(__MINGW32__)
114  // Mingw: with '_' prefix
115  #define besselFunc(func) \
116  inline Scalar func(const Scalar s) \
117  { \
118  return _##func(s); \
119  }
120  #define besselFunc2(func) \
121  inline Scalar func(const int n, const Scalar s) \
122  { \
123  return _##func(n, s); \
124  }
125 #else
126  #define besselFunc(func) \
127  inline Scalar func(const Scalar s) \
128  { \
129  return ::func(s); \
130  }
131  #define besselFunc2(func) \
132  inline Scalar func(const int n, const Scalar s) \
133  { \
134  return ::func(n, s); \
135  }
136 #endif
137 
138 
139 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
140 
141 } // End namespace Foam
142 
143 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
144 
145 #include "Scalar.H"
146 
147 #undef Scalar
148 #undef ScalarVGREAT
149 #undef ScalarVSMALL
150 #undef ScalarROOTVGREAT
151 #undef ScalarROOTVSMALL
152 #undef ScalarRead
153 #undef transFunc
154 #undef besselFunc
155 #undef besselFunc2
156 
157 
158 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
159 
160 #endif
161 
162 // ************************************************************************* //
Foam::doubleScalar
double doubleScalar
A typedef for double.
Definition: scalarFwd.H:48
Foam::doubleScalarROOTVGREAT
constexpr doubleScalar doubleScalarROOTVGREAT
Definition: doubleScalar.H:59
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:61
Foam::doubleScalarSMALL
constexpr doubleScalar doubleScalarSMALL
Definition: doubleScalar.H:60
Foam::hypot
doubleScalar hypot(const doubleScalar x, const doubleScalar y)
Definition: doubleScalar.H:79
Foam::hypot
dimensionedScalar hypot(const dimensionedScalar &x, const dimensionedScalar &y)
Definition: dimensionedScalar.C:327
Foam::doubleScalarVGREAT
constexpr doubleScalar doubleScalarVGREAT
Definition: doubleScalar.H:58
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:62
direction.H
Direction is an 8-bit unsigned integer type used to represent the Cartesian directions etc.
Scalar
#define Scalar
Definition: doubleScalar.H:66
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:84
Foam::doubleScalarROOTVSMALL
constexpr doubleScalar doubleScalarROOTVSMALL
Definition: doubleScalar.H:63
word.H
Foam::doubleScalarGREAT
constexpr doubleScalar doubleScalarGREAT
Definition: doubleScalar.H:57
Scalar.H
y
scalar y
Definition: LISASMDCalcMethod1.H:14