mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: caseInfo function object - store data in IOdictionary for external lookup
This commit is contained in:
@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user