ENH: function objects - use Info on construction/read, and Log for all other messages

This commit is contained in:
Andrew Heather
2016-11-03 12:11:20 +00:00
parent 40252e99aa
commit c4c57690c6
20 changed files with 75 additions and 110 deletions

View File

@ -114,6 +114,7 @@ Foam::functionObjects::blendingFactor::~blendingFactor()
bool Foam::functionObjects::blendingFactor::read(const dictionary& dict)
{
fieldExpression::read(dict);
writeFile::read(dict);
phiName_ = dict.lookupOrDefault<word>("phi", "phi");
dict.readIfPresent("tolerance", tolerance_);

View File

@ -936,9 +936,6 @@ bool Foam::functionObjects::externalCoupled::read(const dictionary& dict)
}
// Print a bit
if (log)
{
Info<< type() << ": Communicating with regions:" << endl;
forAll(regionGroupNames_, rgi)
{
@ -966,7 +963,6 @@ bool Foam::functionObjects::externalCoupled::read(const dictionary& dict)
Info<< decrIndent;
}
Info<< endl;
}
// Note: we should not have to make directories since the geometry

View File

@ -108,8 +108,7 @@ void Foam::functionObjects::fieldAverage::initialize()
void Foam::functionObjects::fieldAverage::restart()
{
Log
<< " Restarting averaging at time " << obr_.time().timeName()
Log << " Restarting averaging at time " << obr_.time().timeName()
<< nl << endl;
totalIter_.clear();
@ -159,8 +158,7 @@ void Foam::functionObjects::fieldAverage::calcAverages()
restart();
}
Log
<< type() << " " << name() << " write:" << nl
Log << type() << " " << name() << " write:" << nl
<< " Calculating averages" << nl;
addMeanSqrToPrime2Mean<scalar, scalar>();
@ -221,14 +219,14 @@ void Foam::functionObjects::fieldAverage::readAveragingProperties()
totalTime_.clear();
totalTime_.setSize(faItems_.size(), obr_.time().deltaTValue());
if ((restartOnRestart_ || restartOnOutput_) && log)
if (restartOnRestart_ || restartOnOutput_)
{
Info<< " Starting averaging at time " << obr_.time().timeName()
<< nl;
}
else
{
Log << " Restarting averaging for fields:" << nl;
Info<< " Restarting averaging for fields:" << nl;
forAll(faItems_, fieldi)
@ -242,15 +240,13 @@ void Foam::functionObjects::fieldAverage::readAveragingProperties()
totalIter_[fieldi] = readLabel(fieldDict.lookup("totalIter"));
totalTime_[fieldi] = readScalar(fieldDict.lookup("totalTime"));
Log
<< " " << fieldName
Info<< " " << fieldName
<< " iters = " << totalIter_[fieldi]
<< " time = " << totalTime_[fieldi] << nl;
}
else
{
Log
<< " " << fieldName
Info<< " " << fieldName
<< ": starting averaging at time "
<< obr_.time().timeName() << endl;
}
@ -299,7 +295,7 @@ bool Foam::functionObjects::fieldAverage::read(const dictionary& dict)
initialised_ = false;
Log << type() << " " << name() << ":" << nl;
Info<< type() << " " << name() << ":" << nl;
dict.readIfPresent("restartOnRestart", restartOnRestart_);
dict.readIfPresent("restartOnOutput", restartOnOutput_);
@ -309,8 +305,7 @@ bool Foam::functionObjects::fieldAverage::read(const dictionary& dict)
if (periodicRestart_)
{
dict.lookup("restartPeriod") >> restartPeriod_;
Log
<< " Restart period " << restartPeriod_
Info<< " Restart period " << restartPeriod_
<< nl << endl;
}
@ -324,15 +319,14 @@ bool Foam::functionObjects::fieldAverage::read(const dictionary& dict)
}
else
{
Log
<< " Restart scheduled at time " << restartTime_
Info<< " Restart scheduled at time " << restartTime_
<< nl << endl;
}
}
readAveragingProperties();
Log << endl;
Info<< endl;
return true;
}

View File

@ -60,7 +60,7 @@ fieldCoordinateSystemTransform
{
read(dict);
Log << type() << " " << name << ":" << nl
Info<< type() << " " << name << ":" << nl
<< " Applying transformation from global Cartesian to local "
<< coordSys_ << nl << endl;
}

View File

