FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

floatScalar.H

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2010 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software: you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
00023 
00024 Typedef
00025     Foam::floatScalar
00026 
00027 Description
00028     Float precision floating point scalar type.
00029 
00030 SourceFiles
00031     floatScalar.C
00032 
00033 \*---------------------------------------------------------------------------*/
00034 
00035 #ifndef floatScalar_H
00036 #define floatScalar_H
00037 
00038 #include <OpenFOAM/doubleFloat.H>
00039 #include <OpenFOAM/direction.H>
00040 #include <OpenFOAM/word.H>
00041 
00042 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00043 
00044 namespace Foam
00045 {
00046 
00047 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00048 
00049 typedef float floatScalar;
00050 
00051 // Largest and smallest scalar values allowed in certain parts of the code
00052 // (6 is the number of significant figures in an
00053 //  IEEE single precision number.  See limits.h or float.h)
00054 static const floatScalar floatScalarGREAT = 1.0e+6;
00055 static const floatScalar floatScalarVGREAT = 1.0e+37;
00056 static const floatScalar floatScalarROOTVGREAT = 1.0e+18;
00057 static const floatScalar floatScalarSMALL = 1.0e-6;
00058 static const floatScalar floatScalarVSMALL = 1.0e-37;
00059 static const floatScalar floatScalarROOTVSMALL = 1.0e-18;
00060 
00061 
00062 #define Scalar floatScalar
00063 #define ScalarVGREAT floatScalarVGREAT
00064 #define ScalarVSMALL floatScalarVSMALL
00065 #define readScalar readFloatScalar
00066 
00067 inline Scalar mag(const Scalar s)
00068 {
00069     return ::fabsf(s);
00070 }
00071 
00072 #define transFunc(func)            \
00073 inline Scalar func(const Scalar s) \
00074 {                                  \
00075     return ::func##f(s);           \
00076 }
00077 
00078 #include <OpenFOAM/Scalar_.H>
00079 
00080 inline Scalar hypot(const Scalar x, const Scalar y)
00081 {
00082     return ::hypotf(x, y);
00083 }
00084 
00085 inline Scalar atan2(const Scalar y, const Scalar x)
00086 {
00087     return ::atan2f(y, x);
00088 }
00089 
00090 inline Scalar jn(const int n, const Scalar s)
00091 {
00092     return ::jnf(n, s);
00093 }
00094 
00095 inline Scalar yn(const int n, const Scalar s)
00096 {
00097     return ::ynf(n, s);
00098 }
00099 
00100 #undef Scalar
00101 #undef ScalarVGREAT
00102 #undef ScalarVSMALL
00103 #undef readScalar
00104 #undef transFunc
00105 
00106 
00107 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00108 
00109 } // End namespace Foam
00110 
00111 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00112 
00113 #endif
00114 
00115 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines