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 "fvMesh.H"
|
||||||
#include "Time.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 * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::IObasicSourceList::IObasicSourceList
|
Foam::IObasicSourceList::IObasicSourceList
|
||||||
@ -34,17 +67,7 @@ Foam::IObasicSourceList::IObasicSourceList
|
|||||||
const fvMesh& mesh
|
const fvMesh& mesh
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
IOdictionary
|
IOdictionary(createIOobject(mesh)),
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"sourcesProperties",
|
|
||||||
mesh.time().constant(),
|
|
||||||
mesh,
|
|
||||||
IOobject::MUST_READ_IF_MODIFIED,
|
|
||||||
IOobject::NO_WRITE
|
|
||||||
)
|
|
||||||
),
|
|
||||||
basicSourceList(mesh, *this)
|
basicSourceList(mesh, *this)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|||||||
@ -57,6 +57,9 @@ private:
|
|||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Create IO object if dictionary is present
|
||||||
|
IOobject createIOobject(const fvMesh& mesh) const;
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct
|
//- Disallow default bitwise copy construct
|
||||||
IObasicSourceList(const IObasicSourceList&);
|
IObasicSourceList(const IObasicSourceList&);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user