changeset 1868:81559cb7b11c feature/grids/manifolds

Merge default
author Jonatan Werpers <jonatan@werpers.com>
date Thu, 23 Jan 2025 23:22:11 +0100
parents de4b4f2aee4f (current diff) 0d8d56eca0c8 (diff)
children 20bd8887db0d
files Project.toml src/Grids/equidistant_grid.jl src/Grids/mapped_grid.jl test/Grids/mapped_grid_test.jl
diffstat 20 files changed, 255 insertions(+), 108 deletions(-) [+]
line wrap: on
line diff
diff -r de4b4f2aee4f -r 81559cb7b11c Manifest.toml
--- a/Manifest.toml	Tue Nov 12 18:15:27 2024 +0100
+++ b/Manifest.toml	Thu Jan 23 23:22:11 2025 +0100
@@ -1,8 +1,8 @@
 # This file is machine-generated - editing it directly is not advised
 
-julia_version = "1.11.1"
+julia_version = "1.11.2"
 manifest_format = "2.0"
-project_hash = "e8ce4954d65eae4e48090d67a590f9405da1832d"
+project_hash = "a8bfbeb10ca8c44ef39fdba75f02b23fc92b2c6a"
 
 [[deps.Artifacts]]
 uuid = "56f22d72-fd6d-98f1-02f0-08ddc0907c33"
@@ -60,9 +60,9 @@
 
 [[deps.StaticArrays]]
 deps = ["LinearAlgebra", "PrecompileTools", "Random", "StaticArraysCore"]
-git-tree-sha1 = "eeafab08ae20c62c44c8399ccb9354a04b80db50"
+git-tree-sha1 = "47091a0340a675c738b1304b58161f3b0839d454"
 uuid = "90137ffa-7385-5640-81b9-e52037218182"
-version = "1.9.7"
+version = "1.9.10"
 
     [deps.StaticArrays.extensions]
     StaticArraysChainRulesCoreExt = "ChainRulesCore"
diff -r de4b4f2aee4f -r 81559cb7b11c Project.toml
--- a/Project.toml	Tue Nov 12 18:15:27 2024 +0100
+++ b/Project.toml	Thu Jan 23 23:22:11 2025 +0100
@@ -23,3 +23,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"
diff -r de4b4f2aee4f -r 81559cb7b11c README.md
--- a/README.md	Tue Nov 12 18:15:27 2024 +0100
+++ b/README.md	Thu Jan 23 23:22:11 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.
 
diff -r de4b4f2aee4f -r 81559cb7b11c benchmark/Manifest.toml
--- a/benchmark/Manifest.toml	Tue Nov 12 18:15:27 2024 +0100
+++ b/benchmark/Manifest.toml	Thu Jan 23 23:22:11 2025 +0100
@@ -1,6 +1,6 @@
 # This file is machine-generated - editing it directly is not advised
 
-julia_version = "1.11.1"
+julia_version = "1.11.2"
 manifest_format = "2.0"
 project_hash = "ecfc3e12aca5be17a874aba6134ff821abf61540"
 
@@ -22,10 +22,20 @@
 version = "1.11.0"
 
 [[deps.BenchmarkTools]]
-deps = ["JSON", "Logging", "Printf", "Profile", "Statistics", "UUIDs"]
-git-tree-sha1 = "f1dff6729bc61f4d49e140da1af55dcd1ac97b2f"
+deps = ["Compat", "JSON", "Logging", "Printf", "Profile", "Statistics", "UUIDs"]
+git-tree-sha1 = "e38fbc49a620f5d0b660d7f543db1009fe0f8336"
 uuid = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
-version = "1.5.0"
+version = "1.6.0"
+
+[[deps.Compat]]
+deps = ["TOML", "UUIDs"]
+git-tree-sha1 = "8ae8d32e09f0dcf42a36b90d4e17f5dd2e4c4215"
+uuid = "34da2185-b29b-5c13-b0c7-acf172513d20"
+version = "4.16.0"
+weakdeps = ["Dates", "LinearAlgebra"]
+
+    [deps.Compat.extensions]
+    CompatLinearAlgebraExt = "LinearAlgebra"
 
 [[deps.CompilerSupportLibraries_jll]]
 deps = ["Artifacts", "Libdl"]
@@ -167,9 +177,9 @@
 version = "0.3.27+1"
 
 [[deps.OrderedCollections]]
-git-tree-sha1 = "dfdf5519f235516220579f949664f1bf44e741c5"
+git-tree-sha1 = "12f1439c4f986bb868acda6ea33ebc78e19b95ad"
 uuid = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"
-version = "1.6.3"
+version = "1.7.0"
 
 [[deps.Parsers]]
 deps = ["Dates", "PrecompileTools", "UUIDs"]
@@ -232,9 +242,9 @@
 
 [[deps.StaticArrays]]
 deps = ["LinearAlgebra", "PrecompileTools", "Random", "StaticArraysCore"]
-git-tree-sha1 = "eeafab08ae20c62c44c8399ccb9354a04b80db50"
+git-tree-sha1 = "47091a0340a675c738b1304b58161f3b0839d454"
 uuid = "90137ffa-7385-5640-81b9-e52037218182"
-version = "1.9.7"
+version = "1.9.10"
 
     [deps.StaticArrays.extensions]
     StaticArraysChainRulesCoreExt = "ChainRulesCore"
diff -r de4b4f2aee4f -r 81559cb7b11c docs/Manifest.toml
--- a/docs/Manifest.toml	Tue Nov 12 18:15:27 2024 +0100
+++ b/docs/Manifest.toml	Thu Jan 23 23:22:11 2025 +0100
@@ -1,6 +1,6 @@
 # This file is machine-generated - editing it directly is not advised
 
-julia_version = "1.11.1"
+julia_version = "1.11.2"
 manifest_format = "2.0"
 project_hash = "c04450bb5c379e77d137cc05c4c0ab58eb1bfae9"
 
@@ -67,9 +67,9 @@
 
 [[deps.Documenter]]
 deps = ["ANSIColoredPrinters", "AbstractTrees", "Base64", "CodecZlib", "Dates", "DocStringExtensions", "Downloads", "Git", "IOCapture", "InteractiveUtils", "JSON", "LibGit2", "Logging", "Markdown", "MarkdownAST", "Pkg", "PrecompileTools", "REPL", "RegistryInstances", "SHA", "TOML", "Test", "Unicode"]
-git-tree-sha1 = "5a1ee886566f2fa9318df1273d8b778b9d42712d"
+git-tree-sha1 = "d0ea2c044963ed6f37703cead7e29f70cba13d7e"
 uuid = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
-version = "1.7.0"
+version = "1.8.0"
 
 [[deps.Downloads]]
 deps = ["ArgTools", "FileWatching", "LibCURL", "NetworkOptions"]
@@ -78,9 +78,9 @@
 
 [[deps.Expat_jll]]
 deps = ["Artifacts", "JLLWrappers", "Libdl"]
-git-tree-sha1 = "1c6317308b9dc757616f0b5cb379db10494443a7"
+git-tree-sha1 = "e51db81749b0777b2147fbe7b783ee79045b8e99"
 uuid = "2e619515-83b5-522b-bb60-26c02a35a201"
-version = "2.6.2+0"
+version = "2.6.4+3"
 
 [[deps.FileWatching]]
 uuid = "7b1f6079-737a-58dc-b8bc-7a2ca5c1b5ee"
@@ -94,9 +94,9 @@
 
 [[deps.Git_jll]]
 deps = ["Artifacts", "Expat_jll", "JLLWrappers", "LibCURL_jll", "Libdl", "Libiconv_jll", "OpenSSL_jll", "PCRE2_jll", "Zlib_jll"]
-git-tree-sha1 = "ea372033d09e4552a04fd38361cd019f9003f4f4"
+git-tree-sha1 = "399f4a308c804b446ae4c91eeafadb2fe2c54ff9"
 uuid = "f8c6e375-362e-5223-8a59-34ff63f689eb"
-version = "2.46.2+0"
+version = "2.47.1+0"
 
 [[deps.IOCapture]]
 deps = ["Logging", "Random"]
@@ -111,9 +111,9 @@
 
 [[deps.JLLWrappers]]
 deps = ["Artifacts", "Preferences"]
-git-tree-sha1 = "be3dc50a92e5a386872a493a10050136d4703f9b"
+git-tree-sha1 = "a007feb38b422fbdab534406aeca1b86823cb4d6"
 uuid = "692b3bcd-3c85-4b1f-b108-f13ce0eb3210"
-version = "1.6.1"
+version = "1.7.0"
 
 [[deps.JSON]]
 deps = ["Dates", "Mmap", "Parsers", "Unicode"]
@@ -122,9 +122,9 @@
 version = "0.21.4"
 
 [[deps.LazilyInitializedFields]]
-git-tree-sha1 = "8f7f3cabab0fd1800699663533b6d5cb3fc0e612"
+git-tree-sha1 = "0f2da712350b020bc3957f269c9caad516383ee0"
 uuid = "0e77f7df-68c5-4e49-93ce-4cd80f5598bf"
-version = "1.2.2"
+version = "1.3.0"
 
 [[deps.LibCURL]]
 deps = ["LibCURL_jll", "MozillaCACerts_jll"]
@@ -157,9 +157,9 @@
 
 [[deps.Libiconv_jll]]
 deps = ["Artifacts", "JLLWrappers", "Libdl"]
-git-tree-sha1 = "f9557a255370125b405568f9767d6d195822a175"
+git-tree-sha1 = "61dfdba58e585066d8bce214c5a51eaa0539f269"
 uuid = "94ce4f54-9a6c-5748-9c1c-f9c7231a4531"
-version = "1.17.0+0"
+version = "1.17.0+1"
 
 [[deps.LinearAlgebra]]
 deps = ["Libdl", "OpenBLAS_jll", "libblastrampoline_jll"]
@@ -207,7 +207,7 @@
 deps = ["Artifacts", "JLLWrappers", "Libdl"]
 git-tree-sha1 = "7493f61f55a6cce7325f197443aa80d32554ba10"
 uuid = "458c3c95-2e84-50aa-8efc-19380b2a3a95"
-version = "3.0.15+1"
+version = "3.0.15+3"
 
 [[deps.PCRE2_jll]]
 deps = ["Artifacts", "Libdl"]
@@ -276,9 +276,9 @@
 
 [[deps.StaticArrays]]
 deps = ["LinearAlgebra", "PrecompileTools", "Random", "StaticArraysCore"]
-git-tree-sha1 = "eeafab08ae20c62c44c8399ccb9354a04b80db50"
+git-tree-sha1 = "47091a0340a675c738b1304b58161f3b0839d454"
 uuid = "90137ffa-7385-5640-81b9-e52037218182"
-version = "1.9.7"
+version = "1.9.10"
 
     [deps.StaticArrays.extensions]
     StaticArraysChainRulesCoreExt = "ChainRulesCore"
diff -r de4b4f2aee4f -r 81559cb7b11c src/Diffinitive.jl
--- a/src/Diffinitive.jl	Tue Nov 12 18:15:27 2024 +0100
+++ b/src/Diffinitive.jl	Thu Jan 23 23:22:11 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
diff -r de4b4f2aee4f -r 81559cb7b11c src/Grids/equidistant_grid.jl
--- a/src/Grids/equidistant_grid.jl	Tue Nov 12 18:15:27 2024 +0100
+++ b/src/Grids/equidistant_grid.jl	Thu Jan 23 23:22:11 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)
diff -r de4b4f2aee4f -r 81559cb7b11c src/Grids/mapped_grid.jl
--- a/src/Grids/mapped_grid.jl	Tue Nov 12 18:15:27 2024 +0100
+++ b/src/Grids/mapped_grid.jl	Thu Jan 23 23:22:11 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),
@@ -128,7 +128,7 @@
 """
 function mapped_grid(x, J, ps::ParameterSpace, size::Vararg{Int})
     lg = equidistant_grid(ps, size...)
-    return mapped_grid(lg, x, J)
+    return mapped_grid(x, J, lg)
 end
 
 """
diff -r de4b4f2aee4f -r 81559cb7b11c src/Grids/tensor_grid.jl
--- a/src/Grids/tensor_grid.jl	Tue Nov 12 18:15:27 2024 +0100
+++ b/src/Grids/tensor_grid.jl	Thu Jan 23 23:22:11 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)
diff -r de4b4f2aee4f -r 81559cb7b11c src/LazyTensors/lazy_tensor_operations.jl
--- a/src/LazyTensors/lazy_tensor_operations.jl	Tue Nov 12 18:15:27 2024 +0100
+++ b/src/LazyTensors/lazy_tensor_operations.jl	Thu Jan 23 23:22:11 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)
 
diff -r de4b4f2aee4f -r 81559cb7b11c src/RegionIndices/RegionIndices.jl
--- a/src/RegionIndices/RegionIndices.jl	Tue Nov 12 18:15:27 2024 +0100
+++ b/src/RegionIndices/RegionIndices.jl	Thu Jan 23 23:22:11 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.
diff -r de4b4f2aee4f -r 81559cb7b11c src/SbpOperators/stencil.jl
--- a/src/SbpOperators/stencil.jl	Tue Nov 12 18:15:27 2024 +0100
+++ b/src/SbpOperators/stencil.jl	Thu Jan 23 23:22:11 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}
diff -r de4b4f2aee4f -r 81559cb7b11c src/SbpOperators/volumeops/constant_interior_scaling_operator.jl
--- a/src/SbpOperators/volumeops/constant_interior_scaling_operator.jl	Tue Nov 12 18:15:27 2024 +0100
+++ b/src/SbpOperators/volumeops/constant_interior_scaling_operator.jl	Thu Jan 23 23:22:11 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
 
diff -r de4b4f2aee4f -r 81559cb7b11c src/SbpOperators/volumeops/volume_operator.jl
--- a/src/SbpOperators/volumeops/volume_operator.jl	Tue Nov 12 18:15:27 2024 +0100
+++ b/src/SbpOperators/volumeops/volume_operator.jl	Thu Jan 23 23:22:11 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.
diff -r de4b4f2aee4f -r 81559cb7b11c test/Grids/mapped_grid_test.jl
--- a/test/Grids/mapped_grid_test.jl	Tue Nov 12 18:15:27 2024 +0100
+++ b/test/Grids/mapped_grid_test.jl	Thu Jan 23 23:22:11 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
 
     @test mapped_grid(x̄, J, unitsquare(), 10, 11) == mg
 end
diff -r de4b4f2aee4f -r 81559cb7b11c test/Grids/tensor_grid_test.jl
--- a/test/Grids/tensor_grid_test.jl	Tue Nov 12 18:15:27 2024 +0100
+++ b/test/Grids/tensor_grid_test.jl	Thu Jan 23 23:22:11 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))
diff -r de4b4f2aee4f -r 81559cb7b11c test/Manifest.toml
--- a/test/Manifest.toml	Tue Nov 12 18:15:27 2024 +0100
+++ b/test/Manifest.toml	Thu Jan 23 23:22:11 2025 +0100
@@ -1,8 +1,14 @@
 # This file is machine-generated - editing it directly is not advised
 
-julia_version = "1.11.1"
+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"
@@ -17,10 +23,26 @@
 version = "1.11.0"
 
 [[deps.BenchmarkTools]]
-deps = ["JSON", "Logging", "Printf", "Profile", "Statistics", "UUIDs"]
-git-tree-sha1 = "f1dff6729bc61f4d49e140da1af55dcd1ac97b2f"
+deps = ["Compat", "JSON", "Logging", "Printf", "Profile", "Statistics", "UUIDs"]
+git-tree-sha1 = "e38fbc49a620f5d0b660d7f543db1009fe0f8336"
 uuid = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
-version = "1.5.0"
+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"
+uuid = "34da2185-b29b-5c13-b0c7-acf172513d20"
+version = "4.16.0"
+weakdeps = ["Dates", "LinearAlgebra"]
+
+    [deps.Compat.extensions]
+    CompatLinearAlgebraExt = "LinearAlgebra"
 
 [[deps.CompilerSupportLibraries_jll]]
 deps = ["Artifacts", "Libdl"]
@@ -78,11 +100,25 @@
 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 = "be3dc50a92e5a386872a493a10050136d4703f9b"
+git-tree-sha1 = "a007feb38b422fbdab534406aeca1b86823cb4d6"
 uuid = "692b3bcd-3c85-4b1f-b108-f13ce0eb3210"
-version = "1.6.1"
+version = "1.7.0"
 
 [[deps.JSON]]
 deps = ["Dates", "Mmap", "Parsers", "Unicode"]
@@ -90,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"
@@ -135,9 +177,9 @@
 
 [[deps.LogExpFunctions]]
 deps = ["DocStringExtensions", "IrrationalConstants", "LinearAlgebra"]
-git-tree-sha1 = "a2d09619db4e765091ee5c6ffe8872849de0feea"
+git-tree-sha1 = "13ca9e2586b89836fd20cccf56e57e2b9ae7f38f"
 uuid = "2ab3a3ac-af41-5b50-aa03-7779005ae688"
-version = "0.3.28"
+version = "0.3.29"
 
     [deps.LogExpFunctions.extensions]
     LogExpFunctionsChainRulesCoreExt = "ChainRulesCore"
@@ -153,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"
@@ -173,9 +226,9 @@
 
 [[deps.NaNMath]]
 deps = ["OpenLibm_jll"]
-git-tree-sha1 = "0877504529a3e5c3343c6f8b4c0381e57e4387e4"
+git-tree-sha1 = "030ea22804ef91648f29b7ad3fc15fa49d0e6e71"
 uuid = "77ba4419-2d1f-58cd-9bb1-8ffee604a2e3"
-version = "1.0.2"
+version = "1.0.3"
 
 [[deps.NetworkOptions]]
 uuid = "ca575930-c2e3-43a9-ace4-1e988b2c1908"
@@ -192,10 +245,10 @@
 version = "0.8.1+2"
 
 [[deps.OpenSpecFun_jll]]
-deps = ["Artifacts", "CompilerSupportLibraries_jll", "JLLWrappers", "Libdl", "Pkg"]
-git-tree-sha1 = "13652491f6856acfd2db29360e1bbcd4565d04f1"
+deps = ["Artifacts", "CompilerSupportLibraries_jll", "JLLWrappers", "Libdl"]
+git-tree-sha1 = "1346c9208249809840c91b26703912dff463d335"
 uuid = "efe28fd5-8261-553b-a9e1-b2916fc3738e"
-version = "0.5.5+0"
+version = "0.5.6+0"
 
 [[deps.PackageExtensionCompat]]
 git-tree-sha1 = "fb28e33b8a95c4cee25ce296c817d89cc2e53518"
@@ -286,9 +339,9 @@
 
 [[deps.SpecialFunctions]]
 deps = ["IrrationalConstants", "LogExpFunctions", "OpenLibm_jll", "OpenSpecFun_jll"]
-git-tree-sha1 = "2f5d4697f21388cbe1ff299430dd169ef97d7e14"
+git-tree-sha1 = "64cca0c26b4f31ba18f13f6c12af7c85f478cfde"
 uuid = "276daf66-3868-5448-9aa4-cd146d93841b"
-version = "2.4.0"
+version = "2.5.0"
 
     [deps.SpecialFunctions.extensions]
     SpecialFunctionsChainRulesCoreExt = "ChainRulesCore"
@@ -298,9 +351,9 @@
 
 [[deps.StaticArrays]]
 deps = ["LinearAlgebra", "PrecompileTools", "Random", "StaticArraysCore"]
-git-tree-sha1 = "eeafab08ae20c62c44c8399ccb9354a04b80db50"
+git-tree-sha1 = "47091a0340a675c738b1304b58161f3b0839d454"
 uuid = "90137ffa-7385-5640-81b9-e52037218182"
-version = "1.9.7"
+version = "1.9.10"
 
     [deps.StaticArrays.extensions]
     StaticArraysChainRulesCoreExt = "ChainRulesCore"
@@ -327,15 +380,15 @@
 
 [[deps.Strided]]
 deps = ["LinearAlgebra", "StridedViews", "TupleTools"]
-git-tree-sha1 = "d85461cb47420b6dcecf51de8142fc60484dd0b3"
+git-tree-sha1 = "f9ce8284e6eec72a21de3603493eb5355fcf7f39"
 uuid = "5e0ebb24-38b0-5f93-81fe-25c709ecae67"
-version = "2.1.1"
+version = "2.2.0"
 
 [[deps.StridedViews]]
 deps = ["LinearAlgebra", "PackageExtensionCompat"]
-git-tree-sha1 = "2917996ce0fa6b8a3a85240a5e9ff930e2aeaa43"
+git-tree-sha1 = "b60baf1998bcdccc57e1cc2c6703df1f619a3754"
 uuid = "4db3bf67-4bd7-4b4e-b153-31dc3fb37143"
-version = "0.3.1"
+version = "0.3.2"
 
     [deps.StridedViews.extensions]
     StridedViewsCUDAExt = "CUDA"
@@ -360,9 +413,9 @@
 
 [[deps.TensorOperations]]
 deps = ["LRUCache", "LinearAlgebra", "PackageExtensionCompat", "PtrArrays", "Strided", "StridedViews", "TupleTools", "VectorInterface"]
-git-tree-sha1 = "af2cf256cb575a62d8baf128b13e9045e1ede69c"
+git-tree-sha1 = "d08a24e2cb67aa0cbfcd68d0acdf2879e571126f"
 uuid = "6aa20fa7-93e2-5fca-9bc0-fbd0db3c71a2"
-version = "5.0.2"
+version = "5.1.3"
 
     [deps.TensorOperations.extensions]
     TensorOperationsBumperExt = "Bumper"
@@ -411,9 +464,9 @@
     Tracker = "9f7883ad-71c0-57eb-9f7f-b5c9e6d3789c"
 
 [[deps.TupleTools]]
-git-tree-sha1 = "41d61b1c545b06279871ef1a4b5fcb2cac2191cd"
+git-tree-sha1 = "41e43b9dc950775eac654b9f845c839cd2f1821e"
 uuid = "9d95972d-f1c8-5527-a6e0-b4b365fa01f6"
-version = "1.5.0"
+version = "1.6.0"
 
 [[deps.UUIDs]]
 deps = ["Random", "SHA"]
@@ -426,9 +479,9 @@
 
 [[deps.VectorInterface]]
 deps = ["LinearAlgebra"]
-git-tree-sha1 = "7aff7d62bffad9bba9928eb6ab55226b32a351eb"
+git-tree-sha1 = "cea8abaa6e43f72f97a09cf95b80c9eb53ff75cf"
 uuid = "409d34a3-91d5-4945-b6ec-7529ddf182d8"
-version = "0.4.6"
+version = "0.4.9"
 
 [[deps.Zlib_jll]]
 deps = ["Libdl"]
diff -r de4b4f2aee4f -r 81559cb7b11c test/Project.toml
--- a/test/Project.toml	Tue Nov 12 18:15:27 2024 +0100
+++ b/test/Project.toml	Thu Jan 23 23:22:11 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"
diff -r de4b4f2aee4f -r 81559cb7b11c test/SbpOperators/volumeops/volume_operator_test.jl
--- a/test/SbpOperators/volumeops/volume_operator_test.jl	Tue Nov 12 18:15:27 2024 +0100
+++ b/test/SbpOperators/volumeops/volume_operator_test.jl	Thu Jan 23 23:22:11 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
diff -r de4b4f2aee4f -r 81559cb7b11c test/runtests.jl
--- a/test/runtests.jl	Tue Nov 12 18:15:27 2024 +0100
+++ b/test/runtests.jl	Thu Jan 23 23:22:11 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