From d9cefeff9917490f31dcb5a11c5079df6243f469 Mon Sep 17 00:00:00 2001 From: Andrew Heather <> Date: Thu, 23 May 2019 12:55:32 +0100 Subject: [PATCH] STYLE: writeDictionary - updated output format --- .../writeDictionary/writeDictionary.C | 44 +++++++------------ .../writeDictionary/writeDictionary.H | 3 +- 2 files changed, 16 insertions(+), 31 deletions(-) diff --git a/src/functionObjects/utilities/writeDictionary/writeDictionary.C b/src/functionObjects/utilities/writeDictionary/writeDictionary.C index 83a078c69ee..43531231e01 100644 --- a/src/functionObjects/utilities/writeDictionary/writeDictionary.C +++ b/src/functionObjects/utilities/writeDictionary/writeDictionary.C @@ -54,8 +54,7 @@ namespace functionObjects bool Foam::functionObjects::writeDictionary::tryDirectory ( const label dicti, - const word& location, - bool& firstDict + const word& location ) { IOobject dictIO @@ -74,18 +73,10 @@ bool Foam::functionObjects::writeDictionary::tryDirectory if (dict.digest() != digests_[dicti]) { - if (firstDict) - { - Info<< type() << " " << name() << " write:" << nl << endl; - - IOobject::writeDivider(Info); - Info<< endl; - firstDict = false; - } - Info<< dict.dictName() << dict << nl; IOobject::writeDivider(Info); + Info<< endl; digests_[dicti] = dict.digest(); } @@ -159,11 +150,15 @@ bool Foam::functionObjects::writeDictionary::execute() bool Foam::functionObjects::writeDictionary::write() { - bool firstDict = true; + Info<< type() << " " << name() << " write:" << nl << endl; + + IOobject::writeDivider(Info); + Info<< endl; + forAll(dictNames_, i) { - const dictionary* dictptr = - obr_.findObject<dictionary>(dictNames_[i]); + const IOdictionary* dictptr = + obr_.lookupObjectPtr<IOdictionary>(dictNames_[i]); if (dictptr) { @@ -171,43 +166,34 @@ bool Foam::functionObjects::writeDictionary::write() if (dict.digest() != digests_[i]) { - if (firstDict) - { - Info<< type() << " " << name() << " write:" << nl << endl; - - IOobject::writeDivider(Info); - Info<< endl; - firstDict = false; - } - digests_[i] = dict.digest(); Info<< dict.dictName() << dict << nl; + IOobject::writeDivider(Info); Info<< endl; } } else { - bool processed = tryDirectory(i, obr_.time().timeName(), firstDict); + bool processed = tryDirectory(i, obr_.time().timeName()); if (!processed) { - processed = tryDirectory(i, obr_.time().constant(), firstDict); + processed = tryDirectory(i, obr_.time().constant()); } if (!processed) { - processed = tryDirectory(i, obr_.time().system(), firstDict); + processed = tryDirectory(i, obr_.time().system()); } if (!processed) { Info<< " Unable to locate dictionary " << dictNames_[i] << nl << endl; - } - else - { + + IOobject::writeDivider(Info); Info<< endl; } } diff --git a/src/functionObjects/utilities/writeDictionary/writeDictionary.H b/src/functionObjects/utilities/writeDictionary/writeDictionary.H index c55933479a3..66f44fd81dd 100644 --- a/src/functionObjects/utilities/writeDictionary/writeDictionary.H +++ b/src/functionObjects/utilities/writeDictionary/writeDictionary.H @@ -74,8 +74,7 @@ class writeDictionary bool tryDirectory ( const label dicti, - const word& location, - bool& firstDict + const word& location ); -- GitLab