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) 2011-2015 OpenFOAM Foundation
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 "doubleFloat.H"
39 #include "direction.H"
40 #include "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 doubleScalarROOTSMALL = 3.0e-8;
59 static const doubleScalar doubleScalarVSMALL = 1.0e-300;
60 static const doubleScalar doubleScalarROOTVSMALL = 1.0e-150;
61 
62 //- Read whole of buf as a scalar. Return true if succesful.
63 inline bool readScalar(const char* buf, doubleScalar& s)
64 {
65  char* endPtr;
66  s = strtod(buf, &endPtr);
67 
68  return (*endPtr == '\0');
69 }
70 
71 #define Scalar doubleScalar
72 #define ScalarVGREAT doubleScalarVGREAT
73 #define ScalarVSMALL doubleScalarVSMALL
74 #define ScalarROOTVGREAT doubleScalarROOTVGREAT
75 #define ScalarROOTVSMALL doubleScalarROOTVSMALL
76 #define readScalar readDoubleScalar
77 
78 inline Scalar mag(const Scalar s)
79 {
80  return ::fabs(s);
81 }
82 
83 #define transFunc(func) \
84 inline Scalar func(const Scalar s) \
85 { \
86  return ::func(s); \
87 }
88 
89 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
90 
91 } // End namespace Foam
92 
93 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
94 
95 #include "Scalar.H"
96 
97 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
98 
99 namespace Foam
100 {
101 
102 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
103 
104 inline Scalar hypot(const Scalar x, const Scalar y)
105 {
106  return ::hypot(x, y);
107 }
108 
109 inline Scalar atan2(const Scalar y, const Scalar x)
110 {
111  return ::atan2(y, x);
112 }
113 
114 inline Scalar jn(const int n, const Scalar s)
115 {
116  return ::jn(n, s);
117 }
118 
119 inline Scalar yn(const int n, const Scalar s)
120 {
121  return ::yn(n, s);
122 }
123 
124 #undef Scalar
125 #undef ScalarVGREAT
126 #undef ScalarVSMALL
127 #undef ScalarROOTVGREAT
128 #undef ScalarROOTVSMALL
129 #undef readScalar
130 #undef transFunc
131 
132 
133 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
134 
135 } // End namespace Foam
136 
137 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
138 
139 #endif
140 
141 // ************************************************************************* //
#define Scalar
Definition: doubleScalar.H:71
doubleScalar jn(const int n, const doubleScalar s)
Definition: doubleScalar.H:114
static const doubleScalar doubleScalarVGREAT
Definition: doubleScalar.H:55
dimensionedScalar yn(const int n, const dimensionedScalar &ds)
static const doubleScalar doubleScalarGREAT
Definition: doubleScalar.H:54
doubleScalar yn(const int n, const doubleScalar s)
Definition: doubleScalar.H:119
static const doubleScalar doubleScalarROOTSMALL
Definition: doubleScalar.H:58
scalar y
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){gmvFile<< iter().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))
dimensionedScalar jn(const int n, const dimensionedScalar &ds)
double doubleScalar
Double precision floating point scalar type.
Definition: doubleScalar.H:49
bool readScalar(const char *buf, doubleScalar &s)
Read whole of buf as a scalar. Return true if succesful.
Definition: doubleScalar.H:63
static const doubleScalar doubleScalarROOTVSMALL
Definition: doubleScalar.H:60
static const doubleScalar doubleScalarROOTVGREAT
Definition: doubleScalar.H:56
static const doubleScalar doubleScalarVSMALL
Definition: doubleScalar.H:59
dimensionedScalar atan2(const dimensionedScalar &x, const dimensionedScalar &y)
doubleScalar atan2(const doubleScalar y, const doubleScalar x)
Definition: doubleScalar.H:109
doubleScalar hypot(const doubleScalar x, const doubleScalar y)
Definition: doubleScalar.H:104
Direction is an 8-bit unsigned integer type used to represent the Cartesian directions etc...
static const doubleScalar doubleScalarSMALL
Definition: doubleScalar.H:57
dimensioned< scalar > mag(const dimensioned< Type > &)
label n
dimensionedScalar hypot(const dimensionedScalar &x, const dimensionedScalar &y)
Namespace for OpenFOAM.