[1D] Add accessors for solver statistics
Previously, this information was only available in the text output of the 'showStats' function.
This commit is contained in:
parent
11b665b00a
commit
532e132788
3 changed files with 81 additions and 1 deletions
|
|
@ -250,6 +250,44 @@ public:
|
|||
//! Clear saved statistics
|
||||
void clearStats();
|
||||
|
||||
//! Return total grid size in each call to solve()
|
||||
const std::vector<size_t>& gridSizeStats() {
|
||||
saveStats();
|
||||
return m_gridpts;
|
||||
}
|
||||
|
||||
//! Return CPU time spent evaluating Jacobians in each call to solve()
|
||||
const vector_fp& jacobianTimeStats() {
|
||||
saveStats();
|
||||
return m_jacElapsed;
|
||||
}
|
||||
|
||||
//! Return CPU time spent on non-Jacobian function evaluations in each call
|
||||
//! to solve()
|
||||
const vector_fp& evalTimeStats() {
|
||||
saveStats();
|
||||
return m_funcElapsed;
|
||||
}
|
||||
|
||||
//! Return number of Jacobian evaluations made in each call to solve()
|
||||
const vector_int& jacobianCountStats() {
|
||||
saveStats();
|
||||
return m_jacEvals;
|
||||
}
|
||||
|
||||
//! Return number of non-Jacobian function evaluations made in each call to
|
||||
//! solve()
|
||||
const vector_int& evalCountStats() {
|
||||
saveStats();
|
||||
return m_funcEvals;
|
||||
}
|
||||
|
||||
//! Return number of time steps taken in each call to solve()
|
||||
const vector_int& timeStepStats() {
|
||||
saveStats();
|
||||
return m_timeSteps;
|
||||
}
|
||||
|
||||
//! 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.
|
||||
|
|
|
|||
|
|
@ -687,6 +687,13 @@ cdef extern from "cantera/oneD/Sim1D.h":
|
|||
void restore(string, string, int) except +
|
||||
void writeStats(int) except +
|
||||
void clearStats()
|
||||
vector[size_t]& gridSizeStats()
|
||||
vector[double]& jacobianTimeStats()
|
||||
vector[double]& evalTimeStats()
|
||||
vector[int]& jacobianCountStats()
|
||||
vector[int]& evalCountStats()
|
||||
vector[int]& timeStepStats()
|
||||
|
||||
int domainIndex(string) except +
|
||||
double value(size_t, size_t, size_t) except +
|
||||
double workValue(size_t, size_t, size_t) except +
|
||||
|
|
|
|||
|
|
@ -802,7 +802,6 @@ cdef class Sim1D:
|
|||
self.sim.restoreTimeSteppingSolution()
|
||||
|
||||
def show_stats(self, print_time=True):
|
||||
|
||||
"""
|
||||
Show the statistics for the last solution.
|
||||
|
||||
|
|
@ -817,5 +816,41 @@ cdef class Sim1D:
|
|||
"""
|
||||
self.sim.clearStats()
|
||||
|
||||
property grid_size_stats:
|
||||
"""Return total grid size in each call to solve()"""
|
||||
def __get__(self):
|
||||
return self.sim.gridSizeStats()
|
||||
|
||||
property jacobian_time_stats:
|
||||
"""Return CPU time spent evaluating Jacobians in each call to solve()"""
|
||||
def __get__(self):
|
||||
return self.sim.jacobianTimeStats()
|
||||
|
||||
property jacobian_count_stats:
|
||||
"""Return number of Jacobian evaluations made in each call to solve()"""
|
||||
def __get__(self):
|
||||
return self.sim.jacobianCountStats()
|
||||
|
||||
property eval_time_stats:
|
||||
"""
|
||||
Return CPU time spent on non-Jacobian function evaluations in each call
|
||||
to solve()
|
||||
"""
|
||||
def __get__(self):
|
||||
return self.sim.evalTimeStats()
|
||||
|
||||
property eval_count_stats:
|
||||
"""
|
||||
Return number of non-Jacobian function evaluations made in each call to
|
||||
solve()
|
||||
"""
|
||||
def __get__(self):
|
||||
return self.sim.evalCountStats()
|
||||
|
||||
property time_step_stats:
|
||||
"""Return number of time steps taken in each call to solve()"""
|
||||
def __get__(self):
|
||||
return self.sim.timeStepStats()
|
||||
|
||||
def __dealloc__(self):
|
||||
del self.sim
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue