Create graphs in a sub-directory

This commit is contained in:
Henry
2011-04-28 21:13:08 +01:00
parent ffb0a2df21
commit 5222405567
6 changed files with 52 additions and 18 deletions

View File

@ -26,4 +26,4 @@
mesh
);
# include "createPhi.H"
#include "createPhi.H"

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -110,7 +110,12 @@ int main(int argc, char *argv[])
if (runTime.outputTime())
{
calcEk(U, K).write(runTime.timePath()/"Ek", runTime.graphFormat());
calcEk(U, K).write
(
runTime.path()/"graphs"/runTime.timeName(),
"Ek",
runTime.graphFormat()
);
}
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -43,15 +43,15 @@ Description
int main(int argc, char *argv[])
{
argList::noParallel();
# include "setRootCase.H"
#include "setRootCase.H"
# include "createTime.H"
# include "createMesh.H"
# include "createFields.H"
# include "readBoxTurbDict.H"
#include "createTime.H"
#include "createMesh.H"
#include "createFields.H"
#include "readBoxTurbDict.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Kmesh K(mesh);
@ -67,7 +67,12 @@ int main(int argc, char *argv[])
U.write();
calcEk(U, K).write(runTime.timePath()/"Ek", runTime.graphFormat());
calcEk(U, K).write
(
runTime.path()/"graphs"/runTime.timeName(),
"Ek",
runTime.graphFormat()
);
Info<< "end" << endl;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -27,6 +27,7 @@ License
#include "OFstream.H"
#include "IOmanip.H"
#include "Pair.H"
#include "OSspecific.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -211,11 +212,11 @@ void Foam::graph::write(Ostream& os, const word& format) const
}
void Foam::graph::write(const fileName& fName, const word& format) const
void Foam::graph::write(const fileName& pName, const word& format) const
{
autoPtr<writer> graphWriter(writer::New(format));
OFstream graphFile(fName + '.' + graphWriter().ext());
OFstream graphFile(pName + '.' + graphWriter().ext());
if (graphFile.good())
{
@ -230,6 +231,18 @@ void Foam::graph::write(const fileName& fName, const word& format) const
}
void Foam::graph::write
(
const fileName& path,
const word& name,
const word& format
) const
{
mkDir(path);
write(path/name, format);
}
Foam::Ostream& Foam::operator<<(Ostream& os, const graph& g)
{
g.writeTable(os);

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -252,8 +252,16 @@ public:
//- Write graph to stream in given format
void write(Ostream&, const word& format) const;
//- Write graph to file in given format
void write(const fileName& fName, const word& format) const;
//- Write graph to file in given path-name and format
void write(const fileName& pName, const word& format) const;
//- Write graph to file in given path, name and format
void write
(
const fileName& path,
const word& name,
const word& format
) const;
// Friend operators

View File

@ -16,6 +16,9 @@ void writeCellGraph
const word& graphFormat
)
{
fileName path(vsf.time().path()/"graphs"/vsf.time().timeName());
mkDir(path);
graph
(
vsf.name(),
@ -23,7 +26,7 @@ void writeCellGraph
vsf.name(),
vsf.mesh().C().internalField().component(vector::X),
vsf.internalField()
).write(vsf.time().timePath()/vsf.name(), graphFormat);
).write(path/vsf.name(), graphFormat);
}