ENH: functionObjects - updated writing to file

This commit is contained in:
andy
2013-11-25 10:52:20 +00:00
parent 18ae63051b
commit 636215a0ea
14 changed files with 267 additions and 145 deletions

View File

@ -112,20 +112,23 @@ void Foam::fieldMinMax::read(const dictionary& dict)
void Foam::fieldMinMax::writeFileHeader(const label i)
{
file()
<< "# Time" << token::TAB << "field" << token::TAB
<< "min" << token::TAB << "position(min)";
writeHeader(file(), "Field minima and maxima");
writeCommented(file(), "Time");
writeTabbed(file(), "field");
writeTabbed(file(), "min");
writeTabbed(file(), "position(min)");
if (Pstream::parRun())
{
file() << token::TAB << "proc";
writeTabbed(file(), "processor");
}
file() << token::TAB << "max" << token::TAB << "position(max)";
writeTabbed(file(), "max");
writeTabbed(file(), "position(max)");
if (Pstream::parRun())
{
file() << token::TAB << "proc";
writeTabbed(file(), "processor");
}
file() << endl;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -111,21 +111,25 @@ void Foam::fieldMinMax::calcMinMaxFields
scalar maxValue = maxVs[maxI];
const vector& maxC = maxCs[maxI];
file()<< obr_.time().value();
writeTabbed(file(), fieldName);
file()
<< obr_.time().value() << token::TAB
<< fieldName << token::TAB
<< minValue << token::TAB << minC;
<< token::TAB << minValue
<< token::TAB << minC;
if (Pstream::parRun())
{
file() << token::TAB << minI;
file()<< token::TAB << minI;
}
file() << token::TAB << maxValue << token::TAB << maxC;
file()
<< token::TAB << maxValue
<< token::TAB << maxC;
if (Pstream::parRun())
{
file() << token::TAB << maxI;
file()<< token::TAB << maxI;
}
file() << endl;
@ -212,21 +216,25 @@ void Foam::fieldMinMax::calcMinMaxFields
Type maxValue = maxVs[maxI];
const vector& maxC = maxCs[maxI];
file()<< obr_.time().value();
writeTabbed(file(), fieldName);
file()
<< obr_.time().value() << token::TAB
<< fieldName << token::TAB
<< minValue << token::TAB << minC;
<< token::TAB << minValue
<< token::TAB << minC;
if (Pstream::parRun())
{
file() << token::TAB << minI;
file()<< token::TAB << minI;
}
file() << token::TAB << maxValue << token::TAB << maxC;
file()
<< token::TAB << maxValue
<< token::TAB << maxC;
if (Pstream::parRun())
{
file() << token::TAB << maxI;
file()<< token::TAB << maxI;
}
file() << endl;

View File

@ -94,11 +94,10 @@ void Foam::fieldValues::fieldValueDelta::writeFileHeader(const label i)
Ostream& os = file();
os << "# Source1 : " << source1Ptr_->name() << nl
<< "# Source2 : " << source2Ptr_->name() << nl
<< "# Operation : " << operationTypeNames_[operation_] << nl;
os << "# Time";
writeHeaderValue(os, "Source1", source1Ptr_->name());
writeHeaderValue(os, "Source2", source2Ptr_->name());
writeHeaderValue(os, "Operation", operationTypeNames_[operation_]);
writeCommented(os, "Time");
forAll(commonFields, i)
{
@ -156,7 +155,7 @@ void Foam::fieldValues::fieldValueDelta::write()
if (Pstream::master())
{
file()<< obr_.time().timeName();
file()<< obr_.time().value();
}
if (log_)