Commit db8b5e6b authored by Mark Olesen's avatar Mark Olesen
Browse files

ENH: retain a list of solverPerformance in data

- reset when the iteration changes
parent 7b941b79
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment