ENH: support optional fallback content for IOdictionary
This commit is contained in:
parent
385f92732b
commit
b62437081e
@ -48,7 +48,6 @@ Note
|
||||
#include "polyMesh.H"
|
||||
#include "distributedTriSurfaceMesh.H"
|
||||
#include "mapDistribute.H"
|
||||
#include "localIOdictionary.H"
|
||||
#include "decompositionModel.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
@ -307,10 +307,9 @@ $(functionEntries)/ifEntry/ifEntry.C
|
||||
|
||||
IOdictionary = db/IOobjects/IOdictionary
|
||||
$(IOdictionary)/baseIOdictionary.C
|
||||
$(IOdictionary)/baseIOdictionaryIO.C
|
||||
$(IOdictionary)/IOdictionary.C
|
||||
$(IOdictionary)/localIOdictionary.C
|
||||
$(IOdictionary)/unwatchedIOdictionary.C
|
||||
$(IOdictionary)/IOdictionary.C
|
||||
|
||||
db/IOobjects/IOMap/IOMapName.C
|
||||
db/IOobjects/decomposedBlockData/decomposedBlockData.C
|
||||
|
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -32,15 +33,14 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::IOdictionary::IOdictionary(const IOobject& io)
|
||||
Foam::IOdictionary::IOdictionary
|
||||
(
|
||||
const IOobject& io,
|
||||
const dictionary* fallback
|
||||
)
|
||||
:
|
||||
baseIOdictionary(io)
|
||||
{
|
||||
readHeaderOk(IOstream::ASCII, typeName);
|
||||
|
||||
// For if MUST_READ_IF_MODIFIED
|
||||
addWatch();
|
||||
}
|
||||
IOdictionary(io, typeName, fallback)
|
||||
{}
|
||||
|
||||
|
||||
Foam::IOdictionary::IOdictionary
|
||||
@ -49,11 +49,22 @@ Foam::IOdictionary::IOdictionary
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
baseIOdictionary(io, dict)
|
||||
IOdictionary(io, typeName, &dict)
|
||||
{}
|
||||
|
||||
|
||||
Foam::IOdictionary::IOdictionary
|
||||
(
|
||||
const IOobject& io,
|
||||
const word& wantedType,
|
||||
const dictionary* fallback
|
||||
)
|
||||
:
|
||||
baseIOdictionary(io, fallback)
|
||||
{
|
||||
if (!readHeaderOk(IOstream::ASCII, typeName))
|
||||
if (!readHeaderOk(IOstream::ASCII, wantedType) && fallback)
|
||||
{
|
||||
dictionary::operator=(dict);
|
||||
dictionary::operator=(*fallback);
|
||||
}
|
||||
|
||||
// For if MUST_READ_IF_MODIFIED
|
||||
@ -69,8 +80,7 @@ Foam::IOdictionary::IOdictionary
|
||||
:
|
||||
baseIOdictionary(io, is)
|
||||
{
|
||||
// Note that we do construct the dictionary null and read in
|
||||
// afterwards
|
||||
// Default construct dictionary and read in afterwards
|
||||
// so that if there is some fancy massaging due to a
|
||||
// functionEntry in
|
||||
// the dictionary at least the type information is already complete.
|
||||
@ -81,10 +91,4 @@ Foam::IOdictionary::IOdictionary
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::IOdictionary::~IOdictionary()
|
||||
{}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -34,7 +35,6 @@ Description
|
||||
|
||||
SourceFiles
|
||||
IOdictionary.C
|
||||
IOdictionaryIO.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -56,26 +56,42 @@ class IOdictionary
|
||||
:
|
||||
public baseIOdictionary
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct given an IOobject
|
||||
IOdictionary(const IOobject&);
|
||||
//- and optional fallback dictionary content
|
||||
// A null dictionary pointer is treated like an empty dictionary.
|
||||
explicit IOdictionary
|
||||
(
|
||||
const IOobject& io,
|
||||
const dictionary* fallback = nullptr
|
||||
);
|
||||
|
||||
//- Construct given an IOobject and dictionary
|
||||
IOdictionary(const IOobject&, const dictionary&);
|
||||
//- Construct given an IOobject
|
||||
//- and fallback dictionary content
|
||||
IOdictionary(const IOobject& io, const dictionary& dict);
|
||||
|
||||
//- Construct given an IOobject, wanted typeName
|
||||
//- and optional fallback dictionary content
|
||||
// A null dictionary pointer is treated like an empty dictionary.
|
||||
IOdictionary
|
||||
(
|
||||
const IOobject& io,
|
||||
const word& wantedType,
|
||||
const dictionary* fallback = nullptr
|
||||
);
|
||||
|
||||
//- Construct given an IOobject and Istream
|
||||
IOdictionary(const IOobject&, Istream&);
|
||||
IOdictionary(const IOobject& io, Istream& is);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~IOdictionary();
|
||||
virtual ~IOdictionary() = default;
|
||||
|
||||
|
||||
// Member functions
|
||||
// Member Functions
|
||||
|
||||
//- Is object global
|
||||
virtual bool global() const
|
||||
@ -92,6 +108,8 @@ public:
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
//- Template function for obtaining global status
|
||||
template<>
|
||||
inline bool typeGlobal<IOdictionary>()
|
||||
|
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||
Copyright (C) 2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -45,7 +46,11 @@ namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::baseIOdictionary::baseIOdictionary(const IOobject& io)
|
||||
Foam::baseIOdictionary::baseIOdictionary
|
||||
(
|
||||
const IOobject& io,
|
||||
const dictionary* fallback
|
||||
)
|
||||
:
|
||||
regIOobject(io)
|
||||
{
|
||||
@ -59,10 +64,8 @@ Foam::baseIOdictionary::baseIOdictionary
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
regIOobject(io)
|
||||
{
|
||||
dictionary::name() = IOobject::objectPath();
|
||||
}
|
||||
baseIOdictionary(io, &dict)
|
||||
{}
|
||||
|
||||
|
||||
Foam::baseIOdictionary::baseIOdictionary
|
||||
@ -85,6 +88,31 @@ const Foam::word& Foam::baseIOdictionary::name() const
|
||||
}
|
||||
|
||||
|
||||
bool Foam::baseIOdictionary::readData(Istream& is)
|
||||
{
|
||||
is >> *this;
|
||||
|
||||
if (writeDictionaries && Pstream::master() && !is.bad())
|
||||
{
|
||||
Sout<< nl
|
||||
<< "--- baseIOdictionary " << name()
|
||||
<< ' ' << objectPath() << ":" << nl;
|
||||
writeHeader(Sout);
|
||||
writeData(Sout);
|
||||
Sout<< "--- End of baseIOdictionary " << name() << nl << endl;
|
||||
}
|
||||
|
||||
return !is.bad();
|
||||
}
|
||||
|
||||
|
||||
bool Foam::baseIOdictionary::writeData(Ostream& os) const
|
||||
{
|
||||
dictionary::write(os, false);
|
||||
return os.good();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::baseIOdictionary::operator=(const baseIOdictionary& rhs)
|
||||
|
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -36,7 +36,6 @@ Description
|
||||
|
||||
SourceFiles
|
||||
baseIOdictionary.C
|
||||
baseIOdictionaryIO.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -64,6 +63,7 @@ class baseIOdictionary
|
||||
|
||||
static bool writeDictionaries;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Declare type-name, virtual type (with debug switch)
|
||||
@ -85,13 +85,20 @@ public:
|
||||
// Constructors
|
||||
|
||||
//- Construct given an IOobject
|
||||
baseIOdictionary(const IOobject&);
|
||||
//- and optional fallback dictionary content (ununsed)
|
||||
// A null dictionary pointer is treated like an empty dictionary.
|
||||
explicit baseIOdictionary
|
||||
(
|
||||
const IOobject& io,
|
||||
const dictionary* fallback = nullptr
|
||||
);
|
||||
|
||||
//- Construct given an IOobject and dictionary
|
||||
baseIOdictionary(const IOobject&, const dictionary&);
|
||||
//- Construct given an IOobject and fallback dictionary
|
||||
//- content (ununsed)
|
||||
baseIOdictionary(const IOobject& io, const dictionary& dict);
|
||||
|
||||
//- Construct given an IOobject and Istream
|
||||
baseIOdictionary(const IOobject&, Istream&);
|
||||
//- Construct given an IOobject and Istream (ununsed)
|
||||
baseIOdictionary(const IOobject& io, Istream& is);
|
||||
|
||||
|
||||
// Member Functions
|
||||
@ -117,7 +124,7 @@ public:
|
||||
// Member Operators
|
||||
|
||||
//- Copy assignment of dictionary entries (leave regIOobject untouched)
|
||||
void operator=(const baseIOdictionary&);
|
||||
void operator=(const baseIOdictionary& rhs);
|
||||
|
||||
//- Copy assignment of dictionary entries
|
||||
using dictionary::operator=;
|
||||
|
@ -1,58 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||
-------------------------------------------------------------------------------
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "baseIOdictionary.H"
|
||||
#include "Pstream.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * Members Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::baseIOdictionary::readData(Istream& is)
|
||||
{
|
||||
is >> *this;
|
||||
|
||||
if (writeDictionaries && Pstream::master() && !is.bad())
|
||||
{
|
||||
Sout<< nl
|
||||
<< "--- baseIOdictionary " << name()
|
||||
<< ' ' << objectPath() << ":" << nl;
|
||||
writeHeader(Sout);
|
||||
writeData(Sout);
|
||||
Sout<< "--- End of baseIOdictionary " << name() << nl << endl;
|
||||
}
|
||||
|
||||
return !is.bad();
|
||||
}
|
||||
|
||||
|
||||
bool Foam::baseIOdictionary::writeData(Ostream& os) const
|
||||
{
|
||||
dictionary::write(os, false);
|
||||
return os.good();
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2015-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -29,30 +30,14 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::localIOdictionary::localIOdictionary(const IOobject& io)
|
||||
:
|
||||
baseIOdictionary(io)
|
||||
{
|
||||
readHeaderOk(IOstream::ASCII, typeName);
|
||||
|
||||
// For if MUST_READ_IF_MODIFIED
|
||||
addWatch();
|
||||
}
|
||||
|
||||
|
||||
Foam::localIOdictionary::localIOdictionary
|
||||
(
|
||||
const IOobject& io,
|
||||
const word& wantedType
|
||||
const dictionary* fallback
|
||||
)
|
||||
:
|
||||
baseIOdictionary(io)
|
||||
{
|
||||
readHeaderOk(IOstream::ASCII, wantedType);
|
||||
|
||||
// For if MUST_READ_IF_MODIFIED
|
||||
addWatch();
|
||||
}
|
||||
localIOdictionary(io, typeName, fallback)
|
||||
{}
|
||||
|
||||
|
||||
Foam::localIOdictionary::localIOdictionary
|
||||
@ -61,11 +46,22 @@ Foam::localIOdictionary::localIOdictionary
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
baseIOdictionary(io, dict)
|
||||
localIOdictionary(io, typeName, &dict)
|
||||
{}
|
||||
|
||||
|
||||
Foam::localIOdictionary::localIOdictionary
|
||||
(
|
||||
const IOobject& io,
|
||||
const word& wantedType,
|
||||
const dictionary* fallback
|
||||
)
|
||||
:
|
||||
baseIOdictionary(io, fallback)
|
||||
{
|
||||
if (!readHeaderOk(IOstream::ASCII, typeName))
|
||||
if (!readHeaderOk(IOstream::ASCII, wantedType) && fallback)
|
||||
{
|
||||
dictionary::operator=(dict);
|
||||
dictionary::operator=(*fallback);
|
||||
}
|
||||
|
||||
// For if MUST_READ_IF_MODIFIED
|
||||
@ -81,8 +77,7 @@ Foam::localIOdictionary::localIOdictionary
|
||||
:
|
||||
baseIOdictionary(io, is)
|
||||
{
|
||||
// Note that we do construct the dictionary null and read in
|
||||
// afterwards
|
||||
// Default construct dictionary and read in afterwards
|
||||
// so that if there is some fancy massaging due to a
|
||||
// functionEntry in
|
||||
// the dictionary at least the type information is already complete.
|
||||
@ -93,10 +88,4 @@ Foam::localIOdictionary::localIOdictionary
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::localIOdictionary::~localIOdictionary()
|
||||
{}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2015-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -53,29 +54,41 @@ class localIOdictionary
|
||||
:
|
||||
public baseIOdictionary
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct given an IOobject
|
||||
localIOdictionary(const IOobject& io);
|
||||
//- and optional fallback dictionary content
|
||||
// A null dictionary pointer is treated like an empty dictionary.
|
||||
explicit localIOdictionary
|
||||
(
|
||||
const IOobject& io,
|
||||
const dictionary* fallback = nullptr
|
||||
);
|
||||
|
||||
//- Construct given an IOobject and dictionary
|
||||
//- Construct given an IOobject and fallback dictionary content
|
||||
localIOdictionary(const IOobject& io, const dictionary& dict);
|
||||
|
||||
//- Construct given an IOobject, wanted typeName
|
||||
//- and optional fallback dictionary content
|
||||
// A null dictionary pointer is treated like an empty dictionary.
|
||||
localIOdictionary
|
||||
(
|
||||
const IOobject& io,
|
||||
const word& wantedType,
|
||||
const dictionary* fallback = nullptr
|
||||
);
|
||||
|
||||
//- Construct given an IOobject and Istream
|
||||
localIOdictionary(const IOobject& io, Istream& is);
|
||||
|
||||
//- Construct given an IOobject, supply wanted typeName
|
||||
localIOdictionary(const IOobject& io, const word& wantedType);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~localIOdictionary();
|
||||
virtual ~localIOdictionary() = default;
|
||||
|
||||
|
||||
// Member functions
|
||||
// Member Functions
|
||||
|
||||
//- Is object global
|
||||
virtual bool global() const
|
||||
@ -90,7 +103,6 @@ public:
|
||||
// Use default (local only) search strategy
|
||||
return localFilePath(type());
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2015 OpenFOAM Foundation
|
||||
Copyright (C) 2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -32,15 +33,14 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::unwatchedIOdictionary::unwatchedIOdictionary(const IOobject& io)
|
||||
Foam::unwatchedIOdictionary::unwatchedIOdictionary
|
||||
(
|
||||
const IOobject& io,
|
||||
const dictionary* fallback
|
||||
)
|
||||
:
|
||||
baseIOdictionary(io)
|
||||
{
|
||||
readHeaderOk(IOstream::ASCII, typeName);
|
||||
|
||||
// For if MUST_READ_IF_MODIFIED
|
||||
addWatch();
|
||||
}
|
||||
unwatchedIOdictionary(io, typeName, fallback)
|
||||
{}
|
||||
|
||||
|
||||
Foam::unwatchedIOdictionary::unwatchedIOdictionary
|
||||
@ -49,11 +49,22 @@ Foam::unwatchedIOdictionary::unwatchedIOdictionary
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
baseIOdictionary(io, dict)
|
||||
unwatchedIOdictionary(io, typeName, &dict)
|
||||
{}
|
||||
|
||||
|
||||
Foam::unwatchedIOdictionary::unwatchedIOdictionary
|
||||
(
|
||||
const IOobject& io,
|
||||
const word& wantedType,
|
||||
const dictionary* fallback
|
||||
)
|
||||
:
|
||||
baseIOdictionary(io, fallback)
|
||||
{
|
||||
if (!readHeaderOk(IOstream::ASCII, typeName))
|
||||
if (!readHeaderOk(IOstream::ASCII, wantedType) && fallback)
|
||||
{
|
||||
dictionary::operator=(dict);
|
||||
dictionary::operator=(*fallback);
|
||||
}
|
||||
|
||||
// For if MUST_READ_IF_MODIFIED
|
||||
@ -69,8 +80,7 @@ Foam::unwatchedIOdictionary::unwatchedIOdictionary
|
||||
:
|
||||
baseIOdictionary(io, is)
|
||||
{
|
||||
// Note that we do construct the dictionary null and read in
|
||||
// afterwards
|
||||
// Default construct dictionary and read in afterwards
|
||||
// so that if there is some fancy massaging due to a
|
||||
// functionEntry in
|
||||
// the dictionary at least the type information is already complete.
|
||||
@ -81,12 +91,6 @@ Foam::unwatchedIOdictionary::unwatchedIOdictionary
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::unwatchedIOdictionary::~unwatchedIOdictionary()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Members Functions * * * * * * * * * * * * * //
|
||||
|
||||
Foam::label Foam::unwatchedIOdictionary::addWatch(const fileName& f)
|
||||
@ -112,7 +116,7 @@ void Foam::unwatchedIOdictionary::addWatch()
|
||||
if (readOpt() == MUST_READ_IF_MODIFIED)
|
||||
{
|
||||
fileName f = filePath();
|
||||
if (!f.size())
|
||||
if (f.empty())
|
||||
{
|
||||
// We don't have this file but would like to re-read it.
|
||||
// Possibly if master-only reading mode.
|
||||
@ -123,7 +127,8 @@ void Foam::unwatchedIOdictionary::addWatch()
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Object " << objectPath() << " of type " << type()
|
||||
<< " already watched" << abort(FatalError);
|
||||
<< " already watched" << nl
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
// If master-only reading only the master will have all dependencies
|
||||
|
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2015-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -28,8 +29,11 @@ Class
|
||||
|
||||
Description
|
||||
unwatchedIOdictionary is like IOdictionary but stores
|
||||
dependencies as files instead of fileMonitor watchIndices. Used
|
||||
to read controlDict since there fileMonitor not yet setup.
|
||||
dependencies as files instead of fileMonitor watchIndices.
|
||||
Used to read controlDict since there fileMonitor not yet setup.
|
||||
|
||||
SourceFiles
|
||||
unwatchedIOdictionary.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -51,31 +55,51 @@ class unwatchedIOdictionary
|
||||
:
|
||||
public baseIOdictionary
|
||||
{
|
||||
// Private Data
|
||||
|
||||
//- The files that would be watched
|
||||
fileNameList files_;
|
||||
|
||||
fileNameList files_;
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct given an IOobject
|
||||
unwatchedIOdictionary(const IOobject& io);
|
||||
//- and optional fallback dictionary content
|
||||
// A null dictionary pointer is treated like an empty dictionary.
|
||||
explicit unwatchedIOdictionary
|
||||
(
|
||||
const IOobject& io,
|
||||
const dictionary* fallback = nullptr
|
||||
);
|
||||
|
||||
//- Construct given an IOobject and dictionary
|
||||
//- Construct given an IOobject and fallback dictionary content
|
||||
unwatchedIOdictionary
|
||||
(
|
||||
const IOobject& io,
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
//- Construct given an IOobject, wanted typeName
|
||||
//- and optional fallback dictionary content
|
||||
// A null dictionary pointer is treated like an empty dictionary.
|
||||
unwatchedIOdictionary
|
||||
(
|
||||
const IOobject& io,
|
||||
const word& wantedType,
|
||||
const dictionary* fallback = nullptr
|
||||
);
|
||||
|
||||
//- Construct given an IOobject and Istream
|
||||
unwatchedIOdictionary(const IOobject& io, Istream& is);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~unwatchedIOdictionary();
|
||||
virtual ~unwatchedIOdictionary() = default;
|
||||
|
||||
|
||||
// Member functions
|
||||
// Member Functions
|
||||
|
||||
//- Is object global
|
||||
virtual bool global() const
|
||||
@ -93,23 +117,26 @@ public:
|
||||
//- Add file watch on object (READ_IF_MODIFIED)
|
||||
virtual void addWatch();
|
||||
|
||||
//- Add file watch for fileName on object if not yet watched. Return
|
||||
// index of watch
|
||||
//- Add file watch for fileName on object if not yet watched.
|
||||
// \return index of watch
|
||||
virtual label addWatch(const fileName&);
|
||||
|
||||
const fileNameList& files() const
|
||||
//- Return the files that would be watched
|
||||
const fileNameList& files() const noexcept
|
||||
{
|
||||
return files_;
|
||||
}
|
||||
|
||||
fileNameList& files()
|
||||
//- Access to the files that would be watched
|
||||
fileNameList& files() noexcept
|
||||
{
|
||||
return files_;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
//- Template function for obtaining global status
|
||||
template<>
|
||||
inline bool typeGlobal<unwatchedIOdictionary>()
|
||||
|
@ -116,7 +116,8 @@ void Foam::solution::read(const dictionary& dict)
|
||||
Foam::solution::solution
|
||||
(
|
||||
const objectRegistry& obr,
|
||||
const fileName& dictName
|
||||
const fileName& dictName,
|
||||
const dictionary* fallback
|
||||
)
|
||||
:
|
||||
IOdictionary
|
||||
@ -133,7 +134,8 @@ Foam::solution::solution
|
||||
: obr.readOpt()
|
||||
),
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
),
|
||||
fallback
|
||||
),
|
||||
cache_(),
|
||||
caching_(false),
|
||||
@ -162,41 +164,8 @@ Foam::solution::solution
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
IOdictionary
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
dictName,
|
||||
obr.time().system(),
|
||||
obr,
|
||||
(
|
||||
obr.readOpt() == IOobject::MUST_READ
|
||||
|| obr.readOpt() == IOobject::READ_IF_PRESENT
|
||||
? IOobject::MUST_READ_IF_MODIFIED
|
||||
: obr.readOpt()
|
||||
),
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
dict
|
||||
),
|
||||
cache_(),
|
||||
caching_(false),
|
||||
fieldRelaxDict_(),
|
||||
eqnRelaxDict_(),
|
||||
fieldRelaxDefault_(0),
|
||||
eqnRelaxDefault_(0),
|
||||
solvers_()
|
||||
{
|
||||
if
|
||||
(
|
||||
readOpt() == IOobject::MUST_READ
|
||||
|| readOpt() == IOobject::MUST_READ_IF_MODIFIED
|
||||
|| (readOpt() == IOobject::READ_IF_PRESENT && headerOk())
|
||||
)
|
||||
{
|
||||
read(solutionDict());
|
||||
}
|
||||
}
|
||||
solution(obr, dictName, &dict)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -53,7 +53,7 @@ class solution
|
||||
:
|
||||
public IOdictionary
|
||||
{
|
||||
// Private data
|
||||
// Private Data
|
||||
|
||||
//- Dictionary of temporary fields to cache
|
||||
dictionary cache_;
|
||||
@ -102,15 +102,18 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct for given objectRegistry and dictionary name
|
||||
//- Construct for given objectRegistry, dictionary name and optional
|
||||
//- fallback dictionary content (for a NO_READ or missing file)
|
||||
// A null dictionary pointer is treated like an empty dictionary.
|
||||
solution
|
||||
(
|
||||
const objectRegistry& obr,
|
||||
const fileName& dictName
|
||||
const fileName& dictName,
|
||||
const dictionary* fallback = nullptr
|
||||
);
|
||||
|
||||
//- Construct for given objectRegistry, dictionary name and (optional)
|
||||
// content (gets used in case of NO_READ or dictionary cannot be read)
|
||||
//- Construct for given objectRegistry, dictionary name and
|
||||
//- fallback dictionary content (for a NO_READ or missing file)
|
||||
solution
|
||||
(
|
||||
const objectRegistry& obr,
|
||||
|
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2016-2017 Wikki Ltd
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -191,7 +191,11 @@ void Foam::faSchemes::read(const dictionary& dict)
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::faSchemes::faSchemes(const objectRegistry& obr)
|
||||
Foam::faSchemes::faSchemes
|
||||
(
|
||||
const objectRegistry& obr,
|
||||
const dictionary* fallback
|
||||
)
|
||||
:
|
||||
IOdictionary
|
||||
(
|
||||
@ -207,7 +211,8 @@ Foam::faSchemes::faSchemes(const objectRegistry& obr)
|
||||
: obr.readOpt()
|
||||
),
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
),
|
||||
fallback
|
||||
),
|
||||
ddtSchemes_
|
||||
(
|
||||
@ -322,6 +327,12 @@ Foam::faSchemes::faSchemes(const objectRegistry& obr)
|
||||
}
|
||||
|
||||
|
||||
Foam::faSchemes::faSchemes(const objectRegistry& obr, const dictionary& dict)
|
||||
:
|
||||
faSchemes(obr, &dict)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::faSchemes::read()
|
||||
|
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2016-2017 Wikki Ltd
|
||||
Copyright (C) 2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -54,7 +55,7 @@ class faSchemes
|
||||
:
|
||||
public IOdictionary
|
||||
{
|
||||
// Private data
|
||||
// Private Data
|
||||
|
||||
dictionary ddtSchemes_;
|
||||
ITstream defaultDdtScheme_;
|
||||
@ -104,8 +105,18 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from objectRegistry
|
||||
faSchemes(const objectRegistry& obr);
|
||||
//- Construct for objectRegistry, and optional
|
||||
//- fallback dictionary content (for a NO_READ or missing file)
|
||||
// A null dictionary pointer is treated like an empty dictionary.
|
||||
explicit faSchemes
|
||||
(
|
||||
const objectRegistry& obr,
|
||||
const dictionary* fallback = nullptr
|
||||
);
|
||||
|
||||
//- Construct for objectRegistry, and
|
||||
//- fallback dictionary content (for a NO_READ or missing file)
|
||||
faSchemes(const objectRegistry& obr, const dictionary& dict);
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -195,7 +195,11 @@ void Foam::fvSchemes::read(const dictionary& dict)
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::fvSchemes::fvSchemes(const objectRegistry& obr)
|
||||
Foam::fvSchemes::fvSchemes
|
||||
(
|
||||
const objectRegistry& obr,
|
||||
const dictionary* fallback
|
||||
)
|
||||
:
|
||||
IOdictionary
|
||||
(
|
||||
@ -211,7 +215,8 @@ Foam::fvSchemes::fvSchemes(const objectRegistry& obr)
|
||||
: obr.readOpt()
|
||||
),
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
),
|
||||
fallback
|
||||
),
|
||||
ddtSchemes_
|
||||
(
|
||||
@ -329,136 +334,8 @@ Foam::fvSchemes::fvSchemes(const objectRegistry& obr)
|
||||
|
||||
Foam::fvSchemes::fvSchemes(const objectRegistry& obr, const dictionary& dict)
|
||||
:
|
||||
IOdictionary
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"fvSchemes",
|
||||
obr.time().system(),
|
||||
obr,
|
||||
(
|
||||
obr.readOpt() == IOobject::MUST_READ
|
||||
|| obr.readOpt() == IOobject::READ_IF_PRESENT
|
||||
? IOobject::MUST_READ_IF_MODIFIED
|
||||
: obr.readOpt()
|
||||
),
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
dict
|
||||
),
|
||||
ddtSchemes_
|
||||
(
|
||||
ITstream
|
||||
(
|
||||
objectPath() + ".ddtSchemes",
|
||||
tokenList()
|
||||
)()
|
||||
),
|
||||
defaultDdtScheme_
|
||||
(
|
||||
ddtSchemes_.name() + ".default",
|
||||
tokenList()
|
||||
),
|
||||
d2dt2Schemes_
|
||||
(
|
||||
ITstream
|
||||
(
|
||||
objectPath() + ".d2dt2Schemes",
|
||||
tokenList()
|
||||
)()
|
||||
),
|
||||
defaultD2dt2Scheme_
|
||||
(
|
||||
d2dt2Schemes_.name() + ".default",
|
||||
tokenList()
|
||||
),
|
||||
interpolationSchemes_
|
||||
(
|
||||
ITstream
|
||||
(
|
||||
objectPath() + ".interpolationSchemes",
|
||||
tokenList()
|
||||
)()
|
||||
),
|
||||
defaultInterpolationScheme_
|
||||
(
|
||||
interpolationSchemes_.name() + ".default",
|
||||
tokenList()
|
||||
),
|
||||
divSchemes_
|
||||
(
|
||||
ITstream
|
||||
(
|
||||
objectPath() + ".divSchemes",
|
||||
tokenList()
|
||||
)()
|
||||
),
|
||||
defaultDivScheme_
|
||||
(
|
||||
divSchemes_.name() + ".default",
|
||||
tokenList()
|
||||
),
|
||||
gradSchemes_
|
||||
(
|
||||
ITstream
|
||||
(
|
||||
objectPath() + ".gradSchemes",
|
||||
tokenList()
|
||||
)()
|
||||
),
|
||||
defaultGradScheme_
|
||||
(
|
||||
gradSchemes_.name() + ".default",
|
||||
tokenList()
|
||||
),
|
||||
snGradSchemes_
|
||||
(
|
||||
ITstream
|
||||
(
|
||||
objectPath() + ".snGradSchemes",
|
||||
tokenList()
|
||||
)()
|
||||
),
|
||||
defaultSnGradScheme_
|
||||
(
|
||||
snGradSchemes_.name() + ".default",
|
||||
tokenList()
|
||||
),
|
||||
laplacianSchemes_
|
||||
(
|
||||
ITstream
|
||||
(
|
||||
objectPath() + ".laplacianSchemes",
|
||||
tokenList()
|
||||
)()
|
||||
),
|
||||
defaultLaplacianScheme_
|
||||
(
|
||||
laplacianSchemes_.name() + ".default",
|
||||
tokenList()
|
||||
),
|
||||
fluxRequired_
|
||||
(
|
||||
ITstream
|
||||
(
|
||||
objectPath() + ".fluxRequired",
|
||||
tokenList()
|
||||
)()
|
||||
),
|
||||
defaultFluxRequired_(false),
|
||||
steady_(false)
|
||||
{
|
||||
if
|
||||
(
|
||||
readOpt() == IOobject::MUST_READ
|
||||
|| readOpt() == IOobject::MUST_READ_IF_MODIFIED
|
||||
|| (readOpt() == IOobject::READ_IF_PRESENT && headerOk())
|
||||
)
|
||||
{
|
||||
read(schemesDict());
|
||||
}
|
||||
}
|
||||
|
||||
fvSchemes(obr, &dict)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -55,7 +55,7 @@ class fvSchemes
|
||||
:
|
||||
public IOdictionary
|
||||
{
|
||||
// Private data
|
||||
// Private Data
|
||||
|
||||
dictionary ddtSchemes_;
|
||||
ITstream defaultDdtScheme_;
|
||||
@ -109,12 +109,17 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct for objectRegistry
|
||||
fvSchemes(const objectRegistry& obr);
|
||||
//- Construct for objectRegistry, and optional
|
||||
//- fallback dictionary content (for a NO_READ or missing file)
|
||||
// A null dictionary pointer is treated like an empty dictionary.
|
||||
explicit fvSchemes
|
||||
(
|
||||
const objectRegistry& obr,
|
||||
const dictionary* fallback = nullptr
|
||||
);
|
||||
|
||||
//- Construct from objectRegistry and supplied (optional) content
|
||||
// (gets used in case of NO_READ or fvSchemes dictionary cannot be
|
||||
// read)
|
||||
//- Construct for objectRegistry, and
|
||||
//- fallback dictionary content (for a NO_READ or missing file)
|
||||
fvSchemes(const objectRegistry& obr, const dictionary& dict);
|
||||
|
||||
|
||||
|
@ -53,20 +53,9 @@ class solver
|
||||
:
|
||||
public localIOdictionary
|
||||
{
|
||||
private:
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- No copy construct
|
||||
solver(const solver&) = delete;
|
||||
|
||||
//- No copy assignment
|
||||
void operator=(const solver&) = delete;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
// Protected Data
|
||||
|
||||
//- Reference to the mesh database
|
||||
fvMesh& mesh_;
|
||||
@ -94,6 +83,15 @@ protected:
|
||||
autoPtr<variablesSet> vars_;
|
||||
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
//- No copy construct
|
||||
solver(const solver&) = delete;
|
||||
|
||||
//- No copy assignment
|
||||
void operator=(const solver&) = delete;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
|
||||
@ -122,6 +120,7 @@ public:
|
||||
|
||||
virtual bool readDict(const dictionary& dict);
|
||||
|
||||
|
||||
// Access
|
||||
|
||||
//- Return the solver mesh
|
||||
|
@ -27,7 +27,6 @@ Class
|
||||
Foam::reconstructionSchemes
|
||||
|
||||
Description
|
||||
|
||||
Original code supplied by Henning Scheufler, DLR (2019)
|
||||
|
||||
SourceFiles
|
||||
|
Loading…
Reference in New Issue
Block a user