Skip to content
Snippets Groups Projects
Commit 18ae6305 authored by andy's avatar andy
Browse files

ENH: functionObjectFile - added standardised function for writing values

parent b0ca0d9d
No related branches found
No related tags found
No related merge requests found
...@@ -147,6 +147,12 @@ void Foam::functionObjectFile::resetName(const word& name) ...@@ -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 * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::functionObjectFile::functionObjectFile Foam::functionObjectFile::functionObjectFile
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation \\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
...@@ -43,6 +43,7 @@ SourceFiles ...@@ -43,6 +43,7 @@ SourceFiles
#include "OFstream.H" #include "OFstream.H"
#include "PtrList.H" #include "PtrList.H"
#include "HashSet.H" #include "HashSet.H"
#include "IOmanip.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
...@@ -98,6 +99,9 @@ protected: ...@@ -98,6 +99,9 @@ protected:
//- Reset the list of names to a single name entry //- Reset the list of names to a single name entry
virtual void resetName(const word& name); 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 //- Disallow default bitwise copy construct
functionObjectFile(const functionObjectFile&); functionObjectFile(const functionObjectFile&);
...@@ -149,6 +153,14 @@ public: ...@@ -149,6 +153,14 @@ public:
//- Return file 'i' //- Return file 'i'
OFstream& file(const label 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: ...@@ -158,6 +170,12 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "functionObjectFileTemplates.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif #endif
// ************************************************************************* // // ************************************************************************* //
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment