mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: retain a list of solverPerformance in data
- reset when the iteration changes
This commit is contained in:
@ -45,7 +45,8 @@ Foam::data::data(const objectRegistry& obr)
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
)
|
||||
),
|
||||
prevTimeIndex_(0)
|
||||
{
|
||||
set("solverPerformance", dictionary());
|
||||
}
|
||||
@ -65,7 +66,25 @@ void Foam::data::setSolverPerformance
|
||||
const lduMatrix::solverPerformance& sp
|
||||
) const
|
||||
{
|
||||
const_cast<dictionary&>(solverPerformanceDict()).set(name, sp);
|
||||
dictionary& dict = const_cast<dictionary&>(solverPerformanceDict());
|
||||
|
||||
List<lduMatrix::solverPerformance> perfs;
|
||||
|
||||
if (prevTimeIndex_ != this->time().timeIndex())
|
||||
{
|
||||
// reset solver performance between iterations
|
||||
prevTimeIndex_ = this->time().timeIndex();
|
||||
dict.clear();
|
||||
}
|
||||
else
|
||||
{
|
||||
dict.readIfPresent(name, perfs);
|
||||
}
|
||||
|
||||
// append to list
|
||||
perfs.setSize(perfs.size()+1, sp);
|
||||
|
||||
dict.set(name, perfs);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -47,13 +47,19 @@ namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class data Declaration
|
||||
Class data Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class data
|
||||
:
|
||||
public IOdictionary
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Previously used time-index, used for reset between iterations
|
||||
mutable label prevTimeIndex_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
|
||||
Reference in New Issue
Block a user