diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index d0a3b706..2b40114e 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -44,7 +44,7 @@ jobs: fail-fast: false matrix: version: - - '1.8' + - '1.9' os: - ubuntu-latest - macOS-latest diff --git a/Project.toml b/Project.toml index 2a6af7d3..93fd65b8 100644 --- a/Project.toml +++ b/Project.toml @@ -34,4 +34,4 @@ SparseArrays = "1" StaticArrays = "1" SummationByPartsOperators = "0.5.41" TimerOutputs = "0.5.7" -julia = "1.8" +julia = "1.9" diff --git a/README.md b/README.md index c5829ce9..7615b6d1 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ A more detailed documentation can be found [online](https://JoshuaLampert.github ## Installation If you have not yet installed Julia, then you first need to [download Julia](https://julialang.org/downloads/). Please [follow the instructions for your operating system](https://julialang.org/downloads/platform/). -DispersiveShallowWater.jl works with Julia v1.8 and newer. DispersiveShallowWater.jl is a registered Julia package. Therefore, you can install it by executing the following commands from the Julia REPL +DispersiveShallowWater.jl works with Julia v1.9 and newer. DispersiveShallowWater.jl is a registered Julia package. Therefore, you can install it by executing the following commands from the Julia REPL ```julia julia> using Pkg diff --git a/docs/src/index.md b/docs/src/index.md index 121505b1..a66df7af 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -22,7 +22,7 @@ Fully discrete entropy-conservative methods can be obtained by using the [relaxa ## Installation If you have not yet installed Julia, then you first need to [download Julia](https://julialang.org/downloads/). Please [follow the instructions for your operating system](https://julialang.org/downloads/platform/). -DispersiveShallowWater.jl works with Julia v1.8 and newer. DispersiveShallowWater.jl is a registered Julia package. Therefore, you can install it by executing the following commands from the Julia REPL +DispersiveShallowWater.jl works with Julia v1.9 and newer. DispersiveShallowWater.jl is a registered Julia package. Therefore, you can install it by executing the following commands from the Julia REPL ```julia julia> using Pkg diff --git a/src/callbacks_step/summary.jl b/src/callbacks_step/summary.jl index 1a1fbdb0..8bb4b60a 100644 --- a/src/callbacks_step/summary.jl +++ b/src/callbacks_step/summary.jl @@ -1,9 +1,8 @@ """ SummaryCallback(io::IO = stdout) -Create and return a callback that prints a human-readable summary of the simulation setup at the -beginning of a simulation and then resets the timer. When the returned callback is executed -directly, the current timer values are shown. +Create and return a callback that resets the timer at the beginning of +a simulation and prints the timer values at the end of the simulation. """ struct SummaryCallback io::IO @@ -12,12 +11,17 @@ struct SummaryCallback function initialize(cb, u, t, integrator) initialize_summary_callback(cb, u, t, integrator) end + # At the end of the simulation, the timer is printed + function finalize(cb, u, t, integrator) + finalize_summary_callback(cb, u, t, integrator) + end summary_callback = new(io) - # SummaryCallback is called at end of simulation - condition = (u, t, integrator) -> isfinished(integrator) + # SummaryCallback is never called during the simulation + condition = (u, t, integrator) -> false DiscreteCallback(condition, summary_callback, save_positions = (false, false), - initialize = initialize) + initialize = initialize, + finalize = finalize) end end @@ -32,22 +36,14 @@ function initialize_summary_callback(cb::DiscreteCallback, u, t, integrator) return nothing end -function (cb::SummaryCallback)(integrator) - u_modified!(integrator, false) - cb() -end +# the summary callback does nothing when called accidentally +(cb::SummaryCallback)(integrator) = u_modified!(integrator, false) -function (summary_callback::SummaryCallback)() - io = summary_callback.io +function finalize_summary_callback(cb::DiscreteCallback, u, t, integrator) + io = cb.affect!.io TimerOutputs.complement!(timer()) print_timer(io, timer(), title = "DispersiveSWE", allocations = true, linechars = :unicode, compact = false) println(io) return nothing end - -# Allow calling the callback explicitly -function (cb::DiscreteCallback{Condition, Affect!})() where {Condition, - Affect! <: SummaryCallback} - cb.affect!() -end diff --git a/test/test_unit.jl b/test/test_unit.jl index 782f9dfd..d00a7228 100644 --- a/test/test_unit.jl +++ b/test/test_unit.jl @@ -218,7 +218,6 @@ using SparseArrays: sparse, SparseMatrixCSC summary_callback = SummaryCallback() @test_nowarn print(summary_callback) @test_nowarn display(summary_callback) - @test_nowarn summary_callback() end @testset "util" begin