probes: Improved formatting of header to make it easier to parse and read probe locations

New layout:

    # Probe 0 (0.0254 0.0253 0)
    # Probe 1 (0.0508 0.0253 0)
    # Probe 2 (0.0762 0.0253 0)
    #       Probe             0             1             2
    #        Time
            1e-05        142974        128861        115934
            2e-05      -69444.1        -62541      -56395.7
            3e-05      -1546.81      -1445.94      -1154.79
This commit is contained in:
Henry
2015-05-05 12:26:28 +01:00
parent c1b53fda48
commit 52f22486c4

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -34,7 +34,7 @@ License
namespace Foam
{
defineTypeNameAndDebug(probes, 0);
defineTypeNameAndDebug(probes, 0);
}
@ -228,30 +228,35 @@ Foam::label Foam::probes::prepare()
// Create directory if does not exist.
mkDir(probeDir);
OFstream* sPtr = new OFstream(probeDir/fieldName);
OFstream* fPtr = new OFstream(probeDir/fieldName);
OFstream& fout = *fPtr;
if (debug)
{
Info<< "open probe stream: " << sPtr->name() << endl;
Info<< "open probe stream: " << fout.name() << endl;
}
probeFilePtrs_.insert(fieldName, sPtr);
probeFilePtrs_.insert(fieldName, fPtr);
unsigned int w = IOstream::defaultPrecision() + 7;
for (direction cmpt=0; cmpt<vector::nComponents; cmpt++)
forAll(*this, probeI)
{
*sPtr<< '#' << setw(IOstream::defaultPrecision() + 6)
<< vector::componentNames[cmpt];
forAll(*this, probeI)
{
*sPtr<< ' ' << setw(w) << operator[](probeI)[cmpt];
}
*sPtr << endl;
fout<< "# Probe " << probeI << ' ' << operator[](probeI)
<< endl;
}
*sPtr<< '#' << setw(IOstream::defaultPrecision() + 6)
fout<< '#' << setw(IOstream::defaultPrecision() + 6)
<< "Probe";
forAll(*this, probeI)
{
fout<< ' ' << setw(w) << probeI;
}
fout<< endl;
fout<< '#' << setw(IOstream::defaultPrecision() + 6)
<< "Time" << endl;
}
}