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