[1D] Add 'clearStats' function for clearing accumulated solver stats

This commit is contained in:
Ray Speth 2014-09-07 21:17:00 +00:00
parent 959cbb7d7a
commit a837dfdc6d
4 changed files with 21 additions and 0 deletions

View file

@ -241,6 +241,9 @@ public:
*/
void saveStats();
//! Clear saved statistics
void clearStats();
//! Set a function that will be called every time #eval is called.
//! Can be used to provide keyboard interrupt support in the high-level
//! language interfaces.

View file

@ -462,6 +462,7 @@ cdef extern from "cantera/oneD/Sim1D.h":
void save(string, string, string, int) except +
void restore(string, string, int) except +
void writeStats(int) except +
void clearStats()
int domainIndex(string) except +
double value(size_t, size_t, size_t) except +
double workValue(size_t, size_t, size_t) except +

View file

@ -787,5 +787,11 @@ cdef class Sim1D:
"""
self.sim.writeStats(print_time)
def clear_stats(self):
"""
Clear solver statistics.
"""
self.sim.clearStats()
def __dealloc__(self):
del self.sim

View file

@ -129,6 +129,17 @@ void OneDim::saveStats()
}
}
void OneDim::clearStats()
{
m_gridpts.clear();
m_jacEvals.clear();
m_jacElapsed.clear();
m_funcEvals.clear();
m_funcElapsed.clear();
m_nevals = 0;
m_evaltime = 0.0;
}
void OneDim::resize()
{
m_bw = 0;