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 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 //- Read whole of buf as a scalar. Return true if successful.
76 inline bool readScalar(const char* buf, longDoubleScalar& s)
77 {
78  char* endPtr;
79  s = strtold(buf, &endPtr);
80 
81  return (*endPtr == '\0');
82 }
83 
84 #define Scalar longDoubleScalar
85 #define ScalarVGreat longDoubleScalarVGreat
86 #define ScalarVSmall longDoubleScalarVSmall
87 #define ScalarRootVGreat longDoubleScalarRootVGreat
88 #define ScalarRootVSmall longDoubleScalarRootVSmall
89 #define readScalar readLongDoubleScalar
90 
91 inline Scalar mag(const Scalar s)
92 {
93  return ::fabsl(s);
94 }
95 
96 #define MAXMINPOW(retType, type1, type2) \
97  \
98 MAXMIN(retType, type1, type2) \
99  \
100 inline double pow(const type1 s, const type2 e) \
101 { \
102  return ::powl(Scalar(s), Scalar(e)); \
103 }
104 
106 MAXMINPOW(Scalar, Scalar, int)
107 MAXMINPOW(Scalar, int, Scalar)
108 MAXMINPOW(Scalar, Scalar, long)
109 MAXMINPOW(Scalar, long, Scalar)
110 MAXMINPOW(Scalar, Scalar, float)
111 MAXMINPOW(Scalar, float, Scalar)
112 MAXMINPOW(Scalar, Scalar, double)
113 MAXMINPOW(Scalar, double, Scalar)
114 
115 #undef MAXMINPOW
116 
117 #define transFunc(func) \
118 inline Scalar func(const Scalar s) \
119 { \
120  return ::func(s); \
121 }
122 
123 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
124 
125 } // End namespace Foam
126 
127 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
128 
129 #include "Scalar.H"
130 
131 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
132 
133 namespace Foam
134 {
135 
136 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
137 
138 inline Scalar hypot(const Scalar x, const Scalar y)
139 {
140  return ::hypotl(x, y);
141 }
142 
143 inline Scalar atan2(const Scalar y, const Scalar x)
144 {
145  return ::atan2l(y, x);
146 }
147 
148 inline Scalar jn(const int n, const Scalar s)
149 {
150  return ::jnl(n, s);
151 }
152 
153 inline Scalar yn(const int n, const Scalar s)
154 {
155  return ::ynl(n, s);
156 }
157 
158 #undef Scalar
159 #undef ScalarVGreat
160 #undef ScalarVSmall
161 #undef ScalarRootVGreat
162 #undef ScalarRootVSmall
163 #undef readScalar
164 #undef transFunc
165 
166 
167 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
168 
169 } // End namespace Foam
170 
171 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
172 
173 #endif
174 
175 // ************************************************************************* //
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
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:68
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.