Commit f900abd8 authored by Henry Weller's avatar Henry Weller
Browse files

functionObjects: Format time according to the specification in controlDict

Resolves bug-report http://www.openfoam.org/mantisbt/view.php?id=1921
parent 26a2c177
......@@ -334,4 +334,10 @@ void Foam::functionObjectFile::writeHeader
}
void Foam::functionObjectFile::writeTime(Ostream& os) const
{
os << setw(charWidth()) << obr_.time().timeName();
}
// ************************************************************************* //
......@@ -180,6 +180,9 @@ public:
const string& str
) const;
//- Write the current time to stream
void writeTime(Ostream& os) const;
//- Write a (commented) header property and value pair
template<class Type>
void writeHeaderValue
......
......@@ -129,8 +129,9 @@ void Foam::cloudInfo::write()
if (Pstream::master())
{
writeTime(file(i));
file(i)
<< obr_.time().value() << token::TAB
<< token::TAB
<< nParcels << token::TAB
<< massInSystem << endl;
}
......
......@@ -166,7 +166,7 @@ void Foam::fieldMinMax::write()
{
functionObjectFile::write();
if (!location_) file()<< obr_.time().value();
if (!location_) writeTime(file());
if (log_) Info<< type() << " " << name_ << " output:" << nl;
forAll(fieldSet_, fieldI)
......
......@@ -45,7 +45,7 @@ void Foam::fieldMinMax::output
if (location_)
{
file<< obr_.time().value();
writeTime(file());
writeTabbed(file, fieldName);
......
......@@ -234,7 +234,7 @@ void Foam::fieldValues::cellSource::write()
{
if (Pstream::master())
{
file() << obr_.time().value();
writeTime(file());
}
if (writeVolume_)
......
......@@ -675,7 +675,7 @@ void Foam::fieldValues::faceSource::write()
if (Pstream::master())
{
file() << obr_.time().value();
writeTime(file());
}
if (writeArea_)
......
......@@ -155,7 +155,7 @@ void Foam::fieldValues::fieldValueDelta::write()
if (Pstream::master())
{
file()<< obr_.time().value();
writeTime(file());
}
if (log_) Info<< type() << " " << name_ << " output:" << endl;
......
......@@ -223,8 +223,9 @@ void Foam::forceCoeffs::write()
scalar Clf = Cl/2.0 + Cm;
scalar Clr = Cl/2.0 - Cm;
writeTime(file(0));
file(0)
<< obr_.time().value() << tab << Cm << tab << Cd
<< tab << Cm << tab << Cd
<< tab << Cl << tab << Clf << tab << Clr << endl;
if (log_) Info<< type() << " " << name_ << " output:" << nl
......@@ -246,7 +247,7 @@ void Foam::forceCoeffs::write()
}
}
file(1)<< obr_.time().value();
writeTime(file(1));
forAll(coeffs[0], i)
{
......
......@@ -402,7 +402,8 @@ void Foam::forces::writeForces()
<< " porous : " << sum(moment_[2])
<< endl;
file(0) << obr_.time().value() << tab << setw(1) << '('
writeTime(file(0));
file(0) << tab << setw(1) << '('
<< sum(force_[0]) << setw(1) << ' '
<< sum(force_[1]) << setw(1) << ' '
<< sum(force_[2]) << setw(3) << ") ("
......@@ -420,7 +421,8 @@ void Foam::forces::writeForces()
vectorField localMomentT(coordSys_.localVector(moment_[1]));
vectorField localMomentP(coordSys_.localVector(moment_[2]));
file(0) << obr_.time().value() << tab << setw(1) << '('
writeTime(file(0));
file(0) << tab << setw(1) << '('
<< sum(localForceN) << setw(1) << ' '
<< sum(localForceT) << setw(1) << ' '
<< sum(localForceP) << setw(3) << ") ("
......@@ -456,7 +458,7 @@ void Foam::forces::writeBins()
}
}
file(1) << obr_.time().value();
writeTime(file(1));
forAll(f[0], i)
{
......
......@@ -125,7 +125,7 @@ void Foam::residuals::write()
if (Pstream::master())
{
file()<< obr_.time().value();
writeTime(file());
forAll(fieldSet_, fieldI)
{
......
......@@ -32,7 +32,7 @@ License
namespace Foam
{
defineTypeNameAndDebug(timeActivatedFileUpdate, 0);
defineTypeNameAndDebug(timeActivatedFileUpdate, 0);
}
......
......@@ -77,7 +77,8 @@ void Foam::yPlus::calcYPlus
<< " y+ : min = " << minYplus << ", max = " << maxYplus
<< ", average = " << avgYplus << nl;
file() << obr_.time().value()
writeTime(file());
file()
<< token::TAB << patch.name()
<< token::TAB << minYplus
<< token::TAB << maxYplus
......@@ -107,7 +108,8 @@ void Foam::yPlus::calcYPlus
<< " y+ : min = " << minYplus << ", max = " << maxYplus
<< ", average = " << avgYplus << nl;
file() << obr_.time().value()
writeTime(file());
file()
<< token::TAB << patch.name()
<< token::TAB << minYplus
<< token::TAB << maxYplus
......
Supports Markdown
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