Currently, the statistics object is set in SolutionStrategy.init():
self.nonlinear_solver_statistics = pp.SolverStatistics()
The statistics to be stored are defined as class attributes. Thus, there is no support for expanding the set of attributes. I suggest changing to
self.nonlinear_solver_statistics = self.params.get("nonlinear_solver_statistics", pp.SolverStatistics)(),
allowing me to pass
class MySolverStatistics(pp.SolverStatistics):
foo_error: field(default_factory=list)
bar_attribute: field(default_factory=list)
def log_error():
super().log_error()
self.foo_error.append(42)
and adding to bar_attribute in any other method with access to the model (e.g. when computing line search weights).
Currently, the statistics object is set in SolutionStrategy.init():
self.nonlinear_solver_statistics = pp.SolverStatistics()
The statistics to be stored are defined as class attributes. Thus, there is no support for expanding the set of attributes. I suggest changing toself.nonlinear_solver_statistics = self.params.get("nonlinear_solver_statistics", pp.SolverStatistics)()
, allowing me to passand adding to
bar_attribute
in any other method with access to the model (e.g. when computing line search weights).