FreeFOAM The Cross-Platform CFD Toolkit
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 | Copyright (C) 1991-2010 OpenCFD Ltd.
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Typedef
25  Foam::doubleScalar
26 
27 Description
28  Double precision floating point scalar type.
29 
30 SourceFiles
31  doubleScalar.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef doubleScalar_H
36 #define doubleScalar_H
37 
38 #include <OpenFOAM/doubleFloat.H>
39 #include <OpenFOAM/direction.H>
40 #include <OpenFOAM/word.H>
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 
49 typedef double doubleScalar;
50 
51 // Largest and smallest scalar values allowed in certain parts of the code.
52 // (15 is the number of significant figures in an
53 // IEEE double precision number. See limits.h or float.h)
54 static const doubleScalar doubleScalarGREAT = 1.0e+15;
55 static const doubleScalar doubleScalarVGREAT = 1.0e+300;
56 static const doubleScalar doubleScalarROOTVGREAT = 1.0e+150;
57 static const doubleScalar doubleScalarSMALL = 1.0e-15;
58 static const doubleScalar doubleScalarVSMALL = 1.0e-300;
59 static const doubleScalar doubleScalarROOTVSMALL = 1.0e-150;
60 
61 
62 #define Scalar doubleScalar
63 #define ScalarVGREAT doubleScalarVGREAT
64 #define ScalarVSMALL doubleScalarVSMALL
65 #define readScalar readDoubleScalar
66 
67 inline Scalar mag(const Scalar s)
68 {
69  return ::fabs(s);
70 }
71 
72 #define transFunc(func) \
73 inline Scalar func(const Scalar s) \
74 { \
75  return ::func(s); \
76 }
77 
78 #include <OpenFOAM/Scalar_.H>
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 inline Scalar jn(const int n, const Scalar s)
91 {
92  return ::jn(n, s);
93 }
94 
95 inline Scalar yn(const int n, const Scalar s)
96 {
97  return ::yn(n, s);
98 }
99 
100 #undef Scalar
101 #undef ScalarVGREAT
102 #undef ScalarVSMALL
103 #undef readScalar
104 #undef transFunc
105 
106 
107 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
108 
109 } // End namespace Foam
110 
111 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
112 
113 #endif
114 
115 // ************************ vim: set sw=4 sts=4 et: ************************ //