Skip to content
Snippets Groups Projects
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
No related merge requests found
...@@ -45,7 +45,8 @@ Foam::data::data(const objectRegistry& obr) ...@@ -45,7 +45,8 @@ Foam::data::data(const objectRegistry& obr)
IOobject::NO_READ, IOobject::NO_READ,
IOobject::NO_WRITE IOobject::NO_WRITE
) )
) ),
prevTimeIndex_(0)
{ {
set("solverPerformance", dictionary()); set("solverPerformance", dictionary());
} }
...@@ -65,7 +66,25 @@ void Foam::data::setSolverPerformance ...@@ -65,7 +66,25 @@ void Foam::data::setSolverPerformance
const lduMatrix::solverPerformance& sp const lduMatrix::solverPerformance& sp
) const ) 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 ...@@ -47,13 +47,19 @@ namespace Foam
{ {
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class data Declaration Class data Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class data class data
: :
public IOdictionary public IOdictionary
{ {
// Private data
//- Previously used time-index, used for reset between iterations
mutable label prevTimeIndex_;
// Private Member Functions // Private Member Functions
//- Disallow default bitwise copy construct //- Disallow default bitwise copy construct
......
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