mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: stateFunctionObject - added helper functions to retrieve object result info
This commit is contained in:
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2015-2019 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -238,5 +238,68 @@ Foam::functionObjects::stateFunctionObject::objectResultEntries
|
|||||||
return entries;
|
return entries;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Foam::functionObjects::stateFunctionObject::writeResultEntries
|
||||||
|
(
|
||||||
|
Ostream& os
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
writeResultEntries(name(), os);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::functionObjects::stateFunctionObject::writeResultEntries
|
||||||
|
(
|
||||||
|
const word& objectName,
|
||||||
|
Ostream& os
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
const IOdictionary& stateDict = this->stateDict();
|
||||||
|
|
||||||
|
if (stateDict.found(resultsName_))
|
||||||
|
{
|
||||||
|
const dictionary& resultsDict = stateDict.subDict(resultsName_);
|
||||||
|
|
||||||
|
if (resultsDict.found(objectName))
|
||||||
|
{
|
||||||
|
const dictionary& objectDict = resultsDict.subDict(objectName);
|
||||||
|
|
||||||
|
for (const word& dataFormat : objectDict.sortedToc())
|
||||||
|
{
|
||||||
|
os << " Type: " << dataFormat << nl;
|
||||||
|
|
||||||
|
const dictionary& resultDict = objectDict.subDict(dataFormat);
|
||||||
|
|
||||||
|
for (const word& result : resultDict.sortedToc())
|
||||||
|
{
|
||||||
|
os << " " << result << nl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::functionObjects::stateFunctionObject::writeAllResultEntries
|
||||||
|
(
|
||||||
|
Ostream& os
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
const IOdictionary& stateDict = this->stateDict();
|
||||||
|
|
||||||
|
if (stateDict.found(resultsName_))
|
||||||
|
{
|
||||||
|
const dictionary& resultsDict = stateDict.subDict(resultsName_);
|
||||||
|
|
||||||
|
const wordList allObjectNames = resultsDict.sortedToc();
|
||||||
|
|
||||||
|
for (const word& objectName : allObjectNames)
|
||||||
|
{
|
||||||
|
os << "Object: " << objectName << endl;
|
||||||
|
|
||||||
|
writeResultEntries(objectName, os);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -250,6 +250,15 @@ public:
|
|||||||
|
|
||||||
//- Return result entries for named object
|
//- Return result entries for named object
|
||||||
List<word> objectResultEntries(const word& objectName) const;
|
List<word> objectResultEntries(const word& objectName) const;
|
||||||
|
|
||||||
|
//- Write the results entries for all objects to stream
|
||||||
|
void writeResultEntries(Ostream& os) const;
|
||||||
|
|
||||||
|
//- Write the results entries for named object to stream
|
||||||
|
void writeResultEntries(const word& objectName, Ostream& os) const;
|
||||||
|
|
||||||
|
//- Write the results entries for all objects to stream
|
||||||
|
void writeAllResultEntries(Ostream& os) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user