From b24bd516ae9ca6f874bfabdae7124ef0ab333f27 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Tue, 8 May 2018 09:25:07 +0200 Subject: [PATCH] ENH: write ensightWrite case on each write (closes #733) - allows processing of the data during the calculation. --- .../utilities/ensightWrite/ensightWrite.C | 26 +++---------------- .../utilities/ensightWrite/ensightWrite.H | 23 ++++++++-------- 2 files changed, 15 insertions(+), 34 deletions(-) diff --git a/src/functionObjects/utilities/ensightWrite/ensightWrite.C b/src/functionObjects/utilities/ensightWrite/ensightWrite.C index d9d0170369..b286935733 100644 --- a/src/functionObjects/utilities/ensightWrite/ensightWrite.C +++ b/src/functionObjects/utilities/ensightWrite/ensightWrite.C @@ -98,19 +98,6 @@ Foam::functionObjects::ensightWrite::ensightWrite } -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::functionObjects::ensightWrite::~ensightWrite() -{ - if (ensCase_.valid()) - { - // finalize case - ensCase().write(); - ensCase_.clear(); - } -} - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // bool Foam::functionObjects::ensightWrite::read(const dictionary& dict) @@ -271,19 +258,14 @@ bool Foam::functionObjects::ensightWrite::write() << "Unprocessed field " << ignored << endl; } + ensCase().write(); // Flush case information + return true; } bool Foam::functionObjects::ensightWrite::end() { - if (ensCase_.valid()) - { - // finalize case - ensCase().write(); - ensCase_.clear(); - } - return true; } @@ -294,7 +276,7 @@ void Foam::functionObjects::ensightWrite::updateMesh(const mapPolyMesh& mpm) if (ensMesh_.valid()) { - ensMesh_().expire(); + ensMesh_->expire(); } } @@ -305,7 +287,7 @@ void Foam::functionObjects::ensightWrite::movePoints(const polyMesh& mpm) if (ensMesh_.valid()) { - ensMesh_().expire(); + ensMesh_->expire(); } } diff --git a/src/functionObjects/utilities/ensightWrite/ensightWrite.H b/src/functionObjects/utilities/ensightWrite/ensightWrite.H index 0d61f4dfab..1c1b30c7f4 100644 --- a/src/functionObjects/utilities/ensightWrite/ensightWrite.H +++ b/src/functionObjects/utilities/ensightWrite/ensightWrite.H @@ -60,7 +60,7 @@ Description writeControl | Output control | recommended | timeStep directory | The output directory name | no | "ensightWrite" 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 noPatches | Suppress writing patches | no | false patches | Select patches to write | no | @@ -99,7 +99,7 @@ SourceFiles namespace Foam { -// Forward declaration of classes +// Forward declarations class dictionary; namespace functionObjects @@ -154,17 +154,16 @@ class ensightWrite template int writeVolField(const word& inputName, int& state); - //- Process by trying to apply for various volume field types. int process(const word& inputName); - - //- Disallow default bitwise copy construct + //- No copy construct ensightWrite(const ensightWrite&) = delete; - //- Disallow default bitwise assignment + //- No copy assignment void operator=(const ensightWrite&) = delete; + public: //- Runtime type information @@ -183,28 +182,28 @@ public: //- Destructor - virtual ~ensightWrite(); + virtual ~ensightWrite() = default; // Member Functions //- Read the ensightWrite specification - virtual bool read(const dictionary&); + virtual bool read(const dictionary& dict); //- Do nothing virtual bool execute(); - //- Write fields + //- Write fields, flush case file virtual bool write(); - //- Execute at the final time-loop, flush case file + //- Do nothing at the final time-loop virtual bool end(); //- Update for changes of mesh - virtual void updateMesh(const mapPolyMesh&); + virtual void updateMesh(const mapPolyMesh& mpm); //- Update for mesh point-motion - virtual void movePoints(const polyMesh&); + virtual void movePoints(const polyMesh& mpm); };