Skip to content

Commit

Permalink
use AbstractTransientSolution in GridVisualize stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
j-fu committed Jul 11, 2023
1 parent 774ba7b commit 3036e7e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "VoronoiFVM"
uuid = "82b139dc-5afc-11e9-35da-9b9bdfd336f3"
authors = ["Jürgen Fuhrmann <juergen.fuhrmann@wias-berlin.de>", "Dilara Abdel", "Jan Weidner", "Alexander Seiler", "Patricio Farrell", "Matthias Liero"]
version = "1.9.1"
version = "1.10"

[deps]
BandedMatrices = "aae01518-5342-5314-be14-df237901396f"
Expand Down
2 changes: 2 additions & 0 deletions docs/src/changes.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Changes
## v1.10.0 July 11, 2023
- Use AbstractTransientSolution in gridvisualize stuff

## v1.9.0 June 27, 2023
- With `control.handle_exceptions=true`, in case of a failing step,
Expand Down
4 changes: 2 additions & 2 deletions src/gridvisualize.jl
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ end
Plot one species from transient solution
"""
function GridVisualize.scalarplot(sys::AbstractSystem, sol::TransientSolution; species = 1, scale=1.0, tscale=:identity, kwargs...)
function GridVisualize.scalarplot(sys::AbstractSystem, sol::AbstractTransientSolution; species = 1, scale=1.0, tscale=:identity, kwargs...)
@assert dim_space(grid) == 1
vis = GridVisualizer(kwargs...)
if !isnothing(vis.Plotter)
Expand All @@ -52,7 +52,7 @@ end
Plot one species from transient solution
"""
function GridVisualize.scalarplot!(vis, sys::AbstractSystem, sol::TransientSolution; species = 1,scale=1.0, tscale = :identity, tlabel = "t",
function GridVisualize.scalarplot!(vis, sys::AbstractSystem, sol::AbstractTransientSolution; species = 1,scale=1.0, tscale = :identity, tlabel = "t",
kwargs...)
if !isnothing(vis)
grid = sys.grid
Expand Down
8 changes: 4 additions & 4 deletions src/vfvm_transientsolution.jl
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ mutable struct TransientSolution{T, N, A, B} <: AbstractTransientSolution{T, N,
end

function TransientSolution(vec::AbstractVector{T}, ts, ::NTuple{N}) where {T, N}
TransientSolution{eltype(T), N, typeof(vec), typeof(ts)}(vec, ts)
TransientSolution{T, N, typeof(vec), typeof(ts)}(vec, ts)
end

TransientSolution(vec::AbstractVector, ts::AbstractVector) = TransientSolution(vec, ts, (size(vec[1])..., length(vec)))

Base.append!(s::TransientSolution, t::Real, sol::AbstractArray) = push!(s.t, t), push!(s.u, copy(sol))
Base.append!(s::AbstractTransientSolution, t::Real, sol::AbstractArray) = push!(s.t, t), push!(s.u, copy(sol))

(sol::TransientSolution)(t) = _interpolate(sol, t)
(sol::AbstractTransientSolution)(t) = _interpolate(sol, t)

function _interpolate(sol, t)
if isapprox(t, sol.t[1]; atol = 1.0e-10 * abs(sol.t[2] - sol.t[1]))
Expand Down Expand Up @@ -126,7 +126,7 @@ function VectorOfDiskArrays(obj::AbstractArray{T}; keep_open = true, fname = _te
v
end

function Base.append!(s::TransientSolution{T, N, VectorOfDiskArrays{T}, B}, t::Real, sol::AbstractArray) where {T, N, B}
function Base.append!(s::AbstractTransientSolution{T, N, VectorOfDiskArrays{T}, B}, t::Real, sol::AbstractArray) where {T, N, B}
push!(s.t, t), push!(s.u, sol)
end

Expand Down

2 comments on commit 3036e7e

@j-fu
Copy link
Member Author

@j-fu j-fu commented on 3036e7e Jul 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/87256

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v1.10.0 -m "<description of version>" 3036e7e5207bf4637401c6a3206418075c8836f5
git push origin v1.10.0

Please sign in to comment.