functionObjects::volRegion: Cache integral properties for writeFileHeader

This commit is contained in:
Henry Weller
2016-08-24 09:32:34 +01:00
parent 428b1d8866
commit 5c9b80a083
4 changed files with 15 additions and 6 deletions

View File

@ -124,7 +124,7 @@ void Foam::functionObjects::writeFile::writeCommented
) const
{
os << setw(1) << "#" << setw(1) << ' '
<< setw(charWidth() - 2) << str.c_str();
<< setf(ios_base::left) << setw(charWidth() - 2) << str.c_str();
}

View File

@ -34,7 +34,7 @@ void Foam::functionObjects::writeFile::writeHeaderValue
) const
{
os << setw(1) << '#' << setw(1) << ' '
<< setw(charWidth() - 2) << setf(ios_base::left) << property.c_str()
<< setf(ios_base::left) << setw(charWidth() - 2) << property.c_str()
<< setw(1) << ':' << setw(1) << ' ' << value << nl;
}

View File

@ -60,10 +60,11 @@ void Foam::functionObjects::volRegion::writeFileHeader
Ostream& file
)
{
wf.writeCommented(file, "Region : ");
file << regionTypeNames_[regionType_] << " " << regionName_ << endl;
wf.writeHeaderValue(file, "Cells", nCells());
wf.writeHeaderValue(file, "Volume", V());
wf.writeCommented(file, "Region");
file<< setw(1) << ':' << setw(1) << ' '
<< regionTypeNames_[regionType_] << " " << regionName_ << endl;
wf.writeHeaderValue(file, "Cells", nCells_);
wf.writeHeaderValue(file, "Volume", V_);
}
@ -85,6 +86,10 @@ Foam::functionObjects::volRegion::volRegion
regionID_(-1)
{
read(dict);
// Cache integral properties of the region for writeFileHeader
nCells_ = nCells();
V_ = V();
}

View File

@ -94,6 +94,10 @@ class volRegion
const fvMesh& mesh_;
// Cache integral properties of the region for writeFileHeader
label nCells_;
scalar V_;
public: