ENH: functionObjectFile - added standardised function for writing values

This commit is contained in:
andy
2013-11-25 10:51:44 +00:00
parent b0ca0d9dde
commit 18ae63051b
2 changed files with 25 additions and 1 deletions

View File

@ -147,6 +147,12 @@ void Foam::functionObjectFile::resetName(const word& name)
}
Foam::Omanip<int> Foam::functionObjectFile::valueWidth(const label offset) const
{
return setw(IOstream::defaultPrecision() + 7 + offset);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::functionObjectFile::functionObjectFile

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -43,6 +43,7 @@ SourceFiles
#include "OFstream.H"
#include "PtrList.H"
#include "HashSet.H"
#include "IOmanip.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -98,6 +99,9 @@ protected:
//- Reset the list of names to a single name entry
virtual void resetName(const word& name);
//- Return the value width when writing to stream with optional offset
virtual Omanip<int> valueWidth(const label offset = 0) const;
//- Disallow default bitwise copy construct
functionObjectFile(const functionObjectFile&);
@ -149,6 +153,14 @@ public:
//- Return file 'i'
OFstream& file(const label i);
//- Write a formatted value to stream
template<class Type>
const char* writeValue
(
const Type& value,
const label offset = 0
) const;
};
@ -158,6 +170,12 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "functionObjectFileTemplates.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //