diff --git a/src/OpenFOAM/Make/files b/src/OpenFOAM/Make/files index 92c81085ab93aad0624f2bd3ba873d54dcd9dd9d..833be5ccd565a1f21b19382b5eeb4a3150f38fbf 100644 --- a/src/OpenFOAM/Make/files +++ b/src/OpenFOAM/Make/files @@ -144,11 +144,14 @@ $(regIOobject)/regIOobjectWrite.C db/IOobjectList/IOobjectList.C db/objectRegistry/objectRegistry.C -db/functionObject/functionObject.C -db/functionObjectList/functionObjectList.C db/CallbackRegistry/CallbackRegistryName.C db/dlLibraryTable/dlLibraryTable.C +db/functionObjects/functionObject/functionObject.C +db/functionObjects/functionObjectList/functionObjectList.C +db/functionObjects/outputFilterOutputControl/outputFilterOutputControl.C + + Time = db/Time $(Time)/TimePaths.C $(Time)/TimeState.C diff --git a/src/OpenFOAM/db/Time/Time.C b/src/OpenFOAM/db/Time/Time.C index d157501506af36a3c59c171e4657f91c15475296..f52303220f27347e315f1acffa61c5f7676925a0 100644 --- a/src/OpenFOAM/db/Time/Time.C +++ b/src/OpenFOAM/db/Time/Time.C @@ -498,8 +498,8 @@ bool Foam::Time::run() const // ie, when exiting the control loop if (!running && timeIndex_ != startTimeIndex_) { - // Note, the execute() also calls an indirect start() if required - functionObjects_.execute(); + // Note, end() also calls an indirect start() as required + functionObjects_.end(); } } @@ -509,8 +509,7 @@ bool Foam::Time::run() const bool Foam::Time::end() const { - bool done = value() > (endTime_ + 0.5*deltaT_); - return done; + return value() > (endTime_ + 0.5*deltaT_); } diff --git a/src/OpenFOAM/db/Time/Time.H b/src/OpenFOAM/db/Time/Time.H index 3cb65583b2aa7a5a2f36c7ddcbacbe50768e649b..70f6985b4142b349cca2ca2a9971fafe6e93268e 100644 --- a/src/OpenFOAM/db/Time/Time.H +++ b/src/OpenFOAM/db/Time/Time.H @@ -348,16 +348,28 @@ public: // Check - //- Return true if run should continue - // @sa end() + //- Return true if run should continue, + // also invokes the functionObjectList::end() method + // when the time goes out of range // @note - // the rounding heuristics near endTime mean that - // @code run() @endcode and @code !end() @endcode may - // not yield the same result + // For correct baheviour, the following style of time-loop + // is recommended: + // @code + // while (runTime.run()) + // { + // runTime++; + // solve; + // runTime.write(); + // } + // @endcode virtual bool run() const; - //- Return true if end of run - // @sa run() + //- Return true if end of run, + // does not invoke any functionObject methods + // @note + // The rounding heuristics near endTime mean that + // @code run() @endcode and @code !end() @endcode may + // not yield the same result virtual bool end() const; @@ -406,13 +418,15 @@ public: // Member operators - //- Set deltaT to that specified and increment time + //- Set deltaT to that specified and increment time via operator++() virtual Time& operator+=(const dimensionedScalar&); - //- Set deltaT to that specified and increment time + //- Set deltaT to that specified and increment time via operator++() virtual Time& operator+=(const scalar); - //- Prefix increment + //- Prefix increment, + // also invokes the functionObjectList::start() or + // functionObjectList::execute() method, depending on the time-index virtual Time& operator++(); //- Postfix increment, this is identical to the prefix increment diff --git a/src/sampling/outputFilters/IOOutputFilter/IOOutputFilter.C b/src/OpenFOAM/db/functionObjects/IOOutputFilter/IOOutputFilter.C similarity index 100% rename from src/sampling/outputFilters/IOOutputFilter/IOOutputFilter.C rename to src/OpenFOAM/db/functionObjects/IOOutputFilter/IOOutputFilter.C diff --git a/src/sampling/outputFilters/IOOutputFilter/IOOutputFilter.H b/src/OpenFOAM/db/functionObjects/IOOutputFilter/IOOutputFilter.H similarity index 100% rename from src/sampling/outputFilters/IOOutputFilter/IOOutputFilter.H rename to src/OpenFOAM/db/functionObjects/IOOutputFilter/IOOutputFilter.H diff --git a/src/sampling/outputFilters/OutputFilterFunctionObject/OutputFilterFunctionObject.C b/src/OpenFOAM/db/functionObjects/OutputFilterFunctionObject/OutputFilterFunctionObject.C similarity index 93% rename from src/sampling/outputFilters/OutputFilterFunctionObject/OutputFilterFunctionObject.C rename to src/OpenFOAM/db/functionObjects/OutputFilterFunctionObject/OutputFilterFunctionObject.C index 45305257e9f760ea57028d8dd395937c36a56479..15a32c1e8e3b979d53da4aefac77e0e65afe4682 100644 --- a/src/sampling/outputFilters/OutputFilterFunctionObject/OutputFilterFunctionObject.C +++ b/src/OpenFOAM/db/functionObjects/OutputFilterFunctionObject/OutputFilterFunctionObject.C @@ -65,6 +65,20 @@ Foam::OutputFilterFunctionObject<OutputFilter>::OutputFilterFunctionObject // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +template<class OutputFilter> +void Foam::OutputFilterFunctionObject<OutputFilter>::on() +{ + enabled_ = true; +} + + +template<class OutputFilter> +void Foam::OutputFilterFunctionObject<OutputFilter>::off() +{ + enabled_ = false; +} + + template<class OutputFilter> bool Foam::OutputFilterFunctionObject<OutputFilter>::start() { @@ -120,16 +134,19 @@ bool Foam::OutputFilterFunctionObject<OutputFilter>::execute() template<class OutputFilter> -void Foam::OutputFilterFunctionObject<OutputFilter>::on() +bool Foam::OutputFilterFunctionObject<OutputFilter>::end() { - enabled_ = true; -} + if (enabled_) + { + ptr_->end(); + if (enabled_ && outputControl_.output()) + { + ptr_->write(); + } + } -template<class OutputFilter> -void Foam::OutputFilterFunctionObject<OutputFilter>::off() -{ - enabled_ = false; + return true; } diff --git a/src/sampling/outputFilters/OutputFilterFunctionObject/OutputFilterFunctionObject.H b/src/OpenFOAM/db/functionObjects/OutputFilterFunctionObject/OutputFilterFunctionObject.H similarity index 92% rename from src/sampling/outputFilters/OutputFilterFunctionObject/OutputFilterFunctionObject.H rename to src/OpenFOAM/db/functionObjects/OutputFilterFunctionObject/OutputFilterFunctionObject.H index 80ee33cf815433a48593fb5deb8e3cefdc31abe9..5ab4ebbecec37c35c8e76d5d1eb5653e0ed13fad 100644 --- a/src/sampling/outputFilters/OutputFilterFunctionObject/OutputFilterFunctionObject.H +++ b/src/OpenFOAM/db/functionObjects/OutputFilterFunctionObject/OutputFilterFunctionObject.H @@ -53,7 +53,7 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class OutputFilterFunctionObject Declaration + Class OutputFilterFunctionObject Declaration \*---------------------------------------------------------------------------*/ template<class OutputFilter> @@ -69,7 +69,7 @@ class OutputFilterFunctionObject word regionName_; word dictName_; - //- Switch for the execution of the functionObjects + //- Switch for the execution of the functionObject bool enabled_; outputFilterOutputControl outputControl_; @@ -114,18 +114,23 @@ public: return name_; } - //- start is called at the start of the time-loop - virtual bool start(); - - //- execute is called at each ++ or += of the time-loop - virtual bool execute(); - //- Switch the function object on virtual void on(); //- Switch the function object off virtual void off(); + + //- Called at the start of the time-loop + virtual bool start(); + + //- Called at each ++ or += of the time-loop + virtual bool execute(); + + //- Called when Time::run() determines that the time-loop exits + virtual bool end(); + + //- Read and set the function object if its data have changed virtual bool read(const dictionary&); }; diff --git a/src/OpenFOAM/db/functionObject/functionObject.C b/src/OpenFOAM/db/functionObjects/functionObject/functionObject.C similarity index 98% rename from src/OpenFOAM/db/functionObject/functionObject.C rename to src/OpenFOAM/db/functionObjects/functionObject/functionObject.C index 29ee48342b3f1659d72a354b31c790c0e1e2adcd..a731621ff676fae227b64f15f4387b2a006170dd 100644 --- a/src/OpenFOAM/db/functionObject/functionObject.C +++ b/src/OpenFOAM/db/functionObjects/functionObject/functionObject.C @@ -103,6 +103,12 @@ Foam::functionObject::~functionObject() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +bool Foam::functionObject::end() +{ + return execute(); +} + + Foam::autoPtr<Foam::functionObject> Foam::functionObject::iNew::operator() ( const word& name, diff --git a/src/OpenFOAM/db/functionObject/functionObject.H b/src/OpenFOAM/db/functionObjects/functionObject/functionObject.H similarity index 94% rename from src/OpenFOAM/db/functionObject/functionObject.H rename to src/OpenFOAM/db/functionObjects/functionObject/functionObject.H index 268bf128e403551ed512e4b71745fde3eec276f0..94a2f7aea4848f65b2279142f4dc0eb8e2c9b642 100644 --- a/src/OpenFOAM/db/functionObject/functionObject.H +++ b/src/OpenFOAM/db/functionObjects/functionObject/functionObject.H @@ -137,12 +137,16 @@ public: // Member Functions - //- start is called at the start of the time-loop + //- Called at the start of the time-loop virtual bool start() = 0; - //- execute is called at each ++ or += of the time-loop + //- Called at each ++ or += of the time-loop virtual bool execute() = 0; + //- Called when Time::run() determines that the time-loop exits. + // By default it simply calls execute(). + virtual bool end(); + //- Read and set the function object if its data have changed virtual bool read(const dictionary&) = 0; }; diff --git a/src/OpenFOAM/db/functionObjectList/functionObjectList.C b/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C similarity index 93% rename from src/OpenFOAM/db/functionObjectList/functionObjectList.C rename to src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C index 1ca37e02e3b0a7edb1ef410cebbf637fa19cf808..0e52db7fc71ae2cff6e5307884af84000cd8a5d3 100644 --- a/src/OpenFOAM/db/functionObjectList/functionObjectList.C +++ b/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C @@ -142,7 +142,12 @@ bool Foam::functionObjectList::execute() read(); } - forAllIter(PtrList<functionObject>, *this, iter) + forAllIter + ( + PtrList<functionObject>, + static_cast<PtrList<functionObject>&>(*this), + iter + ) { ok = iter().execute() && ok; } @@ -152,6 +157,32 @@ bool Foam::functionObjectList::execute() } +bool Foam::functionObjectList::end() +{ + bool ok = true; + + if (execution_) + { + if (!updated_) + { + read(); + } + + forAllIter + ( + PtrList<functionObject>, + static_cast<PtrList<functionObject>&>(*this), + iter + ) + { + ok = iter().end() && ok; + } + } + + return ok; +} + + bool Foam::functionObjectList::read() { bool ok = true; @@ -279,28 +310,4 @@ bool Foam::functionObjectList::read() } -bool Foam::functionObjectList::manualStart() -{ - bool state = execution_; - execution_ = true; - - bool ret = start(); - - execution_ = state; - return ret; -} - - -bool Foam::functionObjectList::manualExecute() -{ - bool state = execution_; - execution_ = true; - - bool ret = execute(); - - execution_ = state; - return ret; -} - - // ************************************************************************* // diff --git a/src/OpenFOAM/db/functionObjectList/functionObjectList.H b/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.H similarity index 91% rename from src/OpenFOAM/db/functionObjectList/functionObjectList.H rename to src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.H index 374e23775b12f09bfb2fae604a3dc25729608e33..ea2c43adf328e285fcde866a85a9997449ce8353 100644 --- a/src/OpenFOAM/db/functionObjectList/functionObjectList.H +++ b/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.H @@ -26,8 +26,8 @@ Class Foam::functionObjectList Description - List of function objects with execute() function that is called for each - object. + List of function objects with start(), execute() and end() functions + that is called for each object. See Also Foam::functionObject and Foam::OutputFilterFunctionObject @@ -147,22 +147,18 @@ public: virtual bool status() const; - //- Start is called at the start of the time-loop + //- Called at the start of the time-loop virtual bool start(); - //- Execute is called at each ++ or += of the time-loop + //- Called at each ++ or += of the time-loop virtual bool execute(); + //- Called when Time::run() determines that the time-loop exits + virtual bool end(); + //- Read and set the function objects if their data have changed virtual bool read(); - - //- Call start() manually regardless of the execution status - virtual bool manualStart(); - - //- Call execute() manually regardless of the execution status - virtual bool manualExecute(); - }; diff --git a/src/sampling/outputFilters/outputFilterOutputControl/outputFilterOutputControl.C b/src/OpenFOAM/db/functionObjects/outputFilterOutputControl/outputFilterOutputControl.C similarity index 100% rename from src/sampling/outputFilters/outputFilterOutputControl/outputFilterOutputControl.C rename to src/OpenFOAM/db/functionObjects/outputFilterOutputControl/outputFilterOutputControl.C diff --git a/src/sampling/outputFilters/outputFilterOutputControl/outputFilterOutputControl.H b/src/OpenFOAM/db/functionObjects/outputFilterOutputControl/outputFilterOutputControl.H similarity index 100% rename from src/sampling/outputFilters/outputFilterOutputControl/outputFilterOutputControl.H rename to src/OpenFOAM/db/functionObjects/outputFilterOutputControl/outputFilterOutputControl.H diff --git a/src/postProcessing/functionObjects/field/fieldAverage/fieldAverage/fieldAverage.C b/src/postProcessing/functionObjects/field/fieldAverage/fieldAverage/fieldAverage.C index b9c4023401a4fbcb744cacc684fc6e567aef531d..b3ca4f6d4df0a0466fd0bb560deffa6708e855d8 100644 --- a/src/postProcessing/functionObjects/field/fieldAverage/fieldAverage/fieldAverage.C +++ b/src/postProcessing/functionObjects/field/fieldAverage/fieldAverage/fieldAverage.C @@ -255,6 +255,15 @@ void Foam::fieldAverage::execute() } +void Foam::fieldAverage::end() +{ + if (active_) + { + calcAverages(); + } +} + + void Foam::fieldAverage::write() { if (active_) diff --git a/src/postProcessing/functionObjects/field/fieldAverage/fieldAverage/fieldAverage.H b/src/postProcessing/functionObjects/field/fieldAverage/fieldAverage/fieldAverage.H index 2cb245b14d0c387c9f1cbbf14bd13f50f079c646..435bb2746db274f4555bdfd39bb3c40908cf53eb 100644 --- a/src/postProcessing/functionObjects/field/fieldAverage/fieldAverage/fieldAverage.H +++ b/src/postProcessing/functionObjects/field/fieldAverage/fieldAverage/fieldAverage.H @@ -41,7 +41,7 @@ Description // averaging info if available cleanRestart true; - // Fields to be probed. runTime modifiable! + // Fields to be averaged. runTime modifiable! fields ( U @@ -281,6 +281,9 @@ public: //- Execute the averaging virtual void execute(); + //- Execute the averaging at the final time-loop + virtual void end(); + //- Calculate the field average data and write virtual void write(); }; diff --git a/src/postProcessing/functionObjects/field/fieldAverage/fieldAverageItem/fieldAverageItemIO.C b/src/postProcessing/functionObjects/field/fieldAverage/fieldAverageItem/fieldAverageItemIO.C index 82c934e1941f63b8f5fb512fc13a0538828387d6..d149063b0601edf260391eba4bec9516e30e93dd 100644 --- a/src/postProcessing/functionObjects/field/fieldAverage/fieldAverageItem/fieldAverageItemIO.C +++ b/src/postProcessing/functionObjects/field/fieldAverage/fieldAverageItem/fieldAverageItemIO.C @@ -76,14 +76,12 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const fieldAverageItem& faItem) "(Foam::Ostream&, const Foam::fieldAverageItem&)" ); - os<< faItem.fieldName_ << nl; - os<< token::BEGIN_BLOCK << nl; + os << faItem.fieldName_ << nl << token::BEGIN_BLOCK << nl; os.writeKeyword("mean") << faItem.mean_ << token::END_STATEMENT << nl; os.writeKeyword("prime2Mean") << faItem.mean_ << token::END_STATEMENT << nl; os.writeKeyword("base") << faItem.baseTypeNames_[faItem.base_] - << token::END_STATEMENT << nl; - os<< token::END_BLOCK << nl; + << token::END_STATEMENT << nl << token::END_BLOCK << nl; os.check ( diff --git a/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMax.C b/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMax.C index 051f9f9a6dc95b7ce492557f245e0636f8899a7b..509e483f2b79c0b07b7d928a998f9d1b8b67f1fe 100644 --- a/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMax.C +++ b/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMax.C @@ -163,6 +163,13 @@ void Foam::fieldMinMax::execute() // Do nothing - only valid on write } + +void Foam::fieldMinMax::end() +{ + // Do nothing - only valid on write +} + + void Foam::fieldMinMax::write() { if (active_) diff --git a/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMax.H b/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMax.H index 17cfcf54e333083cfca9a3f89228d7305b874a2a..812359f71caa3edffcf8b43629c58db520f05823 100644 --- a/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMax.H +++ b/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMax.H @@ -80,8 +80,8 @@ protected: // Protected data - //- Name of this set of forces, - // Also used as the name of the probes directory. + //- Name of this set of field min/max. + // Also used as the name of the output directory. word name_; const objectRegistry& obr_; @@ -108,7 +108,7 @@ protected: // Private Member Functions - //- If the forces file has not been created create it + //- If the output file has not been created create it void makeFile(); //- Disallow default bitwise copy construct @@ -147,18 +147,21 @@ public: // Member Functions - //- Return name of the set of forces + //- Return name of the set of field min/max virtual const word& name() const { return name_; } - //- Read the forces data + //- Read the field min/max data virtual void read(const dictionary&); - //- Execute + //- Execute, currently does nothing virtual void execute(); + //- Execute at the final time-loop, currently does nothing + virtual void end(); + //- Calculate the field min/max template<class Type> void calcMinMaxFields(const word& fieldName); diff --git a/src/postProcessing/functionObjects/forces/forceCoeffs/forceCoeffs.C b/src/postProcessing/functionObjects/forces/forceCoeffs/forceCoeffs.C index d76b7fdd2856cea2adbab9129fc473e5c974faab..5fe1b846707dcd266b5fc67b536c34a3ac8b9dc8 100644 --- a/src/postProcessing/functionObjects/forces/forceCoeffs/forceCoeffs.C +++ b/src/postProcessing/functionObjects/forces/forceCoeffs/forceCoeffs.C @@ -104,6 +104,12 @@ void Foam::forceCoeffs::execute() } +void Foam::forceCoeffs::end() +{ + // Do nothing - only valid on write +} + + void Foam::forceCoeffs::write() { if (active_) diff --git a/src/postProcessing/functionObjects/forces/forceCoeffs/forceCoeffs.H b/src/postProcessing/functionObjects/forces/forceCoeffs/forceCoeffs.H index 87e6cf47c84a23abba7dce113a23d1d7119452f8..d9a948db0896e2115d8de42adf671ef98315de51 100644 --- a/src/postProcessing/functionObjects/forces/forceCoeffs/forceCoeffs.H +++ b/src/postProcessing/functionObjects/forces/forceCoeffs/forceCoeffs.H @@ -126,9 +126,12 @@ public: //- Read the forces data virtual void read(const dictionary&); - //- Execute + //- Execute, currently does nothing virtual void execute(); + //- Execute at the final time-loop, currently does nothing + virtual void end(); + //- Write the forces virtual void write(); }; diff --git a/src/postProcessing/functionObjects/forces/forces/forces.C b/src/postProcessing/functionObjects/forces/forces/forces.C index 3ed12ef475e35e9cc3cd48d10959bc10001954cd..3fb9cc135a3d571cd7a218aa5c5a497ebcb8a99c 100644 --- a/src/postProcessing/functionObjects/forces/forces/forces.C +++ b/src/postProcessing/functionObjects/forces/forces/forces.C @@ -273,6 +273,13 @@ void Foam::forces::execute() // Do nothing - only valid on write } + +void Foam::forces::end() +{ + // Do nothing - only valid on write +} + + void Foam::forces::write() { if (active_) diff --git a/src/postProcessing/functionObjects/forces/forces/forces.H b/src/postProcessing/functionObjects/forces/forces/forces.H index 08d9d09ce2195d1d618f3af639710fb7cda47a1f..73edae9da13c1aa12ba87c34fd03bbd8bccdc208 100644 --- a/src/postProcessing/functionObjects/forces/forces/forces.H +++ b/src/postProcessing/functionObjects/forces/forces/forces.H @@ -200,9 +200,12 @@ public: //- Read the forces data virtual void read(const dictionary&); - //- Execute + //- Execute, currently does nothing virtual void execute(); + //- Execute at the final time-loop, currently does nothing + virtual void end(); + //- Write the forces virtual void write(); diff --git a/src/postProcessing/functionObjects/systemCall/systemCall.C b/src/postProcessing/functionObjects/systemCall/systemCall.C index f0cc9f9c08886d3577ad6375ef412ff41538f1ba..6fdf84d70c6adf76c53cb729e58d4667e38b9379 100644 --- a/src/postProcessing/functionObjects/systemCall/systemCall.C +++ b/src/postProcessing/functionObjects/systemCall/systemCall.C @@ -41,15 +41,14 @@ namespace Foam Foam::systemCall::systemCall ( const word& name, - const objectRegistry& obr, + const objectRegistry&, const dictionary& dict, - const bool loadFromFiles + const bool ) : name_(name), - obr_(obr), - active_(true), executeCalls_(), + endCalls_(), writeCalls_() { read(dict); @@ -66,8 +65,16 @@ Foam::systemCall::~systemCall() void Foam::systemCall::read(const dictionary& dict) { - dict.lookup("executeCalls") >> executeCalls_; - dict.lookup("writeCalls") >> writeCalls_; + dict.readIfPresent("executeCalls", executeCalls_); + dict.readIfPresent("endCalls", endCalls_); + dict.readIfPresent("writeCalls", writeCalls_); + + if (executeCalls_.empty() && endCalls_.empty() && writeCalls_.empty()) + { + WarningIn("Foam::system::read(const dictionary&)") + << "no executeCalls, endCalls or writeCalls defined." + << endl; + } } @@ -79,6 +86,16 @@ void Foam::systemCall::execute() } } + +void Foam::systemCall::end() +{ + forAll(endCalls_, callI) + { + ::system(endCalls_[callI].c_str()); + } +} + + void Foam::systemCall::write() { forAll(writeCalls_, callI) diff --git a/src/postProcessing/functionObjects/systemCall/systemCall.H b/src/postProcessing/functionObjects/systemCall/systemCall.H index e516159b695868ae1458e307303bd9024c166761..6dc8fed5294e6f3d7a8b58f17208581cb09437d3 100644 --- a/src/postProcessing/functionObjects/systemCall/systemCall.H +++ b/src/postProcessing/functionObjects/systemCall/systemCall.H @@ -63,14 +63,12 @@ protected: //- Name of this set of system calls word name_; - const objectRegistry& obr_; - - //- on/off switch - bool active_; - //- List of calls to execute - every step stringList executeCalls_; + //- List of calls to execute when exiting the time-loop + stringList endCalls_; + //- List of calls to execute - write steps stringList writeCalls_; @@ -97,9 +95,9 @@ public: systemCall ( const word& name, - const objectRegistry&, + const objectRegistry& unused, const dictionary&, - const bool loadFromFiles = false + const bool loadFromFilesUnused = false ); @@ -119,10 +117,13 @@ public: //- Read the system calls virtual void read(const dictionary&); - //- Execute + //- Execute the "executeCalls" at each time-step virtual void execute(); - //- Write + //- Execute the "endCalls" at the final time-loop + virtual void end(); + + //- Write, execute the "writeCalls" virtual void write(); //- Update for changes of mesh diff --git a/src/postProcessing/functionObjects/utilities/dynamicPressure/dynamicPressure.C b/src/postProcessing/functionObjects/utilities/dynamicPressure/dynamicPressure.C index f5398a84415853923a3296156271e2dbe452c5b8..a31c913ba78a4a515d38ee93cf5b57e6a4b4bf90 100644 --- a/src/postProcessing/functionObjects/utilities/dynamicPressure/dynamicPressure.C +++ b/src/postProcessing/functionObjects/utilities/dynamicPressure/dynamicPressure.C @@ -58,7 +58,7 @@ Foam::dynamicPressure::dynamicPressure name_(name), obr_(obr), active_(true), - pName_(dict.lookup("p")), + pName_(dict.lookupOrDefault<word>("p", "p")), rho_(readScalar(dict.lookup("rho"))) { // Check if the available mesh is an fvMesh, otherwise deactivate @@ -68,7 +68,7 @@ Foam::dynamicPressure::dynamicPressure WarningIn ( "dynamicPressure::dynamicPressure" - "(const objectRegistry& obr, const dictionary& dict)" + "(const objectRegistry&, const dictionary&)" ) << "No fvMesh available, deactivating." << nl << endl; } @@ -81,7 +81,7 @@ Foam::dynamicPressure::dynamicPressure WarningIn ( "dynamicPressure::dynamicPressure" - "(const objectRegistry& obr, const dictionary& dict)" + "(const objectRegistry&, const dictionary&)" ) << "Pressure is not kinematic pressure, deactivating." << nl << endl; } @@ -103,7 +103,7 @@ void Foam::dynamicPressure::read(const dictionary& dict) { if (active_) { - dict.lookup("p") >> pName_; + dict.readIfPresent("p", pName_); dict.lookup("rho") >> rho_; } } @@ -115,6 +115,12 @@ void Foam::dynamicPressure::execute() } +void Foam::dynamicPressure::end() +{ + // Do nothing - only valid on write +} + + void Foam::dynamicPressure::write() { if (active_) diff --git a/src/postProcessing/functionObjects/utilities/dynamicPressure/dynamicPressure.H b/src/postProcessing/functionObjects/utilities/dynamicPressure/dynamicPressure.H index cf7f5530f3d8dfa258bbb4171f6d660065aaaacb..c3c6bdbb0f3d60afe65274a0bdbb014a260bdd38 100644 --- a/src/postProcessing/functionObjects/utilities/dynamicPressure/dynamicPressure.H +++ b/src/postProcessing/functionObjects/utilities/dynamicPressure/dynamicPressure.H @@ -66,10 +66,10 @@ class dynamicPressure //- on/off switch bool active_; - //- Name of pressure field + //- Name of pressure field, default is "p" word pName_; - //- Density + //- Density value scalar rho_; @@ -120,9 +120,12 @@ public: //- Read the dynamicPressure data virtual void read(const dictionary&); - //- Execute + //- Execute, currently does nothing virtual void execute(); + //- Execute at the final time-loop, currently does nothing + virtual void end(); + //- Calculate the dynamicPressure and write virtual void write(); diff --git a/src/sampling/Make/files b/src/sampling/Make/files index 004f81d435793d392ca76af730cd3c28509d5faa..c52803251940c51fa2ee40d702e4a25be6bd3760 100644 --- a/src/sampling/Make/files +++ b/src/sampling/Make/files @@ -48,8 +48,6 @@ graphField/writePatchGraph.C graphField/writeCellGraph.C graphField/makeGraph.C -outputFilters/outputFilterOutputControl/outputFilterOutputControl.C - meshToMesh = meshToMeshInterpolation/meshToMesh $(meshToMesh)/meshToMesh.C $(meshToMesh)/calculateMeshToMeshAddressing.C diff --git a/src/sampling/probes/probes.C b/src/sampling/probes/probes.C index f0596ea5631a7431e26552f9ae4d2c4c77e22b26..91c588c6d3ef1128ca0d7f47325f092cd027c0a8 100644 --- a/src/sampling/probes/probes.C +++ b/src/sampling/probes/probes.C @@ -304,6 +304,12 @@ void Foam::probes::execute() } +void Foam::probes::end() +{ + // Do nothing - only valid on write +} + + void Foam::probes::write() { if (probeLocations_.size() && checkFieldTypes()) diff --git a/src/sampling/probes/probes.H b/src/sampling/probes/probes.H index 27c2a9a3bb6c97ef72650ea8d980a182589f4a0f..33e4f39e25056cda02b95f87a2fa8ae676ad5869 100644 --- a/src/sampling/probes/probes.H +++ b/src/sampling/probes/probes.H @@ -194,15 +194,18 @@ public: return cellList_; } + //- Execute, currently does nothing + virtual void execute(); + + //- Execute at the final time-loop, currently does nothing + virtual void end(); + //- Sample and write virtual void write(); //- Read the probes virtual void read(const dictionary&); - //- Execute - virtual void execute(); - //- Update for changes of mesh virtual void updateMesh(const mapPolyMesh&) {} diff --git a/src/sampling/sampledSet/sampledSets/sampledSets.C b/src/sampling/sampledSet/sampledSets/sampledSets.C index f09a82e30aeab74afb48ce2e390fc1b1721afbd7..621efba7a51244df2150d9105e97dac5168ab1bf 100644 --- a/src/sampling/sampledSet/sampledSets/sampledSets.C +++ b/src/sampling/sampledSet/sampledSets/sampledSets.C @@ -275,6 +275,12 @@ void Foam::sampledSets::execute() } +void Foam::sampledSets::end() +{ + // Do nothing - only valid on write +} + + void Foam::sampledSets::write() { if (size() && checkFieldTypes()) diff --git a/src/sampling/sampledSet/sampledSets/sampledSets.H b/src/sampling/sampledSet/sampledSets/sampledSets.H index baf21e450bfe47f2ba4da9a07ea15d363de40b31..da38f9e1c50ef5d43adf9426fb0517dbadd94a9a 100644 --- a/src/sampling/sampledSet/sampledSets/sampledSets.H +++ b/src/sampling/sampledSet/sampledSets/sampledSets.H @@ -270,9 +270,12 @@ public: //- set verbosity level void verbose(const bool verbosity = true); - //- Execute + //- Execute, currently does nothing virtual void execute(); + //- Execute at the final time-loop, currently does nothing + virtual void end(); + //- Sample and write virtual void write(); diff --git a/src/sampling/sampledSurface/isoSurface/sampledIsoSurface.C b/src/sampling/sampledSurface/isoSurface/sampledIsoSurface.C index 2cbe93c40abd1c863bdb73de74f7fc9f54079f1b..5fd09bda66e9ba888e5f0212c05cca58c567a70f 100644 --- a/src/sampling/sampledSurface/isoSurface/sampledIsoSurface.C +++ b/src/sampling/sampledSurface/isoSurface/sampledIsoSurface.C @@ -335,7 +335,7 @@ bool Foam::sampledIsoSurface::updateGeometry() const subMeshPtr_.reset ( - new fvMeshSubset(static_cast<const fvMesh&>(mesh())) + new fvMeshSubset(fvm) ); subMeshPtr_().setLargeCellSubset ( diff --git a/src/sampling/sampledSurface/isoSurface/sampledIsoSurface.H b/src/sampling/sampledSurface/isoSurface/sampledIsoSurface.H index 4cf334ecbd504924344a3b6a4b51224f3a9ffbdc..99324cdf5f398a66b1f1e3416d1454e12ff07f20 100644 --- a/src/sampling/sampledSurface/isoSurface/sampledIsoSurface.H +++ b/src/sampling/sampledSurface/isoSurface/sampledIsoSurface.H @@ -87,7 +87,7 @@ class sampledIsoSurface // Recreated for every isoSurface - //- Time at last call, also track it surface needs an update + //- Time at last call, also track if surface needs an update mutable label prevTimeIndex_; //- Cached volfield diff --git a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.C b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.C index 003515c7d403160b9f41119016ce45ffee38639a..9eb0e73f1116eeef237df6f048fe5738e6796712 100644 --- a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.C +++ b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.C @@ -203,7 +203,6 @@ Foam::sampledSurfaces::~sampledSurfaces() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - void Foam::sampledSurfaces::verbose(const bool verbosity) { verbose_ = verbosity; @@ -216,6 +215,12 @@ void Foam::sampledSurfaces::execute() } +void Foam::sampledSurfaces::end() +{ + // Do nothing - only valid on write +} + + void Foam::sampledSurfaces::write() { if (size() && checkFieldTypes()) diff --git a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.H b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.H index 263578340906a08937a80a6cc9f55aa444ad17db..7bf12aaba8e1099501ef31424a3917f1c4562a34 100644 --- a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.H +++ b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.H @@ -257,9 +257,12 @@ public: //- set verbosity level void verbose(const bool verbosity = true); - //- Execute + //- Execute, currently does nothing virtual void execute(); + //- Execute at the final time-loop, currently does nothing + virtual void end(); + //- Sample and write virtual void write();