mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Time and functionObject updated for end()
- added end() method to functionObject, functionObjectList & associated classes - moved outputFilters from src/sampling -> src/OpenFOAM/db/functionObjects
This commit is contained in:
@ -144,11 +144,14 @@ $(regIOobject)/regIOobjectWrite.C
|
|||||||
|
|
||||||
db/IOobjectList/IOobjectList.C
|
db/IOobjectList/IOobjectList.C
|
||||||
db/objectRegistry/objectRegistry.C
|
db/objectRegistry/objectRegistry.C
|
||||||
db/functionObject/functionObject.C
|
|
||||||
db/functionObjectList/functionObjectList.C
|
|
||||||
db/CallbackRegistry/CallbackRegistryName.C
|
db/CallbackRegistry/CallbackRegistryName.C
|
||||||
db/dlLibraryTable/dlLibraryTable.C
|
db/dlLibraryTable/dlLibraryTable.C
|
||||||
|
|
||||||
|
db/functionObjects/functionObject/functionObject.C
|
||||||
|
db/functionObjects/functionObjectList/functionObjectList.C
|
||||||
|
db/functionObjects/outputFilterOutputControl/outputFilterOutputControl.C
|
||||||
|
|
||||||
|
|
||||||
Time = db/Time
|
Time = db/Time
|
||||||
$(Time)/TimePaths.C
|
$(Time)/TimePaths.C
|
||||||
$(Time)/TimeState.C
|
$(Time)/TimeState.C
|
||||||
|
|||||||
@ -498,8 +498,8 @@ bool Foam::Time::run() const
|
|||||||
// ie, when exiting the control loop
|
// ie, when exiting the control loop
|
||||||
if (!running && timeIndex_ != startTimeIndex_)
|
if (!running && timeIndex_ != startTimeIndex_)
|
||||||
{
|
{
|
||||||
// Note, the execute() also calls an indirect start() if required
|
// Note, end() also calls an indirect start() as required
|
||||||
functionObjects_.execute();
|
functionObjects_.end();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -509,8 +509,7 @@ bool Foam::Time::run() const
|
|||||||
|
|
||||||
bool Foam::Time::end() const
|
bool Foam::Time::end() const
|
||||||
{
|
{
|
||||||
bool done = value() > (endTime_ + 0.5*deltaT_);
|
return value() > (endTime_ + 0.5*deltaT_);
|
||||||
return done;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -348,16 +348,28 @@ public:
|
|||||||
|
|
||||||
// Check
|
// Check
|
||||||
|
|
||||||
//- Return true if run should continue
|
//- Return true if run should continue,
|
||||||
// @sa end()
|
// also invokes the functionObjectList::end() method
|
||||||
|
// when the time goes out of range
|
||||||
// @note
|
// @note
|
||||||
// the rounding heuristics near endTime mean that
|
// For correct baheviour, the following style of time-loop
|
||||||
// @code run() @endcode and @code !end() @endcode may
|
// is recommended:
|
||||||
// not yield the same result
|
// @code
|
||||||
|
// while (runTime.run())
|
||||||
|
// {
|
||||||
|
// runTime++;
|
||||||
|
// solve;
|
||||||
|
// runTime.write();
|
||||||
|
// }
|
||||||
|
// @endcode
|
||||||
virtual bool run() const;
|
virtual bool run() const;
|
||||||
|
|
||||||
//- Return true if end of run
|
//- Return true if end of run,
|
||||||
// @sa 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;
|
virtual bool end() const;
|
||||||
|
|
||||||
|
|
||||||
@ -406,13 +418,15 @@ public:
|
|||||||
|
|
||||||
// Member operators
|
// 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&);
|
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);
|
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++();
|
virtual Time& operator++();
|
||||||
|
|
||||||
//- Postfix increment, this is identical to the prefix increment
|
//- Postfix increment, this is identical to the prefix increment
|
||||||
|
|||||||
@ -65,6 +65,20 @@ Foam::OutputFilterFunctionObject<OutputFilter>::OutputFilterFunctionObject
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * 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>
|
template<class OutputFilter>
|
||||||
bool Foam::OutputFilterFunctionObject<OutputFilter>::start()
|
bool Foam::OutputFilterFunctionObject<OutputFilter>::start()
|
||||||
{
|
{
|
||||||
@ -120,16 +134,19 @@ bool Foam::OutputFilterFunctionObject<OutputFilter>::execute()
|
|||||||
|
|
||||||
|
|
||||||
template<class OutputFilter>
|
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>
|
return true;
|
||||||
void Foam::OutputFilterFunctionObject<OutputFilter>::off()
|
|
||||||
{
|
|
||||||
enabled_ = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ namespace Foam
|
|||||||
{
|
{
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class OutputFilterFunctionObject Declaration
|
Class OutputFilterFunctionObject Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
template<class OutputFilter>
|
template<class OutputFilter>
|
||||||
@ -69,7 +69,7 @@ class OutputFilterFunctionObject
|
|||||||
word regionName_;
|
word regionName_;
|
||||||
word dictName_;
|
word dictName_;
|
||||||
|
|
||||||
//- Switch for the execution of the functionObjects
|
//- Switch for the execution of the functionObject
|
||||||
bool enabled_;
|
bool enabled_;
|
||||||
|
|
||||||
outputFilterOutputControl outputControl_;
|
outputFilterOutputControl outputControl_;
|
||||||
@ -114,18 +114,23 @@ public:
|
|||||||
return name_;
|
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
|
//- Switch the function object on
|
||||||
virtual void on();
|
virtual void on();
|
||||||
|
|
||||||
//- Switch the function object off
|
//- Switch the function object off
|
||||||
virtual void 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
|
//- Read and set the function object if its data have changed
|
||||||
virtual bool read(const dictionary&);
|
virtual bool read(const dictionary&);
|
||||||
};
|
};
|
||||||
@ -103,6 +103,12 @@ Foam::functionObject::~functionObject()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
bool Foam::functionObject::end()
|
||||||
|
{
|
||||||
|
return execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::autoPtr<Foam::functionObject> Foam::functionObject::iNew::operator()
|
Foam::autoPtr<Foam::functionObject> Foam::functionObject::iNew::operator()
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
@ -137,12 +137,16 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- start is called at the start of the time-loop
|
//- Called at the start of the time-loop
|
||||||
virtual bool start() = 0;
|
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;
|
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
|
//- Read and set the function object if its data have changed
|
||||||
virtual bool read(const dictionary&) = 0;
|
virtual bool read(const dictionary&) = 0;
|
||||||
};
|
};
|
||||||
@ -142,7 +142,12 @@ bool Foam::functionObjectList::execute()
|
|||||||
read();
|
read();
|
||||||
}
|
}
|
||||||
|
|
||||||
forAllIter(PtrList<functionObject>, *this, iter)
|
forAllIter
|
||||||
|
(
|
||||||
|
PtrList<functionObject>,
|
||||||
|
static_cast<PtrList<functionObject>&>(*this),
|
||||||
|
iter
|
||||||
|
)
|
||||||
{
|
{
|
||||||
ok = iter().execute() && ok;
|
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 Foam::functionObjectList::read()
|
||||||
{
|
{
|
||||||
bool ok = true;
|
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
@ -26,8 +26,8 @@ Class
|
|||||||
Foam::functionObjectList
|
Foam::functionObjectList
|
||||||
|
|
||||||
Description
|
Description
|
||||||
List of function objects with execute() function that is called for each
|
List of function objects with start(), execute() and end() functions
|
||||||
object.
|
that is called for each object.
|
||||||
|
|
||||||
See Also
|
See Also
|
||||||
Foam::functionObject and Foam::OutputFilterFunctionObject
|
Foam::functionObject and Foam::OutputFilterFunctionObject
|
||||||
@ -147,22 +147,18 @@ public:
|
|||||||
virtual bool status() const;
|
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();
|
virtual bool start();
|
||||||
|
|
||||||
//- Execute is called at each ++ or += of the time-loop
|
//- Called at each ++ or += of the time-loop
|
||||||
virtual bool execute();
|
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
|
//- Read and set the function objects if their data have changed
|
||||||
virtual bool read();
|
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();
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -255,6 +255,15 @@ void Foam::fieldAverage::execute()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::fieldAverage::end()
|
||||||
|
{
|
||||||
|
if (active_)
|
||||||
|
{
|
||||||
|
calcAverages();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::fieldAverage::write()
|
void Foam::fieldAverage::write()
|
||||||
{
|
{
|
||||||
if (active_)
|
if (active_)
|
||||||
|
|||||||
@ -41,7 +41,7 @@ Description
|
|||||||
// averaging info if available
|
// averaging info if available
|
||||||
cleanRestart true;
|
cleanRestart true;
|
||||||
|
|
||||||
// Fields to be probed. runTime modifiable!
|
// Fields to be averaged. runTime modifiable!
|
||||||
fields
|
fields
|
||||||
(
|
(
|
||||||
U
|
U
|
||||||
@ -281,6 +281,9 @@ public:
|
|||||||
//- Execute the averaging
|
//- Execute the averaging
|
||||||
virtual void execute();
|
virtual void execute();
|
||||||
|
|
||||||
|
//- Execute the averaging at the final time-loop
|
||||||
|
virtual void end();
|
||||||
|
|
||||||
//- Calculate the field average data and write
|
//- Calculate the field average data and write
|
||||||
virtual void write();
|
virtual void write();
|
||||||
};
|
};
|
||||||
|
|||||||
@ -76,14 +76,12 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const fieldAverageItem& faItem)
|
|||||||
"(Foam::Ostream&, const Foam::fieldAverageItem&)"
|
"(Foam::Ostream&, const Foam::fieldAverageItem&)"
|
||||||
);
|
);
|
||||||
|
|
||||||
os<< faItem.fieldName_ << nl;
|
os << faItem.fieldName_ << nl << token::BEGIN_BLOCK << nl;
|
||||||
os<< token::BEGIN_BLOCK << nl;
|
|
||||||
os.writeKeyword("mean") << faItem.mean_ << token::END_STATEMENT << nl;
|
os.writeKeyword("mean") << faItem.mean_ << token::END_STATEMENT << nl;
|
||||||
os.writeKeyword("prime2Mean") << faItem.mean_
|
os.writeKeyword("prime2Mean") << faItem.mean_
|
||||||
<< token::END_STATEMENT << nl;
|
<< token::END_STATEMENT << nl;
|
||||||
os.writeKeyword("base") << faItem.baseTypeNames_[faItem.base_]
|
os.writeKeyword("base") << faItem.baseTypeNames_[faItem.base_]
|
||||||
<< token::END_STATEMENT << nl;
|
<< token::END_STATEMENT << nl << token::END_BLOCK << nl;
|
||||||
os<< token::END_BLOCK << nl;
|
|
||||||
|
|
||||||
os.check
|
os.check
|
||||||
(
|
(
|
||||||
|
|||||||
@ -163,6 +163,13 @@ void Foam::fieldMinMax::execute()
|
|||||||
// Do nothing - only valid on write
|
// Do nothing - only valid on write
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::fieldMinMax::end()
|
||||||
|
{
|
||||||
|
// Do nothing - only valid on write
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::fieldMinMax::write()
|
void Foam::fieldMinMax::write()
|
||||||
{
|
{
|
||||||
if (active_)
|
if (active_)
|
||||||
|
|||||||
@ -80,8 +80,8 @@ protected:
|
|||||||
|
|
||||||
// Protected data
|
// Protected data
|
||||||
|
|
||||||
//- Name of this set of forces,
|
//- Name of this set of field min/max.
|
||||||
// Also used as the name of the probes directory.
|
// Also used as the name of the output directory.
|
||||||
word name_;
|
word name_;
|
||||||
|
|
||||||
const objectRegistry& obr_;
|
const objectRegistry& obr_;
|
||||||
@ -108,7 +108,7 @@ protected:
|
|||||||
|
|
||||||
// Private Member Functions
|
// 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();
|
void makeFile();
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct
|
//- Disallow default bitwise copy construct
|
||||||
@ -147,18 +147,21 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Return name of the set of forces
|
//- Return name of the set of field min/max
|
||||||
virtual const word& name() const
|
virtual const word& name() const
|
||||||
{
|
{
|
||||||
return name_;
|
return name_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Read the forces data
|
//- Read the field min/max data
|
||||||
virtual void read(const dictionary&);
|
virtual void read(const dictionary&);
|
||||||
|
|
||||||
//- Execute
|
//- Execute, currently does nothing
|
||||||
virtual void execute();
|
virtual void execute();
|
||||||
|
|
||||||
|
//- Execute at the final time-loop, currently does nothing
|
||||||
|
virtual void end();
|
||||||
|
|
||||||
//- Calculate the field min/max
|
//- Calculate the field min/max
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void calcMinMaxFields(const word& fieldName);
|
void calcMinMaxFields(const word& fieldName);
|
||||||
|
|||||||
@ -104,6 +104,12 @@ void Foam::forceCoeffs::execute()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::forceCoeffs::end()
|
||||||
|
{
|
||||||
|
// Do nothing - only valid on write
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::forceCoeffs::write()
|
void Foam::forceCoeffs::write()
|
||||||
{
|
{
|
||||||
if (active_)
|
if (active_)
|
||||||
|
|||||||
@ -126,9 +126,12 @@ public:
|
|||||||
//- Read the forces data
|
//- Read the forces data
|
||||||
virtual void read(const dictionary&);
|
virtual void read(const dictionary&);
|
||||||
|
|
||||||
//- Execute
|
//- Execute, currently does nothing
|
||||||
virtual void execute();
|
virtual void execute();
|
||||||
|
|
||||||
|
//- Execute at the final time-loop, currently does nothing
|
||||||
|
virtual void end();
|
||||||
|
|
||||||
//- Write the forces
|
//- Write the forces
|
||||||
virtual void write();
|
virtual void write();
|
||||||
};
|
};
|
||||||
|
|||||||
@ -273,6 +273,13 @@ void Foam::forces::execute()
|
|||||||
// Do nothing - only valid on write
|
// Do nothing - only valid on write
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::forces::end()
|
||||||
|
{
|
||||||
|
// Do nothing - only valid on write
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::forces::write()
|
void Foam::forces::write()
|
||||||
{
|
{
|
||||||
if (active_)
|
if (active_)
|
||||||
|
|||||||
@ -200,9 +200,12 @@ public:
|
|||||||
//- Read the forces data
|
//- Read the forces data
|
||||||
virtual void read(const dictionary&);
|
virtual void read(const dictionary&);
|
||||||
|
|
||||||
//- Execute
|
//- Execute, currently does nothing
|
||||||
virtual void execute();
|
virtual void execute();
|
||||||
|
|
||||||
|
//- Execute at the final time-loop, currently does nothing
|
||||||
|
virtual void end();
|
||||||
|
|
||||||
//- Write the forces
|
//- Write the forces
|
||||||
virtual void write();
|
virtual void write();
|
||||||
|
|
||||||
|
|||||||
@ -41,15 +41,14 @@ namespace Foam
|
|||||||
Foam::systemCall::systemCall
|
Foam::systemCall::systemCall
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const objectRegistry& obr,
|
const objectRegistry&,
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
const bool loadFromFiles
|
const bool
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
name_(name),
|
name_(name),
|
||||||
obr_(obr),
|
|
||||||
active_(true),
|
|
||||||
executeCalls_(),
|
executeCalls_(),
|
||||||
|
endCalls_(),
|
||||||
writeCalls_()
|
writeCalls_()
|
||||||
{
|
{
|
||||||
read(dict);
|
read(dict);
|
||||||
@ -66,8 +65,16 @@ Foam::systemCall::~systemCall()
|
|||||||
|
|
||||||
void Foam::systemCall::read(const dictionary& dict)
|
void Foam::systemCall::read(const dictionary& dict)
|
||||||
{
|
{
|
||||||
dict.lookup("executeCalls") >> executeCalls_;
|
dict.readIfPresent("executeCalls", executeCalls_);
|
||||||
dict.lookup("writeCalls") >> writeCalls_;
|
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()
|
void Foam::systemCall::write()
|
||||||
{
|
{
|
||||||
forAll(writeCalls_, callI)
|
forAll(writeCalls_, callI)
|
||||||
|
|||||||
@ -63,14 +63,12 @@ protected:
|
|||||||
//- Name of this set of system calls
|
//- Name of this set of system calls
|
||||||
word name_;
|
word name_;
|
||||||
|
|
||||||
const objectRegistry& obr_;
|
|
||||||
|
|
||||||
//- on/off switch
|
|
||||||
bool active_;
|
|
||||||
|
|
||||||
//- List of calls to execute - every step
|
//- List of calls to execute - every step
|
||||||
stringList executeCalls_;
|
stringList executeCalls_;
|
||||||
|
|
||||||
|
//- List of calls to execute when exiting the time-loop
|
||||||
|
stringList endCalls_;
|
||||||
|
|
||||||
//- List of calls to execute - write steps
|
//- List of calls to execute - write steps
|
||||||
stringList writeCalls_;
|
stringList writeCalls_;
|
||||||
|
|
||||||
@ -97,9 +95,9 @@ public:
|
|||||||
systemCall
|
systemCall
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const objectRegistry&,
|
const objectRegistry& unused,
|
||||||
const dictionary&,
|
const dictionary&,
|
||||||
const bool loadFromFiles = false
|
const bool loadFromFilesUnused = false
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -119,10 +117,13 @@ public:
|
|||||||
//- Read the system calls
|
//- Read the system calls
|
||||||
virtual void read(const dictionary&);
|
virtual void read(const dictionary&);
|
||||||
|
|
||||||
//- Execute
|
//- Execute the "executeCalls" at each time-step
|
||||||
virtual void execute();
|
virtual void execute();
|
||||||
|
|
||||||
//- Write
|
//- Execute the "endCalls" at the final time-loop
|
||||||
|
virtual void end();
|
||||||
|
|
||||||
|
//- Write, execute the "writeCalls"
|
||||||
virtual void write();
|
virtual void write();
|
||||||
|
|
||||||
//- Update for changes of mesh
|
//- Update for changes of mesh
|
||||||
|
|||||||
@ -58,7 +58,7 @@ Foam::dynamicPressure::dynamicPressure
|
|||||||
name_(name),
|
name_(name),
|
||||||
obr_(obr),
|
obr_(obr),
|
||||||
active_(true),
|
active_(true),
|
||||||
pName_(dict.lookup("p")),
|
pName_(dict.lookupOrDefault<word>("p", "p")),
|
||||||
rho_(readScalar(dict.lookup("rho")))
|
rho_(readScalar(dict.lookup("rho")))
|
||||||
{
|
{
|
||||||
// Check if the available mesh is an fvMesh, otherwise deactivate
|
// Check if the available mesh is an fvMesh, otherwise deactivate
|
||||||
@ -68,7 +68,7 @@ Foam::dynamicPressure::dynamicPressure
|
|||||||
WarningIn
|
WarningIn
|
||||||
(
|
(
|
||||||
"dynamicPressure::dynamicPressure"
|
"dynamicPressure::dynamicPressure"
|
||||||
"(const objectRegistry& obr, const dictionary& dict)"
|
"(const objectRegistry&, const dictionary&)"
|
||||||
) << "No fvMesh available, deactivating." << nl
|
) << "No fvMesh available, deactivating." << nl
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
@ -81,7 +81,7 @@ Foam::dynamicPressure::dynamicPressure
|
|||||||
WarningIn
|
WarningIn
|
||||||
(
|
(
|
||||||
"dynamicPressure::dynamicPressure"
|
"dynamicPressure::dynamicPressure"
|
||||||
"(const objectRegistry& obr, const dictionary& dict)"
|
"(const objectRegistry&, const dictionary&)"
|
||||||
) << "Pressure is not kinematic pressure, deactivating." << nl
|
) << "Pressure is not kinematic pressure, deactivating." << nl
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
@ -103,7 +103,7 @@ void Foam::dynamicPressure::read(const dictionary& dict)
|
|||||||
{
|
{
|
||||||
if (active_)
|
if (active_)
|
||||||
{
|
{
|
||||||
dict.lookup("p") >> pName_;
|
dict.readIfPresent("p", pName_);
|
||||||
dict.lookup("rho") >> rho_;
|
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()
|
void Foam::dynamicPressure::write()
|
||||||
{
|
{
|
||||||
if (active_)
|
if (active_)
|
||||||
|
|||||||
@ -66,10 +66,10 @@ class dynamicPressure
|
|||||||
//- on/off switch
|
//- on/off switch
|
||||||
bool active_;
|
bool active_;
|
||||||
|
|
||||||
//- Name of pressure field
|
//- Name of pressure field, default is "p"
|
||||||
word pName_;
|
word pName_;
|
||||||
|
|
||||||
//- Density
|
//- Density value
|
||||||
scalar rho_;
|
scalar rho_;
|
||||||
|
|
||||||
|
|
||||||
@ -120,9 +120,12 @@ public:
|
|||||||
//- Read the dynamicPressure data
|
//- Read the dynamicPressure data
|
||||||
virtual void read(const dictionary&);
|
virtual void read(const dictionary&);
|
||||||
|
|
||||||
//- Execute
|
//- Execute, currently does nothing
|
||||||
virtual void execute();
|
virtual void execute();
|
||||||
|
|
||||||
|
//- Execute at the final time-loop, currently does nothing
|
||||||
|
virtual void end();
|
||||||
|
|
||||||
//- Calculate the dynamicPressure and write
|
//- Calculate the dynamicPressure and write
|
||||||
virtual void write();
|
virtual void write();
|
||||||
|
|
||||||
|
|||||||
@ -48,8 +48,6 @@ graphField/writePatchGraph.C
|
|||||||
graphField/writeCellGraph.C
|
graphField/writeCellGraph.C
|
||||||
graphField/makeGraph.C
|
graphField/makeGraph.C
|
||||||
|
|
||||||
outputFilters/outputFilterOutputControl/outputFilterOutputControl.C
|
|
||||||
|
|
||||||
meshToMesh = meshToMeshInterpolation/meshToMesh
|
meshToMesh = meshToMeshInterpolation/meshToMesh
|
||||||
$(meshToMesh)/meshToMesh.C
|
$(meshToMesh)/meshToMesh.C
|
||||||
$(meshToMesh)/calculateMeshToMeshAddressing.C
|
$(meshToMesh)/calculateMeshToMeshAddressing.C
|
||||||
|
|||||||
@ -304,6 +304,12 @@ void Foam::probes::execute()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::probes::end()
|
||||||
|
{
|
||||||
|
// Do nothing - only valid on write
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::probes::write()
|
void Foam::probes::write()
|
||||||
{
|
{
|
||||||
if (probeLocations_.size() && checkFieldTypes())
|
if (probeLocations_.size() && checkFieldTypes())
|
||||||
|
|||||||
@ -194,15 +194,18 @@ public:
|
|||||||
return cellList_;
|
return cellList_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//- Execute, currently does nothing
|
||||||
|
virtual void execute();
|
||||||
|
|
||||||
|
//- Execute at the final time-loop, currently does nothing
|
||||||
|
virtual void end();
|
||||||
|
|
||||||
//- Sample and write
|
//- Sample and write
|
||||||
virtual void write();
|
virtual void write();
|
||||||
|
|
||||||
//- Read the probes
|
//- Read the probes
|
||||||
virtual void read(const dictionary&);
|
virtual void read(const dictionary&);
|
||||||
|
|
||||||
//- Execute
|
|
||||||
virtual void execute();
|
|
||||||
|
|
||||||
//- Update for changes of mesh
|
//- Update for changes of mesh
|
||||||
virtual void updateMesh(const mapPolyMesh&)
|
virtual void updateMesh(const mapPolyMesh&)
|
||||||
{}
|
{}
|
||||||
|
|||||||
@ -275,6 +275,12 @@ void Foam::sampledSets::execute()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::sampledSets::end()
|
||||||
|
{
|
||||||
|
// Do nothing - only valid on write
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::sampledSets::write()
|
void Foam::sampledSets::write()
|
||||||
{
|
{
|
||||||
if (size() && checkFieldTypes())
|
if (size() && checkFieldTypes())
|
||||||
|
|||||||
@ -270,9 +270,12 @@ public:
|
|||||||
//- set verbosity level
|
//- set verbosity level
|
||||||
void verbose(const bool verbosity = true);
|
void verbose(const bool verbosity = true);
|
||||||
|
|
||||||
//- Execute
|
//- Execute, currently does nothing
|
||||||
virtual void execute();
|
virtual void execute();
|
||||||
|
|
||||||
|
//- Execute at the final time-loop, currently does nothing
|
||||||
|
virtual void end();
|
||||||
|
|
||||||
//- Sample and write
|
//- Sample and write
|
||||||
virtual void write();
|
virtual void write();
|
||||||
|
|
||||||
|
|||||||
@ -335,7 +335,7 @@ bool Foam::sampledIsoSurface::updateGeometry() const
|
|||||||
|
|
||||||
subMeshPtr_.reset
|
subMeshPtr_.reset
|
||||||
(
|
(
|
||||||
new fvMeshSubset(static_cast<const fvMesh&>(mesh()))
|
new fvMeshSubset(fvm)
|
||||||
);
|
);
|
||||||
subMeshPtr_().setLargeCellSubset
|
subMeshPtr_().setLargeCellSubset
|
||||||
(
|
(
|
||||||
|
|||||||
@ -87,7 +87,7 @@ class sampledIsoSurface
|
|||||||
|
|
||||||
// Recreated for every isoSurface
|
// 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_;
|
mutable label prevTimeIndex_;
|
||||||
|
|
||||||
//- Cached volfield
|
//- Cached volfield
|
||||||
|
|||||||
@ -203,7 +203,6 @@ Foam::sampledSurfaces::~sampledSurfaces()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|
||||||
void Foam::sampledSurfaces::verbose(const bool verbosity)
|
void Foam::sampledSurfaces::verbose(const bool verbosity)
|
||||||
{
|
{
|
||||||
verbose_ = 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()
|
void Foam::sampledSurfaces::write()
|
||||||
{
|
{
|
||||||
if (size() && checkFieldTypes())
|
if (size() && checkFieldTypes())
|
||||||
|
|||||||
@ -257,9 +257,12 @@ public:
|
|||||||
//- set verbosity level
|
//- set verbosity level
|
||||||
void verbose(const bool verbosity = true);
|
void verbose(const bool verbosity = true);
|
||||||
|
|
||||||
//- Execute
|
//- Execute, currently does nothing
|
||||||
virtual void execute();
|
virtual void execute();
|
||||||
|
|
||||||
|
//- Execute at the final time-loop, currently does nothing
|
||||||
|
virtual void end();
|
||||||
|
|
||||||
//- Sample and write
|
//- Sample and write
|
||||||
virtual void write();
|
virtual void write();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user