Mercurial > repos > public > sbplib_julia
changeset 1863:516eaabf1169 refactor/grids/iterable_boundary_indices
Merge default
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Wed, 22 Jan 2025 09:00:40 +0100 |
parents | aa7da5c899d8 (current diff) 0d8d56eca0c8 (diff) |
children | fa96b57af6a1 |
files | src/Diffinitive.jl src/Grids/equidistant_grid.jl src/Grids/mapped_grid.jl src/Grids/tensor_grid.jl test/Grids/tensor_grid_test.jl |
diffstat | 18 files changed, 249 insertions(+), 53 deletions(-) [+] |
line wrap: on
line diff
--- a/Manifest.toml Fri Jan 10 19:53:10 2025 +0100 +++ b/Manifest.toml Wed Jan 22 09:00:40 2025 +0100 @@ -2,7 +2,7 @@ julia_version = "1.11.2" manifest_format = "2.0" -project_hash = "e8ce4954d65eae4e48090d67a590f9405da1832d" +project_hash = "a8bfbeb10ca8c44ef39fdba75f02b23fc92b2c6a" [[deps.Artifacts]] uuid = "56f22d72-fd6d-98f1-02f0-08ddc0907c33"
--- a/Project.toml Fri Jan 10 19:53:10 2025 +0100 +++ b/Project.toml Wed Jan 22 09:00:40 2025 +0100 @@ -21,3 +21,10 @@ [compat] julia = "1.5" +StaticArrays = "1.0" +TOML = "1.0" +Makie = "0.21" +SparseArrayKit = "0.3" +Tokens = "0.1.1" +SparseArrays = "1.10" +LinearAlgebra = "1.5"
--- a/README.md Fri Jan 10 19:53:10 2025 +0100 +++ b/README.md Wed Jan 22 09:00:40 2025 +0100 @@ -29,11 +29,17 @@ will run any file named `lazy_tensor_operations_test.jl` and all the files in the `Grids` folder. ## Running benchmarks -Benchmarks are defined in `benchmark/` and use the tools for benchmark suites in BenchmarkTools.jl. The format is compatible with PkgBenchmark.jl which helps with running the suite, comparing results and presenting the results in a readable way. There are custom functions included for running the benchmarks in this Mercurial repository. +Benchmarks are defined in `benchmark/` and use the tools for benchmark suites +in BenchmarkTools.jl. The format is compatible with PkgBenchmark.jl which +helps with running the suite, comparing results and presenting the results in +a readable way. There are custom functions included for running the benchmarks +in this Mercurial repository. -`benchmark/` contains a julia environment with the necessary packages for working with the benchmarks. +`benchmark/` contains a julia environment with the necessary packages for +working with the benchmarks. -To run the benchmarks, either use `make` run them manually from the REPL, as explained further below. +To run the benchmarks, either use `make` or run them manually from the REPL, as +explained further below. Using `make` there are four targets for benchmarks ```shell @@ -42,18 +48,22 @@ make benchmarkcmp TARGET=target BASELINE=baseline # Compares two revisions make cleanbenchmark # Cleans up benchmark tunings and results ``` -Here `rev`, `target` and `baseline` are any valid Mercurial revision specifiers. Note that `make benchmarkrev` and `make benchmarkcmp` will fail if you have pending changes in your repository. +Here `rev`, `target` and `baseline` are any valid Mercurial revision +specifiers. - -Alternatively, the benchmarks can be run from the REPL. To do this, first activate the environment in `benchmark/` then include the file `benchmark_utils.jl`. The suite can then be run using the function `main` in one of the following ways +Alternatively, the benchmarks can be run from the REPL. To do this, first +activate the environment in `benchmark/` then include the file +`benchmark_utils.jl`. The suite can then be run using the function `main` in +one of the following ways ```julia -main() # Runs the suite for the current working directory -main(rev) # Runs the suite at the specified revision -main(target, baseline) # Compares two revisions +main() # Runs the suite for the current working directory +main(rev="...") # Runs the suite at the specified revision +main(target="...", baseline="...") # Compares two revisions ``` -Again, `rev`, `target` and `baseline` are any valid Mercurial revision specifiers. Note that `main(rev)` and `main(target, baseline)` will fail if you have pending changes in your repository. +Again, `rev`, `target` and `baseline` are any valid Mercurial revision +specifiers. PkgBenchmark can also be used directly.
--- a/src/Diffinitive.jl Fri Jan 10 19:53:10 2025 +0100 +++ b/src/Diffinitive.jl Wed Jan 22 09:00:40 2025 +0100 @@ -10,4 +10,13 @@ export Grids export SbpOperators + +# Aqua.jl fixes +using StaticArrays +using .LazyTensors +Base.:+(a::StaticArray, b::LazyArray) = a +̃ b +Base.:+(a::LazyArray, b::StaticArray) = a +̃ b +Base.:-(a::StaticArray, b::LazyArray) = a -̃ b +Base.:-(a::LazyArray, b::StaticArray) = a -̃ b + end
--- a/src/Grids/equidistant_grid.jl Fri Jan 10 19:53:10 2025 +0100 +++ b/src/Grids/equidistant_grid.jl Wed Jan 22 09:00:40 2025 +0100 @@ -15,7 +15,7 @@ end # Indexing interface -Base.getindex(g::EquidistantGrid, i) = g.points[i] +Base.getindex(g::EquidistantGrid, i::Int) = g.points[i] Base.eachindex(g::EquidistantGrid) = eachindex(g.points) Base.firstindex(g::EquidistantGrid) = firstindex(g.points) Base.lastindex(g::EquidistantGrid) = lastindex(g.points)
--- a/src/Grids/mapped_grid.jl Fri Jan 10 19:53:10 2025 +0100 +++ b/src/Grids/mapped_grid.jl Wed Jan 22 09:00:40 2025 +0100 @@ -92,27 +92,27 @@ ) end - +# TODO: Make sure all methods of `mapped_grid` are implemented correctly and tested. """ mapped_grid(x, J, size::Vararg{Int}) A `MappedGrid` with a default logical grid on the D-dimensional unit hyper -box [0,1]ᴰ. `x` and `J`are functions to be evaluated on the logical grid +box [0,1]ᴰ. `x` and `J` are functions to be evaluated on the logical grid and `size` determines the size of the logical grid. """ function mapped_grid(x, J, size::Vararg{Int}) D = length(size) - lg = equidistant_grid(ntuple(i->0., D), ntuple(i->1., D), size...) - return mapped_grid(lg, x, J) + lg = equidistant_grid(ntuple(i->0., D), ntuple(i->1., D), size...) # TODO: Clean this up with ParamaterSpace once feature/grids/manifolds is merged + return mapped_grid(x, J, lg) end """ - mapped_grid(lg::Grid, x, J) + mapped_grid(x, J, lg::Grid) A `MappedGrid` with logical grid `lg`. Physical coordinates and Jacobian are determined by the functions `x` and `J`. """ -function mapped_grid(lg::Grid, x, J) +function mapped_grid(x, J, lg::Grid) return MappedGrid( lg, map(x,lg), @@ -121,6 +121,17 @@ end """ + mapped_grid(x, J, parameterspace, size) + +A `MappedGrid` with logical grid `lg`. Physical coordinates and Jacobian are +determined by the functions `x` and `J`. +""" +function mapped_grid(x, J, parameterspace, size::Vararg{Int}) + lg = equidistant_grid(parameterspace, size...) + return mapped_grid(x, J, lg) +end + +""" metric_tensor(g::MappedGrid) The metric tensor of `g` as a grid function.
--- a/src/Grids/tensor_grid.jl Fri Jan 10 19:53:10 2025 +0100 +++ b/src/Grids/tensor_grid.jl Wed Jan 22 09:00:40 2025 +0100 @@ -47,6 +47,10 @@ Base.size(g::TensorGrid) = LazyTensors.concatenate_tuples(size.(g.grids)...) Base.size(g::TensorGrid, d) = size(g)[d] +function spacing(g::TensorGrid) + relevant_grids = filter(g->!isa(g,ZeroDimGrid),g.grids) + return spacing.(relevant_grids) +end function min_spacing(g::TensorGrid) relevant_grids = filter(g->!isa(g,ZeroDimGrid),g.grids)
--- a/src/LazyTensors/lazy_tensor_operations.jl Fri Jan 10 19:53:10 2025 +0100 +++ b/src/LazyTensors/lazy_tensor_operations.jl Wed Jan 22 09:00:40 2025 +0100 @@ -169,10 +169,10 @@ ) end -InflatedTensor(before::IdentityTensor, tm::LazyTensor{T}) where T = InflatedTensor(before,tm,IdentityTensor{T}()) -InflatedTensor(tm::LazyTensor{T}, after::IdentityTensor) where T = InflatedTensor(IdentityTensor{T}(),tm,after) +InflatedTensor(before::IdentityTensor, tm::LazyTensor) = InflatedTensor(before,tm,IdentityTensor{eltype(tm)}()) +InflatedTensor(tm::LazyTensor, after::IdentityTensor) = InflatedTensor(IdentityTensor{eltype(tm)}(),tm,after) # Resolve ambiguity between the two previous methods -InflatedTensor(I1::IdentityTensor{T}, I2::IdentityTensor{T}) where T = InflatedTensor(I1,I2,IdentityTensor{T}()) +InflatedTensor(I1::IdentityTensor, I2::IdentityTensor) = InflatedTensor(I1,I2,IdentityTensor{promote_type(eltype(I1), eltype(I2))}()) # TODO: Implement some pretty printing in terms of ⊗. E.g InflatedTensor(I(3),B,I(2)) -> I(3)⊗B⊗I(2) @@ -263,7 +263,7 @@ return itm1∘itm2 end -LazyOuterProduct(t1::IdentityTensor{T}, t2::IdentityTensor{T}) where T = IdentityTensor{T}(t1.size...,t2.size...) +LazyOuterProduct(t1::IdentityTensor, t2::IdentityTensor) = IdentityTensor{promote_type(eltype(t1),eltype(t2))}(t1.size...,t2.size...) LazyOuterProduct(t1::LazyTensor, t2::IdentityTensor) = InflatedTensor(t1, t2) LazyOuterProduct(t1::IdentityTensor, t2::LazyTensor) = InflatedTensor(t1, t2)
--- a/src/RegionIndices/RegionIndices.jl Fri Jan 10 19:53:10 2025 +0100 +++ b/src/RegionIndices/RegionIndices.jl Wed Jan 22 09:00:40 2025 +0100 @@ -25,18 +25,17 @@ Index(R::Type{<:Region}, T::Type{<:Integer}) = Index{R,T} IndexTupleType(T::Type{<:Integer},R::NTuple{N, DataType} where N) = Tuple{Index.(R, T)...} -Base.convert(::Type{T}, i::Index{R,T} where R) where T = i.i +Base.convert(::Type{T}, i::Index{R,T} where R) where T <: Integer = i.i Base.convert(::Type{CartesianIndex}, I::NTuple{N,Index} where N) = CartesianIndex(convert.(Int, I)) Base.Int(I::Index) = I.i Base.to_index(I::Index) = Int(I) #How to get this to work for all cases?? -Base.getindex(A::AbstractArray{T,N}, I::NTuple{N,Index}) where {T,N} = A[I...] #Is this ok?? function Index(i::Integer, boundary_width::Integer, dim_size::Integer) return Index{getregion(i,boundary_width,dim_size)}(i) end -IndexTuple(t::Vararg{Tuple{T, DataType}}) where T<:Integer = Index.(t) +IndexTuple(t::Vararg{Tuple{Integer, DataType}}) = Index.(t) export IndexTuple # TODO: Use the values of the region structs, e.g. Lower(), for the region parameter instead of the types.
--- a/src/SbpOperators/stencil.jl Fri Jan 10 19:53:10 2025 +0100 +++ b/src/SbpOperators/stencil.jl Wed Jan 22 09:00:40 2025 +0100 @@ -2,14 +2,16 @@ range::UnitRange{Int64} weights::NTuple{N,T} - function Stencil(range::UnitRange,weights::NTuple{N,T}) where {T, N} + function Stencil(range::UnitRange,weights::NTuple{N,Any}) where N + T = eltype(weights) + @assert length(range) == N new{T,N}(range,weights) end end """ - Stencil(weights::NTuple; center::Int) + Stencil(weights...; center::Int) Create a stencil with the given weights with element `center` as the center of the stencil. """ @@ -109,21 +111,24 @@ s::Stencil{Stencil{T,N},M} end +NestedStencil(;center) = NestedStencil(Stencil(;center)) +CenteredNestedStencil() = NestedStencil(CenteredStencil()) + # Stencil input NestedStencil(s::Vararg{Stencil}; center) = NestedStencil(Stencil(s... ; center)) CenteredNestedStencil(s::Vararg{Stencil}) = NestedStencil(CenteredStencil(s...)) # Tuple input -function NestedStencil(weights::Vararg{NTuple{N,Any}}; center) where N +function NestedStencil(weights::Vararg{NTuple{N,Any} where N}; center) inner_stencils = map(w -> Stencil(w...; center), weights) return NestedStencil(Stencil(inner_stencils... ; center)) end -function CenteredNestedStencil(weights::Vararg{NTuple{N,Any}}) where N + +function CenteredNestedStencil(weights::Vararg{NTuple{N,Any} where N}) inner_stencils = map(w->CenteredStencil(w...), weights) return CenteredNestedStencil(inner_stencils...) end - # Conversion function NestedStencil{T,N,M}(ns::NestedStencil{S,N,M}) where {T,S,N,M} return NestedStencil(Stencil{Stencil{T}}(ns.s)) @@ -136,7 +141,7 @@ function Base.convert(::Type{NestedStencil{T,N,M}}, s::NestedStencil{S,N,M}) where {T,S,N,M} return NestedStencil{T,N,M}(s) end -Base.convert(::Type{NestedStencil{T}}, stencil) where T = NestedStencil{T}(stencil) +Base.convert(::Type{NestedStencil{T}}, stencil::NestedStencil) where T = NestedStencil{T}(stencil) function Base.promote_rule(::Type{NestedStencil{T,N,M}}, ::Type{NestedStencil{S,N,M}}) where {T,S,N,M} return NestedStencil{promote_type(T,S),N,M}
--- a/src/SbpOperators/volumeops/constant_interior_scaling_operator.jl Fri Jan 10 19:53:10 2025 +0100 +++ b/src/SbpOperators/volumeops/constant_interior_scaling_operator.jl Wed Jan 22 09:00:40 2025 +0100 @@ -19,7 +19,7 @@ end end -function ConstantInteriorScalingOperator(grid::EquidistantGrid, interior_weight, closure_weights) +function ConstantInteriorScalingOperator(grid::EquidistantGrid, interior_weight::T, closure_weights::NTuple{N,T} where N) where T return ConstantInteriorScalingOperator(interior_weight, Tuple(closure_weights), size(grid)[1]) end
--- a/src/SbpOperators/volumeops/volume_operator.jl Fri Jan 10 19:53:10 2025 +0100 +++ b/src/SbpOperators/volumeops/volume_operator.jl Wed Jan 22 09:00:40 2025 +0100 @@ -6,18 +6,23 @@ struct VolumeOperator{T,N,M,K} <: LazyTensor{T,1,1} inner_stencil::Stencil{T,N} closure_stencils::NTuple{M,Stencil{T,K}} - size::NTuple{1,Int} + size::Int parity::Parity + + function VolumeOperator(inner_stencil::Stencil{T,N}, closure_stencils::Tuple{Stencil{T,K}, Vararg{Stencil{T,K}}}, size::Int, parity::Parity) where {T,N,K} + M = length(closure_stencils) + return new{T,N,M,K}(inner_stencil, closure_stencils, size, parity) + end end function VolumeOperator(grid::EquidistantGrid, inner_stencil, closure_stencils, parity) - return VolumeOperator(inner_stencil, Tuple(closure_stencils), size(grid), parity) + return VolumeOperator(inner_stencil, Tuple(closure_stencils), size(grid,1), parity) end # TBD: Remove this function? closure_size(::VolumeOperator{T,N,M}) where {T,N,M} = M -LazyTensors.range_size(op::VolumeOperator) = op.size -LazyTensors.domain_size(op::VolumeOperator) = op.size +LazyTensors.range_size(op::VolumeOperator) = (op.size,) +LazyTensors.domain_size(op::VolumeOperator) = (op.size,) function LazyTensors.apply(op::VolumeOperator, v::AbstractVector, i::Index{Lower}) return @inbounds apply_stencil(op.closure_stencils[Int(i)], v, Int(i)) @@ -28,11 +33,11 @@ end function LazyTensors.apply(op::VolumeOperator, v::AbstractVector, i::Index{Upper}) - return @inbounds Int(op.parity)*apply_stencil_backwards(op.closure_stencils[op.size[1]-Int(i)+1], v, Int(i)) + return @inbounds Int(op.parity)*apply_stencil_backwards(op.closure_stencils[op.size-Int(i)+1], v, Int(i)) end function LazyTensors.apply(op::VolumeOperator, v::AbstractVector, i) - r = getregion(i, closure_size(op), op.size[1]) + r = getregion(i, closure_size(op), op.size) return LazyTensors.apply(op, v, Index(i, r)) end # TODO: Move this to LazyTensors when we have the region communication down.
--- a/test/Grids/mapped_grid_test.jl Fri Jan 10 19:53:10 2025 +0100 +++ b/test/Grids/mapped_grid_test.jl Wed Jan 22 09:00:40 2025 +0100 @@ -282,7 +282,7 @@ @test logical_grid(mg) == lg @test collect(mg) == map(x̄, lg) - @test mapped_grid(lg, x̄, J) == mg + @test mapped_grid(x̄, J, lg) == mg end @testset "metric_tensor" begin
--- a/test/Grids/tensor_grid_test.jl Fri Jan 10 19:53:10 2025 +0100 +++ b/test/Grids/tensor_grid_test.jl Wed Jan 22 09:00:40 2025 +0100 @@ -137,6 +137,27 @@ @test axes(g) == (1:11,1:6) end + @testset "spacing" begin + g₁ = EquidistantGrid(range(0,1,length=11)) + g₂ = EquidistantGrid(range(2,3,length=6)) + g₃ = ZeroDimGrid(@SVector[1,2]) + + @test spacing(TensorGrid(g₁)) == (1/10,) + @test spacing(TensorGrid(g₂)) == (1/5,) + + @test spacing(TensorGrid(g₁, g₂)) == (1/10, 1/5) + + @test spacing(TensorGrid(g₁, g₃)) == (1/10,) + @test spacing(TensorGrid(g₃, g₂)) == (1/5,) + + + @test spacing(TensorGrid(g₁, g₂, g₁)) == (1/10, 1/5, 1/10) + + @test spacing(TensorGrid(g₃, g₂, g₁)) == (1/5, 1/10) + @test spacing(TensorGrid(g₁, g₃, g₁)) == (1/10, 1/10) + @test spacing(TensorGrid(g₁, g₂, g₃)) == (1/10, 1/5) + end + @testset "min_spacing" begin g₁ = EquidistantGrid(range(0,1,length=11)) g₂ = EquidistantGrid(range(2,3,length=6))
--- a/test/Manifest.toml Fri Jan 10 19:53:10 2025 +0100 +++ b/test/Manifest.toml Wed Jan 22 09:00:40 2025 +0100 @@ -2,7 +2,17 @@ julia_version = "1.11.2" manifest_format = "2.0" -project_hash = "9dddd5385164ee197d1b3f22302bc95701c1f5e5" +project_hash = "b23d6f58220d898029330f7adcac8132668171ec" + +[[deps.Aqua]] +deps = ["Compat", "Pkg", "Test"] +git-tree-sha1 = "49b1d7a9870c87ba13dc63f8ccfcf578cb266f95" +uuid = "4c88cf16-eb10-579e-8560-4a9242c79595" +version = "0.8.9" + +[[deps.ArgTools]] +uuid = "0dad84c5-d112-42e6-8d28-ef12dabb789f" +version = "1.1.2" [[deps.Artifacts]] uuid = "56f22d72-fd6d-98f1-02f0-08ddc0907c33" @@ -18,6 +28,12 @@ uuid = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf" version = "1.6.0" +[[deps.CodeTracking]] +deps = ["InteractiveUtils", "UUIDs"] +git-tree-sha1 = "7eee164f122511d3e4e1ebadb7956939ea7e1c77" +uuid = "da1fd8a2-8d9e-5ec2-8556-3022fb5608a2" +version = "1.3.6" + [[deps.Compat]] deps = ["TOML", "UUIDs"] git-tree-sha1 = "8ae8d32e09f0dcf42a36b90d4e17f5dd2e4c4215" @@ -60,6 +76,15 @@ uuid = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae" version = "0.9.3" +[[deps.Downloads]] +deps = ["ArgTools", "FileWatching", "LibCURL", "NetworkOptions"] +uuid = "f43a241f-c20a-4ad4-852c-f6b1247861c6" +version = "1.6.0" + +[[deps.FileWatching]] +uuid = "7b1f6079-737a-58dc-b8bc-7a2ca5c1b5ee" +version = "1.11.0" + [[deps.Glob]] git-tree-sha1 = "97285bbd5230dd766e9ef6749b80fc617126d496" uuid = "c27321d9-0574-5035-807b-f59d2c89b15c" @@ -75,6 +100,20 @@ uuid = "92d709cd-6900-40b7-9082-c6be49f344b6" version = "0.2.2" +[[deps.JET]] +deps = ["CodeTracking", "InteractiveUtils", "JuliaInterpreter", "LoweredCodeUtils", "MacroTools", "Pkg", "PrecompileTools", "Preferences", "Test"] +git-tree-sha1 = "5c5ac91e775b585864015c5c1703cee283071a47" +uuid = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b" +version = "0.9.12" + + [deps.JET.extensions] + JETCthulhuExt = "Cthulhu" + ReviseExt = "Revise" + + [deps.JET.weakdeps] + Cthulhu = "f68482b8-f384-11e8-15f7-abe071a5a75f" + Revise = "295af30f-e4ad-537b-8983-00126c2a3abe" + [[deps.JLLWrappers]] deps = ["Artifacts", "Preferences"] git-tree-sha1 = "a007feb38b422fbdab534406aeca1b86823cb4d6" @@ -87,6 +126,12 @@ uuid = "682c06a0-de6a-54ab-a142-c8b1cf79cde6" version = "0.21.4" +[[deps.JuliaInterpreter]] +deps = ["CodeTracking", "InteractiveUtils", "Random", "UUIDs"] +git-tree-sha1 = "10da5154188682e5c0726823c2b5125957ec3778" +uuid = "aa1ae85d-cabe-5617-a682-6adf51b2e16a" +version = "0.9.38" + [[deps.LRUCache]] git-tree-sha1 = "b3cc6698599b10e652832c2f23db3cab99d51b59" uuid = "8ac3fa9e-de4c-5943-b1dc-09c6b5f20637" @@ -96,6 +141,16 @@ [deps.LRUCache.extensions] SerializationExt = ["Serialization"] +[[deps.LibCURL]] +deps = ["LibCURL_jll", "MozillaCACerts_jll"] +uuid = "b27032c2-a3e7-50c8-80cd-2d36dbcbfd21" +version = "0.6.4" + +[[deps.LibCURL_jll]] +deps = ["Artifacts", "LibSSH2_jll", "Libdl", "MbedTLS_jll", "Zlib_jll", "nghttp2_jll"] +uuid = "deac9b47-8bc7-5906-a0fe-35ac56dc84c0" +version = "8.6.0+0" + [[deps.LibGit2]] deps = ["Base64", "LibGit2_jll", "NetworkOptions", "Printf", "SHA"] uuid = "76f85450-5226-5b5a-8eaa-529ad045b433" @@ -140,6 +195,17 @@ uuid = "56ddb016-857b-54e1-b83d-db4d58db5568" version = "1.11.0" +[[deps.LoweredCodeUtils]] +deps = ["JuliaInterpreter"] +git-tree-sha1 = "688d6d9e098109051ae33d126fcfc88c4ce4a021" +uuid = "6f1432cf-f94c-5a45-995e-cdbf5db27b0b" +version = "3.1.0" + +[[deps.MacroTools]] +git-tree-sha1 = "72aebe0b5051e5143a079a4685a46da330a40472" +uuid = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09" +version = "0.5.15" + [[deps.Markdown]] deps = ["Base64"] uuid = "d6f4376e-aef5-505a-96c1-9c027394607a" @@ -154,6 +220,10 @@ uuid = "a63ad114-7e13-5084-954f-fe012c677804" version = "1.11.0" +[[deps.MozillaCACerts_jll]] +uuid = "14a3606d-f60d-562e-9121-12d972cd8159" +version = "2023.12.12" + [[deps.NaNMath]] deps = ["OpenLibm_jll"] git-tree-sha1 = "030ea22804ef91648f29b7ad3fc15fa49d0e6e71" @@ -192,6 +262,17 @@ uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0" version = "2.8.1" +[[deps.Pkg]] +deps = ["Artifacts", "Dates", "Downloads", "FileWatching", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "Random", "SHA", "TOML", "Tar", "UUIDs", "p7zip_jll"] +uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" +version = "1.11.0" + + [deps.Pkg.extensions] + REPLExt = "REPL" + + [deps.Pkg.weakdeps] + REPL = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb" + [[deps.PrecompileTools]] deps = ["Preferences"] git-tree-sha1 = "5aa36f7049a63a1528fe8f7c3f2113413ffd4e1f" @@ -325,6 +406,11 @@ uuid = "fa267f1f-6049-4f14-aa54-33bafae1ed76" version = "1.0.3" +[[deps.Tar]] +deps = ["ArgTools", "SHA"] +uuid = "a4e569a6-e804-4fa4-b0f3-eef7a1d5b13e" +version = "1.10.0" + [[deps.TensorOperations]] deps = ["LRUCache", "LinearAlgebra", "PackageExtensionCompat", "PtrArrays", "Strided", "StridedViews", "TupleTools", "VectorInterface"] git-tree-sha1 = "d08a24e2cb67aa0cbfcd68d0acdf2879e571126f" @@ -397,7 +483,22 @@ uuid = "409d34a3-91d5-4945-b6ec-7529ddf182d8" version = "0.4.9" +[[deps.Zlib_jll]] +deps = ["Libdl"] +uuid = "83775a58-1f1d-513f-b197-d71354ab007a" +version = "1.2.13+1" + [[deps.libblastrampoline_jll]] deps = ["Artifacts", "Libdl"] uuid = "8e850b90-86db-534c-a0d3-1478176c7d93" version = "5.11.0+0" + +[[deps.nghttp2_jll]] +deps = ["Artifacts", "Libdl"] +uuid = "8e850ede-7688-5339-a07c-302acd2aaf8d" +version = "1.59.0+0" + +[[deps.p7zip_jll]] +deps = ["Artifacts", "Libdl"] +uuid = "3f19e933-33d8-53b3-aaab-bd5110c3b7a0" +version = "17.4.0+2"
--- a/test/Project.toml Fri Jan 10 19:53:10 2025 +0100 +++ b/test/Project.toml Wed Jan 22 09:00:40 2025 +0100 @@ -1,6 +1,8 @@ [deps] +Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595" BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf" Glob = "c27321d9-0574-5035-807b-f59d2c89b15c" +JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" SparseArrayKit = "a9a3c162-d163-4c15-8926-b8794fbefed2" SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
--- a/test/SbpOperators/volumeops/volume_operator_test.jl Fri Jan 10 19:53:10 2025 +0100 +++ b/test/SbpOperators/volumeops/volume_operator_test.jl Wed Jan 22 09:00:40 2025 +0100 @@ -17,7 +17,7 @@ g = equidistant_grid(0.,1., 11) @testset "Constructors" begin - op = VolumeOperator(inner_stencil,closure_stencils,(11,),even) + op = VolumeOperator(inner_stencil, closure_stencils, 11, even) @test op == VolumeOperator(g,inner_stencil,closure_stencils,even) @test op isa LazyTensor{T,1,1} where T end
--- a/test/runtests.jl Fri Jan 10 19:53:10 2025 +0100 +++ b/test/runtests.jl Wed Jan 22 09:00:40 2025 +0100 @@ -1,4 +1,7 @@ +using Diffinitive using Test +using JET +using Aqua using Glob """ @@ -18,7 +21,7 @@ run_testfiles(".", globs) end -function run_testfiles(path, globs) +function run_testfiles(path, globs) for name ∈ readdir(path) filepath = joinpath(path, name) @@ -29,25 +32,44 @@ end if endswith(name, "_test.jl") && any(occursin.(globs, filepath)) - printstyled("Running "; bold=true, color=:green) - print(filepath) - - t_start = time() - @testset "$name" begin - include(filepath) + log_and_time(filepath) do + @testset "$name" begin + include(filepath) + end end - t_end = time() - - Δt = t_end - t_start - printstyled(" ($(round(Δt, digits=2)) s)"; color=:light_black) - println() end end end +function log_and_time(f, msg) + printstyled("Running "; bold=true, color=:green) + print(msg) + + t_start = time() + f() + t_end = time() + Δt = t_end - t_start + printstyled(" ($(round(Δt, digits=2)) s)"; color=:light_black) + println() +end + testsetname = isempty(ARGS) ? "Diffinitive.jl" : "["*join(ARGS, ", ")*"]" @testset "$testsetname" begin + if isempty(ARGS) + log_and_time("code quality tests using Aqua.jl") do + @testset "Code quality (Aqua.jl)" begin + Aqua.test_all(Diffinitive) + end + end + + log_and_time("code linting using JET.jl") do + @testset "Code linting (JET.jl)" begin + JET.test_package(Diffinitive; target_defined_modules = true) + end + end + end + run_testfiles(ARGS) println() end