diff --git a/src/OSspecific/POSIX/signals/sigStopAtWriteNow.C b/src/OSspecific/POSIX/signals/sigStopAtWriteNow.C index 8ff4641279..785fd20e67 100644 --- a/src/OSspecific/POSIX/signals/sigStopAtWriteNow.C +++ b/src/OSspecific/POSIX/signals/sigStopAtWriteNow.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -40,38 +40,6 @@ int sigStopAtWriteNow::signal_ debug::optimisationSwitch("stopAtWriteNowSignal", -1) ); -// Register re-reader -class addstopAtWriteNowSignalToOpt -: - public ::Foam::simpleRegIOobject -{ -public: - - addstopAtWriteNowSignalToOpt(const char* name) - : - ::Foam::simpleRegIOobject(Foam::debug::addOptimisationObject, name) - {} - - virtual ~addstopAtWriteNowSignalToOpt() - {} - - virtual void readData(Foam::Istream& is) - { - sigStopAtWriteNow::signal_ = readLabel(is); - sigStopAtWriteNow::set(writeInfoHeader); - } - - virtual void writeData(Foam::Ostream& os) const - { - os << sigStopAtWriteNow::signal_; - } -}; - -addstopAtWriteNowSignalToOpt addstopAtWriteNowSignalToOpt_ -( - "stopAtWriteNowSignal" -); - } // End namespace Foam diff --git a/src/OSspecific/POSIX/signals/sigWriteNow.C b/src/OSspecific/POSIX/signals/sigWriteNow.C index 6b2a821de4..1bfcecceed 100644 --- a/src/OSspecific/POSIX/signals/sigWriteNow.C +++ b/src/OSspecific/POSIX/signals/sigWriteNow.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -40,36 +40,6 @@ int sigWriteNow::signal_ debug::optimisationSwitch("writeNowSignal", -1) ); -// Register re-reader -class addwriteNowSignalToOpt -: - public ::Foam::simpleRegIOobject -{ - -public: - - addwriteNowSignalToOpt(const char* name) - : - ::Foam::simpleRegIOobject(Foam::debug::addOptimisationObject, name) - {} - - virtual ~addwriteNowSignalToOpt() - {} - - virtual void readData(Foam::Istream& is) - { - sigWriteNow::signal_ = readLabel(is); - sigWriteNow::set(writeInfoHeader); - } - - virtual void writeData(Foam::Ostream& os) const - { - os << sigWriteNow::signal_; - } -}; - -addwriteNowSignalToOpt addwriteNowSignalToOpt_("writeNowSignal"); - } // End namespace Foam diff --git a/src/OpenFOAM/db/IOobject/IOobject.C b/src/OpenFOAM/db/IOobject/IOobject.C index f2848a52ee..943695ce0d 100644 --- a/src/OpenFOAM/db/IOobject/IOobject.C +++ b/src/OpenFOAM/db/IOobject/IOobject.C @@ -26,7 +26,6 @@ License #include "IOobject.H" #include "Time.H" #include "IFstream.H" -#include "registerNamedEnum.H" #include "OSspecific.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -59,15 +58,6 @@ Foam::IOobject::fileCheckTypes Foam::IOobject::fileModificationChecking ) ); -// Register re-reader -registerOptNamedEnum -( - "fileModificationChecking", - Foam::IOobject::fileCheckTypesNames, - Foam::IOobject::fileModificationChecking -); - - // * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * // bool Foam::IOobject::fileNameComponents diff --git a/src/OpenFOAM/db/IOobjects/IOdictionary/IOdictionary.C b/src/OpenFOAM/db/IOobjects/IOdictionary/IOdictionary.C index 2146629762..c83abd2940 100644 --- a/src/OpenFOAM/db/IOobjects/IOdictionary/IOdictionary.C +++ b/src/OpenFOAM/db/IOobjects/IOdictionary/IOdictionary.C @@ -27,7 +27,6 @@ License #include "objectRegistry.H" #include "Pstream.H" #include "Time.H" -#include "registerSwitch.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -39,13 +38,6 @@ namespace Foam ( debug::infoSwitch("writeDictionaries", 0) ); - - registerInfoSwitch - ( - "writeDictionaries", - bool, - IOdictionary::writeDictionaries - ); } diff --git a/src/OpenFOAM/db/IOstreams/Pstreams/UPstream.C b/src/OpenFOAM/db/IOstreams/Pstreams/UPstream.C index 78b0158a00..01525447e0 100644 --- a/src/OpenFOAM/db/IOstreams/Pstreams/UPstream.C +++ b/src/OpenFOAM/db/IOstreams/Pstreams/UPstream.C @@ -25,8 +25,6 @@ License #include "UPstream.H" #include "debug.H" -#include "registerSwitch.H" -#include "registerNamedEnum.H" #include "dictionary.H" #include "IOstreams.H" @@ -435,23 +433,11 @@ bool Foam::UPstream::floatTransfer ( Foam::debug::optimisationSwitch("floatTransfer", 0) ); -registerOptSwitch -( - "floatTransfer", - bool, - Foam::UPstream::floatTransfer -); int Foam::UPstream::nProcsSimpleSum ( Foam::debug::optimisationSwitch("nProcsSimpleSum", 16) ); -registerOptSwitch -( - "nProcsSimpleSum", - int, - Foam::UPstream::nProcsSimpleSum -); Foam::UPstream::commsTypes Foam::UPstream::defaultCommsType ( @@ -462,12 +448,6 @@ Foam::UPstream::commsTypes Foam::UPstream::defaultCommsType defaultCommsType ) ); -registerOptNamedEnum -( - "commsType", - Foam::UPstream::commsTypeNames, - Foam::UPstream::defaultCommsType -); Foam::label Foam::UPstream::worldComm(0); @@ -477,12 +457,6 @@ int Foam::UPstream::nPollProcInterfaces ( Foam::debug::optimisationSwitch("nPollProcInterfaces", 0) ); -registerOptSwitch -( - "nPollProcInterfaces", - int, - Foam::UPstream::nPollProcInterfaces -); // ************************************************************************* // diff --git a/src/OpenFOAM/db/Time/Time.C b/src/OpenFOAM/db/Time/Time.C index d4a7c8acc6..739240afc7 100644 --- a/src/OpenFOAM/db/Time/Time.C +++ b/src/OpenFOAM/db/Time/Time.C @@ -24,11 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "Time.H" -#include "PstreamReduceOps.H" #include "argList.H" -#include "IOdictionary.H" - -#include // * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * * // @@ -446,6 +442,32 @@ Foam::Time::Time // from it reads as well (e.g. fvSolution). readOpt() = IOobject::MUST_READ_IF_MODIFIED; + if (args.options().found("case")) + { + const wordList switchSets + ( + { + "InfoSwitches", + "OptimisationSwitches", + "DebugSwitches", + "DimensionedConstants", + "DimensionSets" + } + ); + + forAll(switchSets, i) + { + if (controlDict_.found(switchSets[i])) + { + IOWarningInFunction(controlDict_) + << switchSets[i] + << " in system/controlDict are only processed if " + << args.executable() << " is run in the " + << args.path() << " directory" << endl; + } + } + } + setControls(); // Add a watch on the controlDict file after runTimeModifiable_ is set diff --git a/src/OpenFOAM/db/Time/TimeIO.C b/src/OpenFOAM/db/Time/TimeIO.C index 2e236de7fb..06c1652728 100644 --- a/src/OpenFOAM/db/Time/TimeIO.C +++ b/src/OpenFOAM/db/Time/TimeIO.C @@ -24,12 +24,6 @@ License \*---------------------------------------------------------------------------*/ #include "Time.H" -#include "Pstream.H" -#include "simpleObjectRegistry.H" -#include "registerSwitch.H" -#include "dimensionedConstants.H" -#include "IOdictionary.H" -#include "fileOperation.H" #include "OSspecific.H" // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // @@ -43,65 +37,6 @@ void Foam::Time::readDict() setEnv("FOAM_APPLICATION", application, false); } - // Check for local switches and settings and update - debug::readSwitches("Debug", debug::debugObjects(), controlDict_); - debug::readSwitches("Info", debug::infoObjects(), controlDict_); - debug::readSwitches - ( - "Optimisation", - debug::optimisationObjects(), - controlDict_ - ); - - // Handle fileHandler override explicitly since interacts with local - // dictionary monitoring - if (controlDict_.found("OptimisationSwitches")) - { - const dictionary& localSettings = - controlDict_.subDict("OptimisationSwitches"); - - word fileHandlerName; - if - ( - localSettings.readIfPresent("fileHandler", fileHandlerName) - && fileHandler().type() != fileHandlerName - ) - { - // Remove the old watches since destroying the file - fileNameList oldWatchedFiles(controlDict_.watchIndices()); - forAllReverse(controlDict_.watchIndices(), i) - { - label watchi = controlDict_.watchIndices()[i]; - oldWatchedFiles[i] = fileHandler().getFile(watchi); - fileHandler().removeWatch(watchi); - } - controlDict_.watchIndices().clear(); - - // Installing the new handler - InfoHeader - << "Overriding fileHandler to " << fileHandlerName << endl; - - autoPtr handler - ( - fileOperation::New - ( - fileHandlerName, - true - ) - ); - Foam::fileHandler(handler); - - // Reinstall old watches - fileHandler().addWatches(controlDict_, oldWatchedFiles); - } - } - - // Check for local dimensionSets and update - readDimensionSets(controlDict_); - - // Check for local dimensionedConstants and update - readDimensionedConstants(controlDict_); - if (!deltaTchanged_) { deltaT_ = controlDict_.lookup("deltaT"); diff --git a/src/OpenFOAM/db/dictionary/dictionary.C b/src/OpenFOAM/db/dictionary/dictionary.C index 09d9a00c8e..41553f301b 100644 --- a/src/OpenFOAM/db/dictionary/dictionary.C +++ b/src/OpenFOAM/db/dictionary/dictionary.C @@ -31,7 +31,6 @@ License #include "DynamicList.H" #include "inputSyntaxEntry.H" #include "fileOperation.H" -#include "registerSwitch.H" #include "stringOps.H" /* * * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * */ @@ -48,13 +47,6 @@ bool Foam::dictionary::writeOptionalEntries Foam::debug::infoSwitch("writeOptionalEntries", 0) ); -registerInfoSwitch -( - "writeOptionalEntries", - bool, - Foam::dictionary::writeOptionalEntries -); - // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // diff --git a/src/OpenFOAM/db/dictionary/entry/entry.C b/src/OpenFOAM/db/dictionary/entry/entry.C index 1d9ce18bf8..cffd0184f3 100644 --- a/src/OpenFOAM/db/dictionary/entry/entry.C +++ b/src/OpenFOAM/db/dictionary/entry/entry.C @@ -26,7 +26,6 @@ License #include "entry.H" #include "dictionary.H" #include "OStringStream.H" -#include "registerSwitch.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -35,13 +34,6 @@ int Foam::entry::disableFunctionEntries Foam::debug::infoSwitch("disableFunctionEntries", 0) ); -registerInfoSwitch -( - "disableFunctionEntries", - int, - Foam::entry::disableFunctionEntries -); - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/db/regIOobject/regIOobject.C b/src/OpenFOAM/db/regIOobject/regIOobject.C index d97dbf3bf2..31a85c57d4 100644 --- a/src/OpenFOAM/db/regIOobject/regIOobject.C +++ b/src/OpenFOAM/db/regIOobject/regIOobject.C @@ -26,7 +26,6 @@ License #include "regIOobject.H" #include "Time.H" #include "polyMesh.H" -#include "registerSwitch.H" #include "fileOperation.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/dimensionSet/dimensionSets.C b/src/OpenFOAM/dimensionSet/dimensionSets.C index 35332ea786..7814ad74a7 100644 --- a/src/OpenFOAM/dimensionSet/dimensionSets.C +++ b/src/OpenFOAM/dimensionSet/dimensionSets.C @@ -25,16 +25,12 @@ License #include "dimensionSet.H" #include "dimensionedScalar.H" -#include "simpleObjectRegistry.H" -#include "demandDrivenData.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { -/* * * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * */ - // Since dimensionSystems() can be reread we actually store a copy of // the controlDict subDict (v.s. a reference to the subDict for e.g. // dimensionedConstants) @@ -42,47 +38,11 @@ dictionary* dimensionSystemsPtr_(nullptr); HashTable* unitSetPtr_(nullptr); dimensionSets* writeUnitSetPtr_(nullptr); -// Helper class to -// register re-reader -// deallocate demand-driven data -class addDimensionSetsToDebug -: - public simpleRegIOobject -{ +} -public: +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - addDimensionSetsToDebug(const char* name) - : - simpleRegIOobject(debug::addDimensionSetObject, name) - {} - - virtual ~addDimensionSetsToDebug() - { - deleteDemandDrivenData(dimensionSystemsPtr_); - deleteDemandDrivenData(unitSetPtr_); - deleteDemandDrivenData(writeUnitSetPtr_); - - } - - virtual void readData(Istream& is) - { - deleteDemandDrivenData(dimensionSystemsPtr_); - deleteDemandDrivenData(unitSetPtr_); - deleteDemandDrivenData(writeUnitSetPtr_); - dimensionSystemsPtr_ = new dictionary(is); - } - - virtual void writeData(Ostream& os) const - { - os << dimensionSystems(); - } -}; - -addDimensionSetsToDebug addDimensionSetsToDebug_("DimensionSets"); - - -dictionary& dimensionSystems() +Foam::dictionary& Foam::dimensionSystems() { if (!dimensionSystemsPtr_) { @@ -100,7 +60,7 @@ dictionary& dimensionSystems() } -const HashTable& unitSet() +const Foam::HashTable& Foam::unitSet() { if (!unitSetPtr_) { @@ -166,7 +126,7 @@ const HashTable& unitSet() } -const dimensionSets& writeUnitSet() +const Foam::dimensionSets& Foam::writeUnitSet() { if (!writeUnitSetPtr_) { @@ -176,72 +136,35 @@ const dimensionSets& writeUnitSet() } -void readDimensionSets(const dictionary& dict) -{ - if (dict.found("DimensionSets")) - { - InfoHeader - << "Overriding DimensionSets according to " - << dict.name() << endl; +const Foam::dimensionSet Foam::dimless(0, 0, 0, 0, 0, 0, 0); - dictionary dimensionSetDict(Foam::dimensionSystems()); - dimensionSetDict.merge(dict.subDict("DimensionSets")); +const Foam::dimensionSet Foam::dimMass(1, 0, 0, 0, 0, 0, 0); +const Foam::dimensionSet Foam::dimLength(0, 1, 0, 0, 0, 0, 0); +const Foam::dimensionSet Foam::dimTime(0, 0, 1, 0, 0, 0, 0); +const Foam::dimensionSet Foam::dimTemperature(0, 0, 0, 1, 0, 0, 0); +const Foam::dimensionSet Foam::dimMoles(0, 0, 0, 0, 1, 0, 0); +const Foam::dimensionSet Foam::dimCurrent(0, 0, 0, 0, 0, 1, 0); +const Foam::dimensionSet Foam::dimLuminousIntensity(0, 0, 0, 0, 0, 0, 1); - simpleObjectRegistry& objects = debug::dimensionSetObjects(); - simpleObjectRegistryEntry* objPtr = objects.lookupPtr("DimensionSets"); +const Foam::dimensionSet Foam::dimArea(sqr(dimLength)); +const Foam::dimensionSet Foam::dimVolume(pow3(dimLength)); +const Foam::dimensionSet Foam::dimVol(dimVolume); - if (objPtr) - { - InfoHeader << dict.subDict("DimensionSets") << endl; +const Foam::dimensionSet Foam::dimVelocity(dimLength/dimTime); +const Foam::dimensionSet Foam::dimAcceleration(dimVelocity/dimTime); - const List& objects = *objPtr; +const Foam::dimensionSet Foam::dimDensity(dimMass/dimVolume); +const Foam::dimensionSet Foam::dimForce(dimMass*dimAcceleration); +const Foam::dimensionSet Foam::dimEnergy(dimForce*dimLength); +const Foam::dimensionSet Foam::dimPower(dimEnergy/dimTime); - OStringStream os(IOstream::ASCII); - os << dimensionSetDict; - IStringStream is(os.str()); +const Foam::dimensionSet Foam::dimPressure(dimForce/dimArea); +const Foam::dimensionSet Foam::dimCompressibility(dimDensity/dimPressure); +const Foam::dimensionSet Foam::dimGasConstant(dimEnergy/dimMass/dimTemperature); +const Foam::dimensionSet Foam::dimSpecificHeatCapacity(dimGasConstant); +const Foam::dimensionSet Foam::dimViscosity(dimArea/dimTime); +const Foam::dimensionSet Foam::dimDynamicViscosity(dimDensity*dimViscosity); - forAll(objects, i) - { - objects[i]->readData(is.rewind()); - } - } - } -} - - -const dimensionSet dimless(0, 0, 0, 0, 0, 0, 0); - -const dimensionSet dimMass(1, 0, 0, 0, 0, 0, 0); -const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0); -const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0); -const dimensionSet dimTemperature(0, 0, 0, 1, 0, 0, 0); -const dimensionSet dimMoles(0, 0, 0, 0, 1, 0, 0); -const dimensionSet dimCurrent(0, 0, 0, 0, 0, 1, 0); -const dimensionSet dimLuminousIntensity(0, 0, 0, 0, 0, 0, 1); - -const dimensionSet dimArea(sqr(dimLength)); -const dimensionSet dimVolume(pow3(dimLength)); -const dimensionSet dimVol(dimVolume); - -const dimensionSet dimVelocity(dimLength/dimTime); -const dimensionSet dimAcceleration(dimVelocity/dimTime); - -const dimensionSet dimDensity(dimMass/dimVolume); -const dimensionSet dimForce(dimMass*dimAcceleration); -const dimensionSet dimEnergy(dimForce*dimLength); -const dimensionSet dimPower(dimEnergy/dimTime); - -const dimensionSet dimPressure(dimForce/dimArea); -const dimensionSet dimCompressibility(dimDensity/dimPressure); -const dimensionSet dimGasConstant(dimEnergy/dimMass/dimTemperature); -const dimensionSet dimSpecificHeatCapacity(dimGasConstant); -const dimensionSet dimViscosity(dimArea/dimTime); -const dimensionSet dimDynamicViscosity(dimDensity*dimViscosity); - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/dimensionSet/dimensionSets.H b/src/OpenFOAM/dimensionSet/dimensionSets.H index d6826de5b0..51bb8d1ef6 100644 --- a/src/OpenFOAM/dimensionSet/dimensionSets.H +++ b/src/OpenFOAM/dimensionSet/dimensionSets.H @@ -92,6 +92,7 @@ class dimensionSets //- Is LU decomposition valid bool valid_; + public: // Constructors @@ -132,9 +133,6 @@ const HashTable& unitSet(); //- Set of units const dimensionSets& writeUnitSet(); -//- Read and update the dimensionSets specified in dict -void readDimensionSets(const dictionary& dict); - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/global/constants/atomic/atomicConstants.C b/src/OpenFOAM/global/constants/atomic/atomicConstants.C index ea8be90105..325d43570f 100644 --- a/src/OpenFOAM/global/constants/atomic/atomicConstants.C +++ b/src/OpenFOAM/global/constants/atomic/atomicConstants.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -40,80 +40,51 @@ namespace constant const char* const atomic::group = "atomic"; -// Note: cannot use dimless etc. since not guaranteed to be constructed -defineDimensionedConstantWithDefault +// Note: cannot use dimless etc. as they may not have been constructed yet + +const Foam::dimensionedScalar atomic::alpha ( - atomic, - alpha, - dimensionedScalar + dimensionedConstant ( + atomic::group, + "alpha", + sqr(electromagnetic::e) + /(2*electromagnetic::epsilon0 *universal::h *universal::c) + ) +); + + +const Foam::dimensionedScalar atomic::Rinf +( + dimensionedConstant + ( + atomic::group, + "Rinf", + sqr(atomic::alpha)*atomic::me*universal::c/(2*universal::h) + ) +); + + +const Foam::dimensionedScalar atomic::a0 +( + dimensionedConstant + ( + atomic::group, + "a0", + atomic::alpha/(4*mathematical::pi*atomic::Rinf) + ) +); + + +const Foam::dimensionedScalar atomic::re +( + dimensionedConstant + ( + atomic::group, + "re", sqr(electromagnetic::e) /( - dimensionedScalar("C", dimensionSet(0, 0, 0, 0, 0), 2.0) - *electromagnetic::epsilon0 - *universal::h - *universal::c - ) - ) -); - - -defineDimensionedConstantWithDefault -( - atomic, - Rinf, - dimensionedScalar - ( - sqr(atomic::alpha) - *atomic::me - *universal::c - /( - dimensionedScalar - ( - "C", - dimensionSet(0, 0, 0, 0, 0), - 2.0 - ) - *universal::h - ) - ) -); - - -defineDimensionedConstantWithDefault -( - atomic, - a0, - dimensionedScalar - ( - atomic::alpha - /( - dimensionedScalar - ( - "C", - dimensionSet(0, 0, 0, 0, 0), - 4.0*mathematical::pi - ) - *atomic::Rinf - ) - ) -); - - -defineDimensionedConstantWithDefault -( - atomic, - re, - dimensionedScalar - ( - sqr(electromagnetic::e) - /( - dimensionedScalar - ( - "C", - dimensionSet(0, 0, 0, 0, 0), - 4.0*mathematical::pi - ) + 4*mathematical::pi *electromagnetic::epsilon0 *atomic::me *sqr(universal::c) @@ -122,14 +93,13 @@ defineDimensionedConstantWithDefault ); -defineDimensionedConstantWithDefault +const Foam::dimensionedScalar atomic::Eh ( - atomic, - Eh, - dimensionedScalar + dimensionedConstant ( - dimensionedScalar("C", dimensionSet(0, 0, 0, 0, 0), 2.0) - *atomic::Rinf*universal::h*universal::c + atomic::group, + "Eh", + 2*atomic::Rinf*universal::h*universal::c ) ); diff --git a/src/OpenFOAM/global/constants/atomic/atomicConstants.H b/src/OpenFOAM/global/constants/atomic/atomicConstants.H index bfc2a8c86c..1cbdb518e3 100644 --- a/src/OpenFOAM/global/constants/atomic/atomicConstants.H +++ b/src/OpenFOAM/global/constants/atomic/atomicConstants.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -49,20 +49,19 @@ namespace atomic extern const char* const group; //- Fine-structure constant: default SI units: [] - extern const dimensionedScalar& alpha; + extern const dimensionedScalar alpha; //- Rydberg constant: default SI units: [1/m] - extern const dimensionedScalar& Rinf; + extern const dimensionedScalar Rinf; //- Bohr radius: default SI units: [m] - extern const dimensionedScalar& a0; + extern const dimensionedScalar a0; //- Classical electron radius: default SI units: [m] - extern const dimensionedScalar& re; + extern const dimensionedScalar re; //- Hartree energy: default SI units: [J] - extern const dimensionedScalar& Eh; - + extern const dimensionedScalar Eh; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/global/constants/dimensionedConstants.C b/src/OpenFOAM/global/constants/dimensionedConstants.C index 5df42c863d..3fff656497 100644 --- a/src/OpenFOAM/global/constants/dimensionedConstants.C +++ b/src/OpenFOAM/global/constants/dimensionedConstants.C @@ -43,7 +43,12 @@ Foam::dictionary& Foam::dimensionedConstants() } -void Foam::registerDimensionedConstant::lookup() +Foam::dimensionedScalar Foam::dimensionedConstant +( + const char* const group, + const char* name, + const dimensionSet& dimensions +) { dictionary& dict = dimensionedConstants(); @@ -64,88 +69,52 @@ void Foam::registerDimensionedConstant::lookup() << dict.name() << std::endl; } - dimensionedScalar::operator= + return dimensionedScalar ( - dimensionedScalar - ( - name(), - dimensions(), - dict.subDict(unitSetCoeffs).subDict(group_) - ) + name, + dimensions, + dict.subDict(unitSetCoeffs).subDict(group) ); } -void Foam::registerDimensionedConstantWithDefault::lookup() +Foam::dimensionedScalar Foam::dimensionedConstant +( + const char* const group, + const char* name, + const dimensionedScalar& defaultValuee +) { dictionary& dict = dimensionedConstants(); const word unitSet(dict.lookup("unitSet")); dictionary& unitDict(dict.subDict(unitSet + "Coeffs")); - const dimensionedScalar defaultValue(name(), defaultFunc_()); + const dimensionedScalar defaultValue(name, defaultValuee); - if (unitDict.found(group_)) + if (unitDict.found(group)) { - dictionary& groupDict = unitDict.subDict(group_); - if (groupDict.found(name())) + dictionary& groupDict = unitDict.subDict(group); + if (groupDict.found(name)) { - dimensionedScalar::operator= + return dimensionedScalar ( - dimensionedScalar - ( - name(), - defaultValue.dimensions(), - groupDict.lookup(name()) - ) + name, + defaultValue.dimensions(), + groupDict.lookup(name) ); } else { - groupDict.add(name(), defaultValue); - dimensionedScalar::operator=(defaultValue); + groupDict.add(name, defaultValue); + return defaultValue; } } else { - unitDict.add(group_, dictionary::null); - unitDict.subDict(group_).add(name(), defaultValue); - dimensionedScalar::operator=(defaultValue); - } -} - - -void Foam::readDimensionedConstants(const dictionary& dict) -{ - if (dict.found("DimensionedConstants")) - { - InfoHeader - << "Overriding DimensionedConstants according to " - << dict.name() << endl; - - // Change dimensionedConstants dictionary in-memory - dimensionedConstants().merge(dict.subDict("DimensionedConstants")); - - simpleObjectRegistry& objects = debug::dimensionedConstantObjects(); - - IStringStream dummyIs(""); - - forAllConstIter(simpleObjectRegistry, objects, iter) - { - const List& objects = *iter; - - forAll(objects, i) - { - objects[i]->readData(dummyIs); - - if (writeInfoHeader) - { - Info<< " "; - objects[i]->writeData(Info); - Info<< endl; - } - } - } + unitDict.add(group, dictionary::null); + unitDict.subDict(group).add(name, defaultValue); + return defaultValue; } } diff --git a/src/OpenFOAM/global/constants/dimensionedConstants.H b/src/OpenFOAM/global/constants/dimensionedConstants.H index 377047e411..3558ce2227 100644 --- a/src/OpenFOAM/global/constants/dimensionedConstants.H +++ b/src/OpenFOAM/global/constants/dimensionedConstants.H @@ -51,127 +51,19 @@ namespace Foam dictionary& dimensionedConstants(); +dimensionedScalar dimensionedConstant +( + const char* const group, + const char* name, + const dimensionSet& dimensions +); -class registerDimensionedConstant -: - public simpleRegIOobject, - public dimensionedScalar -{ - const char* const group_; - - //- Lookup the dimensionedConstant from the registry - void lookup(); - - -public: - - registerDimensionedConstant - ( - const char* const group, - const char* name, - const dimensionSet& dimensions - ) - : - simpleRegIOobject(debug::addDimensionedConstantObject, name), - dimensionedScalar(name, dimensions, 0), - group_(group) - { - lookup(); - } - - virtual ~registerDimensionedConstant() - {} - - virtual void readData(Istream& is) - { - lookup(); - } - - virtual void writeData(Ostream& os) const - { - os << static_cast(*this); - } -}; - - -//- Defined and register a dimensioned constant -#define defineDimensionedConstant(Group, Name, Dimensions) \ - registerDimensionedConstant register##Name##DimensionedConstant_ \ - ( \ - Group::group, \ - #Name, \ - Dimensions \ - ); \ - const Foam::dimensionedScalar& Group::Name \ - ( \ - register##Name##DimensionedConstant_ \ - ); - - -class registerDimensionedConstantWithDefault -: - public simpleRegIOobject, - public dimensionedScalar -{ - typedef dimensionedScalar (*defaultFuncPtr)(); - - const char* const group_; - defaultFuncPtr defaultFunc_; - - //- Lookup the dimensionedConstant from the registry - void lookup(); - - -public: - - registerDimensionedConstantWithDefault - ( - const char* const group, - const char* name, - defaultFuncPtr defaultFunc - ) - : - simpleRegIOobject(debug::addDimensionedConstantObject, name), - dimensionedScalar(name, defaultFunc()), - group_(group), - defaultFunc_(defaultFunc) - { - lookup(); - } - - virtual ~registerDimensionedConstantWithDefault() - {} - - virtual void readData(Istream& is) - { - lookup(); - } - - virtual void writeData(Ostream& os) const - { - os << static_cast(*this); - } -}; - - -//- Read and update the dimensionedConstants specified in dict -void readDimensionedConstants(const dictionary& dict); - - -//- Defined and register a dimensioned constant with default -#define defineDimensionedConstantWithDefault(Group, Name, DefaultExpr) \ - registerDimensionedConstantWithDefault \ - register##Name##DimensionedConstant_ \ - ( \ - Group::group, \ - #Name, \ - [](){return DefaultExpr;} \ - ); \ - \ - const Foam::dimensionedScalar& Group::Name \ - ( \ - register##Name##DimensionedConstant_ \ - ); +dimensionedScalar dimensionedConstant +( + const char* const group, + const char* name, + const dimensionedScalar& defaultValue +); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/global/constants/electromagnetic/electromagneticConstants.C b/src/OpenFOAM/global/constants/electromagnetic/electromagneticConstants.C index 2cc0601f33..f991851bce 100644 --- a/src/OpenFOAM/global/constants/electromagnetic/electromagneticConstants.C +++ b/src/OpenFOAM/global/constants/electromagnetic/electromagneticConstants.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -27,7 +27,6 @@ License #include "universalConstants.H" #include "electromagneticConstants.H" #include "atomicConstants.H" - #include "dimensionedConstants.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -40,107 +39,97 @@ namespace constant const char* const electromagnetic::group = "electromagnetic"; -defineDimensionedConstantWithDefault -( - electromagnetic, - mu0, - dimensionedScalar - ( - dimensionSet(1, 1, -2, 0, 0, -2, 0), - 4*mathematical::pi*1e-07 - ) -); +// Note: cannot use dimless etc. as they may not have been constructed yet - -// Note: cannot use dimless etc. since not guaranteed to be constructed -defineDimensionedConstantWithDefault +const Foam::dimensionedScalar electromagnetic::mu0 ( - electromagnetic, - epsilon0, - dimensionedScalar + dimensionedConstant ( + electromagnetic::group, + "mu0", dimensionedScalar ( - "C", - dimensionSet(0, 0, 0, 0, 0), - 1 - ) - /(electromagnetic::mu0*sqr(universal::c)) - ) -); - - -defineDimensionedConstantWithDefault -( - electromagnetic, - Z0, - dimensionedScalar(electromagnetic::mu0*universal::c) -); - - -defineDimensionedConstantWithDefault -( - electromagnetic, - kappa, - dimensionedScalar - ( - dimensionedScalar - ( - "C", - dimensionSet(0, 0, 0, 0, 0), - 1/(4*mathematical::pi) - ) - /electromagnetic::epsilon0 - ) -); - - -defineDimensionedConstantWithDefault -( - electromagnetic, - G0, - dimensionedScalar - ( - dimensionedScalar("C", dimensionSet(0, 0, 0, 0, 0), 2) - *sqr(electromagnetic::e) - /universal::h - ) -); - - -defineDimensionedConstantWithDefault -( - electromagnetic, - KJ, - dimensionedScalar - ( - dimensionedScalar("C", dimensionSet(0, 0, 0, 0, 0), 2) - *electromagnetic::e - /universal::h - ) -); - - -defineDimensionedConstantWithDefault -( - electromagnetic, - phi0, - dimensionedScalar - ( - universal::h - /( - dimensionedScalar("C", dimensionSet(0, 0, 0, 0, 0), 2) - *electromagnetic::e + dimensionSet(1, 1, -2, 0, 0, -2, 0), + 4*mathematical::pi*1e-07 ) ) ); -defineDimensionedConstantWithDefault +const Foam::dimensionedScalar electromagnetic::epsilon0 ( - electromagnetic, - RK, - dimensionedScalar(universal::h/sqr(electromagnetic::e)) + dimensionedConstant + ( + electromagnetic::group, + "epsilon0", + 1/(electromagnetic::mu0*sqr(universal::c)) + ) +); + + +const Foam::dimensionedScalar electromagnetic::Z0 +( + dimensionedConstant + ( + electromagnetic::group, + "Z0", + electromagnetic::mu0*universal::c + ) +); + + +const Foam::dimensionedScalar electromagnetic::kappa +( + dimensionedConstant + ( + electromagnetic::group, + "kappa", + (1/(4*mathematical::pi))/electromagnetic::epsilon0 + ) +); + + +const Foam::dimensionedScalar electromagnetic::G0 +( + dimensionedConstant + ( + electromagnetic::group, + "G0", + 2*sqr(electromagnetic::e)/universal::h + ) +); + + +const Foam::dimensionedScalar electromagnetic::KJ +( + dimensionedConstant + ( + electromagnetic::group, + "KJ", + 2*electromagnetic::e/universal::h + ) +); + + +const Foam::dimensionedScalar electromagnetic::phi0 +( + dimensionedConstant + ( + electromagnetic::group, + "phi0", + universal::h/(2*electromagnetic::e) + ) +); + + +const Foam::dimensionedScalar electromagnetic::RK +( + dimensionedConstant + ( + electromagnetic::group, + "RK", + universal::h/sqr(electromagnetic::e) + ) ); diff --git a/src/OpenFOAM/global/constants/electromagnetic/electromagneticConstants.H b/src/OpenFOAM/global/constants/electromagnetic/electromagneticConstants.H index 861c4aa3bc..47b4e19a32 100644 --- a/src/OpenFOAM/global/constants/electromagnetic/electromagneticConstants.H +++ b/src/OpenFOAM/global/constants/electromagnetic/electromagneticConstants.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -49,29 +49,28 @@ namespace electromagnetic extern const char* const group; //- Magnetic constant/permeability of free space: default SI units: [H/m] - extern const dimensionedScalar& mu0; + extern const dimensionedScalar mu0; //- Electric constant: default SI units: [F/m] - extern const dimensionedScalar& epsilon0; + extern const dimensionedScalar epsilon0; //- Characteristic impedance of a vacuum: default SI units: [ohm] - extern const dimensionedScalar& Z0; + extern const dimensionedScalar Z0; //- Coulomb constant: default SI units: [N.m2/C2] - extern const dimensionedScalar& kappa; + extern const dimensionedScalar kappa; //- Conductance quantum: default SI units: [S] - extern const dimensionedScalar& G0; + extern const dimensionedScalar G0; //- Josephson constant: default SI units: [Hz/V] - extern const dimensionedScalar& KJ; + extern const dimensionedScalar KJ; //- Magnetic flux quantum: default SI units: [Wb] - extern const dimensionedScalar& phi0; + extern const dimensionedScalar phi0; //- Von Klitzing constant: default SI units: [ohm] - extern const dimensionedScalar& RK; - + extern const dimensionedScalar RK; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/global/constants/fundamental/fundamentalConstants.C b/src/OpenFOAM/global/constants/fundamental/fundamentalConstants.C index 56e1b4857b..f041ce0664 100644 --- a/src/OpenFOAM/global/constants/fundamental/fundamentalConstants.C +++ b/src/OpenFOAM/global/constants/fundamental/fundamentalConstants.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -27,13 +27,11 @@ Description \*---------------------------------------------------------------------------*/ #include "fundamentalConstants.H" - #include "universalConstants.H" #include "electromagneticConstants.H" #include "atomicConstants.H" #include "physicoChemicalConstants.H" #include "standardConstants.H" - #include "dimensionedConstants.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -47,42 +45,100 @@ namespace constant // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -defineDimensionedConstant(universal, c, dimensionSet(0, 1, -1, 0, 0)); -defineDimensionedConstant(universal, G, dimensionSet(-1, 3, -2, 0, 0)); -defineDimensionedConstant(universal, h, dimensionSet(1, 2, -1, 0, 0)); +// Note: cannot use dimless etc. as they may not have been constructed yet -// Electromagnetic -defineDimensionedConstant + +const Foam::dimensionedScalar universal::c ( - electromagnetic, - e, - dimensionSet(0, 0, 1, 0, 0, 1, 0) + dimensionedConstant(universal::group, "c", dimensionSet(0, 1, -1, 0, 0)) ); -// Atomic -defineDimensionedConstant(atomic, me, dimensionSet(1, 0, 0, 0, 0)); -defineDimensionedConstant(atomic, mp, dimensionSet(1, 0, 0, 0, 0)); - -// Physico-chemical -defineDimensionedConstant(physicoChemical, mu, dimensionSet(1, 0, 0, 0, 0)); - -// Note: cannot use dimless etc since not guaranteed to be constructed -defineDimensionedConstantWithDefault +const Foam::dimensionedScalar universal::G ( - physicoChemical, - NA, - dimensionedScalar + dimensionedConstant(universal::group, "G", dimensionSet(-1, 3, -2, 0, 0)) +); + +const Foam::dimensionedScalar universal::h +( + dimensionedConstant(universal::group, "h", dimensionSet(1, 2, -1, 0, 0)) +); + + +// Electromagnetic + +const Foam::dimensionedScalar electromagnetic::e +( + dimensionedConstant ( - dimensionSet(0, 0, 0, 0, -1), // dimless/dimMoles, - 6.0221417930e+23 + electromagnetic::group, + "e", + dimensionSet(0, 0, 1, 0, 0, 1, 0) + ) +); + + +// Atomic + +const Foam::dimensionedScalar atomic::me +( + dimensionedConstant(atomic::group, "me", dimensionSet(1, 0, 0, 0, 0)) +); + +const Foam::dimensionedScalar atomic::mp +( + dimensionedConstant(atomic::group, "mp", dimensionSet(1, 0, 0, 0, 0)) +); + + +// Physico-chemical + +const Foam::dimensionedScalar physicoChemical::mu +( + dimensionedConstant + ( + physicoChemical::group, + "mu", + dimensionSet(1, 0, 0, 0, 0) + ) +); + +const Foam::dimensionedScalar physicoChemical::NA +( + dimensionedConstant + ( + physicoChemical::group, + "NA", + dimensionedScalar + ( + dimensionSet(0, 0, 0, 0, -1), // dimless/dimMoles, + 6.0221417930e+23 + ) + ) +); + +const Foam::dimensionedScalar physicoChemical::k +( + dimensionedConstant + ( + physicoChemical::group, + "k", + dimensionSet(1, 2, -2, -1, 0) ) ); -defineDimensionedConstant(physicoChemical, k, dimensionSet(1, 2, -2, -1, 0)); // Standard -defineDimensionedConstant(standard, Pstd, dimensionSet(1, -1, -2, 0, 0)); -defineDimensionedConstant(standard, Tstd, dimensionSet(0, 0, 0, 1, 0)); + +const Foam::dimensionedScalar standard::Pstd +( + dimensionedConstant(standard::group, "Pstd", dimensionSet(1, -1, -2, 0, 0)) +); + +const Foam::dimensionedScalar standard::Tstd +( + dimensionedConstant(standard::group, "Tstd", dimensionSet(0, 0, 0, 1, 0)) +); + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/global/constants/fundamental/fundamentalConstants.H b/src/OpenFOAM/global/constants/fundamental/fundamentalConstants.H index f46d5c0f33..90fe02bf45 100644 --- a/src/OpenFOAM/global/constants/fundamental/fundamentalConstants.H +++ b/src/OpenFOAM/global/constants/fundamental/fundamentalConstants.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -43,49 +43,49 @@ namespace constant namespace universal { //- Speed of light in a vacuum - extern const dimensionedScalar& c; + extern const dimensionedScalar c; //- Newtonian constant of gravitation - extern const dimensionedScalar& G; + extern const dimensionedScalar G; //- Planck constant - extern const dimensionedScalar& h; + extern const dimensionedScalar h; } namespace electromagnetic { //- Elementary charge - extern const dimensionedScalar& e; + extern const dimensionedScalar e; } namespace atomic { //- Electron mass - extern const dimensionedScalar& me; + extern const dimensionedScalar me; //- Proton mass - extern const dimensionedScalar& mp; + extern const dimensionedScalar mp; } namespace physicoChemical { //- Atomic mass unit - extern const dimensionedScalar& mu; + extern const dimensionedScalar mu; //- Avagadro number - extern const dimensionedScalar& NA; + extern const dimensionedScalar NA; //- Boltzmann constant - extern const dimensionedScalar& k; + extern const dimensionedScalar k; } namespace standard { //- Standard pressure - extern const dimensionedScalar& Pstd; + extern const dimensionedScalar Pstd; //- Standard temperature - extern const dimensionedScalar& Tstd; + extern const dimensionedScalar Tstd; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/global/constants/physicoChemical/physicoChemicalConstants.C b/src/OpenFOAM/global/constants/physicoChemical/physicoChemicalConstants.C index 8a4f4cc754..c30b2c6a88 100644 --- a/src/OpenFOAM/global/constants/physicoChemical/physicoChemicalConstants.C +++ b/src/OpenFOAM/global/constants/physicoChemical/physicoChemicalConstants.C @@ -27,7 +27,6 @@ License #include "universalConstants.H" #include "electromagneticConstants.H" #include "physicoChemicalConstants.H" - #include "dimensionedConstants.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -39,11 +38,17 @@ namespace constant const char* const physicoChemical::group = "physicoChemical"; -defineDimensionedConstantWithDefault + +// Note: cannot use dimless etc. as they may not have been constructed yet + +const Foam::dimensionedScalar physicoChemical::R ( - physicoChemical, - R, - dimensionedScalar(physicoChemical::NA*physicoChemical::k) + dimensionedConstant + ( + physicoChemical::group, + "R", + physicoChemical::NA*physicoChemical::k + ) ); @@ -51,80 +56,70 @@ defineDimensionedConstantWithDefault // SI choice of kg rather than g for mass. // This is not appropriate for USCS and will be changed to an entry in // the DimensionedConstants dictionary in etc/controlDict -defineDimensionedConstantWithDefault +const Foam::dimensionedScalar physicoChemical::RR ( - physicoChemical, - RR, - dimensionedScalar(1000*physicoChemical::R) -); - - -defineDimensionedConstantWithDefault -( - physicoChemical, - F, - dimensionedScalar(physicoChemical::NA*electromagnetic::e) -); - - -// Note: cannot use dimless etc. since not guaranteed to be constructed -defineDimensionedConstantWithDefault -( - physicoChemical, - sigma, - dimensionedScalar + dimensionedConstant ( - dimensionedScalar - ( - "C", - dimensionSet(0, 0, 0, 0, 0), - sqr(mathematical::pi)/60.0 - ) - *pow4(physicoChemical::k) - /(pow3(universal::hr)*sqr(universal::c)) + physicoChemical::group, + "RR", + 1000*physicoChemical::R ) ); -defineDimensionedConstantWithDefault +const Foam::dimensionedScalar physicoChemical::F ( - physicoChemical, - b, - dimensionedScalar + dimensionedConstant ( - (universal::h*universal::c/physicoChemical::k) - /dimensionedScalar - ( - "C", - dimensionSet(0, 0, 0, 0, 0), - 4.965114231 - ) + physicoChemical::group, + "F", + physicoChemical::NA*electromagnetic::e ) ); -defineDimensionedConstantWithDefault +const Foam::dimensionedScalar physicoChemical::sigma ( - physicoChemical, - c1, - dimensionedScalar + dimensionedConstant ( - dimensionedScalar - ( - "C", - dimensionSet(0, 0, 0, 0, 0), - mathematical::twoPi - ) - *universal::h*sqr(universal::c) + physicoChemical::group, + "sigma", + (sqr(mathematical::pi)/60.0) + *pow4(physicoChemical::k)/(pow3(universal::hr)*sqr(universal::c)) ) ); -defineDimensionedConstantWithDefault +const Foam::dimensionedScalar physicoChemical::b ( - physicoChemical, - c2, - dimensionedScalar(universal::h*universal::c/physicoChemical::k) + dimensionedConstant + ( + physicoChemical::group, + "b", + (universal::h*universal::c/physicoChemical::k)/4.965114231 + ) +); + + +const Foam::dimensionedScalar physicoChemical::c1 +( + dimensionedConstant + ( + physicoChemical::group, + "c1", + mathematical::twoPi*universal::h*sqr(universal::c) + ) +); + + +const Foam::dimensionedScalar physicoChemical::c2 +( + dimensionedConstant + ( + physicoChemical::group, + "c2", + universal::h*universal::c/physicoChemical::k + ) ); diff --git a/src/OpenFOAM/global/constants/physicoChemical/physicoChemicalConstants.H b/src/OpenFOAM/global/constants/physicoChemical/physicoChemicalConstants.H index 149374ae07..80af589da0 100644 --- a/src/OpenFOAM/global/constants/physicoChemical/physicoChemicalConstants.H +++ b/src/OpenFOAM/global/constants/physicoChemical/physicoChemicalConstants.H @@ -49,25 +49,25 @@ namespace physicoChemical extern const char* const group; //- Universal gas constant: default SI units: [J/mol/K] - extern const dimensionedScalar& R; + extern const dimensionedScalar R; //- Universal gas constant: default SI units: [J/kmol/K] - extern const dimensionedScalar& RR; + extern const dimensionedScalar RR; //- Faraday constant: default SI units: [C/mol] - extern const dimensionedScalar& F; + extern const dimensionedScalar F; //- Stefan-Boltzmann constant: default SI units: [W/m^2/K^4] - extern const dimensionedScalar& sigma; + extern const dimensionedScalar sigma; //- Wien displacement law constant: default SI units: [m K] - extern const dimensionedScalar& b; + extern const dimensionedScalar b; //- First radiation constant: default SI units: [W/m^2] - extern const dimensionedScalar& c1; + extern const dimensionedScalar c1; //- Second radiation constant: default SI units: [m K] - extern const dimensionedScalar& c2; + extern const dimensionedScalar c2; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/global/constants/universal/universalConstants.C b/src/OpenFOAM/global/constants/universal/universalConstants.C index 1b95bdef98..11ef55a0b6 100644 --- a/src/OpenFOAM/global/constants/universal/universalConstants.C +++ b/src/OpenFOAM/global/constants/universal/universalConstants.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,7 +25,6 @@ License #include "universalConstants.H" #include "mathematicalConstants.H" - #include "dimensionedConstants.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -37,22 +36,16 @@ namespace constant const char* const universal::group = "universal"; -// Note: cannot use dimless etc. since not guaranteed to be constructed -defineDimensionedConstantWithDefault + +// Note: cannot use dimless etc. as they may not have been constructed yet + +const Foam::dimensionedScalar universal::hr ( - universal, - hr, - dimensionedScalar + dimensionedConstant ( - universal::h - /( - dimensionedScalar - ( - "C", - dimensionSet(0, 0, 0, 0, 0), - mathematical::twoPi - ) - ) + universal::group, + "hr", + universal::h/mathematical::twoPi ) ); diff --git a/src/OpenFOAM/global/constants/universal/universalConstants.H b/src/OpenFOAM/global/constants/universal/universalConstants.H index 10eb410217..d4791e79d7 100644 --- a/src/OpenFOAM/global/constants/universal/universalConstants.H +++ b/src/OpenFOAM/global/constants/universal/universalConstants.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -49,7 +49,7 @@ namespace universal extern const char* const group; //- Reduced Planck constant: default SI units: [J/s] - extern const dimensionedScalar& hr; + extern const dimensionedScalar hr; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/global/debug/debug.C b/src/OpenFOAM/global/debug/debug.C index 5d7825756d..9c62ffc158 100644 --- a/src/OpenFOAM/global/debug/debug.C +++ b/src/OpenFOAM/global/debug/debug.C @@ -32,7 +32,6 @@ Description #include "etcFiles.H" #include "Ostream.H" #include "demandDrivenData.H" -#include "simpleObjectRegistry.H" #include "IOobject.H" #include "HashSet.H" @@ -86,12 +85,6 @@ dictionary& optimisationDefaultSwitches() return *optimisationDefaultSwitchesPtr_; } -// Debug switch read and write callback tables. -simpleObjectRegistry* debugObjectsPtr_(nullptr); -simpleObjectRegistry* infoObjectsPtr_(nullptr); -simpleObjectRegistry* optimisationObjectsPtr_(nullptr); -simpleObjectRegistry* dimensionSetObjectsPtr_(nullptr); -simpleObjectRegistry* dimensionedConstantObjectsPtr_(nullptr); // To ensure controlDictPtr_ is deleted at the end of the run class deleteControlDictPtr @@ -103,12 +96,6 @@ public: ~deleteControlDictPtr() { - deleteDemandDrivenData(debugObjectsPtr_); - deleteDemandDrivenData(infoObjectsPtr_); - deleteDemandDrivenData(optimisationObjectsPtr_); - deleteDemandDrivenData(dimensionSetObjectsPtr_); - deleteDemandDrivenData(dimensionedConstantObjectsPtr_); - deleteDemandDrivenData(debugDefaultSwitchesPtr_); deleteDemandDrivenData(infoDefaultSwitchesPtr_); deleteDemandDrivenData(optimisationDefaultSwitchesPtr_); @@ -160,6 +147,13 @@ Foam::dictionary& Foam::debug::controlDict() controlDictPtr_->merge(dictionary(ifs)); } } + + IFstream ifs("system/controlDict"); + if (ifs.good()) + { + entry::disableFunctionEntries = true; + controlDictPtr_->merge(dictionary(ifs)); + } } return *controlDictPtr_; @@ -330,180 +324,7 @@ const Foam::word Foam::debug::wordOptimisationSwitch } -void Foam::debug::addDebugObject(const char* name, simpleRegIOobject* obj) -{ - simpleObjectRegistryEntry* ptr = debugObjects().lookupPtr(name); - if (ptr) - { - ptr->append(obj); - } - else - { - debugObjects().append - ( - name, - new simpleObjectRegistryEntry - ( - List(1, obj) - ) - ); - } -} - - -void Foam::debug::addInfoObject(const char* name, simpleRegIOobject* obj) -{ - simpleObjectRegistryEntry* ptr = infoObjects().lookupPtr(name); - if (ptr) - { - ptr->append(obj); - } - else - { - infoObjects().append - ( - name, - new simpleObjectRegistryEntry - ( - List(1, obj) - ) - ); - } -} - - -void Foam::debug::addOptimisationObject -( - const char* name, - simpleRegIOobject* obj -) -{ - simpleObjectRegistryEntry* ptr = optimisationObjects().lookupPtr(name); - if (ptr) - { - ptr->append(obj); - } - else - { - optimisationObjects().append - ( - name, - new simpleObjectRegistryEntry - ( - List(1, obj) - ) - ); - } -} - - -void Foam::debug::addDimensionSetObject -( - const char* name, - simpleRegIOobject* obj -) -{ - simpleObjectRegistryEntry* ptr = dimensionSetObjects().lookupPtr(name); - if (ptr) - { - ptr->append(obj); - } - else - { - dimensionSetObjects().append - ( - name, - new simpleObjectRegistryEntry - ( - List(1, obj) - ) - ); - } -} - - -void Foam::debug::addDimensionedConstantObject -( - const char* name, - simpleRegIOobject* obj -) -{ - simpleObjectRegistryEntry* ptr = dimensionedConstantObjects().lookupPtr - ( - name - ); - if (ptr) - { - ptr->append(obj); - } - else - { - dimensionedConstantObjects().append - ( - name, - new simpleObjectRegistryEntry - ( - List(1, obj) - ) - ); - } -} - - -Foam::simpleObjectRegistry& Foam::debug::debugObjects() -{ - if (!debugObjectsPtr_) - { - debugObjectsPtr_ = new simpleObjectRegistry(1000); - } - - return *debugObjectsPtr_; -} - - -Foam::simpleObjectRegistry& Foam::debug::infoObjects() -{ - if (!infoObjectsPtr_) - { - infoObjectsPtr_ = new simpleObjectRegistry(100); - } - - return *infoObjectsPtr_; -} - - -Foam::simpleObjectRegistry& Foam::debug::optimisationObjects() -{ - if (!optimisationObjectsPtr_) - { - optimisationObjectsPtr_ = new simpleObjectRegistry(100); - } - - return *optimisationObjectsPtr_; -} - - -Foam::simpleObjectRegistry& Foam::debug::dimensionSetObjects() -{ - if (!dimensionSetObjectsPtr_) - { - dimensionSetObjectsPtr_ = new simpleObjectRegistry(100); - } - - return *dimensionSetObjectsPtr_; -} - - -Foam::simpleObjectRegistry& Foam::debug::dimensionedConstantObjects() -{ - if (!dimensionedConstantObjectsPtr_) - { - dimensionedConstantObjectsPtr_ = new simpleObjectRegistry(100); - } - - return *dimensionedConstantObjectsPtr_; -} - +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { @@ -565,18 +386,16 @@ void listSwitches } } + void listSwitches ( const word& name, const dictionary& switches, - const dictionary& defaultSwitches, - const simpleObjectRegistry& registry + const dictionary& defaultSwitches ) { - wordHashSet registeredDefaultSet; - wordHashSet registeredNonDefaultSet; - wordHashSet nonRegisteredDefaultSet; - wordHashSet nonRegisteredNonDefaultSet; + wordHashSet defaultSet; + wordHashSet nonDefaultSet; wordHashSet noDefaultSet; forAllConstIter(dictionary, switches, iter) @@ -585,35 +404,19 @@ void listSwitches const bool hasDefault = defaultSwitches.found(name); - const bool isRegistered = registry.found(name); - const bool isDefault = hasDefault && defaultSwitches.lookupEntry(name, false, false) == iter(); if (hasDefault) { - if (isRegistered) + if (isDefault) { - if (isDefault) - { - registeredDefaultSet.insert(name); - } - else - { - registeredNonDefaultSet.insert(name); - } + defaultSet.insert(name); } else { - if (isDefault) - { - nonRegisteredDefaultSet.insert(name); - } - else - { - nonRegisteredNonDefaultSet.insert(name); - } + nonDefaultSet.insert(name); } } else @@ -637,26 +440,14 @@ void listSwitches print ( - "Registered switches with default values", - registeredDefaultSet.sortedToc() + "Switches with default values", + defaultSet.sortedToc() ); Info<< nl; print ( - "Registered switches with non default values", - registeredNonDefaultSet.sortedToc() - ); - Info<< nl; - print - ( - "Non-registered switches with default values", - nonRegisteredDefaultSet.sortedToc() - ); - Info<< nl; - print - ( - "Non-registered switches with non-default values", - nonRegisteredNonDefaultSet.sortedToc() + "Switches with non-default values", + nonDefaultSet.sortedToc() ); Info<< nl; print @@ -668,17 +459,18 @@ void listSwitches Info<< decrIndent << token::END_BLOCK << endl; } -} +} // End namespace Foam +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + void Foam::debug::listSwitches() { listSwitches ( "DebugSwitches", debug::debugSwitches(), - debug::debugDefaultSwitches(), - debug::debugObjects() + debug::debugDefaultSwitches() ); Info<< endl; @@ -686,8 +478,7 @@ void Foam::debug::listSwitches() ( "InfoSwitches", debug::infoSwitches(), - debug::infoDefaultSwitches(), - debug::infoObjects() + debug::infoDefaultSwitches() ); Info<< endl; @@ -695,60 +486,9 @@ void Foam::debug::listSwitches() ( "OptimisationSwitches", debug::optimisationSwitches(), - debug::optimisationDefaultSwitches(), - debug::optimisationObjects() + debug::optimisationDefaultSwitches() ); } -void Foam::debug::readSwitches -( - const word& name, - simpleObjectRegistry& objects, - const dictionary& dict -) -{ - if (dict.found(name + "Switches")) - { - InfoHeader - << "Overriding " << name << "Switches according to " - << dict.name() - << endl; - - const dictionary& localSettings = dict.subDict(name + "Switches"); - forAllConstIter(dictionary, localSettings, iter) - { - const word& name = iter().keyword(); - simpleObjectRegistryEntry* objPtr = objects.lookupPtr(name); - - if (objPtr) - { - InfoHeader << " " << iter() << endl; - - const List& objects = *objPtr; - - if (iter().isDict()) - { - OStringStream os(IOstream::ASCII); - os << iter().dict(); - IStringStream is(os.str()); - - forAll(objects, i) - { - objects[i]->readData(is.rewind()); - } - } - else - { - forAll(objects, i) - { - objects[i]->readData(iter().stream()); - } - } - } - } - } -} - - // ************************************************************************* // diff --git a/src/OpenFOAM/global/debug/debug.H b/src/OpenFOAM/global/debug/debug.H index 5f4f29c7d2..56e0889db5 100644 --- a/src/OpenFOAM/global/debug/debug.H +++ b/src/OpenFOAM/global/debug/debug.H @@ -44,8 +44,6 @@ namespace Foam class dictionary; class Istream; class Ostream; -class simpleRegIOobject; -class simpleObjectRegistry; class word; template class NamedEnum; @@ -115,49 +113,6 @@ namespace debug //- List debug switches void listSwitches(); - //- Read and update the switches specified in dict - void readSwitches - ( - const word& name, - simpleObjectRegistry& objects, - const dictionary& dict - ); - - - // Registered debug switches - - //- Register debug switch read/write object - void addDebugObject(const char* name, simpleRegIOobject* obj); - - //- Register info switch read/write object - void addInfoObject(const char* name, simpleRegIOobject* obj); - - //- Register optimisation switch read/write object - void addOptimisationObject(const char* name, simpleRegIOobject* obj); - - //- Register DimensionSets read/write object - void addDimensionSetObject(const char* name, simpleRegIOobject* obj); - - //- Register DimensionedConstant read/write object - void addDimensionedConstantObject(const char* name, simpleRegIOobject*); - - - //- Get access to registered debug switch objects - simpleObjectRegistry& debugObjects(); - - //- Get access to registered info switch objects - simpleObjectRegistry& infoObjects(); - - //- Get access to registered optimisation switch objects - simpleObjectRegistry& optimisationObjects(); - - //- Get access to registered dimensionSets switch objects - simpleObjectRegistry& dimensionSetObjects(); - - //- Get access to registered dimensionedConstant switch objects - simpleObjectRegistry& dimensionedConstantObjects(); - - } // End namespace debug // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/global/debug/defineDebugSwitch.H b/src/OpenFOAM/global/debug/defineDebugSwitch.H index bbcc2ad43b..2ff990dd86 100644 --- a/src/OpenFOAM/global/debug/defineDebugSwitch.H +++ b/src/OpenFOAM/global/debug/defineDebugSwitch.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2012-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -29,100 +29,28 @@ Description #ifndef defineDebugSwitch_H #define defineDebugSwitch_H -#include "simpleRegIOobject.H" #include "debug.H" #include "label.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -namespace Foam -{ - -//- Define the debug information, lookup as \a Name -template -class RegisterDebugSwitch -: - public ::Foam::simpleRegIOobject -{ -public: - - //- The unique RegisterDebugSwitch object - static const RegisterDebugSwitch registerDebugSwitch; - - RegisterDebugSwitch(const char* name) - : - ::Foam::simpleRegIOobject(Foam::debug::addDebugObject, name) - {} - - virtual ~RegisterDebugSwitch() - {} - - virtual void readData(Foam::Istream& is) - { - Type::debug = readLabel(is); - } - - virtual void writeData(Foam::Ostream& os) const - { - os << Type::debug; - } -}; - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#define registerTemplateDebugSwitchWithName(Type,Name) \ - template<> \ - const Foam::RegisterDebugSwitch \ - Foam::RegisterDebugSwitch::registerDebugSwitch(Name) - - -//- Define the debug information, lookup as \a Name -#define registerDebugSwitchWithName(Type,Tag,Name) \ - class add##Tag##ToDebug \ - : \ - public ::Foam::simpleRegIOobject \ - { \ - public: \ - add##Tag##ToDebug(const char* name) \ - : \ - ::Foam::simpleRegIOobject(Foam::debug::addDebugObject, name) \ - {} \ - virtual ~add##Tag##ToDebug() \ - {} \ - virtual void readData(Foam::Istream& is) \ - { \ - Type::debug = readLabel(is); \ - } \ - virtual void writeData(Foam::Ostream& os) const \ - { \ - os << Type::debug; \ - } \ - }; \ - add##Tag##ToDebug add##Tag##ToDebug_(Name) - - //- Define the debug information, lookup as \a Name #define defineDebugSwitchWithName(Type, Name, DebugSwitch) \ int Type::debug(::Foam::debug::debugSwitch(Name, DebugSwitch)) //- Define the debug information #define defineDebugSwitch(Type, DebugSwitch) \ - defineDebugSwitchWithName(Type, Type::typeName_(), DebugSwitch); \ - registerDebugSwitchWithName(Type, Type, Type::typeName_()) + defineDebugSwitchWithName(Type, Type::typeName_(), DebugSwitch); //- Define the debug information for templates, lookup as \a Name #define defineTemplateDebugSwitchWithName(Type, Name, DebugSwitch) \ template<> \ - defineDebugSwitchWithName(Type, Name, DebugSwitch); \ - registerTemplateDebugSwitchWithName(Type, Name) + defineDebugSwitchWithName(Type, Name, DebugSwitch); //- Define the debug information for templates sub-classes, lookup as \a Name #define defineTemplate2DebugSwitchWithName(Type, Name, DebugSwitch) \ template<> \ - defineDebugSwitchWithName(Type, Name, DebugSwitch); \ - registerTemplateDebugSwitchWithName(Type, Name) + defineDebugSwitchWithName(Type, Name, DebugSwitch); //- Define the debug information for templates // Useful with typedefs @@ -133,7 +61,6 @@ public: #define defineNamedTemplateDebugSwitch(Type, DebugSwitch) \ defineTemplateDebugSwitchWithName(Type, Type::typeName_(), DebugSwitch) - //- Define the debug information for templates // Useful with typedefs #define defineTemplate2DebugSwitch(Type, DebugSwitch) \ diff --git a/src/OpenFOAM/global/debug/registerNamedEnum.H b/src/OpenFOAM/global/debug/registerNamedEnum.H deleted file mode 100644 index cd0ab7b8bf..0000000000 --- a/src/OpenFOAM/global/debug/registerNamedEnum.H +++ /dev/null @@ -1,112 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2019-2020 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 . - -Class - Foam::RegisterNamedEnum - -Description - Class and registration macros for info and optimisation named enumerations - to support reading from system/controlDict and dynamic update. - -\*---------------------------------------------------------------------------*/ - -#ifndef registerNamedEnum_H -#define registerNamedEnum_H - -#include "simpleRegIOobject.H" -#include "macros.H" -#include "NamedEnum.H" -#include - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -/*---------------------------------------------------------------------------*\ - Class RegisterNamedEnum Declaration -\*---------------------------------------------------------------------------*/ - -template -class RegisterNamedEnum; - -template -class RegisterNamedEnum> -: - public simpleRegIOobject -{ - const NamedEnum& enumNames_; - - Enum& enumRef_; - -public: - - RegisterNamedEnum - ( - void (*registryFn)(const char* name, simpleRegIOobject*), - const word& name, - const NamedEnum& enumNames, - Enum& enumRef - ) - : - ::Foam::simpleRegIOobject(registryFn, name.c_str()), - enumNames_(enumNames), - enumRef_(enumRef) - {} - - virtual ~RegisterNamedEnum() - {} - - virtual void readData(Istream& is) - { - enumRef_ = enumNames_.read(is); - } - - virtual void writeData(Ostream& os) const - { - os << enumNames_[enumRef_]; - } -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#define registerOptNamedEnum(Name, EnumNames, EnumRef) \ - static Foam::RegisterNamedEnum::type> \ - FILE_UNIQUE(_addToOpt_) \ - (Foam::debug::addOptimisationObject, Name, EnumNames, EnumRef) - -#define registerInfoNamedEnum(Name, EnumNames, EnumRef) \ - static Foam::RegisterNamedEnum::type> \ - FILE_UNIQUE(_addToOpt_) \ - (Foam::debug::addInfoObject, Name, EnumNames, EnumRef) - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/OpenFOAM/global/debug/registerSwitch.H b/src/OpenFOAM/global/debug/registerSwitch.H deleted file mode 100644 index 9daa92dfce..0000000000 --- a/src/OpenFOAM/global/debug/registerSwitch.H +++ /dev/null @@ -1,103 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2015-2020 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 . - -Class - Foam::RegisterSwitch - -Description - Class and registration macros for InfoSwitches and OptimisationSwitches - to support reading from system/controlDict and dynamic update. - -\*---------------------------------------------------------------------------*/ - -#ifndef registerSwitch_H -#define registerSwitch_H - -#include "simpleRegIOobject.H" -#include "macros.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -/*---------------------------------------------------------------------------*\ - Class RegisterSwitch Declaration -\*---------------------------------------------------------------------------*/ - -template -class RegisterSwitch -: - public simpleRegIOobject -{ - Type& optSwitch_; - -public: - - RegisterSwitch - ( - void (*registryFn)(const char* name, simpleRegIOobject*), - const char* name, - Type& optSwitch - ) - : - simpleRegIOobject(registryFn, name), - optSwitch_(optSwitch) - {} - - virtual ~RegisterSwitch() - {} - - virtual void readData(Foam::Istream& is) - { - is >> optSwitch_; - } - - virtual void writeData(Foam::Ostream& os) const - { - os << optSwitch_; - } -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#define registerOptSwitch(Name, Type, Switch) \ - static Foam::RegisterSwitch FILE_UNIQUE(_addToOpt_) \ - (Foam::debug::addOptimisationObject, Name, Switch) - - -#define registerInfoSwitch(Name, Type, Switch) \ - static Foam::RegisterSwitch FILE_UNIQUE(_addToOpt_) \ - (Foam::debug::addInfoObject, Name, Switch) - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/OpenFOAM/global/debug/simpleObjectRegistry.H b/src/OpenFOAM/global/debug/simpleObjectRegistry.H deleted file mode 100644 index 658e54bbda..0000000000 --- a/src/OpenFOAM/global/debug/simpleObjectRegistry.H +++ /dev/null @@ -1,91 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2012-2020 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 . - -Class - Foam::simpleObjectRegistry - -Description - Object registry for simpleRegIOobject. Maintains ordering. - -SourceFiles - -\*---------------------------------------------------------------------------*/ - -#ifndef simpleObjectRegistry_H -#define simpleObjectRegistry_H - -#include "Dictionary.H" -#include "simpleRegIOobject.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -/*---------------------------------------------------------------------------*\ - Class simpleObjectRegistryEntry Declaration -\*---------------------------------------------------------------------------*/ - -class simpleObjectRegistryEntry -: - public Dictionary::link, - public List -{ -public: - - simpleObjectRegistryEntry(const List& data) - : - List(data) - {} -}; - - -/*---------------------------------------------------------------------------*\ - Class simpleObjectRegistry Declaration -\*---------------------------------------------------------------------------*/ - -class simpleObjectRegistry -: - public Dictionary -{ -public: - - // Constructors - - //- Construct given initial table size - simpleObjectRegistry(const label nIoObjects = 128) - : - Dictionary(nIoObjects) - {} -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/OpenFOAM/global/debug/simpleRegIOobject.H b/src/OpenFOAM/global/debug/simpleRegIOobject.H deleted file mode 100644 index 453bf86a5f..0000000000 --- a/src/OpenFOAM/global/debug/simpleRegIOobject.H +++ /dev/null @@ -1,92 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2012-2020 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 . - -Class - Foam::simpleRegIOobject - -Description - Abstract base class for registered object with I/O. Used in debug symbol - registration. - -SourceFiles - -\*---------------------------------------------------------------------------*/ - -#ifndef simpleRegIOobject_H -#define simpleRegIOobject_H - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// Forward declaration of classes -class Istream; -class Ostream; - -/*---------------------------------------------------------------------------*\ - Class simpleRegIOobject Declaration -\*---------------------------------------------------------------------------*/ - -class simpleRegIOobject -{ -public: - - // Constructors - - //- Construct from objectregistry inserter and name - simpleRegIOobject - ( - void (*fn)(const char* name, simpleRegIOobject*), - const char* name - ) - { - (*fn)(name, this); - } - - - //- Destructor - virtual ~simpleRegIOobject() - {}; - - - // Member Functions - - //- Read - virtual void readData(Istream&) = 0; - - //- Write - virtual void writeData(Ostream&) const = 0; - -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/OpenFOAM/global/fileOperations/collatedFileOperation/collatedFileOperation.C b/src/OpenFOAM/global/fileOperations/collatedFileOperation/collatedFileOperation.C index 273ccebc0b..a93bf6b478 100644 --- a/src/OpenFOAM/global/fileOperations/collatedFileOperation/collatedFileOperation.C +++ b/src/OpenFOAM/global/fileOperations/collatedFileOperation/collatedFileOperation.C @@ -27,7 +27,6 @@ License #include "Time.H" #include "threadedCollatedOFstream.H" #include "decomposedBlockData.H" -#include "registerSwitch.H" #include "masterOFstream.H" #include "OFstream.H" #include "addToRunTimeSelectionTable.H" @@ -50,12 +49,6 @@ namespace fileOperations ( debug::floatOptimisationSwitch("maxThreadFileBufferSize", 1e9) ); - registerOptSwitch - ( - "maxThreadFileBufferSize", - float, - collatedFileOperation::maxThreadFileBufferSize - ); // Mark as needing threaded mpi addNamedToRunTimeSelectionTable diff --git a/src/OpenFOAM/global/fileOperations/masterUncollatedFileOperation/masterUncollatedFileOperation.C b/src/OpenFOAM/global/fileOperations/masterUncollatedFileOperation/masterUncollatedFileOperation.C index d31c3f168f..0c95f91c13 100644 --- a/src/OpenFOAM/global/fileOperations/masterUncollatedFileOperation/masterUncollatedFileOperation.C +++ b/src/OpenFOAM/global/fileOperations/masterUncollatedFileOperation/masterUncollatedFileOperation.C @@ -27,7 +27,6 @@ License #include "Time.H" #include "masterOFstream.H" #include "decomposedBlockData.H" -#include "registerSwitch.H" #include "dummyISstream.H" #include "SubList.H" #include "PackedBoolList.H" @@ -52,12 +51,6 @@ namespace fileOperations ( Foam::debug::floatOptimisationSwitch("maxMasterFileBufferSize", 1e9) ); - registerOptSwitch - ( - "maxMasterFileBufferSize", - float, - masterUncollatedFileOperation::maxMasterFileBufferSize - ); // Mark as not needing threaded mpi addNamedToRunTimeSelectionTable diff --git a/src/OpenFOAM/global/global.Cver b/src/OpenFOAM/global/global.Cver index dfe3ca42ef..eb8025fea1 100644 --- a/src/OpenFOAM/global/global.Cver +++ b/src/OpenFOAM/global/global.Cver @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -74,20 +74,12 @@ bool Foam::jobInfo::constructed(false); // Read file modification checking switches #include "regIOobject.H" -#include "registerSwitch.H" float Foam::regIOobject::fileModificationSkew ( Foam::debug::floatOptimisationSwitch("fileModificationSkew", 30) ); -registerOptSwitch -( - "fileModificationSkew", - float, - Foam::regIOobject::fileModificationSkew -); - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // Read parallel communication switches diff --git a/src/OpenFOAM/global/jobInfo/jobInfo.C b/src/OpenFOAM/global/jobInfo/jobInfo.C index 18e3b59ce3..4a0c93e705 100644 --- a/src/OpenFOAM/global/jobInfo/jobInfo.C +++ b/src/OpenFOAM/global/jobInfo/jobInfo.C @@ -36,25 +36,11 @@ bool Foam::jobInfo::writeJobControl Foam::debug::infoSwitch("writeJobControl", 0) ); -registerInfoSwitch -( - "writeJobControl", - bool, - Foam::jobInfo::writeJobControl -); - bool Foam::jobInfo::writeJobInfo ( Foam::debug::infoSwitch("writeJobInfo", 0) ); -registerInfoSwitch -( - "writeJobInfo", - bool, - Foam::jobInfo::writeJobInfo -); - Foam::jobInfo Foam::jobInfo_;