Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8"
OrdinaryDiffEqDifferentiation = "4302a76b-040a-498a-8c04-15b101fed76b"
OrdinaryDiffEqRosenbrock = "43230ef6-c299-4910-a778-202eb28ce4ce"
PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd"
SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462"
Expand All @@ -35,6 +36,7 @@ OrdinaryDiffEq = "7"
OrdinaryDiffEqCore = "4"
OrdinaryDiffEqDifferentiation = "3"
OrdinaryDiffEqRosenbrock = "2"
PrecompileTools = "1.2.1"
RecursiveArrayTools = "4"
SafeTestsets = "0.1, 1"
SciMLBase = "3.28.1"
Expand Down
25 changes: 25 additions & 0 deletions src/MultiScaleArrays.jl
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ module MultiScaleArrays
import SciMLBase
using SciMLBase: full_cache, rand_cache
import DifferentiationInterface as DI
using PrecompileTools: @compile_workload, @setup_workload

Base.show(io::IO, x::AbstractMultiScaleArray) = invoke(show, Tuple{IO, Any}, io, x)
Base.show(io::IO, ::MIME"text/plain", x::AbstractMultiScaleArray) = show(io, x)
Expand Down Expand Up @@ -288,4 +289,28 @@ module MultiScaleArrays
# print_human_readable
export print_human_readable

struct _PrecompileCell <: AbstractMultiScaleArrayLeaf{Float64}
values::Vector{Float64}
end

mutable struct _PrecompileHead{T <: AbstractMultiScaleArray} <:
AbstractMultiScaleArrayHead{Float64}
nodes::Vector{T}
values::Vector{Float64}
end_idxs::Vector{Int}
end

@setup_workload begin
@compile_workload begin
cell = _PrecompileCell([1.0, 2.0])
head = construct(_PrecompileHead, [cell])
head[1]
head[2] = 3.0
num_nodes(head)
collect(level_iter(head, 1))
add_node!(head, _PrecompileCell([4.0]))
remove_node!(head, 2)
end
end

end # module
Loading