mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
STYLE: writeDictionary - updated output messages
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2016-2019 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2013-2017 OpenFOAM Foundation
|
||||
@ -51,10 +51,43 @@ namespace functionObjects
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::functionObjects::writeDictionary::writeHeader()
|
||||
{
|
||||
if (firstChange_)
|
||||
{
|
||||
Info<< type() << " " << name() << " write:" << nl << endl;
|
||||
|
||||
IOobject::writeDivider(Info);
|
||||
Info<< endl;
|
||||
firstChange_ = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::writeDictionary::checkDictionary
|
||||
(
|
||||
const dictionary& dict,
|
||||
const label dicti
|
||||
)
|
||||
{
|
||||
if (dict.digest() != digests_[dicti])
|
||||
{
|
||||
writeHeader();
|
||||
|
||||
digests_[dicti] = dict.digest();
|
||||
|
||||
Info<< dict.dictName() << dict << nl;
|
||||
|
||||
IOobject::writeDivider(Info);
|
||||
Info<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool Foam::functionObjects::writeDictionary::tryDirectory
|
||||
(
|
||||
const label dicti,
|
||||
const word& location
|
||||
const word& location,
|
||||
const label dicti
|
||||
)
|
||||
{
|
||||
IOobject dictIO
|
||||
@ -69,17 +102,7 @@ bool Foam::functionObjects::writeDictionary::tryDirectory
|
||||
|
||||
if (dictIO.typeHeaderOk<IOdictionary>(true))
|
||||
{
|
||||
IOdictionary dict(dictIO);
|
||||
|
||||
if (dict.digest() != digests_[dicti])
|
||||
{
|
||||
Info<< dict.dictName() << dict << nl;
|
||||
|
||||
IOobject::writeDivider(Info);
|
||||
Info<< endl;
|
||||
|
||||
digests_[dicti] = dict.digest();
|
||||
}
|
||||
checkDictionary(IOdictionary(dictIO), dicti);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -99,19 +122,14 @@ Foam::functionObjects::writeDictionary::writeDictionary
|
||||
:
|
||||
regionFunctionObject(name, runTime, dict),
|
||||
dictNames_(),
|
||||
digests_()
|
||||
digests_(),
|
||||
firstChange_(true)
|
||||
{
|
||||
read(dict);
|
||||
execute();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::functionObjects::writeDictionary::~writeDictionary()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::functionObjects::writeDictionary::read(const dictionary& dict)
|
||||
@ -150,47 +168,36 @@ bool Foam::functionObjects::writeDictionary::execute()
|
||||
|
||||
bool Foam::functionObjects::writeDictionary::write()
|
||||
{
|
||||
Info<< type() << " " << name() << " write:" << nl << endl;
|
||||
firstChange_ = true;
|
||||
|
||||
IOobject::writeDivider(Info);
|
||||
Info<< endl;
|
||||
|
||||
forAll(dictNames_, i)
|
||||
forAll(dictNames_, dicti)
|
||||
{
|
||||
const IOdictionary* dictptr =
|
||||
obr_.lookupObjectPtr<IOdictionary>(dictNames_[i]);
|
||||
obr_.lookupObjectPtr<IOdictionary>(dictNames_[dicti]);
|
||||
|
||||
if (dictptr)
|
||||
{
|
||||
const dictionary& dict = *dictptr;
|
||||
|
||||
if (dict.digest() != digests_[i])
|
||||
{
|
||||
digests_[i] = dict.digest();
|
||||
|
||||
Info<< dict.dictName() << dict << nl;
|
||||
|
||||
IOobject::writeDivider(Info);
|
||||
Info<< endl;
|
||||
}
|
||||
checkDictionary(*dictptr, dicti);
|
||||
}
|
||||
else
|
||||
{
|
||||
bool processed = tryDirectory(i, obr_.time().timeName());
|
||||
bool processed = tryDirectory(obr_.time().timeName(), dicti);
|
||||
|
||||
if (!processed)
|
||||
{
|
||||
processed = tryDirectory(i, obr_.time().constant());
|
||||
processed = tryDirectory(obr_.time().constant(), dicti);
|
||||
}
|
||||
|
||||
if (!processed)
|
||||
{
|
||||
processed = tryDirectory(i, obr_.time().system());
|
||||
processed = tryDirectory(obr_.time().system(), dicti);
|
||||
}
|
||||
|
||||
if (!processed)
|
||||
{
|
||||
Info<< " Unable to locate dictionary " << dictNames_[i]
|
||||
writeHeader();
|
||||
|
||||
Info<< " Unable to locate dictionary " << dictNames_[dicti]
|
||||
<< nl << endl;
|
||||
|
||||
IOobject::writeDivider(Info);
|
||||
|
||||
Reference in New Issue
Block a user