mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Added read-if-present equivalent functionality to IObasicSourceList
This commit is contained in:
@ -27,6 +27,39 @@ License
|
||||
#include "fvMesh.H"
|
||||
#include "Time.H"
|
||||
|
||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||
|
||||
Foam::IOobject Foam::IObasicSourceList::createIOobject
|
||||
(
|
||||
const fvMesh& mesh
|
||||
) const
|
||||
{
|
||||
IOobject io
|
||||
(
|
||||
"sourcesProperties",
|
||||
mesh.time().constant(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
);
|
||||
|
||||
if (io.headerOk())
|
||||
{
|
||||
Info<< "Creating field source list from " << io.name() << nl << endl;
|
||||
|
||||
io.readOpt() = IOobject::MUST_READ_IF_MODIFIED;
|
||||
return io;
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< "No field sources present" << nl << endl;
|
||||
|
||||
io.readOpt() = IOobject::NO_READ;
|
||||
return io;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::IObasicSourceList::IObasicSourceList
|
||||
@ -34,17 +67,7 @@ Foam::IObasicSourceList::IObasicSourceList
|
||||
const fvMesh& mesh
|
||||
)
|
||||
:
|
||||
IOdictionary
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"sourcesProperties",
|
||||
mesh.time().constant(),
|
||||
mesh,
|
||||
IOobject::MUST_READ_IF_MODIFIED,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
),
|
||||
IOdictionary(createIOobject(mesh)),
|
||||
basicSourceList(mesh, *this)
|
||||
{}
|
||||
|
||||
|
||||
@ -57,6 +57,9 @@ private:
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Create IO object if dictionary is present
|
||||
IOobject createIOobject(const fvMesh& mesh) const;
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
IObasicSourceList(const IObasicSourceList&);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user