ENH: write ensightWrite case on each write (closes #733)

- allows processing of the data during the calculation.
This commit is contained in:
Mark Olesen
2018-05-08 09:25:07 +02:00
parent 9531212f14
commit b24bd516ae
2 changed files with 15 additions and 34 deletions

View File

@ -98,19 +98,6 @@ Foam::functionObjects::ensightWrite::ensightWrite
} }
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::functionObjects::ensightWrite::~ensightWrite()
{
if (ensCase_.valid())
{
// finalize case
ensCase().write();
ensCase_.clear();
}
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::functionObjects::ensightWrite::read(const dictionary& dict) bool Foam::functionObjects::ensightWrite::read(const dictionary& dict)
@ -271,19 +258,14 @@ bool Foam::functionObjects::ensightWrite::write()
<< "Unprocessed field " << ignored << endl; << "Unprocessed field " << ignored << endl;
} }
ensCase().write(); // Flush case information
return true; return true;
} }
bool Foam::functionObjects::ensightWrite::end() bool Foam::functionObjects::ensightWrite::end()
{ {
if (ensCase_.valid())
{
// finalize case
ensCase().write();
ensCase_.clear();
}
return true; return true;
} }
@ -294,7 +276,7 @@ void Foam::functionObjects::ensightWrite::updateMesh(const mapPolyMesh& mpm)
if (ensMesh_.valid()) if (ensMesh_.valid())
{ {
ensMesh_().expire(); ensMesh_->expire();
} }
} }
@ -305,7 +287,7 @@ void Foam::functionObjects::ensightWrite::movePoints(const polyMesh& mpm)
if (ensMesh_.valid()) if (ensMesh_.valid())
{ {
ensMesh_().expire(); ensMesh_->expire();
} }
} }

View File

@ -60,7 +60,7 @@ Description
writeControl | Output control | recommended | timeStep writeControl | Output control | recommended | timeStep
directory | The output directory name | no | "ensightWrite" directory | The output directory name | no | "ensightWrite"
overwrite | Remove existing directory | no | false overwrite | Remove existing directory | no | false
format | ASCII or binary format | no | same as simulation format | Either ascii or binary | no | same as simulation
width | Mask width for \c data/XXXX | no | 8 width | Mask width for \c data/XXXX | no | 8
noPatches | Suppress writing patches | no | false noPatches | Suppress writing patches | no | false
patches | Select patches to write | no | patches | Select patches to write | no |
@ -99,7 +99,7 @@ SourceFiles
namespace Foam namespace Foam
{ {
// Forward declaration of classes // Forward declarations
class dictionary; class dictionary;
namespace functionObjects namespace functionObjects
@ -154,17 +154,16 @@ class ensightWrite
template<class Type> template<class Type>
int writeVolField(const word& inputName, int& state); int writeVolField(const word& inputName, int& state);
//- Process by trying to apply for various volume field types. //- Process by trying to apply for various volume field types.
int process(const word& inputName); int process(const word& inputName);
//- No copy construct
//- Disallow default bitwise copy construct
ensightWrite(const ensightWrite&) = delete; ensightWrite(const ensightWrite&) = delete;
//- Disallow default bitwise assignment //- No copy assignment
void operator=(const ensightWrite&) = delete; void operator=(const ensightWrite&) = delete;
public: public:
//- Runtime type information //- Runtime type information
@ -183,28 +182,28 @@ public:
//- Destructor //- Destructor
virtual ~ensightWrite(); virtual ~ensightWrite() = default;
// Member Functions // Member Functions
//- Read the ensightWrite specification //- Read the ensightWrite specification
virtual bool read(const dictionary&); virtual bool read(const dictionary& dict);
//- Do nothing //- Do nothing
virtual bool execute(); virtual bool execute();
//- Write fields //- Write fields, flush case file
virtual bool write(); virtual bool write();
//- Execute at the final time-loop, flush case file //- Do nothing at the final time-loop
virtual bool end(); virtual bool end();
//- Update for changes of mesh //- Update for changes of mesh
virtual void updateMesh(const mapPolyMesh&); virtual void updateMesh(const mapPolyMesh& mpm);
//- Update for mesh point-motion //- Update for mesh point-motion
virtual void movePoints(const polyMesh&); virtual void movePoints(const polyMesh& mpm);
}; };