@ -122,6 +122,7 @@ Foam::functionObjects::fieldMinMax::~fieldMinMax()
bool Foam::functionObjects::fieldMinMax::read(const dictionary& dict)
{
fvMeshFunctionObject::read(dict);
writeFile::read(dict);
location_ = dict.lookupOrDefault<Switch>("location", true);

View File

@ -128,7 +128,6 @@ bool Foam::functionObjects::fieldValues::fieldValueDelta::read
)
{
fvMeshFunctionObject::read(dict);
writeFile::read(dict);
region1Ptr_.reset
@ -210,9 +209,9 @@ bool Foam::functionObjects::fieldValues::fieldValueDelta::write()
applyOperation<symmTensor>(type1, name1, name2, entry1, entry2, found);
applyOperation<tensor>(type1, name1, name2, entry1, entry2, found);
if (log && !found)
if (!found)
{
Info<< "Operation between "
Log << "Operation between "
<< name1 << " with result " << entry1 << " and "
<< name2 << " with result " << entry2 << " not applied"
<< endl;

View File

@ -488,7 +488,7 @@ void Foam::functionObjects::fieldValues::surfaceFieldValue::initialise
if (weightFieldName_ == "none")
{
dict.lookup("orientedWeightField") >> weightFieldName_;
Log << " weight field = " << weightFieldName_ << nl;
Info<< " weight field = " << weightFieldName_ << nl;
orientWeightField_ = true;
}
else

View File

@ -21,28 +21,6 @@ License
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
flowType
Group
grpPostProcessingUtilities
Description
Calculates and writes the flowType of velocity field U.
The -noWrite option has no meaning.
The flow type parameter is obtained according to the following equation:
\verbatim
|D| - |Omega|
lambda = -------------
|D| + |Omega|
-1 = rotational flow
0 = simple shear flow
1 = planar extensional flow
\endverbatim
\*---------------------------------------------------------------------------*/
#include "flowType.H"

View File

@ -727,9 +727,6 @@ bool Foam::functionObjects::fluxSummary::read(const dictionary& dict)
}
}
// Provide some output
if (log)
{
Info<< type() << " " << name() << " output:" << nl;
forAll(faceZoneName_, zonei)
@ -741,7 +738,6 @@ bool Foam::functionObjects::fluxSummary::read(const dictionary& dict)
}
Info<< endl;
}
return true;
}

View File

@ -93,6 +93,7 @@ Foam::functionObjects::histogram::~histogram()
bool Foam::functionObjects::histogram::read(const dictionary& dict)
{
fvMeshFunctionObject::read(dict);
writeFile::read(dict);
dict.lookup("field") >> fieldName_;
dict.lookup("max") >> max_;

View File

@ -55,7 +55,7 @@ void Foam::functionObjects::mapFields::createInterpolation
const fvMesh& meshTarget = mesh_;
const word mapRegionName(dict.lookup("mapRegion"));
Log << name() << ':' << nl
Info<< name() << ':' << nl
<< " Reading mesh " << mapRegionName << endl;
mapRegionPtr_.reset
@ -97,12 +97,12 @@ void Foam::functionObjects::mapFields::createInterpolation
// Optionally override
if (dict.readIfPresent("patchMapMethod", patchMapMethodName))
{
Log << " Patch mapping method: " << patchMapMethodName << endl;
Info<< " Patch mapping method: " << patchMapMethodName << endl;
}
bool consistent = readBool(dict.lookup("consistent"));
Log << " Creating mesh to mesh interpolation" << endl;
Info<< " Creating mesh to mesh interpolation" << endl;
if (consistent)
{

View File

@ -281,7 +281,7 @@ bool Foam::functionObjects::nearWallFields::read(const dictionary& dict)
reverseFieldMap_.insert(sampleFldName, fldName);
}
Log << type() << " " << name()
Info<< type() << " " << name()
<< ": Sampling " << fieldMap_.size() << " fields" << endl;
// Do analysis

View File

@ -202,7 +202,7 @@ reactionsSensitivityAnalysis
if (mesh_.nCells() != 1)
{
FatalErrorInFunction
<< "Function object only applicable to single cell cases "
<< "Function object only applicable to single cell cases"
<< abort(FatalError);
}
@ -244,8 +244,8 @@ reactionsSensitivityAnalysis
else
{
FatalErrorInFunction
<< " Not chemistry model found. "
<< " Object available are : " << mesh_.names()
<< " No chemistry model found. "
<< " Objects available are : " << mesh_.names()
<< exit(FatalError);
}
}

View File

