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());
|
fileName path(ePtr->stream());
|
||||||
path.expand();
|
path.expand();
|
||||||
|
|
||||||
IOobject io(path, time(), IOobject::MUST_READ);
|
IOobject io(path, time_, IOobject::MUST_READ);
|
||||||
|
|
||||||
if (!io.typeHeaderOk<dictionary>(false))
|
if (!io.typeHeaderOk<dictionary>(false))
|
||||||
{
|
{
|
||||||
@ -404,6 +404,17 @@ Foam::functionObjects::caseInfo::caseInfo
|
|||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
|
IOdictionary
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
name,
|
||||||
|
runTime.timeName(),
|
||||||
|
runTime,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
)
|
||||||
|
),
|
||||||
stateFunctionObject(name, runTime),
|
stateFunctionObject(name, runTime),
|
||||||
writeFile(runTime, name, typeName, dict),
|
writeFile(runTime, name, typeName, dict),
|
||||||
writeFormat_(writeFormat::dict),
|
writeFormat_(writeFormat::dict),
|
||||||
@ -444,7 +455,8 @@ bool Foam::functionObjects::caseInfo::execute()
|
|||||||
bool Foam::functionObjects::caseInfo::write()
|
bool Foam::functionObjects::caseInfo::write()
|
||||||
{
|
{
|
||||||
// Output dictionary
|
// Output dictionary
|
||||||
dictionary data;
|
dictionary& data = *this;
|
||||||
|
data.clear();
|
||||||
|
|
||||||
// Case meta data
|
// Case meta data
|
||||||
writeMeta(data.subDictOrAdd("meta"));
|
writeMeta(data.subDictOrAdd("meta"));
|
||||||
@ -499,7 +511,7 @@ bool Foam::functionObjects::caseInfo::write()
|
|||||||
|
|
||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
auto filePtr = newFileAtTime(name(), time_.value());
|
auto filePtr = newFileAtTime(functionObject::name(), time_.value());
|
||||||
auto& os = filePtr();
|
auto& os = filePtr();
|
||||||
|
|
||||||
// Reset stream width - was set in writeFile
|
// Reset stream width - was set in writeFile
|
||||||
@ -509,7 +521,7 @@ bool Foam::functionObjects::caseInfo::write()
|
|||||||
{
|
{
|
||||||
case writeFormat::dict:
|
case writeFormat::dict:
|
||||||
{
|
{
|
||||||
os << data << endl;
|
IOdictionary::writeData(os);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case writeFormat::json:
|
case writeFormat::json:
|
||||||
|
|||||||
@ -118,6 +118,7 @@ SourceFiles
|
|||||||
#ifndef functionObjects_caseInfo_H
|
#ifndef functionObjects_caseInfo_H
|
||||||
#define functionObjects_caseInfo_H
|
#define functionObjects_caseInfo_H
|
||||||
|
|
||||||
|
#include "IOdictionary.H"
|
||||||
#include "writeFile.H"
|
#include "writeFile.H"
|
||||||
#include "stateFunctionObject.H"
|
#include "stateFunctionObject.H"
|
||||||
#include "Enum.H"
|
#include "Enum.H"
|
||||||
@ -139,6 +140,7 @@ namespace functionObjects
|
|||||||
|
|
||||||
class caseInfo
|
class caseInfo
|
||||||
:
|
:
|
||||||
|
public IOdictionary,
|
||||||
public stateFunctionObject,
|
public stateFunctionObject,
|
||||||
public writeFile
|
public writeFile
|
||||||
{
|
{
|
||||||
@ -264,6 +266,9 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
|
using regIOobject::read;
|
||||||
|
using regIOobject::write;
|
||||||
|
|
||||||
//- Read the controls
|
//- Read the controls
|
||||||
virtual bool read(const dictionary& dict);
|
virtual bool read(const dictionary& dict);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user