diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/populationBalanceModel/populationBalanceModel/populationBalanceModel.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/populationBalanceModel/populationBalanceModel/populationBalanceModel.C index bcf58ae4b..2645778a7 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/populationBalanceModel/populationBalanceModel/populationBalanceModel.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/populationBalanceModel/populationBalanceModel/populationBalanceModel.C @@ -1344,11 +1344,15 @@ void Foam::diameterModels::populationBalanceModel::solve() d_() = dsm(); } - volScalarField fAlpha0 = - *sizeGroups_.first()*sizeGroups_.first()->phase(); + volScalarField fAlpha0 + ( + *sizeGroups_.first()*sizeGroups_.first()->phase() + ); - volScalarField fAlphaN = - *sizeGroups_.last()*sizeGroups_.last()->phase(); + volScalarField fAlphaN + ( + *sizeGroups_.last()*sizeGroups_.last()->phase() + ); Info<< this->name() << " sizeGroup phase fraction first, last = " << fAlpha0.weightedAverage(this->mesh().V()).value() diff --git a/etc/bashrc b/etc/bashrc index d92b469b0..476e476de 100644 --- a/etc/bashrc +++ b/etc/bashrc @@ -2,7 +2,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | -# \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation +# \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation # \\/ M anipulation | #------------------------------------------------------------------------------ # License @@ -72,7 +72,7 @@ unset WM_COMPILER_ARCH WM_COMPILER_LIB_ARCH export WM_ARCH_OPTION=64 #- Precision: -# WM_PRECISION_OPTION = DP | SP +# WM_PRECISION_OPTION = SP | DP | LP export WM_PRECISION_OPTION=DP #- Label size: diff --git a/etc/config.csh/aliases b/etc/config.csh/aliases index 33bb0e4a9..09efd50a2 100644 --- a/etc/config.csh/aliases +++ b/etc/config.csh/aliases @@ -2,7 +2,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | -# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation +# \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation # \\/ M anipulation | #------------------------------------------------------------------------------ # License @@ -37,6 +37,7 @@ alias wm64 'wmSet WM_ARCH_OPTION=64' alias wm32 'wmSet WM_ARCH_OPTION=32' alias wmSP 'wmSet WM_PRECISION_OPTION=SP' alias wmDP 'wmSet WM_PRECISION_OPTION=DP' +alias wmLP 'wmSet WM_PRECISION_OPTION=LP' # Clear env alias wmUnset 'source $WM_PROJECT_DIR/etc/config.csh/unset' diff --git a/etc/config.sh/aliases b/etc/config.sh/aliases index f1fe0c13a..13b215564 100644 --- a/etc/config.sh/aliases +++ b/etc/config.sh/aliases @@ -2,7 +2,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | -# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation +# \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation # \\/ M anipulation | #------------------------------------------------------------------------------ # License @@ -37,6 +37,7 @@ alias wm64='wmSet WM_ARCH_OPTION=64' alias wm32='wmSet WM_ARCH_OPTION=32' alias wmSP='wmSet WM_PRECISION_OPTION=SP' alias wmDP='wmSet WM_PRECISION_OPTION=DP' +alias wmLP='wmSet WM_PRECISION_OPTION=LP' # Clear env alias wmUnset='. $WM_PROJECT_DIR/etc/config.sh/unset' diff --git a/etc/controlDict b/etc/controlDict index 4868acff5..647656140 100644 --- a/etc/controlDict +++ b/etc/controlDict @@ -300,6 +300,7 @@ DebugSwitches ThermoParcel 0; UMIST 0; UMISTV 0; + UPstream 0; UpwindFitData 0; UpwindFitData 0; UpwindFitData 0; diff --git a/etc/cshrc b/etc/cshrc index d191e3352..87ac3c7b5 100644 --- a/etc/cshrc +++ b/etc/cshrc @@ -2,7 +2,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | -# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation +# \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation # \\/ M anipulation | #------------------------------------------------------------------------------ # License @@ -72,7 +72,7 @@ unsetenv WM_COMPILER_LIB_ARCH setenv WM_ARCH_OPTION 64 #- Precision: -# WM_PRECISION_OPTION = DP | SP +# WM_PRECISION_OPTION = SP | DP | LP setenv WM_PRECISION_OPTION DP #- Label size: diff --git a/src/OpenFOAM/Make/files b/src/OpenFOAM/Make/files index df86f1dc7..7479c40dd 100644 --- a/src/OpenFOAM/Make/files +++ b/src/OpenFOAM/Make/files @@ -42,6 +42,7 @@ $(ints)/uLabel/uLabel.C $(ints)/lists/labelIOList.C $(ints)/lists/labelListIOList.C +primitives/Scalar/longDoubleScalar/longDoubleScalar.C primitives/Scalar/doubleScalar/doubleScalar.C primitives/Scalar/floatScalar/floatScalar.C primitives/Scalar/scalar/scalar.C diff --git a/src/OpenFOAM/db/IOstreams/IOstreams/Istream.H b/src/OpenFOAM/db/IOstreams/IOstreams/Istream.H index 984110e31..822e3d924 100644 --- a/src/OpenFOAM/db/IOstreams/IOstreams/Istream.H +++ b/src/OpenFOAM/db/IOstreams/IOstreams/Istream.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -128,6 +128,9 @@ public: //- Read a doubleScalar virtual Istream& read(doubleScalar&) = 0; + //- Read a longDoubleScalar + virtual Istream& read(longDoubleScalar&) = 0; + //- Read binary block virtual Istream& read(char*, std::streamsize) = 0; diff --git a/src/OpenFOAM/db/IOstreams/IOstreams/Ostream.H b/src/OpenFOAM/db/IOstreams/IOstreams/Ostream.H index aada0b4f9..44dacf3e9 100644 --- a/src/OpenFOAM/db/IOstreams/IOstreams/Ostream.H +++ b/src/OpenFOAM/db/IOstreams/IOstreams/Ostream.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -136,6 +136,9 @@ public: //- Write doubleScalar virtual Ostream& write(const doubleScalar) = 0; + //- Write longDoubleScalar + virtual Ostream& write(const longDoubleScalar) = 0; + //- Write binary block virtual Ostream& write(const char*, std::streamsize) = 0; diff --git a/src/OpenFOAM/db/IOstreams/Pstreams/UIPstream.C b/src/OpenFOAM/db/IOstreams/Pstreams/UIPstream.C index 5707d2d5c..5691ee607 100644 --- a/src/OpenFOAM/db/IOstreams/Pstreams/UIPstream.C +++ b/src/OpenFOAM/db/IOstreams/Pstreams/UIPstream.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -27,6 +27,7 @@ License #include "UIPstream.H" #include "int.H" #include "token.H" + #include @@ -243,6 +244,21 @@ Foam::Istream& Foam::UIPstream::read(token& t) return *this; } + // longDoubleScalar + case token::LONG_DOUBLE_SCALAR : + { + longDoubleScalar val; + if (read(val)) + { + t = val; + } + else + { + t.setBad(); + } + return *this; + } + // Character (returned as a single character word) or error default: { @@ -313,6 +329,13 @@ Foam::Istream& Foam::UIPstream::read(doubleScalar& val) } +Foam::Istream& Foam::UIPstream::read(longDoubleScalar& val) +{ + readFromBuffer(val); + return *this; +} + + Foam::Istream& Foam::UIPstream::read(char* data, std::streamsize count) { if (format() != BINARY) diff --git a/src/OpenFOAM/db/IOstreams/Pstreams/UIPstream.H b/src/OpenFOAM/db/IOstreams/Pstreams/UIPstream.H index b4aefe444..47d221999 100644 --- a/src/OpenFOAM/db/IOstreams/Pstreams/UIPstream.H +++ b/src/OpenFOAM/db/IOstreams/Pstreams/UIPstream.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -159,6 +159,9 @@ public: //- Read a doubleScalar Istream& read(doubleScalar&); + //- Read a longDoubleScalar + Istream& read(longDoubleScalar&); + //- Read binary block Istream& read(char*, std::streamsize); diff --git a/src/OpenFOAM/db/IOstreams/Pstreams/UOPstream.C b/src/OpenFOAM/db/IOstreams/Pstreams/UOPstream.C index 6ac174368..3bc384991 100644 --- a/src/OpenFOAM/db/IOstreams/Pstreams/UOPstream.C +++ b/src/OpenFOAM/db/IOstreams/Pstreams/UOPstream.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -155,12 +155,12 @@ Foam::Ostream& Foam::UOPstream::write(const token& t) // Raw token output only supported for verbatim strings for now if (t.type() == token::VERBATIMSTRING) { - write(char(token::VERBATIMSTRING)); + writeToBuffer(char(token::VERBATIMSTRING)); write(t.stringToken()); } else if (t.type() == token::VARIABLE) { - write(char(token::VARIABLE)); + writeToBuffer(char(token::VARIABLE)); write(t.stringToken()); } else @@ -204,7 +204,7 @@ Foam::Ostream& Foam::UOPstream::write(const char* str) Foam::Ostream& Foam::UOPstream::write(const word& str) { - write(char(token::WORD)); + writeToBuffer(char(token::WORD)); size_t len = str.size(); writeToBuffer(len); @@ -216,7 +216,7 @@ Foam::Ostream& Foam::UOPstream::write(const word& str) Foam::Ostream& Foam::UOPstream::write(const string& str) { - write(char(token::STRING)); + writeToBuffer(char(token::STRING)); size_t len = str.size(); writeToBuffer(len); @@ -234,11 +234,11 @@ Foam::Ostream& Foam::UOPstream::writeQuoted { if (quoted) { - write(char(token::STRING)); + writeToBuffer(char(token::STRING)); } else { - write(char(token::WORD)); + writeToBuffer(char(token::WORD)); } size_t len = str.size(); @@ -251,7 +251,7 @@ Foam::Ostream& Foam::UOPstream::writeQuoted Foam::Ostream& Foam::UOPstream::write(const int32_t val) { - write(char(token::LABEL)); + writeToBuffer(char(token::LABEL)); writeToBuffer(val); return *this; } @@ -259,7 +259,7 @@ Foam::Ostream& Foam::UOPstream::write(const int32_t val) Foam::Ostream& Foam::UOPstream::write(const int64_t val) { - write(char(token::LABEL)); + writeToBuffer(char(token::LABEL)); writeToBuffer(val); return *this; } @@ -267,7 +267,7 @@ Foam::Ostream& Foam::UOPstream::write(const int64_t val) Foam::Ostream& Foam::UOPstream::write(const floatScalar val) { - write(char(token::FLOAT_SCALAR)); + writeToBuffer(char(token::FLOAT_SCALAR)); writeToBuffer(val); return *this; } @@ -275,7 +275,15 @@ Foam::Ostream& Foam::UOPstream::write(const floatScalar val) Foam::Ostream& Foam::UOPstream::write(const doubleScalar val) { - write(char(token::DOUBLE_SCALAR)); + writeToBuffer(char(token::DOUBLE_SCALAR)); + writeToBuffer(val); + return *this; +} + + +Foam::Ostream& Foam::UOPstream::write(const longDoubleScalar val) +{ + writeToBuffer(char(token::LONG_DOUBLE_SCALAR)); writeToBuffer(val); return *this; } diff --git a/src/OpenFOAM/db/IOstreams/Pstreams/UOPstream.H b/src/OpenFOAM/db/IOstreams/Pstreams/UOPstream.H index 349ac5210..3af4aa6b6 100644 --- a/src/OpenFOAM/db/IOstreams/Pstreams/UOPstream.H +++ b/src/OpenFOAM/db/IOstreams/Pstreams/UOPstream.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -168,6 +168,9 @@ public: //- Write doubleScalar Ostream& write(const doubleScalar); + //- Write longDoubleScalar + Ostream& write(const longDoubleScalar); + //- Write binary block Ostream& write(const char*, std::streamsize); diff --git a/src/OpenFOAM/db/IOstreams/Sstreams/ISstream.C b/src/OpenFOAM/db/IOstreams/Sstreams/ISstream.C index 94cf60f4f..b7ccef7fe 100644 --- a/src/OpenFOAM/db/IOstreams/Sstreams/ISstream.C +++ b/src/OpenFOAM/db/IOstreams/Sstreams/ISstream.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -777,6 +777,14 @@ Foam::Istream& Foam::ISstream::read(doubleScalar& val) } +Foam::Istream& Foam::ISstream::read(longDoubleScalar& val) +{ + is_ >> val; + setState(is_.rdstate()); + return *this; +} + + // read binary block Foam::Istream& Foam::ISstream::read(char* buf, std::streamsize count) { diff --git a/src/OpenFOAM/db/IOstreams/Sstreams/ISstream.H b/src/OpenFOAM/db/IOstreams/Sstreams/ISstream.H index 3f6ebb42c..2d53532ce 100644 --- a/src/OpenFOAM/db/IOstreams/Sstreams/ISstream.H +++ b/src/OpenFOAM/db/IOstreams/Sstreams/ISstream.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -160,6 +160,9 @@ public: //- Read a doubleScalar virtual Istream& read(doubleScalar&); + //- Read a longDoubleScalar + virtual Istream& read(longDoubleScalar&); + //- Read binary block virtual Istream& read(char*, std::streamsize); diff --git a/src/OpenFOAM/db/IOstreams/Sstreams/OSstream.C b/src/OpenFOAM/db/IOstreams/Sstreams/OSstream.C index 0feb83534..b447042b0 100644 --- a/src/OpenFOAM/db/IOstreams/Sstreams/OSstream.C +++ b/src/OpenFOAM/db/IOstreams/Sstreams/OSstream.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -215,6 +215,14 @@ Foam::Ostream& Foam::OSstream::write(const doubleScalar val) } +Foam::Ostream& Foam::OSstream::write(const longDoubleScalar val) +{ + os_ << val; + setState(os_.rdstate()); + return *this; +} + + Foam::Ostream& Foam::OSstream::write(const char* buf, std::streamsize count) { if (format() != BINARY) diff --git a/src/OpenFOAM/db/IOstreams/Sstreams/OSstream.H b/src/OpenFOAM/db/IOstreams/Sstreams/OSstream.H index b43b46e56..93df27db8 100644 --- a/src/OpenFOAM/db/IOstreams/Sstreams/OSstream.H +++ b/src/OpenFOAM/db/IOstreams/Sstreams/OSstream.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -142,6 +142,9 @@ public: //- Write doubleScalar virtual Ostream& write(const doubleScalar); + //- Write longDoubleScalar + virtual Ostream& write(const longDoubleScalar); + //- Write binary block virtual Ostream& write(const char*, std::streamsize); diff --git a/src/OpenFOAM/db/IOstreams/Sstreams/prefixOSstream.C b/src/OpenFOAM/db/IOstreams/Sstreams/prefixOSstream.C index 5eb8c506e..d0b165c61 100644 --- a/src/OpenFOAM/db/IOstreams/Sstreams/prefixOSstream.C +++ b/src/OpenFOAM/db/IOstreams/Sstreams/prefixOSstream.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -165,6 +165,13 @@ Foam::Ostream& Foam::prefixOSstream::write(const doubleScalar val) } +Foam::Ostream& Foam::prefixOSstream::write(const longDoubleScalar val) +{ + checkWritePrefix(); + return OSstream::write(val); +} + + Foam::Ostream& Foam::prefixOSstream::write ( const char* buf, diff --git a/src/OpenFOAM/db/IOstreams/Sstreams/prefixOSstream.H b/src/OpenFOAM/db/IOstreams/Sstreams/prefixOSstream.H index d372d6b14..095500555 100644 --- a/src/OpenFOAM/db/IOstreams/Sstreams/prefixOSstream.H +++ b/src/OpenFOAM/db/IOstreams/Sstreams/prefixOSstream.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -133,6 +133,9 @@ public: //- Write doubleScalar virtual Ostream& write(const doubleScalar); + //- Write longDoubleScalar + virtual Ostream& write(const longDoubleScalar); + //- Write binary block virtual Ostream& write(const char*, std::streamsize); diff --git a/src/OpenFOAM/db/IOstreams/Tstreams/ITstream.C b/src/OpenFOAM/db/IOstreams/Tstreams/ITstream.C index c9dae1229..07d7f9f8b 100644 --- a/src/OpenFOAM/db/IOstreams/Tstreams/ITstream.C +++ b/src/OpenFOAM/db/IOstreams/Tstreams/ITstream.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -147,6 +147,13 @@ Foam::Istream& Foam::ITstream::read(doubleScalar&) } +Foam::Istream& Foam::ITstream::read(longDoubleScalar&) +{ + NotImplemented; + return *this; +} + + Foam::Istream& Foam::ITstream::read(char*, std::streamsize) { NotImplemented; diff --git a/src/OpenFOAM/db/IOstreams/Tstreams/ITstream.H b/src/OpenFOAM/db/IOstreams/Tstreams/ITstream.H index 9a179e2d0..d4764e0ed 100644 --- a/src/OpenFOAM/db/IOstreams/Tstreams/ITstream.H +++ b/src/OpenFOAM/db/IOstreams/Tstreams/ITstream.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -185,6 +185,9 @@ public: //- Read a doubleScalar virtual Istream& read(doubleScalar&); + //- Read a longDoubleScalar + virtual Istream& read(longDoubleScalar&); + //- Read binary block virtual Istream& read(char*, std::streamsize); diff --git a/src/OpenFOAM/db/IOstreams/dummyISstream/dummyISstream.H b/src/OpenFOAM/db/IOstreams/dummyISstream/dummyISstream.H index a774271a1..e002a8e73 100644 --- a/src/OpenFOAM/db/IOstreams/dummyISstream/dummyISstream.H +++ b/src/OpenFOAM/db/IOstreams/dummyISstream/dummyISstream.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2017 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2017-2018 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -119,6 +119,13 @@ public: return *this; } + //- Read a longDoubleScalar + virtual Istream& read(longDoubleScalar&) + { + NotImplemented; + return *this; + } + //- Read binary block virtual Istream& read(char*, std::streamsize) { diff --git a/src/OpenFOAM/db/IOstreams/dummyIstream/dummyIstream.H b/src/OpenFOAM/db/IOstreams/dummyIstream/dummyIstream.H index 9e8549820..d2a1a3c94 100644 --- a/src/OpenFOAM/db/IOstreams/dummyIstream/dummyIstream.H +++ b/src/OpenFOAM/db/IOstreams/dummyIstream/dummyIstream.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2017 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2017-2018 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -120,6 +120,13 @@ public: return *this; } + //- Read a longDoubleScalar + virtual Istream& read(longDoubleScalar&) + { + NotImplemented; + return *this; + } + //- Read binary block virtual Istream& read(char*, std::streamsize) { diff --git a/src/OpenFOAM/db/IOstreams/token/token.H b/src/OpenFOAM/db/IOstreams/token/token.H index 7229e58b8..adedf2ccb 100644 --- a/src/OpenFOAM/db/IOstreams/token/token.H +++ b/src/OpenFOAM/db/IOstreams/token/token.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -73,11 +73,11 @@ class token public: //- Enumeration defining the types of token - enum tokenType + enum tokenType : char { - UNDEFINED, + UNDEFINED = 0, - PUNCTUATION, + PUNCTUATION = -127, WORD, VARIABLE, STRING, @@ -85,14 +85,14 @@ public: LABEL, FLOAT_SCALAR, DOUBLE_SCALAR, + LONG_DOUBLE_SCALAR, COMPOUND, ERROR }; - //- Standard punctuation tokens - enum punctuationToken + enum punctuationToken : char { NULL_TOKEN = '\0', SPACE = ' ', @@ -120,7 +120,6 @@ public: DIVIDE = '/' }; - //- Abstract base class for complex tokens class compound : @@ -260,6 +259,7 @@ private: label labelToken_; floatScalar floatScalarToken_; doubleScalar doubleScalarToken_; + longDoubleScalar* longDoubleScalarTokenPtr_; mutable compound* compoundTokenPtr_; }; @@ -309,6 +309,9 @@ public: //- Construct doubleScalar token inline token(const doubleScalar, label lineNumber=0); + //- Construct longDoubleScalar token + inline token(const longDoubleScalar, label lineNumber=0); + //- Construct from Istream token(Istream&); @@ -348,6 +351,9 @@ public: inline bool isDoubleScalar() const; inline doubleScalar doubleScalarToken() const; + inline bool isLongDoubleScalar() const; + inline longDoubleScalar longDoubleScalarToken() const; + inline bool isScalar() const; inline scalar scalarToken() const; @@ -395,6 +401,7 @@ public: inline void operator=(const label); inline void operator=(const floatScalar); inline void operator=(const doubleScalar); + inline void operator=(const longDoubleScalar); inline void operator=(compound*); @@ -408,6 +415,7 @@ public: inline bool operator==(const label) const; inline bool operator==(const floatScalar) const; inline bool operator==(const doubleScalar) const; + inline bool operator==(const longDoubleScalar) const; // Inequality @@ -419,6 +427,7 @@ public: inline bool operator!=(const label) const; inline bool operator!=(const floatScalar) const; inline bool operator!=(const doubleScalar) const; + inline bool operator!=(const longDoubleScalar) const; // IOstream operators diff --git a/src/OpenFOAM/db/IOstreams/token/tokenI.H b/src/OpenFOAM/db/IOstreams/token/tokenI.H index 2f0383c9b..3c5f47bc5 100644 --- a/src/OpenFOAM/db/IOstreams/token/tokenI.H +++ b/src/OpenFOAM/db/IOstreams/token/tokenI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -37,6 +37,10 @@ inline void Foam::token::clear() { delete stringTokenPtr_; } + else if (type_ == LONG_DOUBLE_SCALAR) + { + delete longDoubleScalarTokenPtr_; + } else if (type_ == COMPOUND) { if (compoundTokenPtr_->unique()) @@ -98,6 +102,11 @@ inline Foam::token::token(const token& t) doubleScalarToken_ = t.doubleScalarToken_; break; + case LONG_DOUBLE_SCALAR: + longDoubleScalarTokenPtr_ = + new longDoubleScalar(*t.longDoubleScalarTokenPtr_); + break; + case COMPOUND: compoundTokenPtr_ = t.compoundTokenPtr_; compoundTokenPtr_->refCount::operator++(); @@ -157,6 +166,14 @@ inline Foam::token::token(const doubleScalar s, label lineNumber) {} +inline Foam::token::token(const longDoubleScalar s, label lineNumber) +: + type_(LONG_DOUBLE_SCALAR), + longDoubleScalarTokenPtr_(new longDoubleScalar(s)), + lineNumber_(lineNumber) +{} + + // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // inline Foam::token::~token() @@ -307,9 +324,33 @@ inline Foam::doubleScalar Foam::token::doubleScalarToken() const } +inline bool Foam::token::isLongDoubleScalar() const +{ + return (type_ == LONG_DOUBLE_SCALAR); +} + +inline Foam::longDoubleScalar Foam::token::longDoubleScalarToken() const +{ + if (type_ == LONG_DOUBLE_SCALAR) + { + return *longDoubleScalarTokenPtr_; + } + else + { + parseError("longDoubleScalar"); + return 0.0; + } +} + + inline bool Foam::token::isScalar() const { - return (type_ == FLOAT_SCALAR || type_ == DOUBLE_SCALAR); + return + ( + type_ == FLOAT_SCALAR + || type_ == DOUBLE_SCALAR + || type_ == LONG_DOUBLE_SCALAR + ); } inline Foam::scalar Foam::token::scalarToken() const @@ -322,6 +363,10 @@ inline Foam::scalar Foam::token::scalarToken() const { return doubleScalarToken_; } + else if (type_ == LONG_DOUBLE_SCALAR) + { + return *longDoubleScalarTokenPtr_; + } else { parseError(pTraits::typeName); @@ -426,6 +471,11 @@ inline void Foam::token::operator=(const token& t) doubleScalarToken_ = t.doubleScalarToken_; break; + case LONG_DOUBLE_SCALAR: + longDoubleScalarTokenPtr_ = + new longDoubleScalar(*t.longDoubleScalarTokenPtr_); + break; + case COMPOUND: compoundTokenPtr_ = t.compoundTokenPtr_; compoundTokenPtr_->refCount::operator++(); @@ -490,6 +540,13 @@ inline void Foam::token::operator=(const doubleScalar s) doubleScalarToken_ = s; } +inline void Foam::token::operator=(const longDoubleScalar s) +{ + clear(); + type_ = LONG_DOUBLE_SCALAR; + longDoubleScalarTokenPtr_ = new longDoubleScalar(s); +} + inline void Foam::token::operator=(Foam::token::compound* cPtr) { clear(); @@ -530,6 +587,13 @@ inline bool Foam::token::operator==(const token& t) const case DOUBLE_SCALAR: return equal(doubleScalarToken_, t.doubleScalarToken_); + case LONG_DOUBLE_SCALAR: + return equal + ( + *longDoubleScalarTokenPtr_, + *t.longDoubleScalarTokenPtr_ + ); + case COMPOUND: return compoundTokenPtr_ == t.compoundTokenPtr_; @@ -574,6 +638,14 @@ inline bool Foam::token::operator==(const doubleScalar s) const return (type_ == DOUBLE_SCALAR && equal(doubleScalarToken_, s)); } +inline bool Foam::token::operator==(const longDoubleScalar s) const +{ + return + ( + type_ == LONG_DOUBLE_SCALAR && equal(*longDoubleScalarTokenPtr_, s) + ); +} + inline bool Foam::token::operator!=(const token& t) const { return !operator==(t); @@ -604,6 +676,11 @@ inline bool Foam::token::operator!=(const doubleScalar s) const return !operator==(s); } +inline bool Foam::token::operator!=(const longDoubleScalar s) const +{ + return !operator==(s); +} + inline bool Foam::token::operator!=(const label l) const { return !operator==(l); diff --git a/src/OpenFOAM/db/IOstreams/token/tokenIO.C b/src/OpenFOAM/db/IOstreams/token/tokenIO.C index 2a2a8a700..7ba7fb284 100644 --- a/src/OpenFOAM/db/IOstreams/token/tokenIO.C +++ b/src/OpenFOAM/db/IOstreams/token/tokenIO.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -88,6 +88,10 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const token& t) os << t.doubleScalarToken_; break; + case token::LONG_DOUBLE_SCALAR: + os << *t.longDoubleScalarTokenPtr_; + break; + case token::COMPOUND: os << *t.compoundTokenPtr_; break; @@ -179,6 +183,10 @@ ostream& Foam::operator<<(ostream& os, const InfoProxy& ip) os << " the doubleScalar " << t.doubleScalarToken(); break; + case token::LONG_DOUBLE_SCALAR: + os << " the longDoubleScalar " << t.longDoubleScalarToken(); + break; + case token::COMPOUND: { if (t.compoundToken().empty()) @@ -251,6 +259,10 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const InfoProxy& ip) os << " the doubleScalar " << t.doubleScalarToken(); break; + case token::LONG_DOUBLE_SCALAR: + os << " the longDoubleScalar " << t.longDoubleScalarToken(); + break; + case token::COMPOUND: { if (t.compoundToken().empty()) diff --git a/src/OpenFOAM/db/dictionary/primitiveEntry/primitiveEntryIO.C b/src/OpenFOAM/db/dictionary/primitiveEntry/primitiveEntryIO.C index 8777819d4..da4cbcac5 100644 --- a/src/OpenFOAM/db/dictionary/primitiveEntry/primitiveEntryIO.C +++ b/src/OpenFOAM/db/dictionary/primitiveEntry/primitiveEntryIO.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -96,7 +96,7 @@ bool Foam::primitiveEntry::read(const dictionary& dict, Istream& is) { is.fatalCheck ( - "primitiveEntry::readData(const dictionary&, Istream&)" + "primitiveEntry::read(const dictionary&, Istream&) start" ); label blockCount = 0; @@ -150,7 +150,7 @@ bool Foam::primitiveEntry::read(const dictionary& dict, Istream& is) is.fatalCheck ( - "primitiveEntry::readData(const dictionary&, Istream&)" + "primitiveEntry::read(const dictionary&, Istream&) end" ); if (currToken.good()) diff --git a/src/OpenFOAM/dimensionSet/dimensionSet.C b/src/OpenFOAM/dimensionSet/dimensionSet.C index e1d51f8f9..90f7606a5 100644 --- a/src/OpenFOAM/dimensionSet/dimensionSet.C +++ b/src/OpenFOAM/dimensionSet/dimensionSet.C @@ -31,8 +31,8 @@ License namespace Foam { -defineTypeNameAndDebug(dimensionSet, 1); -const scalar dimensionSet::smallExponent = small; + defineTypeNameAndDebug(dimensionSet, 1); + const scalar dimensionSet::smallExponent = small; } diff --git a/src/OpenFOAM/meshes/primitiveShapes/plane/plane.C b/src/OpenFOAM/meshes/primitiveShapes/plane/plane.C index 780fc02d3..e0f9ed1ec 100644 --- a/src/OpenFOAM/meshes/primitiveShapes/plane/plane.C +++ b/src/OpenFOAM/meshes/primitiveShapes/plane/plane.C @@ -322,9 +322,10 @@ Foam::scalar Foam::plane::normalIntersect const vector& dir ) const { - scalar denom = stabilise((dir & normal_), vSmall); + const scalar num = (point_ - pnt0) & normal_; + const scalar den = dir & normal_; - return ((point_ - pnt0) & normal_)/denom; + return mag(den) > mag(num)*vSmall ? num/den : vGreat; } diff --git a/src/OpenFOAM/primitives/Scalar/longDoubleScalar/longDoubleScalar.C b/src/OpenFOAM/primitives/Scalar/longDoubleScalar/longDoubleScalar.C new file mode 100644 index 000000000..85d7f4d9d --- /dev/null +++ b/src/OpenFOAM/primitives/Scalar/longDoubleScalar/longDoubleScalar.C @@ -0,0 +1,47 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "longDoubleScalar.H" +#include "IOstreams.H" + +#include + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#define Scalar longDoubleScalar +#define ScalarVGreat longDoubleScalarVGreat +#define ScalarVSmall longDoubleScalarVSmall +#define ScalarRootVGreat longDoubleScalarRootVGreat +#define ScalarRootVSmall longDoubleScalarRootVSmall +#define readScalar readLongDoubleScalar +#include "Scalar.C" +#undef Scalar +#undef ScalarVGreat +#undef ScalarVSmall +#undef ScalarRootVGreat +#undef ScalarRootVSmall +#undef readScalar + +// ************************************************************************* // diff --git a/src/OpenFOAM/primitives/Scalar/longDoubleScalar/longDoubleScalar.H b/src/OpenFOAM/primitives/Scalar/longDoubleScalar/longDoubleScalar.H new file mode 100644 index 000000000..93c1d87ff --- /dev/null +++ b/src/OpenFOAM/primitives/Scalar/longDoubleScalar/longDoubleScalar.H @@ -0,0 +1,175 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2018 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Typedef + Foam::longDoubleScalar + +Description + Lang double precision floating point scalar type. + +SourceFiles + longDoubleScalar.C + +\*---------------------------------------------------------------------------*/ + +#ifndef longDoubleScalar_H +#define longDoubleScalar_H + +#include "doubleFloat.H" +#include "direction.H" +#include "word.H" + +#include +using std::numeric_limits; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +typedef long double longDoubleScalar; + +// Largest and smallest scalar values allowed in certain parts of the code. +static const longDoubleScalar longDoubleScalarVGreat + = numeric_limits::max()/10; +static const longDoubleScalar longDoubleScalarVSmall + = numeric_limits::min(); + +static const longDoubleScalar longDoubleScalarSmall + = 1e3*numeric_limits::epsilon(); +static const longDoubleScalar longDoubleScalarGreat + = 1.0/longDoubleScalarSmall; + +static const longDoubleScalar longDoubleScalarRootVGreat + = ::sqrtl(longDoubleScalarVGreat); +static const longDoubleScalar longDoubleScalarRootVSmall + = ::sqrtl(longDoubleScalarVSmall); + +static const longDoubleScalar longDoubleScalarRootGreat + = ::sqrtl(longDoubleScalarGreat); +static const longDoubleScalar longDoubleScalarRootSmall + = ::sqrtl(longDoubleScalarSmall); + +//- Read whole of buf as a scalar. Return true if succesful. +inline bool readScalar(const char* buf, longDoubleScalar& s) +{ + char* endPtr; + s = strtold(buf, &endPtr); + + return (*endPtr == '\0'); +} + +#define Scalar longDoubleScalar +#define ScalarVGreat longDoubleScalarVGreat +#define ScalarVSmall longDoubleScalarVSmall +#define ScalarRootVGreat longDoubleScalarRootVGreat +#define ScalarRootVSmall longDoubleScalarRootVSmall +#define readScalar readLongDoubleScalar + +inline Scalar mag(const Scalar s) +{ + return ::fabsl(s); +} + +#define MAXMINPOW(retType, type1, type2) \ + \ +MAXMIN(retType, type1, type2) \ + \ +inline double pow(const type1 s, const type2 e) \ +{ \ + return ::powl(Scalar(s), Scalar(e)); \ +} + +MAXMINPOW(Scalar, Scalar, Scalar) +MAXMINPOW(Scalar, Scalar, int) +MAXMINPOW(Scalar, int, Scalar) +MAXMINPOW(Scalar, Scalar, long) +MAXMINPOW(Scalar, long, Scalar) +MAXMINPOW(Scalar, Scalar, float) +MAXMINPOW(Scalar, float, Scalar) +MAXMINPOW(Scalar, Scalar, double) +MAXMINPOW(Scalar, double, Scalar) + +#undef MAXMINPOW + +#define transFunc(func) \ +inline Scalar func(const Scalar s) \ +{ \ + return ::func(s); \ +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "Scalar.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +inline Scalar hypot(const Scalar x, const Scalar y) +{ + return ::hypotl(x, y); +} + +inline Scalar atan2(const Scalar y, const Scalar x) +{ + return ::atan2l(y, x); +} + +inline Scalar jn(const int n, const Scalar s) +{ + return ::jnl(n, s); +} + +inline Scalar yn(const int n, const Scalar s) +{ + return ::ynl(n, s); +} + +#undef Scalar +#undef ScalarVGreat +#undef ScalarVSmall +#undef ScalarRootVGreat +#undef ScalarRootVSmall +#undef readScalar +#undef transFunc + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/OpenFOAM/primitives/Scalar/scalar/scalar.H b/src/OpenFOAM/primitives/Scalar/scalar/scalar.H index d8810c386..6c11a950d 100644 --- a/src/OpenFOAM/primitives/Scalar/scalar/scalar.H +++ b/src/OpenFOAM/primitives/Scalar/scalar/scalar.H @@ -26,7 +26,7 @@ Typedef Description Single floating point number identical to float or double depending on - whether WM_SP or WM_DP is defined. + whether WM_SP, WM_DP or WM_LP is defined. SourceFiles scalar.C @@ -38,6 +38,7 @@ SourceFiles #include "floatScalar.H" #include "doubleScalar.H" +#include "longDoubleScalar.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -57,8 +58,6 @@ namespace Foam static const scalar rootSmall = floatScalarRootSmall; static const scalar vSmall = floatScalarVSmall; static const scalar rootVSmall = floatScalarRootVSmall; - - scalar readScalar(Istream& is); } #elif defined(WM_DP) @@ -77,10 +76,30 @@ namespace Foam static const scalar rootSmall = doubleScalarRootSmall; static const scalar vSmall = doubleScalarVSmall; static const scalar rootVSmall = doubleScalarRootVSmall; - - scalar readScalar(Istream& is); } +#elif defined(WM_LP) + +// Define scalar as a long double + +namespace Foam +{ + typedef longDoubleScalar scalar; + + static const scalar great = longDoubleScalarGreat; + static const scalar rootGreat = longDoubleScalarRootGreat; + static const scalar vGreat = longDoubleScalarVGreat; + static const scalar rootVGreat = longDoubleScalarRootVGreat; + static const scalar small = longDoubleScalarSmall; + static const scalar rootSmall = longDoubleScalarRootSmall; + static const scalar vSmall = longDoubleScalarVSmall; + static const scalar rootVSmall = longDoubleScalarRootVSmall; +} + +#else + + #error "Precision not set, please set either WM_SP, WM_DP or WM_LP" + #endif //- Deprecated limit constant for backward-compatibility @@ -96,15 +115,19 @@ namespace Foam static const scalar ROOTVSMALL = rootVSmall; } + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -// Additional transcendental functions +// Additional global and transcendental functions namespace Foam { + scalar readScalar(Istream& is); + //- Inverse normalized incomplete gamma function scalar invIncGamma(const scalar a, const scalar P); } + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #endif diff --git a/src/OpenFOAM/primitives/one/one.H b/src/OpenFOAM/primitives/one/one.H index b9a88d441..819cab1a3 100644 --- a/src/OpenFOAM/primitives/one/one.H +++ b/src/OpenFOAM/primitives/one/one.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -80,6 +80,12 @@ public: { return 1; } + + //- Return 1 for double + inline operator long double() const + { + return 1; + } }; diff --git a/src/OpenFOAM/primitives/zero/zero.H b/src/OpenFOAM/primitives/zero/zero.H index b0156929b..65278c6ba 100644 --- a/src/OpenFOAM/primitives/zero/zero.H +++ b/src/OpenFOAM/primitives/zero/zero.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -85,6 +85,12 @@ public: { return 0; } + + //- Return 0 for double + inline operator long double() const + { + return 0; + } }; diff --git a/src/Pstream/mpi/UPstream.C b/src/Pstream/mpi/UPstream.C index 51306bf7f..ab231d59d 100644 --- a/src/Pstream/mpi/UPstream.C +++ b/src/Pstream/mpi/UPstream.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -44,6 +44,8 @@ Note #define MPI_SCALAR MPI_FLOAT #elif defined(WM_DP) #define MPI_SCALAR MPI_DOUBLE +#elif defined(WM_LP) + #define MPI_SCALAR MPI_LONG_DOUBLE #endif // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/surfMesh/surfaceFormats/obj/OBJstream.C b/src/surfMesh/surfaceFormats/obj/OBJstream.C index 695e51852..6e24ccef8 100644 --- a/src/surfMesh/surfaceFormats/obj/OBJstream.C +++ b/src/surfMesh/surfaceFormats/obj/OBJstream.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2018 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -105,7 +105,7 @@ Foam::Ostream& Foam::OBJstream::write(const word& str) Foam::Ostream& Foam::OBJstream::write(const string& str) { - OFstream::write(token::BEGIN_STRING); + OFstream::write(char(token::BEGIN_STRING)); int backslash = 0; for (string::const_iterator iter = str.begin(); iter != str.end(); ++iter) @@ -141,7 +141,7 @@ Foam::Ostream& Foam::OBJstream::write(const string& str) // silently drop any trailing backslashes // they would otherwise appear like an escaped end-quote - OFstream::write(token::END_STRING); + OFstream::write(char(token::END_STRING)); return *this; } @@ -154,7 +154,7 @@ Foam::Ostream& Foam::OBJstream::writeQuoted { if (quoted) { - OFstream::write(token::BEGIN_STRING); + OFstream::write(char(token::BEGIN_STRING)); int backslash = 0; for @@ -194,7 +194,7 @@ Foam::Ostream& Foam::OBJstream::writeQuoted // silently drop any trailing backslashes // they would otherwise appear like an escaped end-quote - OFstream::write(token::END_STRING); + OFstream::write(char(token::END_STRING)); } else { diff --git a/src/surfMesh/surfaceFormats/stl/STLpoint.H b/src/surfMesh/surfaceFormats/stl/STLpoint.H index eb0d9fccd..28e1ad009 100644 --- a/src/surfMesh/surfaceFormats/stl/STLpoint.H +++ b/src/surfMesh/surfaceFormats/stl/STLpoint.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -80,7 +80,7 @@ public: // Member Operators - #ifdef WM_DP + #if defined(WM_DP) || defined(WM_LP) //- Conversion to double-precision point inline operator point() const {