Commit c4c57690 authored by Andrew Heather's avatar Andrew Heather
Browse files

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

parent 40252e99
......@@ -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_);
......
......@@ -936,37 +936,33 @@ bool Foam::functionObjects::externalCoupled::read(const dictionary& dict)
}
// Print a bit
if (log)
Info<< type() << ": Communicating with regions:" << endl;
forAll(regionGroupNames_, rgi)
{
Info<< type() << ": Communicating with regions:" << endl;
forAll(regionGroupNames_, rgi)
{
//const wordList& regionNames = regionGroupRegions_[rgi];
const word& compName = regionGroupNames_[rgi];
//const wordList& regionNames = regionGroupRegions_[rgi];
const word& compName = regionGroupNames_[rgi];
Info<< "Region: " << compName << endl << incrIndent;
const labelList& groups = regionToGroups_[compName];
forAll(groups, i)
{
label groupi = groups[i];
const wordRe& groupName = groupNames_[groupi];
Info<< "Region: " << compName << endl << incrIndent;
const labelList& groups = regionToGroups_[compName];
forAll(groups, i)
{
label groupi = groups[i];
const wordRe& groupName = groupNames_[groupi];
Info<< indent << "patchGroup: " << groupName << "\t"
<< endl
<< incrIndent
<< indent << "Reading fields: "
<< groupReadFields_[groupi]
<< endl
<< indent << "Writing fields: "
<< groupWriteFields_[groupi]
<< endl
<< decrIndent;
}
Info<< decrIndent;
Info<< indent << "patchGroup: " << groupName << "\t"
<< endl
<< incrIndent
<< indent << "Reading fields: "
<< groupReadFields_[groupi]
<< endl
<< indent << "Writing fields: "
<< groupWriteFields_[groupi]
<< endl
<< decrIndent;
}
Info<< endl;
Info<< decrIndent;
}
Info<< endl;
// Note: we should not have to make directories since the geometry
......
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -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);
......
......@@ -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;
......
......@@ -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
......
......@@ -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"
......
......@@ -727,22 +727,18 @@ bool Foam::functionObjects::fluxSummary::read(const dictionary& dict)
}
}
// Provide some output
if (log)
{
Info<< type() << " " << name() << " output:" << nl;
Info<< type() << " " << name() << " output:" << nl;
forAll(faceZoneName_, zonei)
{
const word& zoneName = faceZoneName_[zonei];
scalar zoneArea = faceArea_[zonei];
Info<< " Zone: " << zoneName << ", area: " << zoneArea << nl;
}
forAll(faceZoneName_, zonei)
{
const word& zoneName = faceZoneName_[zonei];
scalar zoneArea = faceArea_[zonei];
Info<< endl;
Info<< " Zone: " << zoneName << ", area: " << zoneArea << nl;
}
Info<< endl;
return true;
}
......
......@@ -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_;
......
......@@ -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)
{
......
......@@ -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
......
......@@ -138,10 +138,10 @@ writeSpeciesRR()
prodFilePtr_() << "delta T : "<< mesh_.time().deltaT().value() << nl << nl;
consIntFilePtr_() << "start time : " << startTime_ << tab
<< "end time :" << endTime_ << nl;
<< "end time :" << endTime_ << nl;
prodIntFilePtr_() << "start time : " << startTime_ << tab
<< "end time :" << endTime_ << nl;
<< "end time :" << endTime_ << nl;
for (label reactioni = 0; reactioni < nReactions_; ++reactioni)
{
......@@ -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);
}
......@@ -243,9 +243,9 @@ reactionsSensitivityAnalysis
}
else
{
FatalErrorInFunction
<< " Not chemistry model found. "
<< " Object available are : " << mesh_.names()
FatalErrorInFunction
<< " No chemistry model found. "
<< " Objects available are : " << mesh_.names()
<< exit(FatalError);
}
}
......
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -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;
......
......@@ -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;
}
......
......@@ -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
(
......
......@@ -120,9 +120,7 @@ bool Foam::functionObjects::icoUncoupledKinematicCloud::read
const dictionary& dict
)
{
fvMeshFunctionObject::read(dict);
return true;
return fvMeshFunctionObject::read(dict);
}
......
......@@ -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;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment