mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: runTimePostProcessing - added option to clear/remove objects after use
This commit is contained in:
@ -48,6 +48,7 @@ set(LIBRARY_OUTPUT_PATH $ENV{FOAM_LIBBIN}
|
|||||||
|
|
||||||
file(GLOB SOURCE_FILES
|
file(GLOB SOURCE_FILES
|
||||||
fieldVisualisationBase.C
|
fieldVisualisationBase.C
|
||||||
|
functionObjectBase.C
|
||||||
functionObjectCloud.C
|
functionObjectCloud.C
|
||||||
functionObjectLine.C
|
functionObjectLine.C
|
||||||
functionObjectSurface.C
|
functionObjectSurface.C
|
||||||
|
|||||||
@ -507,12 +507,10 @@ void Foam::functionObjects::fieldVisualisationBase::addGlyphs
|
|||||||
|
|
||||||
Foam::functionObjects::fieldVisualisationBase::fieldVisualisationBase
|
Foam::functionObjects::fieldVisualisationBase::fieldVisualisationBase
|
||||||
(
|
(
|
||||||
const runTimePostProcessing& parent,
|
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
const HashPtrTable<Function1<vector>, word>& colours
|
const HashPtrTable<Function1<vector>, word>& colours
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
parent_(parent),
|
|
||||||
colours_(colours),
|
colours_(colours),
|
||||||
fieldName_(dict.lookup("field")),
|
fieldName_(dict.lookup("field")),
|
||||||
colourBy_(cbColour),
|
colourBy_(cbColour),
|
||||||
|
|||||||
@ -93,12 +93,6 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
// Private data
|
|
||||||
|
|
||||||
//- Reference to the parent function object
|
|
||||||
const runTimePostProcessing& parent_;
|
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct
|
//- Disallow default bitwise copy construct
|
||||||
@ -185,7 +179,6 @@ public:
|
|||||||
//- Construct from dictionary
|
//- Construct from dictionary
|
||||||
fieldVisualisationBase
|
fieldVisualisationBase
|
||||||
(
|
(
|
||||||
const runTimePostProcessing& parent,
|
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
const HashPtrTable<Function1<vector>, word>& colours
|
const HashPtrTable<Function1<vector>, word>& colours
|
||||||
);
|
);
|
||||||
|
|||||||
@ -0,0 +1,112 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "functionObjectBase.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace functionObjects
|
||||||
|
{
|
||||||
|
namespace runTimePostPro
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(functionObjectBase, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
bool Foam::functionObjects::runTimePostPro::functionObjectBase::removeFile
|
||||||
|
(
|
||||||
|
const word& keyword,
|
||||||
|
const word& fieldName
|
||||||
|
)
|
||||||
|
{
|
||||||
|
dictionary dict;
|
||||||
|
state_.getObjectDict(functionObjectName_, fieldName, dict);
|
||||||
|
|
||||||
|
fileName fName;
|
||||||
|
if (dict.readIfPresent(keyword, fName))
|
||||||
|
{
|
||||||
|
Foam::rm(fName);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::fileName
|
||||||
|
Foam::functionObjects::runTimePostPro::functionObjectBase::getFileName
|
||||||
|
(
|
||||||
|
const word& keyword,
|
||||||
|
const word& fieldName
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
dictionary dict;
|
||||||
|
state_.getObjectDict(functionObjectName_, fieldName, dict);
|
||||||
|
|
||||||
|
fileName fName(dict.lookupOrDefault(keyword, fileName::null));
|
||||||
|
|
||||||
|
return fName;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::functionObjects::runTimePostPro::functionObjectBase::functionObjectBase
|
||||||
|
(
|
||||||
|
const stateFunctionObject& state,
|
||||||
|
const dictionary& dict,
|
||||||
|
const HashPtrTable<Function1<vector>, word>& colours
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fieldVisualisationBase(dict, colours),
|
||||||
|
state_(state),
|
||||||
|
functionObjectName_(""),
|
||||||
|
clearObjects_(dict.lookupOrDefault<bool>("clearObjects", false))
|
||||||
|
{
|
||||||
|
dict.lookup("functionObject") >> functionObjectName_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::functionObjects::runTimePostPro::functionObjectBase::~functionObjectBase()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
bool Foam::functionObjects::runTimePostPro::functionObjectBase::clear()
|
||||||
|
{
|
||||||
|
return clearObjects_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,130 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::functionObjects::runTimePostPro::functionObjectBase
|
||||||
|
|
||||||
|
Description
|
||||||
|
Base class for function object visualisation
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
functionObjectBase.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef functionObjects_runTimePostPro_functionObjectBase_H
|
||||||
|
#define functionObjects_runTimePostPro_functionObjectBase_H
|
||||||
|
|
||||||
|
#include "fieldVisualisationBase.H"
|
||||||
|
#include "stateFunctionObject.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace functionObjects
|
||||||
|
{
|
||||||
|
namespace runTimePostPro
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class functionObjectBase Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class functionObjectBase
|
||||||
|
:
|
||||||
|
public fieldVisualisationBase
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Disallow default bitwise copy construct
|
||||||
|
functionObjectBase(const functionObjectBase&);
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const functionObjectBase&);
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Protected data
|
||||||
|
|
||||||
|
//- Reference to the state
|
||||||
|
const stateFunctionObject& state_;
|
||||||
|
|
||||||
|
//- Function object name
|
||||||
|
word functionObjectName_;
|
||||||
|
|
||||||
|
//- Flag to indicate that source data should be cleared after use
|
||||||
|
bool clearObjects_;
|
||||||
|
|
||||||
|
|
||||||
|
// Protected Member Functions
|
||||||
|
|
||||||
|
//- Retrieve file used to create the scene object
|
||||||
|
fileName getFileName(const word& keyword, const word& fieldName) const;
|
||||||
|
|
||||||
|
//- Remove file used to create the scene object
|
||||||
|
bool removeFile(const word& keyword, const word& fieldName);
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Run-time type information
|
||||||
|
TypeName("functionObjectBase");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from dictionary
|
||||||
|
functionObjectBase
|
||||||
|
(
|
||||||
|
const stateFunctionObject& state,
|
||||||
|
const dictionary& dict,
|
||||||
|
const HashPtrTable<Function1<vector>, word>& colours
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~functionObjectBase();
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Clear files used to create the object(s)
|
||||||
|
virtual bool clear();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace runTimePostPro
|
||||||
|
} // End namespace functionObjects
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -62,9 +62,8 @@ Foam::functionObjects::runTimePostPro::functionObjectCloud::functionObjectCloud
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
pointData(parent, dict, colours),
|
pointData(parent, dict, colours),
|
||||||
fieldVisualisationBase(parent, dict, colours),
|
functionObjectBase(parent, dict, colours),
|
||||||
cloudName_(dict.lookup("cloud")),
|
cloudName_(dict.lookup("cloud")),
|
||||||
functionObject_(dict.lookup("functionObject")),
|
|
||||||
colourFieldName_(dict.lookup("colourField")),
|
colourFieldName_(dict.lookup("colourField")),
|
||||||
actor_()
|
actor_()
|
||||||
{
|
{
|
||||||
@ -103,18 +102,18 @@ addGeometryToScene
|
|||||||
if (cloudDict.found("functionObjectCloud"))
|
if (cloudDict.found("functionObjectCloud"))
|
||||||
{
|
{
|
||||||
const dictionary& foDict = cloudDict.subDict("cloudFunctionObject");
|
const dictionary& foDict = cloudDict.subDict("cloudFunctionObject");
|
||||||
if (foDict.found(functionObject_))
|
if (foDict.found(functionObjectName_))
|
||||||
{
|
{
|
||||||
foDict.subDict(functionObject_).readIfPresent("file", fName);
|
foDict.subDict(functionObjectName_).readIfPresent("file", fName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fName.empty())
|
if (fName.empty())
|
||||||
{
|
{
|
||||||
WarningInFunction
|
WarningInFunction
|
||||||
<< "Unable to find function object " << functionObject_
|
<< "Unable to find function object " << functionObjectName_
|
||||||
<< " output for field " << fieldName_
|
<< " output for field " << fieldName_
|
||||||
<< ". Line will not be processed"
|
<< ". Cloud will not be processed"
|
||||||
<< endl;
|
<< endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -159,4 +158,36 @@ void Foam::functionObjects::runTimePostPro::functionObjectCloud::updateActors
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Foam::functionObjects::runTimePostPro::functionObjectCloud::clear()
|
||||||
|
{
|
||||||
|
if (functionObjectBase::clear())
|
||||||
|
{
|
||||||
|
const dictionary& cloudDict =
|
||||||
|
geometryBase::parent_.mesh().lookupObject<IOdictionary>
|
||||||
|
(
|
||||||
|
cloudName_ & "OutputProperties"
|
||||||
|
);
|
||||||
|
|
||||||
|
if (cloudDict.found("functionObjectCloud"))
|
||||||
|
{
|
||||||
|
const dictionary& foDict = cloudDict.subDict("functionObjectCloud");
|
||||||
|
if (foDict.found(functionObjectName_))
|
||||||
|
{
|
||||||
|
const dictionary& functionDict =
|
||||||
|
foDict.subDict(functionObjectName_);
|
||||||
|
|
||||||
|
fileName fName;
|
||||||
|
if (functionDict.readIfPresent("file", fName))
|
||||||
|
{
|
||||||
|
Foam::rm(fName);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -36,7 +36,7 @@ SourceFiles
|
|||||||
#define functionObjects_runTimePostPro_functionObjectCloud_H
|
#define functionObjects_runTimePostPro_functionObjectCloud_H
|
||||||
|
|
||||||
#include "pointData.H"
|
#include "pointData.H"
|
||||||
#include "fieldVisualisationBase.H"
|
#include "functionObjectBase.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -54,7 +54,7 @@ namespace runTimePostPro
|
|||||||
class functionObjectCloud
|
class functionObjectCloud
|
||||||
:
|
:
|
||||||
public pointData,
|
public pointData,
|
||||||
public fieldVisualisationBase
|
public functionObjectBase
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
|
||||||
@ -74,9 +74,6 @@ protected:
|
|||||||
//- Name of functionObjectCloud
|
//- Name of functionObjectCloud
|
||||||
word cloudName_;
|
word cloudName_;
|
||||||
|
|
||||||
//- Name of functionObjectCloud function object result to render
|
|
||||||
word functionObject_;
|
|
||||||
|
|
||||||
//- Name of field to colour by
|
//- Name of field to colour by
|
||||||
word colourFieldName_;
|
word colourFieldName_;
|
||||||
|
|
||||||
@ -116,6 +113,9 @@ public:
|
|||||||
|
|
||||||
//- Update actors
|
//- Update actors
|
||||||
virtual void updateActors(const scalar position);
|
virtual void updateActors(const scalar position);
|
||||||
|
|
||||||
|
//- Clear files used to create the object(s)
|
||||||
|
virtual bool clear();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -61,8 +61,7 @@ Foam::functionObjects::runTimePostPro::functionObjectLine::functionObjectLine
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
pathline(parent, dict, colours),
|
pathline(parent, dict, colours),
|
||||||
fieldVisualisationBase(parent, dict, colours),
|
functionObjectBase(parent, dict, colours),
|
||||||
functionObject_(dict.lookup("functionObject")),
|
|
||||||
actor_()
|
actor_()
|
||||||
{
|
{
|
||||||
actor_ = vtkSmartPointer<vtkActor>::New();
|
actor_ = vtkSmartPointer<vtkActor>::New();
|
||||||
@ -89,23 +88,12 @@ addGeometryToScene
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
dictionary dict;
|
fileName fName = getFileName("file", fieldName_);
|
||||||
if (!geometryBase::parent_.getObjectDict(functionObject_, fieldName_, dict))
|
if (fName.empty())
|
||||||
{
|
|
||||||
WarningInFunction
|
|
||||||
<< "Unable to find function object " << functionObject_
|
|
||||||
<< " output for field " << fieldName_
|
|
||||||
<< ". Line will not be processed"
|
|
||||||
<< endl;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
fileName fName;
|
|
||||||
if (!dict.readIfPresent("file", fName))
|
|
||||||
{
|
{
|
||||||
WarningInFunction
|
WarningInFunction
|
||||||
<< "Unable to read file name from function object "
|
<< "Unable to read file name from function object "
|
||||||
<< functionObject_ << " for field " << fieldName_
|
<< functionObjectName_ << " for field " << fieldName_
|
||||||
<< ". Line will not be processed"
|
<< ". Line will not be processed"
|
||||||
<< endl;
|
<< endl;
|
||||||
return;
|
return;
|
||||||
@ -140,5 +128,15 @@ void Foam::functionObjects::runTimePostPro::functionObjectLine::updateActors
|
|||||||
actor_->GetProperty()->SetOpacity(opacity(position));
|
actor_->GetProperty()->SetOpacity(opacity(position));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Foam::functionObjects::runTimePostPro::functionObjectLine::clear()
|
||||||
|
{
|
||||||
|
if (functionObjectBase::clear())
|
||||||
|
{
|
||||||
|
return removeFile("file", fieldName_);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -36,7 +36,7 @@ SourceFiles
|
|||||||
#define functionObjects_runTimePostPro_functionObjectLine_H
|
#define functionObjects_runTimePostPro_functionObjectLine_H
|
||||||
|
|
||||||
#include "pathline.H"
|
#include "pathline.H"
|
||||||
#include "fieldVisualisationBase.H"
|
#include "functionObjectBase.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -54,7 +54,7 @@ namespace runTimePostPro
|
|||||||
class functionObjectLine
|
class functionObjectLine
|
||||||
:
|
:
|
||||||
public pathline,
|
public pathline,
|
||||||
public fieldVisualisationBase
|
public functionObjectBase
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
|
||||||
@ -71,9 +71,6 @@ protected:
|
|||||||
|
|
||||||
// Protected data
|
// Protected data
|
||||||
|
|
||||||
//- Name of function object result to render
|
|
||||||
word functionObject_;
|
|
||||||
|
|
||||||
//- Actor
|
//- Actor
|
||||||
vtkSmartPointer<vtkActor> actor_;
|
vtkSmartPointer<vtkActor> actor_;
|
||||||
|
|
||||||
@ -110,6 +107,9 @@ public:
|
|||||||
|
|
||||||
//- Update actors
|
//- Update actors
|
||||||
virtual void updateActors(const scalar position);
|
virtual void updateActors(const scalar position);
|
||||||
|
|
||||||
|
//- Clear files used to create the object(s)
|
||||||
|
virtual bool clear();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -62,14 +62,8 @@ functionObjectSurface
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
geometrySurface(parent, dict, colours, List<fileName>()),
|
geometrySurface(parent, dict, colours, List<fileName>()),
|
||||||
fieldVisualisationBase(parent, dict, colours),
|
functionObjectBase(parent, dict, colours)
|
||||||
functionObject_("")
|
{}
|
||||||
{
|
|
||||||
if (visible_)
|
|
||||||
{
|
|
||||||
dict.lookup("functionObject") >> functionObject_;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
@ -93,23 +87,12 @@ addGeometryToScene
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
dictionary dict;
|
fileName fName = getFileName("file", fieldName_);
|
||||||
if (!geometryBase::parent_.getObjectDict(functionObject_, fieldName_, dict))
|
if (fName.empty())
|
||||||
{
|
|
||||||
WarningInFunction
|
|
||||||
<< "Unable to find function object " << functionObject_
|
|
||||||
<< " output for field " << fieldName_
|
|
||||||
<< ". Surface will not be processed"
|
|
||||||
<< endl;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
fileName fName;
|
|
||||||
if (!dict.readIfPresent("file", fName))
|
|
||||||
{
|
{
|
||||||
WarningInFunction
|
WarningInFunction
|
||||||
<< "Unable to read file name from function object "
|
<< "Unable to read file name from function object "
|
||||||
<< functionObject_ << " for field " << fieldName_
|
<< functionObjectName_ << " for field " << fieldName_
|
||||||
<< ". Surface will not be processed"
|
<< ". Surface will not be processed"
|
||||||
<< endl;
|
<< endl;
|
||||||
return;
|
return;
|
||||||
@ -167,4 +150,15 @@ addGeometryToScene
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Foam::functionObjects::runTimePostPro::functionObjectSurface::clear()
|
||||||
|
{
|
||||||
|
if (functionObjectBase::clear())
|
||||||
|
{
|
||||||
|
return removeFile("file", fieldName_);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -36,7 +36,7 @@ SourceFiles
|
|||||||
#define functionObjects_runTimePostPro_functionObjectSurface_H
|
#define functionObjects_runTimePostPro_functionObjectSurface_H
|
||||||
|
|
||||||
#include "geometrySurface.H"
|
#include "geometrySurface.H"
|
||||||
#include "fieldVisualisationBase.H"
|
#include "functionObjectBase.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -54,10 +54,9 @@ namespace runTimePostPro
|
|||||||
class functionObjectSurface
|
class functionObjectSurface
|
||||||
:
|
:
|
||||||
public geometrySurface,
|
public geometrySurface,
|
||||||
public fieldVisualisationBase
|
public functionObjectBase
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
@ -69,14 +68,6 @@ private:
|
|||||||
void operator=(const functionObjectSurface&) = delete;
|
void operator=(const functionObjectSurface&) = delete;
|
||||||
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
// Protected data
|
|
||||||
|
|
||||||
//- Name of function object result to render
|
|
||||||
word functionObject_;
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//- Run-time type information
|
//- Run-time type information
|
||||||
@ -106,6 +97,9 @@ public:
|
|||||||
const scalar position,
|
const scalar position,
|
||||||
vtkRenderer* renderer
|
vtkRenderer* renderer
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//- Clear files used to create the object(s)
|
||||||
|
virtual bool clear();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -50,6 +50,7 @@ namespace Foam
|
|||||||
{
|
{
|
||||||
namespace functionObjects
|
namespace functionObjects
|
||||||
{
|
{
|
||||||
|
|
||||||
class runTimePostProcessing;
|
class runTimePostProcessing;
|
||||||
|
|
||||||
namespace runTimePostPro
|
namespace runTimePostPro
|
||||||
@ -163,6 +164,9 @@ public:
|
|||||||
|
|
||||||
//- Update the actors
|
//- Update the actors
|
||||||
virtual void updateActors(const scalar position) = 0;
|
virtual void updateActors(const scalar position) = 0;
|
||||||
|
|
||||||
|
//- Clear files used to create the object(s)
|
||||||
|
virtual bool clear() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -211,4 +211,13 @@ void Foam::functionObjects::runTimePostPro::geometrySurface::updateActors
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Foam::functionObjects::runTimePostPro::geometrySurface::clear()
|
||||||
|
{
|
||||||
|
// Note: not removing geometry files
|
||||||
|
// - these are usually static files that are used e.g. for meshing
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -127,6 +127,9 @@ public:
|
|||||||
|
|
||||||
//- Update actors
|
//- Update actors
|
||||||
virtual void updateActors(const scalar position);
|
virtual void updateActors(const scalar position);
|
||||||
|
|
||||||
|
//- Clear files used to create the object(s)
|
||||||
|
virtual bool clear();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -217,6 +217,24 @@ bool Foam::functionObjects::runTimePostProcessing::write()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Clean up
|
||||||
|
forAll(text_, i)
|
||||||
|
{
|
||||||
|
text_[i].clear();
|
||||||
|
}
|
||||||
|
forAll(points_, i)
|
||||||
|
{
|
||||||
|
points_[i].clear();
|
||||||
|
}
|
||||||
|
forAll(lines_, i)
|
||||||
|
{
|
||||||
|
lines_[i].clear();
|
||||||
|
}
|
||||||
|
forAll(surfaces_, i)
|
||||||
|
{
|
||||||
|
surfaces_[i].clear();
|
||||||
|
}
|
||||||
|
|
||||||
// Reset any floating point trapping
|
// Reset any floating point trapping
|
||||||
sigFpe::set(false);
|
sigFpe::set(false);
|
||||||
|
|
||||||
|
|||||||
@ -81,6 +81,7 @@ namespace functionObjects
|
|||||||
{
|
{
|
||||||
namespace runTimePostPro
|
namespace runTimePostPro
|
||||||
{
|
{
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class scene Declaration
|
Class scene Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|||||||
@ -115,7 +115,13 @@ void Foam::functionObjects::runTimePostPro::text::updateActors
|
|||||||
const scalar position
|
const scalar position
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// do nothing - all handled by addGeometryToScene
|
// Do nothing - all handled by addGeometryToScene
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Foam::functionObjects::runTimePostPro::text::clear()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -135,6 +135,9 @@ public:
|
|||||||
|
|
||||||
//- Update actors
|
//- Update actors
|
||||||
virtual void updateActors(const scalar position);
|
virtual void updateActors(const scalar position);
|
||||||
|
|
||||||
|
//- Clear files used to create the object(s)
|
||||||
|
virtual bool clear();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user