ENH: Added read-if-present equivalent functionality to IObasicSourceList

This commit is contained in:
andy
2011-11-02 15:17:25 +00:00
parent 638f39f1cb
commit aaf8985467
2 changed files with 37 additions and 11 deletions

View File

@ -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)
{}

View File

@ -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&);