functionObjects: Simply functionObjects requiring access to the fvMesh using fvMeshFunctionObject

This commit is contained in:
Henry Weller
2016-05-16 16:21:06 +01:00
parent 151631c5e4
commit 4ba3463052
31 changed files with 174 additions and 425 deletions

View File

@ -47,27 +47,13 @@ namespace functionObjects
Foam::functionObjects::writeVTK::writeVTK
(
const word& name,
const Time& t,
const Time& runTime,
const dictionary& dict
)
:
functionObject(name),
time_(t),
obr_
(
time_.lookupObject<objectRegistry>
(
dict.lookupOrDefault("region", polyMesh::defaultRegion)
)
),
fvMeshFunctionObject(name, runTime, dict),
objectNames_()
{
if (!isA<fvMesh>(obr_))
{
FatalErrorInFunction
<< "objectRegistry is not an fvMesh" << exit(FatalError);
}
read(dict);
}
@ -98,20 +84,16 @@ bool Foam::functionObjects::writeVTK::write(const bool postProcess)
{
Info<< type() << " " << name() << " output:" << nl;
fvMesh& mesh = const_cast<fvMesh&>(refCast<const fvMesh>(obr_));
Info<< "Time: " << time_.timeName() << endl;
const Time& runTime = mesh.time();
Info<< "Time: " << runTime.timeName() << endl;
word timeDesc = runTime.timeName();
word timeDesc = time_.timeName();
// VTK/ directory in the case
fileName fvPath(runTime.path()/"VTK");
fileName fvPath(time_.path()/"VTK");
mkDir(fvPath);
string vtkName = runTime.caseName();
string vtkName = time_.caseName();
if (Pstream::parRun())
{
@ -135,7 +117,7 @@ bool Foam::functionObjects::writeVTK::write(const bool postProcess)
Info<< " Internal : " << vtkFileName << endl;
vtkMesh vMesh(mesh);
vtkMesh vMesh(const_cast<fvMesh&>(mesh_));
// Write mesh
internalWriter writer(vMesh, false, vtkFileName);

View File

@ -54,7 +54,7 @@ Description
\endtable
SeeAlso
Foam::functionObject
Foam::functionObjects::fvMeshFunctionObject
Foam::functionObjects::timeControl
SourceFiles
@ -66,18 +66,13 @@ SourceFiles
#ifndef functionObjects_writeVTK_H
#define functionObjects_writeVTK_H
#include "functionObject.H"
#include "fvMeshFunctionObject.H"
#include "wordReList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
class Time;
class objectRegistry;
namespace functionObjects
{
@ -87,16 +82,10 @@ namespace functionObjects
class writeVTK
:
public functionObject
public fvMeshFunctionObject
{
// Private data
//- Reference to the Time
const Time& time_;
//- Refererence to objectRegistry
const objectRegistry& obr_;
//- Names of objects
wordReList objectNames_;