ENH: probes: reformat output for third-party readers

This commit is contained in:
Kutalmis Bercin
2023-11-23 15:22:10 +00:00
parent 2d042268ba
commit 5a29b2b076
2 changed files with 10 additions and 8 deletions

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2015-2022 OpenCFD Ltd. Copyright (C) 2015-2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -105,6 +105,7 @@ void Foam::probes::createProbeFiles(const wordList& fieldNames)
DebugInfo<< "open probe stream: " << os.name() << endl; DebugInfo<< "open probe stream: " << os.name() << endl;
const unsigned int width(IOstream::defaultPrecision() + 7); const unsigned int width(IOstream::defaultPrecision() + 7);
os << setf(ios_base::left);
forAll(*this, probei) forAll(*this, probei)
{ {
@ -139,8 +140,7 @@ void Foam::probes::createProbeFiles(const wordList& fieldNames)
os << nl; os << nl;
} }
os << '#' << setw(IOstream::defaultPrecision() + 6) os << setw(width) << "# Time";
<< "Probe";
forAll(*this, probei) forAll(*this, probei)
{ {
@ -149,10 +149,7 @@ void Foam::probes::createProbeFiles(const wordList& fieldNames)
os << ' ' << setw(width) << probei; os << ' ' << setw(width) << probei;
} }
} }
os << nl; os << endl;
os << '#' << setw(IOstream::defaultPrecision() + 6)
<< "Time" << endl;
} }
} }
} }

View File

@ -31,6 +31,7 @@ License
#include "surfaceFields.H" #include "surfaceFields.H"
#include "IOmanip.H" #include "IOmanip.H"
#include "interpolation.H" #include "interpolation.H"
#include "SpanStream.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -137,11 +138,15 @@ void Foam::probes::writeValues
os << setw(width) << timeValue; os << setw(width) << timeValue;
OCharStream buf;
forAll(values, probei) forAll(values, probei)
{ {
if (includeOutOfBounds_ || processor_[probei] != -1) if (includeOutOfBounds_ || processor_[probei] != -1)
{ {
os << ' ' << setw(width) << values[probei]; buf.rewind();
buf << values[probei];
os << ' ' << setw(width) << buf.str().data();
} }
} }
os << endl; os << endl;