longDoubleScalar.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2018-2019 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::longDoubleScalar
26 
27 Description
28  Lang double precision floating point scalar type.
29 
30 SourceFiles
31  longDoubleScalar.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef longDoubleScalar_H
36 #define longDoubleScalar_H
37 
38 #include "doubleFloat.H"
39 #include "direction.H"
40 #include "word.H"
41 
42 #include <limits>
43 using std::numeric_limits;
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 
52 typedef long double longDoubleScalar;
53 
54 // Largest and smallest scalar values allowed in certain parts of the code.
55 static const longDoubleScalar longDoubleScalarVGreat
57 static const longDoubleScalar longDoubleScalarVSmall
59 
60 static const longDoubleScalar longDoubleScalarSmall
62 static const longDoubleScalar longDoubleScalarGreat
64 
65 static const longDoubleScalar longDoubleScalarRootVGreat
67 static const longDoubleScalar longDoubleScalarRootVSmall
69 
70 static const longDoubleScalar longDoubleScalarRootGreat
72 static const longDoubleScalar longDoubleScalarRootSmall
74 
75 static const longDoubleScalar longDoubleScalarNaN
76  = numeric_limits<longDoubleScalar>::signaling_NaN();
77 
78 //- Read whole of buf as a scalar. Return true if successful.
79 inline bool readScalar(const char* buf, longDoubleScalar& s)
80 {
81  char* endPtr;
82  s = strtold(buf, &endPtr);
83 
84  return (*endPtr == '\0');
85 }
86 
87 #define Scalar longDoubleScalar
88 #define ScalarVGreat longDoubleScalarVGreat
89 #define ScalarVSmall longDoubleScalarVSmall
90 #define ScalarRootVGreat longDoubleScalarRootVGreat
91 #define ScalarRootVSmall longDoubleScalarRootVSmall
92 #define readScalar readLongDoubleScalar
93 
94 inline Scalar mag(const Scalar s)
95 {
96  return ::fabsl(s);
97 }
98 
99 #define MAXMINPOW(retType, type1, type2) \
100  \
101 MAXMIN(retType, type1, type2) \
102  \
103 inline double pow(const type1 s, const type2 e) \
104 { \
105  return ::powl(Scalar(s), Scalar(e)); \
106 }
107 
109 MAXMINPOW(Scalar, Scalar, int)
110 MAXMINPOW(Scalar, int, Scalar)
111 MAXMINPOW(Scalar, Scalar, long)
112 MAXMINPOW(Scalar, long, Scalar)
113 MAXMINPOW(Scalar, Scalar, float)
114 MAXMINPOW(Scalar, float, Scalar)
115 MAXMINPOW(Scalar, Scalar, double)
116 MAXMINPOW(Scalar, double, Scalar)
117 
118 #undef MAXMINPOW
119 
120 #define transFunc(func) \
121 inline Scalar func(const Scalar s) \
122 { \
123  return ::func(s); \
124 }
125 
126 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
127 
128 } // End namespace Foam
129 
130 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
131 
132 #include "Scalar.H"
133 
134 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
135 
136 namespace Foam
137 {
138 
139 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
140 
141 inline Scalar hypot(const Scalar x, const Scalar y)
142 {
143  return ::hypotl(x, y);
144 }
145 
146 inline Scalar atan2(const Scalar y, const Scalar x)
147 {
148  return ::atan2l(y, x);
149 }
150 
151 inline Scalar jn(const int n, const Scalar s)
152 {
153  return ::jnl(n, s);
154 }
155 
156 inline Scalar yn(const int n, const Scalar s)
157 {
158  return ::ynl(n, s);
159 }
160 
161 #undef Scalar
162 #undef ScalarVGreat
163 #undef ScalarVSmall
164 #undef ScalarRootVGreat
165 #undef ScalarRootVSmall
166 #undef readScalar
167 #undef transFunc
168 
169 
170 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
171 
172 } // End namespace Foam
173 
174 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
175 
176 #endif
177 
178 // ************************************************************************* //
static const longDoubleScalar longDoubleScalarGreat
static const longDoubleScalar longDoubleScalarVSmall
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
dimensionedScalar yn(const int n, const dimensionedScalar &ds)
#define MAXMINPOW(retType, type1, type2)
static const longDoubleScalar longDoubleScalarRootVGreat
static const longDoubleScalar longDoubleScalarRootSmall
static const longDoubleScalar longDoubleScalarNaN
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))
static const longDoubleScalar longDoubleScalarRootVSmall
#define Scalar
dimensionedScalar jn(const int n, const dimensionedScalar &ds)
bool readScalar(const char *buf, doubleScalar &s)
Read whole of buf as a scalar. Return true if successful.
Definition: doubleScalar.H:75
dimensionedScalar atan2(const dimensionedScalar &x, const dimensionedScalar &y)
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
static const longDoubleScalar longDoubleScalarSmall
long double longDoubleScalar
Lang double precision floating point scalar type.
Direction is an 8-bit unsigned integer type used to represent the Cartesian directions etc...
scalar epsilon
static const longDoubleScalar longDoubleScalarVGreat
dimensioned< scalar > mag(const dimensioned< Type > &)
label n
dimensionedScalar hypot(const dimensionedScalar &x, const dimensionedScalar &y)
static const longDoubleScalar longDoubleScalarRootGreat
Namespace for OpenFOAM.