@ -354,6 +354,7 @@ Foam::functionObjects::regionSizeDistribution::~regionSizeDistribution()
bool Foam::functionObjects::regionSizeDistribution::read(const dictionary& dict)
{
fvMeshFunctionObject::read(dict);
writeFile::read(dict);
dict.lookup("field") >> alphaName_;
dict.lookup("patches") >> patchNames_;
@ -371,7 +372,7 @@ bool Foam::functionObjects::regionSizeDistribution::read(const dictionary& dict)
{
coordSysPtr_.reset(new coordinateSystem(obr_, dict));
Log << "Transforming all vectorFields with coordinate system "
Info<< "Transforming all vectorFields with coordinate system "
<< coordSysPtr_().name() << endl;
}

View File

@ -162,7 +162,7 @@ bool Foam::functionObjects::streamLine::read(const dictionary& dict)
nSubCycle_ = max(nSubCycle_, 1);
Log << " automatic track length specified through"
Info<< " automatic track length specified through"
<< " number of sub cycles : " << nSubCycle_ << nl
<< endl;
}

View File

@ -157,19 +157,19 @@ bool Foam::functionObjects::turbulenceFields::read(const dictionary& dict)
fieldSet_.insert(wordList(dict.lookup("fields")));
}
Log << type() << " " << name() << ": ";
Info<< type() << " " << name() << ": ";
if (fieldSet_.size())
{
Log << "storing fields:" << nl;
Info<< "storing fields:" << nl;
forAllConstIter(wordHashSet, fieldSet_, iter)
{
Log << " " << modelName << ':' << iter.key() << nl;
Info<< " " << modelName << ':' << iter.key() << nl;
}
Log << endl;
Info<< endl;
}
else
{
Log << "no fields requested to be stored" << nl << endl;
Info<< "no fields requested to be stored" << nl << endl;
}
return true;

View File

@ -143,7 +143,7 @@ bool Foam::functionObjects::wallShearStress::read(const dictionary& dict)
wordReList(dict.lookupOrDefault("patches", wordReList()))
);
Log << type() << " " << name() << ":" << nl;
Info<< type() << " " << name() << ":" << nl;
if (patchSet_.empty())
{
@ -155,7 +155,7 @@ bool Foam::functionObjects::wallShearStress::read(const dictionary& dict)
}
}
Log << " processing all wall patches" << nl << endl;
Info<< " processing all wall patches" << nl << endl;
}
else
{
@ -177,7 +177,7 @@ bool Foam::functionObjects::wallShearStress::read(const dictionary& dict)
}
}
Log << endl;
Info<< endl;
patchSet_ = filteredPatchSet;
}

View File

@ -846,7 +846,7 @@ bool Foam::functionObjects::forces::read(const dictionary& dict)
initialised_ = false;
Info << type() << " " << name() << ":" << nl;
Info<< type() << " " << name() << ":" << nl;
directForceDensity_ = dict.lookupOrDefault("directForceDensity", false);
@ -889,11 +889,11 @@ bool Foam::functionObjects::forces::read(const dictionary& dict)
dict.readIfPresent("porosity", porosity_);
if (porosity_)
{
Info << " Including porosity effects" << endl;
Info<< " Including porosity effects" << endl;
}
else
{
Info << " Not including porosity effects" << endl;
Info<< " Not including porosity effects" << endl;
}
if (dict.found("binData"))
@ -924,7 +924,7 @@ bool Foam::functionObjects::forces::read(const dictionary& dict)
if (writeFields_)
{
Info << " Fields will be written" << endl;
Info<< " Fields will be written" << endl;
volVectorField* forcePtr
(

View File

@ -120,9 +120,7 @@ bool Foam::functionObjects::icoUncoupledKinematicCloud::read
const dictionary& dict
)
{
fvMeshFunctionObject::read(dict);
return true;
return fvMeshFunctionObject::read(dict);
}

View File

@ -111,7 +111,7 @@ bool Foam::functionObjects::timeActivatedFileUpdate::read
lastIndex_ = -1;
fileToUpdate_.expand();
Log << type() << " " << name() << " output:" << nl
Info<< type() << " " << name() << " output:" << nl
<< " time vs file list:" << endl;
forAll(timeVsFile_, i)
@ -124,7 +124,7 @@ bool Foam::functionObjects::timeActivatedFileUpdate::read
<< nl << exit(FatalError);
}
Log << " " << timeVsFile_[i].first() << tab
Info<< " " << timeVsFile_[i].first() << tab
<< timeVsFile_[i].second() << endl;
}