Skip to content
Snippets Groups Projects
Commit bba45b30 authored by Andrew Heather's avatar Andrew Heather
Browse files

ENH: caseInfo function object - store data in IOdictionary for external lookup

parent 6c60b19c
No related branches found
No related tags found
1 merge request!722RELEASE: develop branch to master
......@@ -261,7 +261,7 @@ void Foam::functionObjects::caseInfo::writeFileDicts
fileName path(ePtr->stream());
path.expand();
IOobject io(path, time(), IOobject::MUST_READ);
IOobject io(path, time_, IOobject::MUST_READ);
if (!io.typeHeaderOk<dictionary>(false))
{
......@@ -404,6 +404,17 @@ Foam::functionObjects::caseInfo::caseInfo
const dictionary& dict
)
:
IOdictionary
(
IOobject
(
name,
runTime.timeName(),
runTime,
IOobject::NO_READ,
IOobject::NO_WRITE
)
),
stateFunctionObject(name, runTime),
writeFile(runTime, name, typeName, dict),
writeFormat_(writeFormat::dict),
......@@ -444,7 +455,8 @@ bool Foam::functionObjects::caseInfo::execute()
bool Foam::functionObjects::caseInfo::write()
{
// Output dictionary
dictionary data;
dictionary& data = *this;
data.clear();
// Case meta data
writeMeta(data.subDictOrAdd("meta"));
......@@ -499,7 +511,7 @@ bool Foam::functionObjects::caseInfo::write()
if (Pstream::master())
{
auto filePtr = newFileAtTime(name(), time_.value());
auto filePtr = newFileAtTime(functionObject::name(), time_.value());
auto& os = filePtr();
// Reset stream width - was set in writeFile
......@@ -509,7 +521,7 @@ bool Foam::functionObjects::caseInfo::write()
{
case writeFormat::dict:
{
os << data << endl;
IOdictionary::writeData(os);
break;
}
case writeFormat::json:
......
......@@ -118,6 +118,7 @@ SourceFiles
#ifndef functionObjects_caseInfo_H
#define functionObjects_caseInfo_H
#include "IOdictionary.H"
#include "writeFile.H"
#include "stateFunctionObject.H"
#include "Enum.H"
......@@ -139,6 +140,7 @@ namespace functionObjects
class caseInfo
:
public IOdictionary,
public stateFunctionObject,
public writeFile
{
......@@ -264,6 +266,9 @@ public:
// Member Functions
using regIOobject::read;
using regIOobject::write;
//- Read the controls
virtual bool read(const dictionary& dict);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment