@@ -56,10 +56,18 @@ impl<T: Scalar> BdfConfig<T> {
5656 minimum_timestep : ode_options. min_timestep ,
5757 maximum_error_test_failures : ode_options. max_error_test_failures ,
5858 maximum_newton_fails : ode_options. max_nonlinear_solver_failures ,
59- maximum_timestep_growth : T :: from_f64 ( 2.0 ) . unwrap ( ) ,
60- minimum_timestep_growth : T :: from_f64 ( 2.0 ) . unwrap ( ) ,
61- maximum_timestep_shrink : T :: from_f64 ( 0.9 ) . unwrap ( ) ,
62- minimum_timestep_shrink : T :: from_f64 ( 0.5 ) . unwrap ( ) ,
59+ maximum_timestep_growth : ode_options
60+ . max_timestep_growth
61+ . unwrap_or_else ( || T :: from_f64 ( 2.0 ) . unwrap ( ) ) ,
62+ minimum_timestep_growth : ode_options
63+ . min_timestep_growth
64+ . unwrap_or_else ( || T :: from_f64 ( 2.0 ) . unwrap ( ) ) ,
65+ maximum_timestep_shrink : ode_options
66+ . max_timestep_shrink
67+ . unwrap_or_else ( || T :: from_f64 ( 0.9 ) . unwrap ( ) ) ,
68+ minimum_timestep_shrink : ode_options
69+ . min_timestep_shrink
70+ . unwrap_or_else ( || T :: from_f64 ( 0.5 ) . unwrap ( ) ) ,
6371 maximum_newton_iterations : ode_options. max_nonlinear_solver_iterations ,
6472 }
6573 }
@@ -82,10 +90,18 @@ impl<T: Scalar> SdirkConfig<T> {
8290 Self {
8391 minimum_timestep : ode_options. min_timestep ,
8492 maximum_error_test_failures : ode_options. max_error_test_failures ,
85- maximum_timestep_growth : T :: from_f64 ( 2.0 ) . unwrap ( ) ,
86- minimum_timestep_growth : T :: from_f64 ( 2.0 ) . unwrap ( ) ,
87- maximum_timestep_shrink : T :: from_f64 ( 0.9 ) . unwrap ( ) ,
88- minimum_timestep_shrink : T :: from_f64 ( 0.5 ) . unwrap ( ) ,
93+ maximum_timestep_growth : ode_options
94+ . max_timestep_growth
95+ . unwrap_or_else ( || T :: from_f64 ( 2.0 ) . unwrap ( ) ) ,
96+ minimum_timestep_growth : ode_options
97+ . min_timestep_growth
98+ . unwrap_or_else ( || T :: from_f64 ( 2.0 ) . unwrap ( ) ) ,
99+ maximum_timestep_shrink : ode_options
100+ . max_timestep_shrink
101+ . unwrap_or_else ( || T :: from_f64 ( 0.9 ) . unwrap ( ) ) ,
102+ minimum_timestep_shrink : ode_options
103+ . min_timestep_shrink
104+ . unwrap_or_else ( || T :: from_f64 ( 0.5 ) . unwrap ( ) ) ,
89105 maximum_newton_iterations : ode_options. max_nonlinear_solver_iterations ,
90106 maximum_newton_fails : ode_options. max_nonlinear_solver_failures ,
91107 }
@@ -127,10 +143,18 @@ impl<T: Scalar> ExplicitRkConfig<T> {
127143 Self {
128144 minimum_timestep : ode_options. min_timestep ,
129145 maximum_error_test_failures : ode_options. max_error_test_failures ,
130- maximum_timestep_growth : T :: from_f64 ( 2.0 ) . unwrap ( ) ,
131- minimum_timestep_growth : T :: from_f64 ( 1.0 ) . unwrap ( ) ,
132- maximum_timestep_shrink : T :: from_f64 ( 1.0 ) . unwrap ( ) ,
133- minimum_timestep_shrink : T :: from_f64 ( 0.5 ) . unwrap ( ) ,
146+ maximum_timestep_growth : ode_options
147+ . max_timestep_growth
148+ . unwrap_or_else ( || T :: from_f64 ( 2.0 ) . unwrap ( ) ) ,
149+ minimum_timestep_growth : ode_options
150+ . min_timestep_growth
151+ . unwrap_or_else ( || T :: from_f64 ( 1.0 ) . unwrap ( ) ) ,
152+ maximum_timestep_shrink : ode_options
153+ . max_timestep_shrink
154+ . unwrap_or_else ( || T :: from_f64 ( 1.0 ) . unwrap ( ) ) ,
155+ minimum_timestep_shrink : ode_options
156+ . min_timestep_shrink
157+ . unwrap_or_else ( || T :: from_f64 ( 0.5 ) . unwrap ( ) ) ,
134158 }
135159 }
136160}
0 commit comments