diff --git a/core/src/bmi.jl b/core/src/bmi.jl index c02b27278..0da32897d 100644 --- a/core/src/bmi.jl +++ b/core/src/bmi.jl @@ -10,24 +10,27 @@ BMI.initialize(T::Type{Model}, config_path::AbstractString)::Model = Model(confi Write all results to the configured files. """ -BMI.finalize(model::Model)::Model = write_results(model) +function BMI.finalize(model::Model)::Nothing + write_results(model) + return nothing +end -function BMI.update(model::Model)::Model +function BMI.update(model::Model)::Nothing step!(model.integrator) - return model + return nothing end -function BMI.update_until(model::Model, time::Float64)::Model +function BMI.update_until(model::Model, time::Float64)::Nothing (; t) = model.integrator dt = time - t if dt < 0 error("The model has already passed the given timestamp.") elseif dt == 0 - return model + return nothing else step!(model, dt) end - return model + return nothing end function BMI.get_value_ptr(model::Model, name::AbstractString)::AbstractVector{Float64} @@ -55,8 +58,12 @@ function BMI.get_value_ptr(model::Model, name::AbstractString)::AbstractVector{F end end -BMI.get_current_time(model::Model) = model.integrator.t -BMI.get_start_time(model::Model) = 0.0 -BMI.get_end_time(model::Model) = seconds_since(model.config.endtime, model.config.starttime) -BMI.get_time_units(model::Model) = "s" -BMI.get_time_step(model::Model) = get_proposed_dt(model.integrator) +BMI.get_current_time(model::Model)::Float64 = model.integrator.t +BMI.get_start_time(model::Model)::Float64 = 0.0 +BMI.get_time_step(model::Model)::Float64 = get_proposed_dt(model.integrator) + +function BMI.get_end_time(model::Model)::Float64 + seconds_since(model.config.endtime, model.config.starttime) +end + +BMI.get_time_units(model::Model)::String = "s"