functionObjects: Format time according to the specification in controlDict

Resolves bug-report http://www.openfoam.org/mantisbt/view.php?id=1921
This commit is contained in:
Henry Weller
2015-11-20 13:22:51 +00:00
parent 36fe080bc7
commit 016aad0d72
13 changed files with 30 additions and 15 deletions

View File

@ -334,4 +334,10 @@ void Foam::functionObjectFile::writeHeader
} }
void Foam::functionObjectFile::writeTime(Ostream& os) const
{
os << setw(charWidth()) << obr_.time().timeName();
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -180,6 +180,9 @@ public:
const string& str const string& str
) const; ) const;
//- Write the current time to stream
void writeTime(Ostream& os) const;
//- Write a (commented) header property and value pair //- Write a (commented) header property and value pair
template<class Type> template<class Type>
void writeHeaderValue void writeHeaderValue

View File

@ -129,8 +129,9 @@ void Foam::cloudInfo::write()
if (Pstream::master()) if (Pstream::master())
{ {
writeTime(file(i));
file(i) file(i)
<< obr_.time().value() << token::TAB << token::TAB
<< nParcels << token::TAB << nParcels << token::TAB
<< massInSystem << endl; << massInSystem << endl;
} }

View File

@ -166,7 +166,7 @@ void Foam::fieldMinMax::write()
{ {
functionObjectFile::write(); functionObjectFile::write();
if (!location_) file()<< obr_.time().value(); if (!location_) writeTime(file());
if (log_) Info<< type() << " " << name_ << " output:" << nl; if (log_) Info<< type() << " " << name_ << " output:" << nl;
forAll(fieldSet_, fieldI) forAll(fieldSet_, fieldI)

View File

@ -45,7 +45,7 @@ void Foam::fieldMinMax::output
if (location_) if (location_)
{ {
file<< obr_.time().value(); writeTime(file());
writeTabbed(file, fieldName); writeTabbed(file, fieldName);

View File

@ -234,7 +234,7 @@ void Foam::fieldValues::cellSource::write()
{ {
if (Pstream::master()) if (Pstream::master())
{ {
file() << obr_.time().value(); writeTime(file());
} }
if (writeVolume_) if (writeVolume_)

View File

@ -675,7 +675,7 @@ void Foam::fieldValues::faceSource::write()
if (Pstream::master()) if (Pstream::master())
{ {
file() << obr_.time().value(); writeTime(file());
} }
if (writeArea_) if (writeArea_)

View File

@ -155,7 +155,7 @@ void Foam::fieldValues::fieldValueDelta::write()
if (Pstream::master()) if (Pstream::master())
{ {
file()<< obr_.time().value(); writeTime(file());
} }
if (log_) Info<< type() << " " << name_ << " output:" << endl; if (log_) Info<< type() << " " << name_ << " output:" << endl;

View File

@ -223,8 +223,9 @@ void Foam::forceCoeffs::write()
scalar Clf = Cl/2.0 + Cm; scalar Clf = Cl/2.0 + Cm;
scalar Clr = Cl/2.0 - Cm; scalar Clr = Cl/2.0 - Cm;
writeTime(file(0));
file(0) file(0)
<< obr_.time().value() << tab << Cm << tab << Cd << tab << Cm << tab << Cd
<< tab << Cl << tab << Clf << tab << Clr << endl; << tab << Cl << tab << Clf << tab << Clr << endl;
if (log_) Info<< type() << " " << name_ << " output:" << nl 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) forAll(coeffs[0], i)
{ {

View File

@ -402,7 +402,8 @@ void Foam::forces::writeForces()
<< " porous : " << sum(moment_[2]) << " porous : " << sum(moment_[2])
<< endl; << endl;
file(0) << obr_.time().value() << tab << setw(1) << '(' writeTime(file(0));
file(0) << tab << setw(1) << '('
<< sum(force_[0]) << setw(1) << ' ' << sum(force_[0]) << setw(1) << ' '
<< sum(force_[1]) << setw(1) << ' ' << sum(force_[1]) << setw(1) << ' '
<< sum(force_[2]) << setw(3) << ") (" << sum(force_[2]) << setw(3) << ") ("
@ -420,7 +421,8 @@ void Foam::forces::writeForces()
vectorField localMomentT(coordSys_.localVector(moment_[1])); vectorField localMomentT(coordSys_.localVector(moment_[1]));
vectorField localMomentP(coordSys_.localVector(moment_[2])); 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(localForceN) << setw(1) << ' '
<< sum(localForceT) << setw(1) << ' ' << sum(localForceT) << setw(1) << ' '
<< sum(localForceP) << setw(3) << ") (" << sum(localForceP) << setw(3) << ") ("
@ -456,7 +458,7 @@ void Foam::forces::writeBins()
} }
} }
file(1) << obr_.time().value(); writeTime(file(1));
forAll(f[0], i) forAll(f[0], i)
{ {

View File

@ -125,7 +125,7 @@ void Foam::residuals::write()
if (Pstream::master()) if (Pstream::master())
{ {
file()<< obr_.time().value(); writeTime(file());
forAll(fieldSet_, fieldI) forAll(fieldSet_, fieldI)
{ {

View File

@ -32,7 +32,7 @@ License
namespace Foam namespace Foam
{ {
defineTypeNameAndDebug(timeActivatedFileUpdate, 0); defineTypeNameAndDebug(timeActivatedFileUpdate, 0);
} }

View File

@ -77,7 +77,8 @@ void Foam::yPlus::calcYPlus
<< " y+ : min = " << minYplus << ", max = " << maxYplus << " y+ : min = " << minYplus << ", max = " << maxYplus
<< ", average = " << avgYplus << nl; << ", average = " << avgYplus << nl;
file() << obr_.time().value() writeTime(file());
file()
<< token::TAB << patch.name() << token::TAB << patch.name()
<< token::TAB << minYplus << token::TAB << minYplus
<< token::TAB << maxYplus << token::TAB << maxYplus
@ -107,7 +108,8 @@ void Foam::yPlus::calcYPlus
<< " y+ : min = " << minYplus << ", max = " << maxYplus << " y+ : min = " << minYplus << ", max = " << maxYplus
<< ", average = " << avgYplus << nl; << ", average = " << avgYplus << nl;
file() << obr_.time().value() writeTime(file());
file()
<< token::TAB << patch.name() << token::TAB << patch.name()
<< token::TAB << minYplus << token::TAB << minYplus
<< token::TAB << maxYplus << token::TAB << maxYplus