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-2023 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.
59 
64 
66  = ::sqrtl(longDoubleScalarVGreat);
68  = ::sqrtl(longDoubleScalarVSmall);
69 
71  = ::sqrtl(longDoubleScalarGreat);
73  = ::sqrtl(longDoubleScalarSmall);
74 
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 ScalarNaN longDoubleScalarNaN
93 #define readScalar readLongDoubleScalar
94 
95 inline Scalar mag(const Scalar s)
96 {
97  return ::fabsl(s);
98 }
99 
100 #define MAXMINPOW(retType, type1, type2) \
101  \
102 MAXMIN(retType, type1, type2) \
103  \
104 inline double pow(const type1 s, const type2 e) \
105 { \
106  return ::powl(Scalar(s), Scalar(e)); \
107 }
108 
118 
119 #undef MAXMINPOW
120 
121 #define transFunc(func) \
122 inline Scalar func(const Scalar s) \
123 { \
124  return ::func(s); \
125 }
126 
127 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
128 
129 } // End namespace Foam
130 
131 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
132 
133 #include "Scalar.H"
134 
135 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
136 
137 namespace Foam
138 {
139 
140 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
141 
142 inline Scalar hypot(const Scalar x, const Scalar y)
143 {
144  return ::hypotl(x, y);
145 }
146 
147 inline Scalar atan2(const Scalar y, const Scalar x)
148 {
149  return ::atan2l(y, x);
150 }
151 
152 inline Scalar jn(const int n, const Scalar s)
153 {
154  return ::jnl(n, s);
155 }
156 
157 inline Scalar yn(const int n, const Scalar s)
158 {
159  return ::ynl(n, s);
160 }
161 
162 #undef Scalar
163 #undef ScalarVGreat
164 #undef ScalarVSmall
165 #undef ScalarRootVGreat
166 #undef ScalarRootVSmall
167 #undef ScalarNaN
168 #undef readScalar
169 #undef transFunc
170 
171 
172 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
173 
174 } // End namespace Foam
175 
176 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
177 
178 #endif
179 
180 // ************************************************************************* //
scalar y
label n
Direction is an 8-bit unsigned integer type used to represent the Cartesian directions etc.
const scalar epsilon
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.name(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
#define MAXMINPOW(retType, type1, type2)
#define Scalar
Namespace for OpenFOAM.
static const longDoubleScalar longDoubleScalarNaN
static const longDoubleScalar longDoubleScalarSmall
static const longDoubleScalar longDoubleScalarRootGreat
static const longDoubleScalar longDoubleScalarGreat
static const longDoubleScalar longDoubleScalarRootVSmall
dimensionedScalar yn(const int n, const dimensionedScalar &ds)
static const longDoubleScalar longDoubleScalarVSmall
static const longDoubleScalar longDoubleScalarRootVGreat
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
dimensionedScalar atan2(const dimensionedScalar &x, const dimensionedScalar &y)
bool readScalar(const char *buf, doubleScalar &s)
Read whole of buf as a scalar. Return true if successful.
Definition: doubleScalar.H:75
dimensionedScalar hypot(const dimensionedScalar &x, const dimensionedScalar &y)
static const longDoubleScalar longDoubleScalarVGreat
dimensioned< scalar > mag(const dimensioned< Type > &)
dimensionedScalar jn(const int n, const dimensionedScalar &ds)
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
long double longDoubleScalar
Lang double precision floating point scalar type.
static const longDoubleScalar longDoubleScalarRootSmall