Mercurial > repos > public > sbplib_julia
changeset 1829:871f3f1decea refactor/grids/iterable_boundary_indices
Merge default
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Sun, 20 Oct 2024 21:38:09 +0200 |
parents | 8adecef380b4 (current diff) 9b47cdbbba75 (diff) |
children | 805b9b7fcc39 |
files | src/Diffinitive.jl src/Grids/equidistant_grid.jl src/Grids/tensor_grid.jl test/Grids/equidistant_grid_test.jl test/Grids/tensor_grid_test.jl |
diffstat | 80 files changed, 1569 insertions(+), 1395 deletions(-) [+] |
line wrap: on
line diff
--- a/Manifest.toml Tue Sep 17 11:20:00 2024 +0200 +++ b/Manifest.toml Sun Oct 20 21:38:09 2024 +0200 @@ -1,92 +1,36 @@ # This file is machine-generated - editing it directly is not advised -julia_version = "1.10.2" +julia_version = "1.11.1" manifest_format = "2.0" -project_hash = "a36735c53cfa4453f39635046eeaa47a4ea1231b" - -[[deps.Adapt]] -deps = ["LinearAlgebra", "Requires"] -git-tree-sha1 = "6a55b747d1812e699320963ffde36f1ebdda4099" -uuid = "79e6a3ab-5dfb-504d-930d-738a2a938a0e" -version = "4.0.4" -weakdeps = ["StaticArrays"] - - [deps.Adapt.extensions] - AdaptStaticArraysExt = "StaticArrays" - -[[deps.ArrayInterface]] -deps = ["Adapt", "LinearAlgebra", "SparseArrays", "SuiteSparse"] -git-tree-sha1 = "44691067188f6bd1b2289552a23e4b7572f4528d" -uuid = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9" -version = "7.9.0" - - [deps.ArrayInterface.extensions] - ArrayInterfaceBandedMatricesExt = "BandedMatrices" - ArrayInterfaceBlockBandedMatricesExt = "BlockBandedMatrices" - ArrayInterfaceCUDAExt = "CUDA" - ArrayInterfaceChainRulesExt = "ChainRules" - ArrayInterfaceGPUArraysCoreExt = "GPUArraysCore" - ArrayInterfaceReverseDiffExt = "ReverseDiff" - ArrayInterfaceStaticArraysCoreExt = "StaticArraysCore" - ArrayInterfaceTrackerExt = "Tracker" - - [deps.ArrayInterface.weakdeps] - BandedMatrices = "aae01518-5342-5314-be14-df237901396f" - BlockBandedMatrices = "ffab5731-97b5-5995-9138-79e8c1846df0" - CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba" - ChainRules = "082447d4-558c-5d27-93f4-14fc19e9eca2" - GPUArraysCore = "46192b85-c4d5-4398-a991-12ede77f4527" - ReverseDiff = "37e2e3b7-166d-5795-8a7a-e32c996b4267" - StaticArraysCore = "1e83bf80-4336-4d27-bf5d-d5a4f845583c" - Tracker = "9f7883ad-71c0-57eb-9f7f-b5c9e6d3789c" +project_hash = "e8ce4954d65eae4e48090d67a590f9405da1832d" [[deps.Artifacts]] uuid = "56f22d72-fd6d-98f1-02f0-08ddc0907c33" - -[[deps.Compat]] -deps = ["TOML", "UUIDs"] -git-tree-sha1 = "c955881e3c981181362ae4088b35995446298b80" -uuid = "34da2185-b29b-5c13-b0c7-acf172513d20" -version = "4.14.0" -weakdeps = ["Dates", "LinearAlgebra"] - - [deps.Compat.extensions] - CompatLinearAlgebraExt = "LinearAlgebra" +version = "1.11.0" [[deps.CompilerSupportLibraries_jll]] deps = ["Artifacts", "Libdl"] uuid = "e66e0078-7015-5450-92f7-15fbd957f2ae" -version = "1.1.0+0" +version = "1.1.1+0" [[deps.Dates]] deps = ["Printf"] uuid = "ade2ca70-3891-5945-98fb-dc099432e06a" - -[[deps.IfElse]] -git-tree-sha1 = "debdd00ffef04665ccbb3e150747a77560e8fad1" -uuid = "615f187c-cbe4-4ef1-ba3b-2fcf58d6d173" -version = "0.1.1" +version = "1.11.0" [[deps.Libdl]] uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb" +version = "1.11.0" [[deps.LinearAlgebra]] deps = ["Libdl", "OpenBLAS_jll", "libblastrampoline_jll"] uuid = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" - -[[deps.OffsetArrays]] -git-tree-sha1 = "6a731f2b5c03157418a20c12195eb4b74c8f8621" -uuid = "6fe1bfb0-de20-5000-8ca7-80f57d26f881" -version = "1.13.0" -weakdeps = ["Adapt"] - - [deps.OffsetArrays.extensions] - OffsetArraysAdaptExt = "Adapt" +version = "1.11.0" [[deps.OpenBLAS_jll]] deps = ["Artifacts", "CompilerSupportLibraries_jll", "Libdl"] uuid = "4536629a-c528-5b80-bd46-f80d51c5b363" -version = "0.3.23+4" +version = "0.3.27+1" [[deps.PrecompileTools]] deps = ["Preferences"] @@ -103,51 +47,22 @@ [[deps.Printf]] deps = ["Unicode"] uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7" +version = "1.11.0" [[deps.Random]] deps = ["SHA"] uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" - -[[deps.Requires]] -deps = ["UUIDs"] -git-tree-sha1 = "838a3a4188e2ded87a4f9f184b4b0d78a1e91cb7" -uuid = "ae029012-a4dd-5104-9daa-d747884805df" -version = "1.3.0" +version = "1.11.0" [[deps.SHA]] uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce" version = "0.7.0" -[[deps.Serialization]] -uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b" - -[[deps.SparseArrays]] -deps = ["Libdl", "LinearAlgebra", "Random", "Serialization", "SuiteSparse_jll"] -uuid = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" -version = "1.10.0" - -[[deps.Static]] -deps = ["IfElse"] -git-tree-sha1 = "d2fdac9ff3906e27f7a618d47b676941baa6c80c" -uuid = "aedffcd0-7271-4cad-89d0-dc628f76c6d3" -version = "0.8.10" - -[[deps.StaticArrayInterface]] -deps = ["ArrayInterface", "Compat", "IfElse", "LinearAlgebra", "PrecompileTools", "Requires", "SparseArrays", "Static", "SuiteSparse"] -git-tree-sha1 = "5d66818a39bb04bf328e92bc933ec5b4ee88e436" -uuid = "0d7ed370-da01-4f52-bd93-41d350b8b718" -version = "1.5.0" -weakdeps = ["OffsetArrays", "StaticArrays"] - - [deps.StaticArrayInterface.extensions] - StaticArrayInterfaceOffsetArraysExt = "OffsetArrays" - StaticArrayInterfaceStaticArraysExt = "StaticArrays" - [[deps.StaticArrays]] deps = ["LinearAlgebra", "PrecompileTools", "Random", "StaticArraysCore"] -git-tree-sha1 = "bf074c045d3d5ffd956fa0a461da38a44685d6b2" +git-tree-sha1 = "eeafab08ae20c62c44c8399ccb9354a04b80db50" uuid = "90137ffa-7385-5640-81b9-e52037218182" -version = "1.9.3" +version = "1.9.7" [deps.StaticArrays.extensions] StaticArraysChainRulesCoreExt = "ChainRulesCore" @@ -158,38 +73,20 @@ Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" [[deps.StaticArraysCore]] -git-tree-sha1 = "36b3d696ce6366023a0ea192b4cd442268995a0d" +git-tree-sha1 = "192954ef1208c7019899fbf8049e717f92959682" uuid = "1e83bf80-4336-4d27-bf5d-d5a4f845583c" -version = "1.4.2" - -[[deps.SuiteSparse]] -deps = ["Libdl", "LinearAlgebra", "Serialization", "SparseArrays"] -uuid = "4607b0f0-06f3-5cda-b6b1-a6196a1729e9" - -[[deps.SuiteSparse_jll]] -deps = ["Artifacts", "Libdl", "libblastrampoline_jll"] -uuid = "bea87d4a-7f5b-5778-9afe-8cc45184846c" -version = "7.2.1+1" +version = "1.4.3" [[deps.TOML]] deps = ["Dates"] uuid = "fa267f1f-6049-4f14-aa54-33bafae1ed76" version = "1.0.3" -[[deps.TiledIteration]] -deps = ["OffsetArrays", "StaticArrayInterface"] -git-tree-sha1 = "1176cc31e867217b06928e2f140c90bd1bc88283" -uuid = "06e1c1a7-607b-532d-9fad-de7d9aa2abac" -version = "0.5.0" - -[[deps.UUIDs]] -deps = ["Random", "SHA"] -uuid = "cf7118a7-6976-5b1a-9a39-7adc72f591a4" - [[deps.Unicode]] uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5" +version = "1.11.0" [[deps.libblastrampoline_jll]] deps = ["Artifacts", "Libdl"] uuid = "8e850b90-86db-534c-a0d3-1478176c7d93" -version = "5.8.0+1" +version = "5.11.0+0"
--- a/Notes.md Tue Sep 17 11:20:00 2024 +0200 +++ b/Notes.md Sun Oct 20 21:38:09 2024 +0200 @@ -21,6 +21,21 @@ sat(::DifferentialOperator, grid, stencil_set, bc) = ... ``` + +### Update 2024-06-26 +We will run into trouble if we start assuming things about the coupling +between the continuous and discrete setting. We could add representations of +continuous operators but we will also need representations of discrete +operators. Ideally it should be possible to ignore the continuous +representations and only work with the discrete operators without losing +functionality. The discrete representations does not have to be LazyTensors. +The could be used as inputs to methods for `sat`, `difference_operator` and so +on. + +To see need for a fully functional discrete layer we can consider the +optimization of material parameters or something similar. In this case we do +not necessarily want to handle continuous objects. + ## Reading operators Jonatan's suggestion is to add methods to `Laplace`, `SecondDerivative` and @@ -103,19 +118,10 @@ Maybe if we should have dynamic sizing it could be only for the range. `domain_size` would not be implemented. And the `range_size` would be a function of a vector that the LazyTensor is applied to. ## Reasearch and thinking - - [ ] Use a trait to indicate that a LazyTensor har the same range and domain? - [ ] Check how the native julia doc generator works - [ ] Check if Vidars design docs fit in there - [ ] Create a macro @lazy which replaces a binary op (+,-) by its lazy equivalent? Would be a neat way to indicate which evaluations are lazy without cluttering/confusing with special characters. - - [ ] Dispatch on Lower() instead of the type Lower so `::Lower` instead of `::Type{Lower}` ??? - Seems better unless there is some specific reason to use the type instead of the value. - [ ] Can we have a trait to tell if a LazyTensor is transposable? - - [ ] Is it ok to have "Constructors" for abstract types which create subtypes? For example a Grids() functions that gives different kind of grids based on input? - - [ ] Figure out how to treat the borrowing parameters of operators. Include in into the struct? Expose via function dispatched on the operator type and grid? - -## Identifiers for regions -The identifiers (`Upper`, `Lower`, `Interior`) used for region indecies should probably be included in the grid module. This allows new grid types to come with their own regions. -We implement this by refactoring RegionIndices to be agnostic to the region types and then moving the actual types to Grids. ## Regions and tensormappings - [ ] Use a trait to indicate if a LazyTensor uses indices with regions. @@ -167,15 +173,14 @@ Preferably dimensions and sizes should be checked when lazy objects are created, for example TensorApplication, TensorComposition and so on. If dimension checks decreases performance we can make them skippable later. ## Changes to `eval_on` -There are reasons to replace `eval_on` with regular `map` from Base, and implement a kind of lazy map perhaps `lmap` that work on indexable collections. - -The benefit of doing this is that we can treat grids as gridfunctions for the coordinate function, and get a more flexible tool. For example `map`/`lmap` can then be used both to evaluate a function on the grid but also get a component of a vector valued grid function or similar. +There are reasons to replace `eval_on` with regular `map` from Base, and +implement a kind of lazy map perhaps `lmap` that work on indexable +collections. -A question is how and if we should implement `map`/`lmap` for functions like `(x,y)->x*y` or stick to just using vector inputs. There are a few options. - -* use `Base.splat((x,y)->x*y)` with the single argument `map`/`lmap`. -* implement a kind of `unzip` function to get iterators for each component, which can then be used with the multiple-iterators-version of `map`/`lmap`. -* Inspect the function in the `map`/`lmap` function to determine which matches. +The benefit of doing this is that we can treat grids as gridfunctions for the +coordinate function, and get a more flexible tool. For example `map`/`lmap` +can then be used both to evaluate a function on the grid but also get a +component of a vector valued grid function or similar. Below is a partial implementation of `lmap` with some ideas ```julia @@ -205,7 +210,10 @@ lmap(f, I) = LazyIndexableMap(f,I) ``` -The interaction of the map methods with the probable design of multiblock functions involving nested indecies complicate the picture slightly. It's clear at the time of writing how this would work with `Base.map`. Perhaps we want to implement our own versions of both eager and lazy map. +The interaction of the map methods with the probable design of multiblock +functions involving nested indecies complicate the picture slightly. It's +unclear at the time of writing how this would work with `Base.map`. Perhaps we +want to implement our own versions of both eager and lazy map. ### 2024-04 @@ -276,16 +284,6 @@ Grid-funktioner har typen `AbstractArray{T,2} where T`. `T` kan vara lite vad som helst, tillexemel en SVector eller Array, eller Tuple. Tensoroperatorerna bryr sig inte om exakt vad det är, mer än att typen måste stödja de operationer som operatorn använder. -En nackdel kan vara hur man ska få ut gridfunktionen för tex andra komponenten. - -Syntax: -``` -f(x̄) = x̄ -gf = evalOn(g, f) -gf[2,3] # x̄ för en viss gridpunkt -gf[2,3][2] # x̄[2] för en viss gridpunkt -``` - ### Tensor operatorer Vi kan ha tensor-operatorer som agerar på ett skalärt fält och ger ett vektorfält eller tensorfält. Vi kan också ha tensor-operatorer som agerar på ett vektorfält eller tensorfält och ger ett skalärt fält. @@ -301,16 +299,6 @@ Kanske kan man implementera `⋅(tm::LazyTensor{R,D}, v::AbstractArray{T,D})` där T är en AbstractArray, tm på något sätt har komponenter, lika många som T har element. -### Komponenter som gridfunktioner -En viktig operation för vektorfält är att kunna få ut komponenter som grid-funktioner. Detta behöver antagligen kunna ske lazy. -Det finns ett par olika lösningar: -* Använda map eller en lazy map (se diskussion om eval_on) -* Implementera en egen typ av view som tar hand om detta. Eller Accessors.jl? -* Använda en LazyTensor -* Någon typ av lazy-broadcast -* En lazy array som applicerar en funktion för varje element. - - ### Prestanda-aspekter [Vidar, Discord, 2023-03-03] Typiskt sett finns det två sätt att representera vektorvärda gridfunktioner AbstractArray{T,Dim} där T är en vektor över komponenterna. Man skulle alltså i 1D ha @@ -377,3 +365,38 @@ stencil application on the bugfix/sbp_operators/stencil_return_type branch there seemed to be some strange results where such errors could be the culprit. + + +## Tiled loops and regions in apply +There should be easy ways to use functionalty splitting the application of a lazy array into regions and using tiled iteration. This could make the application more efficient by reducing branching and improving cache usage in the tight loop. On commit f215ac2a5c66 and before there were some early tests regarding this in a DiffOp submodule. + +The main ideas were: +```julia +function apply_region!(D::DiffOpCartesian{2}, u::AbstractArray{T,2}, v::AbstractArray{T,2}) where T + apply_region!(D, u, v, Lower, Lower) + apply_region!(D, u, v, Lower, Interior) + apply_region!(D, u, v, Lower, Upper) + apply_region!(D, u, v, Interior, Lower) + apply_region!(D, u, v, Interior, Interior) + apply_region!(D, u, v, Interior, Upper) + apply_region!(D, u, v, Upper, Lower) + apply_region!(D, u, v, Upper, Interior) + apply_region!(D, u, v, Upper, Upper) + return nothing +end +``` + +```julia +using TiledIteration +function apply_region_tiled!(D::DiffOpCartesian{2}, u::AbstractArray{T,2}, v::AbstractArray{T,2}, r1::Type{<:Region}, r2::Type{<:Region}) where T + ri = regionindices(D.grid.size, closuresize(D.op), (r1,r2)) + # TODO: Pass Tilesize to function + for tileaxs ∈ TileIterator(axes(ri), padded_tilesize(T, (5,5), 2)) + for j ∈ tileaxs[2], i ∈ tileaxs[1] + I = ri[i,j] + u[I] = apply(D, v, (Index{r1}(I[1]), Index{r2}(I[2]))) + end + end + return nothing +end +```
--- a/Project.toml Tue Sep 17 11:20:00 2024 +0200 +++ b/Project.toml Sun Oct 20 21:38:09 2024 +0200 @@ -1,12 +1,23 @@ -name = "Sbplib" +name = "Diffinitive" uuid = "5a373a26-915f-4769-bcab-bf03835de17b" -authors = ["Jonatan Werpers <jonatan@werpers.com>", "Vidar Stiernström <vidar.stiernstrom@it.uu.se>, and contributors"] -version = "0.1.0" +authors = ["Jonatan Werpers <jonatan@werpers.com>", "Vidar Stiernström <vidar.stiernstrom@gmail.com>, and contributors"] +version = "0.1.3" [deps] +LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" TOML = "fa267f1f-6049-4f14-aa54-33bafae1ed76" -TiledIteration = "06e1c1a7-607b-532d-9fad-de7d9aa2abac" + +[weakdeps] +Makie = "ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a" +SparseArrayKit = "a9a3c162-d163-4c15-8926-b8794fbefed2" +SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" +Tokens = "040c2ec2-8d69-4aca-bf03-7d3a7092f2f6" + +[extensions] +DiffinitiveMakieExt = "Makie" +DiffinitiveSparseArrayKitExt = ["SparseArrayKit", "Tokens"] +DiffinitiveSparseArraysExt = ["SparseArrays", "Tokens"] [compat] julia = "1.5"
--- a/README.md Tue Sep 17 11:20:00 2024 +0200 +++ b/README.md Sun Oct 20 21:38:09 2024 +0200 @@ -1,10 +1,10 @@ -# Sbplib +# Diffinitive ## Running tests To run all tests simply run ``` (@v1.5) pkg> activate . -(Sbplib) pkg> test +(Diffinitive) pkg> test ``` If you want to run tests from a specific file in `test/`, you can do @@ -59,8 +59,8 @@ ```julia using PkgBenchmark -import Sbplib -r = benchmarkpkg(Sbplib) +import Diffinitive +r = benchmarkpkg(Diffinitive) export_markdown(stdout, r) ```
--- a/TODO.md Tue Sep 17 11:20:00 2024 +0200 +++ b/TODO.md Sun Oct 20 21:38:09 2024 +0200 @@ -4,11 +4,7 @@ - [ ] Split up Notes.md in several files ## Coding - - [ ] Ändra namn på variabler och funktioner så att det följer style-guide - - [ ] Add new Laplace operator to DiffOps, probably named WaveEqOp(?!!?) - [ ] Create a struct that bundles the necessary Tensor operators for solving the wave equation. - - [ ] Use `@inferred` in a lot of tests. - - [ ] Replace `@inferred` tests with a benchmark suite that automatically tests for regressions. - [ ] Make sure we are setting tolerances in tests in a consistent way - [ ] Write down some coding guideline or checklist for code conventions. For example i,j,... for indices and I for multi-index - [ ] Clean up RegionIndices @@ -16,7 +12,6 @@ 2. [ ] Update RegionIndices accordingly 3. [ ] Fix the rest of the library Should getregion also work for getregion(::Colon,...) - - [ ] Add possibility to create tensor mapping application with `()`, e.g `D1(v) <=> D1*v`? - [ ] Add custom pretty printing to LazyTensors/SbpOperators to enhance readability of e.g error messages. See (https://docs.julialang.org/en/v1/manual/types/#man-custom-pretty-printing) - [ ] Samla noggrannhets- och SBP-ness-tester för alla operatorer på ett ställe @@ -33,6 +28,7 @@ - [ ] Kolla att vi har @inline på rätt ställen - [ ] Profilera + - [ ] Keep a lookout for allowing dependencies of package extensions (https://github.com/JuliaLang/Pkg.jl/issues/3641) This should be used to simplify the matrix extensions so that you don't have to load Tokens which is only used internally to the extension ### Grids
--- a/TimeStepper.jl Tue Sep 17 11:20:00 2024 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,60 +0,0 @@ -abstract type TimeStepper end - -# Returns v and t -function getState(ts::TimeStepper) - error("not implemented") -end - - -function step!(ts::TimeStepper) - error("not implemented") -end - -function stepN(ts::TimeStepper,N::Int) - for i ∈ 1:N - ts.step() - end -end - -function stepTo(ts::TimeStepper) - error("Not yet implemented") -end - -function evolve(ts::TimeStepper) - error("Not yet implemented") -end - - -mutable struct Rk4 <: TimeStepper - F::Function - k::Real - v::Vector - t::Real - n::UInt - - function Rk4(F::Function,k::Real,v0::Vector,t0::Real) - # TODO: Check that F has two inputs and one output - v = v0 - t = t0 - n = 0 - return new(F,k,v,t,n) - end -end - -function getState(ts::Rk4) - return ts.t, ts.v -end - -function step!(ts::Rk4) - k1 = ts.F(ts.v,ts.t) - k2 = ts.F(ts.v+0.5*ts.k*k1,ts.t+0.5*ts.k) - k3 = ts.F(ts.v+0.5*ts.k*k2,ts.t+0.5*ts.k) - k4 = ts.F(ts.v+ ts.k*k3,ts.t+ ts.k) - ts.v = ts.v + (1/6)*(k1+2*(k2+k3)+k4)*ts.k - - ts.n = ts.n + 1 - ts.t = ts.t + ts.k - - return nothing -end -
--- a/benchmark/Manifest.toml Tue Sep 17 11:20:00 2024 +0200 +++ b/benchmark/Manifest.toml Sun Oct 20 21:38:09 2024 +0200 @@ -1,59 +1,25 @@ # This file is machine-generated - editing it directly is not advised -julia_version = "1.10.2" +julia_version = "1.11.1" manifest_format = "2.0" -project_hash = "25bba7b4a00465d5a2b00b589eb10e3301c31f2a" +project_hash = "ecfc3e12aca5be17a874aba6134ff821abf61540" [[deps.AbstractTrees]] git-tree-sha1 = "2d9c9a55f9c93e8887ad391fbae72f8ef55e1177" uuid = "1520ce14-60c1-5f80-bbc7-55ef81b5835c" version = "0.4.5" -[[deps.Adapt]] -deps = ["LinearAlgebra", "Requires"] -git-tree-sha1 = "6a55b747d1812e699320963ffde36f1ebdda4099" -uuid = "79e6a3ab-5dfb-504d-930d-738a2a938a0e" -version = "4.0.4" -weakdeps = ["StaticArrays"] - - [deps.Adapt.extensions] - AdaptStaticArraysExt = "StaticArrays" - [[deps.ArgTools]] uuid = "0dad84c5-d112-42e6-8d28-ef12dabb789f" -version = "1.1.1" - -[[deps.ArrayInterface]] -deps = ["Adapt", "LinearAlgebra", "SparseArrays", "SuiteSparse"] -git-tree-sha1 = "44691067188f6bd1b2289552a23e4b7572f4528d" -uuid = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9" -version = "7.9.0" - - [deps.ArrayInterface.extensions] - ArrayInterfaceBandedMatricesExt = "BandedMatrices" - ArrayInterfaceBlockBandedMatricesExt = "BlockBandedMatrices" - ArrayInterfaceCUDAExt = "CUDA" - ArrayInterfaceChainRulesExt = "ChainRules" - ArrayInterfaceGPUArraysCoreExt = "GPUArraysCore" - ArrayInterfaceReverseDiffExt = "ReverseDiff" - ArrayInterfaceStaticArraysCoreExt = "StaticArraysCore" - ArrayInterfaceTrackerExt = "Tracker" - - [deps.ArrayInterface.weakdeps] - BandedMatrices = "aae01518-5342-5314-be14-df237901396f" - BlockBandedMatrices = "ffab5731-97b5-5995-9138-79e8c1846df0" - CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba" - ChainRules = "082447d4-558c-5d27-93f4-14fc19e9eca2" - GPUArraysCore = "46192b85-c4d5-4398-a991-12ede77f4527" - ReverseDiff = "37e2e3b7-166d-5795-8a7a-e32c996b4267" - StaticArraysCore = "1e83bf80-4336-4d27-bf5d-d5a4f845583c" - Tracker = "9f7883ad-71c0-57eb-9f7f-b5c9e6d3789c" +version = "1.1.2" [[deps.Artifacts]] uuid = "56f22d72-fd6d-98f1-02f0-08ddc0907c33" +version = "1.11.0" [[deps.Base64]] uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f" +version = "1.11.0" [[deps.BenchmarkTools]] deps = ["JSON", "Logging", "Printf", "Profile", "Statistics", "UUIDs"] @@ -61,20 +27,10 @@ uuid = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf" version = "1.5.0" -[[deps.Compat]] -deps = ["TOML", "UUIDs"] -git-tree-sha1 = "c955881e3c981181362ae4088b35995446298b80" -uuid = "34da2185-b29b-5c13-b0c7-acf172513d20" -version = "4.14.0" -weakdeps = ["Dates", "LinearAlgebra"] - - [deps.Compat.extensions] - CompatLinearAlgebraExt = "LinearAlgebra" - [[deps.CompilerSupportLibraries_jll]] deps = ["Artifacts", "Libdl"] uuid = "e66e0078-7015-5450-92f7-15fbd957f2ae" -version = "1.1.0+0" +version = "1.1.1+0" [[deps.DataAPI]] git-tree-sha1 = "abe83f3a2f1b857aac70ef8b269080af17764bbe" @@ -89,6 +45,24 @@ [[deps.Dates]] deps = ["Printf"] uuid = "ade2ca70-3891-5945-98fb-dc099432e06a" +version = "1.11.0" + +[[deps.Diffinitive]] +deps = ["LinearAlgebra", "StaticArrays", "TOML"] +path = ".." +uuid = "5a373a26-915f-4769-bcab-bf03835de17b" +version = "0.1.3" + + [deps.Diffinitive.extensions] + DiffinitiveMakieExt = "Makie" + DiffinitiveSparseArrayKitExt = ["SparseArrayKit", "Tokens"] + DiffinitiveSparseArraysExt = ["SparseArrays", "Tokens"] + + [deps.Diffinitive.weakdeps] + Makie = "ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a" + SparseArrayKit = "a9a3c162-d163-4c15-8926-b8794fbefed2" + SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" + Tokens = "040c2ec2-8d69-4aca-bf03-7d3a7092f2f6" [[deps.Downloads]] deps = ["ArgTools", "FileWatching", "LibCURL", "NetworkOptions"] @@ -97,15 +71,12 @@ [[deps.FileWatching]] uuid = "7b1f6079-737a-58dc-b8bc-7a2ca5c1b5ee" - -[[deps.IfElse]] -git-tree-sha1 = "debdd00ffef04665ccbb3e150747a77560e8fad1" -uuid = "615f187c-cbe4-4ef1-ba3b-2fcf58d6d173" -version = "0.1.1" +version = "1.11.0" [[deps.InteractiveUtils]] deps = ["Markdown"] uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240" +version = "1.11.0" [[deps.IteratorInterfaceExtensions]] git-tree-sha1 = "a3f24677c21f5bbe9d2a714f95dcd58337fb2856" @@ -132,16 +103,17 @@ [[deps.LibCURL_jll]] deps = ["Artifacts", "LibSSH2_jll", "Libdl", "MbedTLS_jll", "Zlib_jll", "nghttp2_jll"] uuid = "deac9b47-8bc7-5906-a0fe-35ac56dc84c0" -version = "8.4.0+0" +version = "8.6.0+0" [[deps.LibGit2]] deps = ["Base64", "LibGit2_jll", "NetworkOptions", "Printf", "SHA"] uuid = "76f85450-5226-5b5a-8eaa-529ad045b433" +version = "1.11.0" [[deps.LibGit2_jll]] deps = ["Artifacts", "LibSSH2_jll", "Libdl", "MbedTLS_jll"] uuid = "e37daf67-58a4-590a-8e99-b0245dd2ffc5" -version = "1.6.4+0" +version = "1.7.2+0" [[deps.LibSSH2_jll]] deps = ["Artifacts", "Libdl", "MbedTLS_jll"] @@ -150,53 +122,49 @@ [[deps.Libdl]] uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb" +version = "1.11.0" [[deps.LinearAlgebra]] deps = ["Libdl", "OpenBLAS_jll", "libblastrampoline_jll"] uuid = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" +version = "1.11.0" [[deps.Logging]] uuid = "56ddb016-857b-54e1-b83d-db4d58db5568" +version = "1.11.0" [[deps.Markdown]] deps = ["Base64"] uuid = "d6f4376e-aef5-505a-96c1-9c027394607a" +version = "1.11.0" [[deps.MbedTLS_jll]] deps = ["Artifacts", "Libdl"] uuid = "c8ffd9c3-330d-5841-b78e-0817d7145fa1" -version = "2.28.2+1" +version = "2.28.6+0" [[deps.Mmap]] uuid = "a63ad114-7e13-5084-954f-fe012c677804" +version = "1.11.0" [[deps.MozillaCACerts_jll]] uuid = "14a3606d-f60d-562e-9121-12d972cd8159" -version = "2023.1.10" +version = "2023.12.12" [[deps.Mustache]] deps = ["Printf", "Tables"] -git-tree-sha1 = "a7cefa21a2ff993bff0456bf7521f46fc077ddf1" +git-tree-sha1 = "3b2db451a872b20519ebb0cec759d3d81a1c6bcb" uuid = "ffc61752-8dc7-55ee-8c37-f3e9cdd09e70" -version = "1.0.19" +version = "1.0.20" [[deps.NetworkOptions]] uuid = "ca575930-c2e3-43a9-ace4-1e988b2c1908" version = "1.2.0" -[[deps.OffsetArrays]] -git-tree-sha1 = "6a731f2b5c03157418a20c12195eb4b74c8f8621" -uuid = "6fe1bfb0-de20-5000-8ca7-80f57d26f881" -version = "1.13.0" -weakdeps = ["Adapt"] - - [deps.OffsetArrays.extensions] - OffsetArraysAdaptExt = "Adapt" - [[deps.OpenBLAS_jll]] deps = ["Artifacts", "CompilerSupportLibraries_jll", "Libdl"] uuid = "4536629a-c528-5b80-bd46-f80d51c5b363" -version = "0.3.23+4" +version = "0.3.27+1" [[deps.OrderedCollections]] git-tree-sha1 = "dfdf5519f235516220579f949664f1bf44e741c5" @@ -210,9 +178,15 @@ version = "2.8.1" [[deps.Pkg]] -deps = ["Artifacts", "Dates", "Downloads", "FileWatching", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "Serialization", "TOML", "Tar", "UUIDs", "p7zip_jll"] +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.10.0" +version = "1.11.0" + + [deps.Pkg.extensions] + REPLExt = "REPL" + + [deps.Pkg.weakdeps] + REPL = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb" [[deps.PkgBenchmark]] deps = ["BenchmarkTools", "Dates", "InteractiveUtils", "JSON", "LibGit2", "Logging", "Pkg", "Printf", "TerminalLoggers", "UUIDs"] @@ -235,10 +209,11 @@ [[deps.Printf]] deps = ["Unicode"] uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7" +version = "1.11.0" [[deps.Profile]] -deps = ["Printf"] uuid = "9abbd945-dff8-562f-b5e8-e1ebf5ef1b79" +version = "1.11.0" [[deps.ProgressLogging]] deps = ["Logging", "SHA", "UUIDs"] @@ -246,63 +221,20 @@ uuid = "33c8b6b6-d38a-422a-b730-caa89a2f386c" version = "0.1.4" -[[deps.REPL]] -deps = ["InteractiveUtils", "Markdown", "Sockets", "Unicode"] -uuid = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb" - [[deps.Random]] deps = ["SHA"] uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" - -[[deps.Requires]] -deps = ["UUIDs"] -git-tree-sha1 = "838a3a4188e2ded87a4f9f184b4b0d78a1e91cb7" -uuid = "ae029012-a4dd-5104-9daa-d747884805df" -version = "1.3.0" +version = "1.11.0" [[deps.SHA]] uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce" version = "0.7.0" -[[deps.Sbplib]] -deps = ["StaticArrays", "TOML", "TiledIteration"] -path = ".." -uuid = "5a373a26-915f-4769-bcab-bf03835de17b" -version = "0.1.0" - -[[deps.Serialization]] -uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b" - -[[deps.Sockets]] -uuid = "6462fe0b-24de-5631-8697-dd941f90decc" - -[[deps.SparseArrays]] -deps = ["Libdl", "LinearAlgebra", "Random", "Serialization", "SuiteSparse_jll"] -uuid = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" -version = "1.10.0" - -[[deps.Static]] -deps = ["IfElse"] -git-tree-sha1 = "d2fdac9ff3906e27f7a618d47b676941baa6c80c" -uuid = "aedffcd0-7271-4cad-89d0-dc628f76c6d3" -version = "0.8.10" - -[[deps.StaticArrayInterface]] -deps = ["ArrayInterface", "Compat", "IfElse", "LinearAlgebra", "PrecompileTools", "Requires", "SparseArrays", "Static", "SuiteSparse"] -git-tree-sha1 = "5d66818a39bb04bf328e92bc933ec5b4ee88e436" -uuid = "0d7ed370-da01-4f52-bd93-41d350b8b718" -version = "1.5.0" -weakdeps = ["OffsetArrays", "StaticArrays"] - - [deps.StaticArrayInterface.extensions] - StaticArrayInterfaceOffsetArraysExt = "OffsetArrays" - StaticArrayInterfaceStaticArraysExt = "StaticArrays" - [[deps.StaticArrays]] deps = ["LinearAlgebra", "PrecompileTools", "Random", "StaticArraysCore"] -git-tree-sha1 = "bf074c045d3d5ffd956fa0a461da38a44685d6b2" +git-tree-sha1 = "eeafab08ae20c62c44c8399ccb9354a04b80db50" uuid = "90137ffa-7385-5640-81b9-e52037218182" -version = "1.9.3" +version = "1.9.7" [deps.StaticArrays.extensions] StaticArraysChainRulesCoreExt = "ChainRulesCore" @@ -313,23 +245,21 @@ Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" [[deps.StaticArraysCore]] -git-tree-sha1 = "36b3d696ce6366023a0ea192b4cd442268995a0d" +git-tree-sha1 = "192954ef1208c7019899fbf8049e717f92959682" uuid = "1e83bf80-4336-4d27-bf5d-d5a4f845583c" -version = "1.4.2" +version = "1.4.3" [[deps.Statistics]] -deps = ["LinearAlgebra", "SparseArrays"] +deps = ["LinearAlgebra"] +git-tree-sha1 = "ae3bb1eb3bba077cd276bc5cfc337cc65c3075c0" uuid = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" -version = "1.10.0" +version = "1.11.1" -[[deps.SuiteSparse]] -deps = ["Libdl", "LinearAlgebra", "Serialization", "SparseArrays"] -uuid = "4607b0f0-06f3-5cda-b6b1-a6196a1729e9" + [deps.Statistics.extensions] + SparseArraysExt = ["SparseArrays"] -[[deps.SuiteSparse_jll]] -deps = ["Artifacts", "Libdl", "libblastrampoline_jll"] -uuid = "bea87d4a-7f5b-5778-9afe-8cc45184846c" -version = "7.2.1+1" + [deps.Statistics.weakdeps] + SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" [[deps.TOML]] deps = ["Dates"] @@ -343,10 +273,10 @@ version = "1.0.1" [[deps.Tables]] -deps = ["DataAPI", "DataValueInterfaces", "IteratorInterfaceExtensions", "LinearAlgebra", "OrderedCollections", "TableTraits"] -git-tree-sha1 = "cb76cf677714c095e535e3501ac7954732aeea2d" +deps = ["DataAPI", "DataValueInterfaces", "IteratorInterfaceExtensions", "OrderedCollections", "TableTraits"] +git-tree-sha1 = "598cd7c1f68d1e205689b1c2fe65a9f85846f297" uuid = "bd369af6-aec1-5ad0-b16a-f7cc5008161c" -version = "1.11.1" +version = "1.12.0" [[deps.Tar]] deps = ["ArgTools", "SHA"] @@ -359,18 +289,14 @@ uuid = "5d786b92-1e48-4d6f-9151-6b4477ca9bed" version = "0.1.7" -[[deps.TiledIteration]] -deps = ["OffsetArrays", "StaticArrayInterface"] -git-tree-sha1 = "1176cc31e867217b06928e2f140c90bd1bc88283" -uuid = "06e1c1a7-607b-532d-9fad-de7d9aa2abac" -version = "0.5.0" - [[deps.UUIDs]] deps = ["Random", "SHA"] uuid = "cf7118a7-6976-5b1a-9a39-7adc72f591a4" +version = "1.11.0" [[deps.Unicode]] uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5" +version = "1.11.0" [[deps.Zlib_jll]] deps = ["Libdl"] @@ -380,12 +306,12 @@ [[deps.libblastrampoline_jll]] deps = ["Artifacts", "Libdl"] uuid = "8e850b90-86db-534c-a0d3-1478176c7d93" -version = "5.8.0+1" +version = "5.11.0+0" [[deps.nghttp2_jll]] deps = ["Artifacts", "Libdl"] uuid = "8e850ede-7688-5339-a07c-302acd2aaf8d" -version = "1.52.0+1" +version = "1.59.0+0" [[deps.p7zip_jll]] deps = ["Artifacts", "Libdl"]
--- a/benchmark/Project.toml Tue Sep 17 11:20:00 2024 +0200 +++ b/benchmark/Project.toml Sun Oct 20 21:38:09 2024 +0200 @@ -1,5 +1,5 @@ [deps] BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf" +Diffinitive = "5a373a26-915f-4769-bcab-bf03835de17b" Mustache = "ffc61752-8dc7-55ee-8c37-f3e9cdd09e70" -PkgBenchmark = "32113eaa-f34f-5b0d-bd6c-c81e245fc73d" -Sbplib = "5a373a26-915f-4769-bcab-bf03835de17b" +PkgBenchmark = "32113eaa-f34f-5b0d-bd6c-c81e245fc73d" \ No newline at end of file
--- a/benchmark/benchmark_laplace.jl Tue Sep 17 11:20:00 2024 +0200 +++ b/benchmark/benchmark_laplace.jl Sun Oct 20 21:38:09 2024 +0200 @@ -1,7 +1,7 @@ -using Sbplib -using Sbplib.SbpOperators -using Sbplib.Grids -using Sbplib.RegionIndices +using Diffinitive +using Diffinitive.SbpOperators +using Diffinitive.Grids +using Diffinitive.RegionIndices using BenchmarkTools # TODO: Move the below benchmarks into the benchmark suite
--- a/benchmark/benchmark_utils.jl Tue Sep 17 11:20:00 2024 +0200 +++ b/benchmark/benchmark_utils.jl Sun Oct 20 21:38:09 2024 +0200 @@ -3,11 +3,11 @@ import Mustache import Dates -import Sbplib +import Diffinitive -const sbplib_root = splitpath(pathof(Sbplib))[1:end-2] |> joinpath -const results_dir = mkpath(joinpath(sbplib_root, "benchmark/results")) -const template_path = joinpath(sbplib_root, "benchmark/result.tmpl") +const diffinitive_root = splitpath(pathof(Diffinitive))[1:end-2] |> joinpath +const results_dir = mkpath(joinpath(diffinitive_root, "benchmark/results")) +const template_path = joinpath(diffinitive_root, "benchmark/result.tmpl") """ mainmain(;rev=nothing, target=nothing, baseline=nothing , kwargs...) @@ -49,7 +49,7 @@ `PkgBenchmark.BenchmarkResult` """ function run_benchmark(;kwargs...) - r = PkgBenchmark.benchmarkpkg(Sbplib; kwargs...) + r = PkgBenchmark.benchmarkpkg(Diffinitive; kwargs...) rev = hg_rev() # Should be changed to hg_id() when the html can handle it. @@ -158,17 +158,17 @@ function hg_id() - cmd = Cmd(`hg id`, dir=sbplib_root) + cmd = Cmd(`hg id`, dir=diffinitive_root) return readchomp(addenv(cmd, "HGPLAIN"=>"")) end function hg_rev() - cmd = Cmd(`hg id -i`, dir=sbplib_root) + cmd = Cmd(`hg id -i`, dir=diffinitive_root) return readchomp(addenv(cmd, "HGPLAIN"=>"")) end function hg_update(rev) - cmd = Cmd(`hg update --check -r $rev`, dir=sbplib_root) + cmd = Cmd(`hg update --check -r $rev`, dir=diffinitive_root) run(addenv(cmd, "HGPLAIN"=>"")) return nothing @@ -182,9 +182,9 @@ """ function hg_commit(msg; secret=false) if secret - cmd = Cmd(`hg commit --verbose --secret --message $msg`, dir=sbplib_root) + cmd = Cmd(`hg commit --verbose --secret --message $msg`, dir=diffinitive_root) else - cmd = Cmd(`hg commit --verbose --message $msg`, dir=sbplib_root) + cmd = Cmd(`hg commit --verbose --message $msg`, dir=diffinitive_root) end out = readchomp(addenv(cmd, "HGPLAIN"=>"")) @@ -200,9 +200,9 @@ """ function hg_strip(rev; keep=false) if keep - cmd = Cmd(`hg --config extensions.strip= strip --keep -r $rev`, dir=sbplib_root) + cmd = Cmd(`hg --config extensions.strip= strip --keep -r $rev`, dir=diffinitive_root) else - cmd = Cmd(`hg --config extensions.strip= strip -r $rev`, dir=sbplib_root) + cmd = Cmd(`hg --config extensions.strip= strip -r $rev`, dir=diffinitive_root) end run(addenv(cmd, "HGPLAIN"=>"")) @@ -216,7 +216,7 @@ Return true if the repositopry has uncommited changes. """ function hg_is_dirty() - cmd = Cmd(`hg identify --id`, dir=sbplib_root) + cmd = Cmd(`hg identify --id`, dir=diffinitive_root) out = readchomp(addenv(cmd, "HGPLAIN"=>"")) return endswith(out, "+")
--- a/benchmark/benchmarks.jl Tue Sep 17 11:20:00 2024 +0200 +++ b/benchmark/benchmarks.jl Sun Oct 20 21:38:09 2024 +0200 @@ -1,10 +1,9 @@ using BenchmarkTools -using Sbplib -using Sbplib.Grids -using Sbplib.SbpOperators -using Sbplib.RegionIndices -using Sbplib.LazyTensors +using Diffinitive +using Diffinitive.Grids +using Diffinitive.SbpOperators +using Diffinitive.LazyTensors using LinearAlgebra @@ -15,9 +14,9 @@ ll(d) = ntuple(i->0., d) lu(d) = ntuple(i->1., d) -g1 = equidistant_grid(ll(1)[1], lu(1)[1], sz(1)[1]) -g2 = equidistant_grid(ll(2), lu(2), sz(2)) -g3 = equidistant_grid(ll(3), lu(3), sz(3)) +g1 = equidistant_grid(ll(1)[1], lu(1)[1], sz(1)...) +g2 = equidistant_grid(ll(2), lu(2), sz(2)...) +g3 = equidistant_grid(ll(3), lu(3), sz(3)...) v1 = rand(sz(1)...) v2 = rand(sz(2)...) @@ -168,20 +167,20 @@ Dxx = second_derivative(g2, stencil_set, 1) Dyy = second_derivative(g2, stencil_set, 2) -e₁ₗ = boundary_restriction(g2, stencil_set, CartesianBoundary{1,Lower}()) -e₁ᵤ = boundary_restriction(g2, stencil_set, CartesianBoundary{1,Upper}()) -e₂ₗ = boundary_restriction(g2, stencil_set, CartesianBoundary{2,Lower}()) -e₂ᵤ = boundary_restriction(g2, stencil_set, CartesianBoundary{2,Upper}()) +e₁ₗ = boundary_restriction(g2, stencil_set, CartesianBoundary{1,LowerBoundary}()) +e₁ᵤ = boundary_restriction(g2, stencil_set, CartesianBoundary{1,UpperBoundary}()) +e₂ₗ = boundary_restriction(g2, stencil_set, CartesianBoundary{2,LowerBoundary}()) +e₂ᵤ = boundary_restriction(g2, stencil_set, CartesianBoundary{2,UpperBoundary}()) -d₁ₗ = normal_derivative(g2, stencil_set, CartesianBoundary{1,Lower}()) -d₁ᵤ = normal_derivative(g2, stencil_set, CartesianBoundary{1,Upper}()) -d₂ₗ = normal_derivative(g2, stencil_set, CartesianBoundary{2,Lower}()) -d₂ᵤ = normal_derivative(g2, stencil_set, CartesianBoundary{2,Upper}()) +d₁ₗ = normal_derivative(g2, stencil_set, CartesianBoundary{1,LowerBoundary}()) +d₁ᵤ = normal_derivative(g2, stencil_set, CartesianBoundary{1,UpperBoundary}()) +d₂ₗ = normal_derivative(g2, stencil_set, CartesianBoundary{2,LowerBoundary}()) +d₂ᵤ = normal_derivative(g2, stencil_set, CartesianBoundary{2,UpperBoundary}()) -H₁ₗ = inner_product(boundary_grid(g2, CartesianBoundary{1,Lower}()), stencil_set) -H₁ᵤ = inner_product(boundary_grid(g2, CartesianBoundary{1,Upper}()), stencil_set) -H₂ₗ = inner_product(boundary_grid(g2, CartesianBoundary{2,Lower}()), stencil_set) -H₂ᵤ = inner_product(boundary_grid(g2, CartesianBoundary{2,Upper}()), stencil_set) +H₁ₗ = inner_product(boundary_grid(g2, CartesianBoundary{1,LowerBoundary}()), stencil_set) +H₁ᵤ = inner_product(boundary_grid(g2, CartesianBoundary{1,UpperBoundary}()), stencil_set) +H₂ₗ = inner_product(boundary_grid(g2, CartesianBoundary{2,LowerBoundary}()), stencil_set) +H₂ᵤ = inner_product(boundary_grid(g2, CartesianBoundary{2,UpperBoundary}()), stencil_set) SUITE["boundary_terms"]["pre_composition"] = @benchmarkable $u2 .= $(H⁻¹∘e₁ₗ'∘H₁ₗ∘d₁ₗ)*$v2 SUITE["boundary_terms"]["composition"] = @benchmarkable $u2 .= ($H⁻¹∘$e₁ₗ'∘$H₁ₗ∘$d₁ₗ)*$v2
--- a/docs/Manifest.toml Tue Sep 17 11:20:00 2024 +0200 +++ b/docs/Manifest.toml Sun Oct 20 21:38:09 2024 +0200 @@ -1,8 +1,8 @@ # This file is machine-generated - editing it directly is not advised -julia_version = "1.10.0" +julia_version = "1.11.1" manifest_format = "2.0" -project_hash = "4f0756199bb5f6739a5f4697152617efc4e0705c" +project_hash = "c04450bb5c379e77d137cc05c4c0ab58eb1bfae9" [[deps.ANSIColoredPrinters]] git-tree-sha1 = "574baf8110975760d391c710b6341da1afa48d8c" @@ -10,70 +10,54 @@ version = "0.0.1" [[deps.AbstractTrees]] -git-tree-sha1 = "faa260e4cb5aba097a73fab382dd4b5819d8ec8c" +git-tree-sha1 = "2d9c9a55f9c93e8887ad391fbae72f8ef55e1177" uuid = "1520ce14-60c1-5f80-bbc7-55ef81b5835c" -version = "0.4.4" - -[[deps.Adapt]] -deps = ["LinearAlgebra", "Requires"] -git-tree-sha1 = "0fb305e0253fd4e833d486914367a2ee2c2e78d0" -uuid = "79e6a3ab-5dfb-504d-930d-738a2a938a0e" -version = "4.0.1" -weakdeps = ["StaticArrays"] - - [deps.Adapt.extensions] - AdaptStaticArraysExt = "StaticArrays" +version = "0.4.5" [[deps.ArgTools]] uuid = "0dad84c5-d112-42e6-8d28-ef12dabb789f" -version = "1.1.1" - -[[deps.ArrayInterface]] -deps = ["Adapt", "LinearAlgebra", "Requires", "SparseArrays", "SuiteSparse"] -git-tree-sha1 = "bbec08a37f8722786d87bedf84eae19c020c4efa" -uuid = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9" -version = "7.7.0" - - [deps.ArrayInterface.extensions] - ArrayInterfaceBandedMatricesExt = "BandedMatrices" - ArrayInterfaceBlockBandedMatricesExt = "BlockBandedMatrices" - ArrayInterfaceCUDAExt = "CUDA" - ArrayInterfaceGPUArraysCoreExt = "GPUArraysCore" - ArrayInterfaceStaticArraysCoreExt = "StaticArraysCore" - ArrayInterfaceTrackerExt = "Tracker" - - [deps.ArrayInterface.weakdeps] - BandedMatrices = "aae01518-5342-5314-be14-df237901396f" - BlockBandedMatrices = "ffab5731-97b5-5995-9138-79e8c1846df0" - CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba" - GPUArraysCore = "46192b85-c4d5-4398-a991-12ede77f4527" - StaticArraysCore = "1e83bf80-4336-4d27-bf5d-d5a4f845583c" - Tracker = "9f7883ad-71c0-57eb-9f7f-b5c9e6d3789c" +version = "1.1.2" [[deps.Artifacts]] uuid = "56f22d72-fd6d-98f1-02f0-08ddc0907c33" +version = "1.11.0" [[deps.Base64]] uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f" +version = "1.11.0" -[[deps.Compat]] -deps = ["TOML", "UUIDs"] -git-tree-sha1 = "75bd5b6fc5089df449b5d35fa501c846c9b6549b" -uuid = "34da2185-b29b-5c13-b0c7-acf172513d20" -version = "4.12.0" -weakdeps = ["Dates", "LinearAlgebra"] - - [deps.Compat.extensions] - CompatLinearAlgebraExt = "LinearAlgebra" +[[deps.CodecZlib]] +deps = ["TranscodingStreams", "Zlib_jll"] +git-tree-sha1 = "bce6804e5e6044c6daab27bb533d1295e4a2e759" +uuid = "944b1d66-785c-5afd-91f1-9de20f533193" +version = "0.7.6" [[deps.CompilerSupportLibraries_jll]] deps = ["Artifacts", "Libdl"] uuid = "e66e0078-7015-5450-92f7-15fbd957f2ae" -version = "1.0.5+1" +version = "1.1.1+0" [[deps.Dates]] deps = ["Printf"] uuid = "ade2ca70-3891-5945-98fb-dc099432e06a" +version = "1.11.0" + +[[deps.Diffinitive]] +deps = ["LinearAlgebra", "StaticArrays", "TOML"] +path = ".." +uuid = "5a373a26-915f-4769-bcab-bf03835de17b" +version = "0.1.3" + + [deps.Diffinitive.extensions] + DiffinitiveMakieExt = "Makie" + DiffinitiveSparseArrayKitExt = ["SparseArrayKit", "Tokens"] + DiffinitiveSparseArraysExt = ["SparseArrays", "Tokens"] + + [deps.Diffinitive.weakdeps] + Makie = "ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a" + SparseArrayKit = "a9a3c162-d163-4c15-8926-b8794fbefed2" + SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" + Tokens = "040c2ec2-8d69-4aca-bf03-7d3a7092f2f6" [[deps.DocStringExtensions]] deps = ["LibGit2"] @@ -82,10 +66,10 @@ version = "0.9.3" [[deps.Documenter]] -deps = ["ANSIColoredPrinters", "AbstractTrees", "Base64", "Dates", "DocStringExtensions", "Downloads", "Git", "IOCapture", "InteractiveUtils", "JSON", "LibGit2", "Logging", "Markdown", "MarkdownAST", "Pkg", "PrecompileTools", "REPL", "RegistryInstances", "SHA", "Test", "Unicode"] -git-tree-sha1 = "2613dbec8f4748273bbe30ba71fd5cb369966bac" +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" uuid = "e30172f5-a6a5-5a46-863b-614d45cd2de4" -version = "1.2.1" +version = "1.7.0" [[deps.Downloads]] deps = ["ArgTools", "FileWatching", "LibCURL", "NetworkOptions"] @@ -94,45 +78,42 @@ [[deps.Expat_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl"] -git-tree-sha1 = "4558ab818dcceaab612d1bb8c19cee87eda2b83c" +git-tree-sha1 = "1c6317308b9dc757616f0b5cb379db10494443a7" uuid = "2e619515-83b5-522b-bb60-26c02a35a201" -version = "2.5.0+0" +version = "2.6.2+0" [[deps.FileWatching]] uuid = "7b1f6079-737a-58dc-b8bc-7a2ca5c1b5ee" +version = "1.11.0" [[deps.Git]] deps = ["Git_jll"] -git-tree-sha1 = "51764e6c2e84c37055e846c516e9015b4a291c7d" +git-tree-sha1 = "04eff47b1354d702c3a85e8ab23d539bb7d5957e" uuid = "d7ba0133-e1db-5d97-8f8c-041e4b3a1eb2" -version = "1.3.0" +version = "1.3.1" [[deps.Git_jll]] deps = ["Artifacts", "Expat_jll", "JLLWrappers", "LibCURL_jll", "Libdl", "Libiconv_jll", "OpenSSL_jll", "PCRE2_jll", "Zlib_jll"] -git-tree-sha1 = "b30c473c97fcc1e1e44fab8f3e88fd1b89c9e9d1" +git-tree-sha1 = "ea372033d09e4552a04fd38361cd019f9003f4f4" uuid = "f8c6e375-362e-5223-8a59-34ff63f689eb" -version = "2.43.0+0" +version = "2.46.2+0" [[deps.IOCapture]] deps = ["Logging", "Random"] -git-tree-sha1 = "8b72179abc660bfab5e28472e019392b97d0985c" +git-tree-sha1 = "b6d6bfdd7ce25b0f9b2f6b3dd56b2673a66c8770" uuid = "b5f81e59-6552-4d32-b1f0-c071b021bf89" -version = "0.2.4" - -[[deps.IfElse]] -git-tree-sha1 = "debdd00ffef04665ccbb3e150747a77560e8fad1" -uuid = "615f187c-cbe4-4ef1-ba3b-2fcf58d6d173" -version = "0.1.1" +version = "0.2.5" [[deps.InteractiveUtils]] deps = ["Markdown"] uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240" +version = "1.11.0" [[deps.JLLWrappers]] deps = ["Artifacts", "Preferences"] -git-tree-sha1 = "7e5d6779a1e09a36db2a7b6cff50942a0a7d0fca" +git-tree-sha1 = "be3dc50a92e5a386872a493a10050136d4703f9b" uuid = "692b3bcd-3c85-4b1f-b108-f13ce0eb3210" -version = "1.5.0" +version = "1.6.1" [[deps.JSON]] deps = ["Dates", "Mmap", "Parsers", "Unicode"] @@ -153,16 +134,17 @@ [[deps.LibCURL_jll]] deps = ["Artifacts", "LibSSH2_jll", "Libdl", "MbedTLS_jll", "Zlib_jll", "nghttp2_jll"] uuid = "deac9b47-8bc7-5906-a0fe-35ac56dc84c0" -version = "8.4.0+0" +version = "8.6.0+0" [[deps.LibGit2]] deps = ["Base64", "LibGit2_jll", "NetworkOptions", "Printf", "SHA"] uuid = "76f85450-5226-5b5a-8eaa-529ad045b433" +version = "1.11.0" [[deps.LibGit2_jll]] deps = ["Artifacts", "LibSSH2_jll", "Libdl", "MbedTLS_jll"] uuid = "e37daf67-58a4-590a-8e99-b0245dd2ffc5" -version = "1.6.4+0" +version = "1.7.2+0" [[deps.LibSSH2_jll]] deps = ["Artifacts", "Libdl", "MbedTLS_jll"] @@ -171,6 +153,7 @@ [[deps.Libdl]] uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb" +version = "1.11.0" [[deps.Libiconv_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl"] @@ -181,13 +164,16 @@ [[deps.LinearAlgebra]] deps = ["Libdl", "OpenBLAS_jll", "libblastrampoline_jll"] uuid = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" +version = "1.11.0" [[deps.Logging]] uuid = "56ddb016-857b-54e1-b83d-db4d58db5568" +version = "1.11.0" [[deps.Markdown]] deps = ["Base64"] uuid = "d6f4376e-aef5-505a-96c1-9c027394607a" +version = "1.11.0" [[deps.MarkdownAST]] deps = ["AbstractTrees", "Markdown"] @@ -198,38 +184,30 @@ [[deps.MbedTLS_jll]] deps = ["Artifacts", "Libdl"] uuid = "c8ffd9c3-330d-5841-b78e-0817d7145fa1" -version = "2.28.2+1" +version = "2.28.6+0" [[deps.Mmap]] uuid = "a63ad114-7e13-5084-954f-fe012c677804" +version = "1.11.0" [[deps.MozillaCACerts_jll]] uuid = "14a3606d-f60d-562e-9121-12d972cd8159" -version = "2023.1.10" +version = "2023.12.12" [[deps.NetworkOptions]] uuid = "ca575930-c2e3-43a9-ace4-1e988b2c1908" version = "1.2.0" -[[deps.OffsetArrays]] -git-tree-sha1 = "6a731f2b5c03157418a20c12195eb4b74c8f8621" -uuid = "6fe1bfb0-de20-5000-8ca7-80f57d26f881" -version = "1.13.0" -weakdeps = ["Adapt"] - - [deps.OffsetArrays.extensions] - OffsetArraysAdaptExt = "Adapt" - [[deps.OpenBLAS_jll]] deps = ["Artifacts", "CompilerSupportLibraries_jll", "Libdl"] uuid = "4536629a-c528-5b80-bd46-f80d51c5b363" -version = "0.3.23+2" +version = "0.3.27+1" [[deps.OpenSSL_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl"] -git-tree-sha1 = "cc6e1927ac521b659af340e0ca45828a3ffc748f" +git-tree-sha1 = "7493f61f55a6cce7325f197443aa80d32554ba10" uuid = "458c3c95-2e84-50aa-8efc-19380b2a3a95" -version = "3.0.12+0" +version = "3.0.15+1" [[deps.PCRE2_jll]] deps = ["Artifacts", "Libdl"] @@ -243,33 +221,40 @@ version = "2.8.1" [[deps.Pkg]] -deps = ["Artifacts", "Dates", "Downloads", "FileWatching", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "Serialization", "TOML", "Tar", "UUIDs", "p7zip_jll"] +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.10.0" +version = "1.11.0" +weakdeps = ["REPL"] + + [deps.Pkg.extensions] + REPLExt = "REPL" [[deps.PrecompileTools]] deps = ["Preferences"] -git-tree-sha1 = "03b4c25b43cb84cee5c90aa9b5ea0a78fd848d2f" +git-tree-sha1 = "5aa36f7049a63a1528fe8f7c3f2113413ffd4e1f" uuid = "aea7be01-6a6a-4083-8856-8a6e6704d82a" -version = "1.2.0" +version = "1.2.1" [[deps.Preferences]] deps = ["TOML"] -git-tree-sha1 = "00805cd429dcb4870060ff49ef443486c262e38e" +git-tree-sha1 = "9306f6085165d270f7e3db02af26a400d580f5c6" uuid = "21216c6a-2e73-6563-6e65-726566657250" -version = "1.4.1" +version = "1.4.3" [[deps.Printf]] deps = ["Unicode"] uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7" +version = "1.11.0" [[deps.REPL]] -deps = ["InteractiveUtils", "Markdown", "Sockets", "Unicode"] +deps = ["InteractiveUtils", "Markdown", "Sockets", "StyledStrings", "Unicode"] uuid = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb" +version = "1.11.0" [[deps.Random]] deps = ["SHA"] uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" +version = "1.11.0" [[deps.RegistryInstances]] deps = ["LazilyInitializedFields", "Pkg", "TOML", "Tar"] @@ -277,55 +262,23 @@ uuid = "2792f1a3-b283-48e8-9a74-f99dce5104f3" version = "0.1.0" -[[deps.Requires]] -deps = ["UUIDs"] -git-tree-sha1 = "838a3a4188e2ded87a4f9f184b4b0d78a1e91cb7" -uuid = "ae029012-a4dd-5104-9daa-d747884805df" -version = "1.3.0" - [[deps.SHA]] uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce" version = "0.7.0" -[[deps.Sbplib]] -deps = ["StaticArrays", "TOML", "TiledIteration"] -path = ".." -uuid = "5a373a26-915f-4769-bcab-bf03835de17b" -version = "0.1.0" - [[deps.Serialization]] uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b" +version = "1.11.0" [[deps.Sockets]] uuid = "6462fe0b-24de-5631-8697-dd941f90decc" - -[[deps.SparseArrays]] -deps = ["Libdl", "LinearAlgebra", "Random", "Serialization", "SuiteSparse_jll"] -uuid = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" -version = "1.10.0" - -[[deps.Static]] -deps = ["IfElse"] -git-tree-sha1 = "f295e0a1da4ca425659c57441bcb59abb035a4bc" -uuid = "aedffcd0-7271-4cad-89d0-dc628f76c6d3" -version = "0.8.8" - -[[deps.StaticArrayInterface]] -deps = ["ArrayInterface", "Compat", "IfElse", "LinearAlgebra", "PrecompileTools", "Requires", "SparseArrays", "Static", "SuiteSparse"] -git-tree-sha1 = "5d66818a39bb04bf328e92bc933ec5b4ee88e436" -uuid = "0d7ed370-da01-4f52-bd93-41d350b8b718" -version = "1.5.0" -weakdeps = ["OffsetArrays", "StaticArrays"] - - [deps.StaticArrayInterface.extensions] - StaticArrayInterfaceOffsetArraysExt = "OffsetArrays" - StaticArrayInterfaceStaticArraysExt = "StaticArrays" +version = "1.11.0" [[deps.StaticArrays]] deps = ["LinearAlgebra", "PrecompileTools", "Random", "StaticArraysCore"] -git-tree-sha1 = "f68dd04d131d9a8a8eb836173ee8f105c360b0c5" +git-tree-sha1 = "eeafab08ae20c62c44c8399ccb9354a04b80db50" uuid = "90137ffa-7385-5640-81b9-e52037218182" -version = "1.9.1" +version = "1.9.7" [deps.StaticArrays.extensions] StaticArraysChainRulesCoreExt = "ChainRulesCore" @@ -336,18 +289,13 @@ Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" [[deps.StaticArraysCore]] -git-tree-sha1 = "36b3d696ce6366023a0ea192b4cd442268995a0d" +git-tree-sha1 = "192954ef1208c7019899fbf8049e717f92959682" uuid = "1e83bf80-4336-4d27-bf5d-d5a4f845583c" -version = "1.4.2" +version = "1.4.3" -[[deps.SuiteSparse]] -deps = ["Libdl", "LinearAlgebra", "Serialization", "SparseArrays"] -uuid = "4607b0f0-06f3-5cda-b6b1-a6196a1729e9" - -[[deps.SuiteSparse_jll]] -deps = ["Artifacts", "Libdl", "libblastrampoline_jll"] -uuid = "bea87d4a-7f5b-5778-9afe-8cc45184846c" -version = "7.2.1+1" +[[deps.StyledStrings]] +uuid = "f489334b-da3d-4c2e-b8f0-e476e12c162b" +version = "1.11.0" [[deps.TOML]] deps = ["Dates"] @@ -362,19 +310,21 @@ [[deps.Test]] deps = ["InteractiveUtils", "Logging", "Random", "Serialization"] uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40" +version = "1.11.0" -[[deps.TiledIteration]] -deps = ["OffsetArrays", "StaticArrayInterface"] -git-tree-sha1 = "1176cc31e867217b06928e2f140c90bd1bc88283" -uuid = "06e1c1a7-607b-532d-9fad-de7d9aa2abac" -version = "0.5.0" +[[deps.TranscodingStreams]] +git-tree-sha1 = "0c45878dcfdcfa8480052b6ab162cdd138781742" +uuid = "3bb67fe8-82b1-5028-8e26-92a6c54297fa" +version = "0.11.3" [[deps.UUIDs]] deps = ["Random", "SHA"] uuid = "cf7118a7-6976-5b1a-9a39-7adc72f591a4" +version = "1.11.0" [[deps.Unicode]] uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5" +version = "1.11.0" [[deps.Zlib_jll]] deps = ["Libdl"] @@ -384,12 +334,12 @@ [[deps.libblastrampoline_jll]] deps = ["Artifacts", "Libdl"] uuid = "8e850b90-86db-534c-a0d3-1478176c7d93" -version = "5.8.0+1" +version = "5.11.0+0" [[deps.nghttp2_jll]] deps = ["Artifacts", "Libdl"] uuid = "8e850ede-7688-5339-a07c-302acd2aaf8d" -version = "1.52.0+1" +version = "1.59.0+0" [[deps.p7zip_jll]] deps = ["Artifacts", "Libdl"]
--- a/docs/Project.toml Tue Sep 17 11:20:00 2024 +0200 +++ b/docs/Project.toml Sun Oct 20 21:38:09 2024 +0200 @@ -1,3 +1,3 @@ [deps] +Diffinitive = "5a373a26-915f-4769-bcab-bf03835de17b" Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" -Sbplib = "5a373a26-915f-4769-bcab-bf03835de17b"
--- a/docs/make.jl Tue Sep 17 11:20:00 2024 +0200 +++ b/docs/make.jl Sun Oct 20 21:38:09 2024 +0200 @@ -1,14 +1,12 @@ using Documenter -using Sbplib +using Diffinitive -using Sbplib.DiffOps -using Sbplib.Grids -using Sbplib.LazyTensors -using Sbplib.RegionIndices -using Sbplib.SbpOperators -using Sbplib.StaticDicts +using Diffinitive.Grids +using Diffinitive.LazyTensors +using Diffinitive.RegionIndices +using Diffinitive.SbpOperators -sitename = "Sbplib.jl" +sitename = "Diffinitive.jl" remotes = nothing edit_link = nothing @@ -31,13 +29,12 @@ "Home" => "index.md", "operator_file_format.md", "grids_and_grid_functions.md", + "matrix_and_tensor_representations.md", "Submodules" => [ "submodules/grids.md", - "submodules/diff_ops.md", "submodules/lazy_tensors.md", "submodules/region_indices.md", "submodules/sbp_operators.md", - "submodules/static_dicts.md", ], "doc_index.md", ]
--- a/docs/src/grids_and_grid_functions.md Tue Sep 17 11:20:00 2024 +0200 +++ b/docs/src/grids_and_grid_functions.md Sun Oct 20 21:38:09 2024 +0200 @@ -7,6 +7,24 @@ ## Interface for grids All grids are expected to work as a grid function for the coordinate function, and thus implements Julia's Indexing- and Iteration-interfaces. Notably they are *not* abstract arrays because that inteface is too restrictive for the types of grids we wish to implement. + +## Plotting +Plotting of grids and grid functions is supported through a package extension with Makie.jl. + +For grids we have: +* `plot(::Grid{<:Any,2})` (same as `lines`) +* `lines(::Grid{<:Any,2})` +* `scatter(::Grid{<:Any,2})` + +For 1D grid functions we have: +* `plot(::Grid{<:Any,1}, ::AbstractVector)` (same as `lines`) +* `lines(::Grid{<:Any,1}, ::AbstractVector)` +* `scatter(::Grid{<:Any,1}, ::AbstractVector)` + +For 2D grid functions we have: +* `plot(::Grid{<:Any,2}, ::AbstractArray{<:Any,2})` (constructs a 2d mesh) +* `surface(::Grid{<:Any,2}, ::AbstractArray{<:Any,2})` + ## To write about <!-- # TODO: --> * Grid functions
--- a/docs/src/index.md Tue Sep 17 11:20:00 2024 +0200 +++ b/docs/src/index.md Sun Oct 20 21:38:09 2024 +0200 @@ -1,4 +1,4 @@ -# Sbplib.jl +# Diffinitive.jl ```@contents Depth = 1
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/src/matrix_and_tensor_representations.md Sun Oct 20 21:38:09 2024 +0200 @@ -0,0 +1,5 @@ +# Matrix and tensor representations + +Sparse matrix and sparse tensor representations of lazy tensors can be constructed by loading [Tokens.jl](http://) and one of SparseArrays.jl or [SparseArrayKit.jl](http://). Through package extensions the following methods `sparse(::LazyTensor)` and `SparseArray(::LazyTensor)` are provided. + +<!-- TODO figure out how to add the docstrings here --/>
--- a/docs/src/operator_file_format.md Tue Sep 17 11:20:00 2024 +0200 +++ b/docs/src/operator_file_format.md Sun Oct 20 21:38:09 2024 +0200 @@ -1,6 +1,6 @@ # Operator file format -The intention is that Sbplib.jl should be a general and extensible framework +The intention is that Diffinitive.jl should be a general and extensible framework for working with finite difference methods. It therefore includes a set of tools for storing and sharing operator definitions as well as a set of widely used operators.
--- a/docs/src/submodules/diff_ops.md Tue Sep 17 11:20:00 2024 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,23 +0,0 @@ -# DiffOps - -## Contents -```@contents -Pages = ["diff_ops.md"] -``` - -## Index -```@index -Pages = ["diff_ops.md"] -``` - -## Public interface -```@autodocs -Modules = [DiffOps] -Private = false # Hide unexported objects -``` - -## Internal interface -```@autodocs -Modules = [DiffOps] -Public = false # Hide exported objects -```
--- a/docs/src/submodules/static_dicts.md Tue Sep 17 11:20:00 2024 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,23 +0,0 @@ -# StaticDicts - -## Contents -```@contents -Pages = ["static_dicts.md"] -``` - -## Index -```@index -Pages = ["static_dicts.md"] -``` - -## Public interface -```@autodocs -Modules = [StaticDicts] -Private = false # Hide unexported objects -``` - -## Internal interface -```@autodocs -Modules = [StaticDicts] -Public = false # Hide exported objects -```
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ext/DiffinitiveMakieExt.jl Sun Oct 20 21:38:09 2024 +0200 @@ -0,0 +1,88 @@ +module DiffinitiveMakieExt + +using Diffinitive.Grids +using Makie +using StaticArrays + + +function verticies_and_faces_and_values(g::Grid{<:Any,2}, gf::AbstractArray{<:Any, 2}) + ps = map(Tuple, g)[:] + values = gf[:] + faces = Vector{NTuple{3,Int}}() + + n,m = size(g) + Li = LinearIndices((1:n, 1:m)) + for i ∈ 1:n-1, j = 1:m-1 + + # Add point in the middle of the patch to preserve symmetries + push!(ps, Tuple((g[i,j] + g[i+1,j] + g[i+1,j+1] + g[i,j+1])/4)) + push!(values, (gf[i,j] + gf[i+1,j] + gf[i+1,j+1] + gf[i,j+1])/4) + + push!(faces, (Li[i,j], Li[i+1,j], length(ps))) + push!(faces, (Li[i+1,j], Li[i+1,j+1], length(ps))) + push!(faces, (Li[i+1,j+1], Li[i,j+1], length(ps))) + push!(faces, (Li[i,j+1], Li[i,j], length(ps))) + end + + verticies = permutedims(reinterpret(reshape,eltype(eltype(ps)), ps)) + faces = permutedims(reinterpret(reshape,Int, faces)) + + return verticies, faces, values +end + + +## Grids + +Makie.convert_arguments(::Type{<:Scatter}, g::Grid) = (reshape(map(Point,g),:),) +function Makie.convert_arguments(::Type{<:Lines}, g::Grid{<:AbstractVector}) + M = collect(g) + + function cat_with_NaN(a,b) + vcat(a,[@SVector fill(NaN, coordinate_size(g))],b) + end + + xlines = reduce(cat_with_NaN, eachrow(M)) + ylines = reduce(cat_with_NaN, eachcol(M)) + + return (cat_with_NaN(xlines,ylines),) +end + +Makie.plot!(plot::Plot(Grid)) = lines!(plot, plot.attributes, plot[1]) + + +## Grid functions + +### 1D +function Makie.convert_arguments(::Type{<:Lines}, g::Grid{<:Any,1}, gf::AbstractArray{<:Any, 1}) + (collect(g), gf) +end + +function Makie.convert_arguments(::Type{<:Scatter}, g::Grid{<:Any,1}, gf::AbstractArray{<:Any, 1}) + (collect(g), gf) +end + +Makie.plot!(plot::Plot(Grid{<:Any,1}, AbstractArray{<:Any,1})) = lines!(plot, plot.attributes, plot[1], plot[2]) + +### 2D +function Makie.convert_arguments(::Type{<:Surface}, g::Grid{<:Any,2}, gf::AbstractArray{<:Any, 2}) + (getindex.(g,1), getindex.(g,2), gf) +end + +function Makie.plot!(plot::Plot(Grid{<:Any,2},AbstractArray{<:Any, 2})) + r = @lift verticies_and_faces_and_values($(plot[1]), $(plot[2])) + v,f,c = (@lift $r[1]), (@lift $r[2]), (@lift $r[3]) + mesh!(plot, plot.attributes, v, f; + color=c, + shading = NoShading, + ) +end +# TBD: Can we define `mesh` instead of the above function and then forward plot! to that? + +function Makie.convert_arguments(::Type{<:Scatter}, g::Grid{<:Any,2}, gf::AbstractArray{<:Any, 2}) + ps = map(g,gf) do (x,y), z + @SVector[x,y,z] + end + (reshape(ps,:),) +end + +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ext/DiffinitiveSparseArrayKitExt.jl Sun Oct 20 21:38:09 2024 +0200 @@ -0,0 +1,22 @@ +module DiffinitiveSparseArrayKitExt + +using Diffinitive +using Diffinitive.LazyTensors + +using SparseArrayKit +using Tokens + +""" + SparseArray(t::LazyTensor) + +The sparse tensor representation of `t` with range dimensions to the left and +domain dimensions to the right. If `L` is a `LazyTensor` with range and +domain dimension 2 and `v` a 2-tensor, then `A = SparseArray(t)` is +constructed so that `∑ₖ∑ₗA[i,j,k,l]*v[k,l] == L*v`. +""" +function SparseArrayKit.SparseArray(t::LazyTensor) + v = ArrayToken(:v, domain_size(t)...) + return Tokens._to_tensor(t*v, range_size(t), domain_size(t)) +end + +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ext/DiffinitiveSparseArraysExt.jl Sun Oct 20 21:38:09 2024 +0200 @@ -0,0 +1,25 @@ +module DiffinitiveSparseArraysExt + +using Diffinitive +using Diffinitive.LazyTensors + +using SparseArrays +using Tokens + +""" + sparse(t::LazyTensor) + +The sparse matrix representation of `t`. + +If `L` is a `LazyTensor` and `v` a tensor, then `A = sparse(L)` is constructed +so that `A*reshape(v,:) == reshape(L*v,:)`. +""" +function SparseArrays.sparse(t::LazyTensor) + v = ArrayToken(:v, prod(domain_size(t))) + + v̄ = reshape(v,domain_size(t)...) + tv = reshape(t*v̄, :) + return Tokens._to_matrix(tv, prod(range_size(t)), prod(domain_size(t))) +end + +end
--- a/plotDerivative.jl Tue Sep 17 11:20:00 2024 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,12 +0,0 @@ -g = sbp.Grid.EquidistantGrid((200,), (0.0,), (2pi,)) -op =sbp.readOperator("d2_4th.txt","h_4th.txt") -Laplace = sbp.Laplace(g,1.0,op) - -init(x) = cos(x) -v = sbp.Grid.evalOn(g,init) -u = zeros(length(v)) - -sbp.apply!(Laplace,u,v) - -@show u -sbp.Grid.plotgridfunction(g,u)
--- a/plotDerivative2d.jl Tue Sep 17 11:20:00 2024 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,16 +0,0 @@ -include("sbpPlot.jl") - -g = sbp.Grid.EquidistantGrid((100,75), (0.0, 0.0), (2pi, 3/2*pi)) -op = sbp.readOperator("d2_4th.txt","h_4th.txt") -Laplace = sbp.Laplace(g, 1.0, op) - -init(x,y) = sin(x) + cos(y) -v = sbp.Grid.evalOn(g,init) -u = zero(v) - -sbp.apply!(Laplace,u,v) - -#@show u -#@show u'*u - -plotgridfunction(g,u)
--- a/sbp.jl Tue Sep 17 11:20:00 2024 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ -module sbp - -using Sbplib.Grids -using Sbplib.RegionIndices -using Sbplib.SbpOperators -using Sbplib.DiffOps - -include("TimeStepper.jl") -end # module
--- a/sbpPlot.jl Tue Sep 17 11:20:00 2024 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,12 +0,0 @@ -include("sbp.jl") -using Makie -import .sbp.Grid -function plotgridfunction(grid::sbp.Grid.EquidistantGrid, gridfunction::AbstractArray) - if sbp.Grid.dimension(grid) == 1 - plot(sbp.Grid.pointsalongdim(grid,1), gridfunction) - elseif sbp.Grid.dimension(grid) == 2 - scene = surface(sbp.Grid.pointsalongdim(grid,1),sbp.Grid.pointsalongdim(grid,2), gridfunction) - else - error(string("Plot not implemented for dimension ", string(dimension(grid)))) - end -end
--- a/src/DiffOps/DiffOps.jl Tue Sep 17 11:20:00 2024 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,103 +0,0 @@ -module DiffOps - -using Sbplib.RegionIndices -using Sbplib.SbpOperators -using Sbplib.Grids -using Sbplib.LazyTensors - -""" - DiffOp - -Supertype of differential operator discretisations. -The action of the DiffOp is defined in the method - apply(D::DiffOp, v::AbstractVector, I...) -""" -abstract type DiffOp end - -function apply end - -function matrixRepresentation(D::DiffOp) - error("not implemented") -end - -abstract type DiffOpCartesian{Dim} <: DiffOp end - -# DiffOp must have a grid of dimension Dim!!! -function apply!(D::DiffOpCartesian{Dim}, u::AbstractArray{T,Dim}, v::AbstractArray{T,Dim}) where {T,Dim} - for I ∈ eachindex(D.grid) - u[I] = apply(D, v, I) - end - - return nothing -end -export apply! - -function apply_region!(D::DiffOpCartesian{2}, u::AbstractArray{T,2}, v::AbstractArray{T,2}) where T - apply_region!(D, u, v, Lower, Lower) - apply_region!(D, u, v, Lower, Interior) - apply_region!(D, u, v, Lower, Upper) - apply_region!(D, u, v, Interior, Lower) - apply_region!(D, u, v, Interior, Interior) - apply_region!(D, u, v, Interior, Upper) - apply_region!(D, u, v, Upper, Lower) - apply_region!(D, u, v, Upper, Interior) - apply_region!(D, u, v, Upper, Upper) - return nothing -end - -# Maybe this should be split according to b3fbef345810 after all?! Seems like it makes performance more predictable -function apply_region!(D::DiffOpCartesian{2}, u::AbstractArray{T,2}, v::AbstractArray{T,2}, r1::Type{<:Region}, r2::Type{<:Region}) where T - for I ∈ regionindices(D.grid.size, closuresize(D.op), (r1,r2)) - @inbounds indextuple = (Index{r1}(I[1]), Index{r2}(I[2])) - @inbounds u[I] = apply(D, v, indextuple) - end - return nothing -end -export apply_region! - -function apply_tiled!(D::DiffOpCartesian{2}, u::AbstractArray{T,2}, v::AbstractArray{T,2}) where T - apply_region_tiled!(D, u, v, Lower, Lower) - apply_region_tiled!(D, u, v, Lower, Interior) - apply_region_tiled!(D, u, v, Lower, Upper) - apply_region_tiled!(D, u, v, Interior, Lower) - apply_region_tiled!(D, u, v, Interior, Interior) - apply_region_tiled!(D, u, v, Interior, Upper) - apply_region_tiled!(D, u, v, Upper, Lower) - apply_region_tiled!(D, u, v, Upper, Interior) - apply_region_tiled!(D, u, v, Upper, Upper) - return nothing -end - -using TiledIteration -function apply_region_tiled!(D::DiffOpCartesian{2}, u::AbstractArray{T,2}, v::AbstractArray{T,2}, r1::Type{<:Region}, r2::Type{<:Region}) where T - ri = regionindices(D.grid.size, closuresize(D.op), (r1,r2)) - # TODO: Pass Tilesize to function - for tileaxs ∈ TileIterator(axes(ri), padded_tilesize(T, (5,5), 2)) - for j ∈ tileaxs[2], i ∈ tileaxs[1] - I = ri[i,j] - u[I] = apply(D, v, (Index{r1}(I[1]), Index{r2}(I[2]))) - end - end - return nothing -end -export apply_region_tiled! - -function apply(D::DiffOp, v::AbstractVector)::AbstractVector - u = zeros(eltype(v), size(v)) - apply!(D,v,u) - return u -end - -# TODO: This conflicts with LazyTensors. Shouldn't DiffOps be LazyTensorOperators and use that apply? -# export apply - - -""" - BoundaryCondition -A BoundaryCondition should implement the method - sat(::DiffOp, v::AbstractArray, data::AbstractArray, ...) -""" -abstract type BoundaryCondition end - - -end # module
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/Diffinitive.jl Sun Oct 20 21:38:09 2024 +0200 @@ -0,0 +1,13 @@ +module Diffinitive + +include("RegionIndices/RegionIndices.jl") +include("LazyTensors/LazyTensors.jl") +include("Grids/Grids.jl") +include("SbpOperators/SbpOperators.jl") + +export RegionIndices +export LazyTensors +export Grids +export SbpOperators + +end
--- a/src/Grids/Grids.jl Tue Sep 17 11:20:00 2024 +0200 +++ b/src/Grids/Grids.jl Sun Oct 20 21:38:09 2024 +0200 @@ -1,8 +1,8 @@ module Grids -using Sbplib.RegionIndices -using Sbplib.LazyTensors +using Diffinitive.LazyTensors using StaticArrays +using LinearAlgebra # Grid export Grid @@ -13,15 +13,19 @@ export boundary_indices export boundary_identifiers export boundary_grid +export min_spacing export coarsen export refine export eval_on export componentview export ArrayComponentView +export normal export BoundaryIdentifier export TensorGridBoundary export CartesianBoundary +export LowerBoundary +export UpperBoundary export TensorGrid export ZeroDimGrid @@ -32,11 +36,17 @@ export equidistant_grid -abstract type BoundaryIdentifier end +# MappedGrid +export MappedGrid +export jacobian +export logical_grid +export mapped_grid +export metric_tensor include("grid.jl") include("tensor_grid.jl") include("equidistant_grid.jl") include("zero_dim_grid.jl") +include("mapped_grid.jl") end # module
--- a/src/Grids/equidistant_grid.jl Tue Sep 17 11:20:00 2024 +0200 +++ b/src/Grids/equidistant_grid.jl Sun Oct 20 21:38:09 2024 +0200 @@ -47,12 +47,32 @@ """ inverse_spacing(g::EquidistantGrid) = 1/step(g.points) +min_spacing(g::EquidistantGrid) = spacing(g) -boundary_identifiers(::EquidistantGrid) = (Lower(), Upper()) -boundary_grid(g::EquidistantGrid, id::Lower) = ZeroDimGrid(g[begin]) -boundary_grid(g::EquidistantGrid, id::Upper) = ZeroDimGrid(g[end]) -boundary_indices(g::EquidistantGrid, id::Lower) = 1 -boundary_indices(g::EquidistantGrid, id::Upper) = length(g) +""" + LowerBoundary <: BoundaryIdentifier + +Boundary identifier for the the lower (left) boundary of a one-dimensional grid. + +See also: [`BoundaryIdentifier`](@ref) +""" +struct LowerBoundary <: BoundaryIdentifier end + +""" + UpperBoundary <: BoundaryIdentifier + +Boundary identifier for the the upper (right) boundary of a one-dimensional grid. + +See also: [`BoundaryIdentifier`](@ref) +""" +struct UpperBoundary <: BoundaryIdentifier end + + +boundary_identifiers(::EquidistantGrid) = (LowerBoundary(), UpperBoundary()) +boundary_grid(g::EquidistantGrid, id::LowerBoundary) = ZeroDimGrid(g[begin]) +boundary_grid(g::EquidistantGrid, id::UpperBoundary) = ZeroDimGrid(g[end]) +boundary_indices(g::EquidistantGrid, id::LowerBoundary) = (firstindex(g),) +boundary_indices(g::EquidistantGrid, id::UpperBoundary) = (lastindex(g),) """ refine(g::EquidistantGrid, r::Int) @@ -119,7 +139,7 @@ Constructs a 1D equidistant grid. """ -function equidistant_grid(limit_lower::T, limit_upper::T, size::Int) where T +function equidistant_grid(limit_lower::Number, limit_upper::Number, size::Int) if any(size .<= 0) throw(DomainError("size must be postive")) end
--- a/src/Grids/grid.jl Tue Sep 17 11:20:00 2024 +0200 +++ b/src/Grids/grid.jl Sun Oct 20 21:38:09 2024 +0200 @@ -82,6 +82,14 @@ # TODO: Implement `setindex!`? # TODO: Implement a more general ComponentView that can handle non-AbstractArrays. + +""" + min_spacing(g::Grid) + +The smallest distance between any pair of grid points in `g`. +""" +function min_spacing end + """ refine(g::Grid, r) @@ -101,6 +109,13 @@ function coarsen end """ + BoundaryIdentifier + +An identifier for a boundary of a grid. +""" +abstract type BoundaryIdentifier end + +""" boundary_identifiers(g::Grid) Identifiers for all the boundaries of `g`.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/Grids/mapped_grid.jl Sun Oct 20 21:38:09 2024 +0200 @@ -0,0 +1,207 @@ +""" + MappedGrid{T,D} <: Grid{T,D} + +A grid defined by a coordinate mapping from a logical grid to some physical +coordinates. The physical coordinates and the Jacobian are stored as grid +functions corresponding to the logical grid. + +See also: [`logical_grid`](@ref), [`jacobian`](@ref), [`metric_tensor`](@ref). +""" +struct MappedGrid{T,D, GT<:Grid{<:Any,D}, CT<:AbstractArray{T,D}, JT<:AbstractArray{<:AbstractMatrix{<:Any}, D}} <: Grid{T,D} + logical_grid::GT + physicalcoordinates::CT + jacobian::JT + + """ + MappedGrid(logical_grid, physicalcoordinates, jacobian) + + A MappedGrid with the given physical coordinates and jacobian. + """ + function MappedGrid(logical_grid::GT, physicalcoordinates::CT, jacobian::JT) where {T,D, GT<:Grid{<:Any,D}, CT<:AbstractArray{T,D}, JT<:AbstractArray{<:AbstractMatrix{<:Any}, D}} + if !(size(logical_grid) == size(physicalcoordinates) == size(jacobian)) + throw(ArgumentError("Sizes must match")) + end + + if size(first(jacobian)) != (length(first(physicalcoordinates)),D) + throw(ArgumentError("The size of the jacobian must match the dimensions of the grid and coordinates")) + end + + return new{T,D,GT,CT,JT}(logical_grid, physicalcoordinates, jacobian) + end +end + +function Base.:(==)(a::MappedGrid, b::MappedGrid) + same_logical_grid = logical_grid(a) == logical_grid(b) + same_coordinates = collect(a) == collect(b) + same_jacobian = jacobian(a) == jacobian(b) + + return same_logical_grid && same_coordinates && same_jacobian +end + +""" + logical_grid(g::MappedGrid) + +The logical grid of `g`. +""" +logical_grid(g::MappedGrid) = g.logical_grid + +""" + jacobian(g::MappedGrid) + +The Jacobian matrix of `g` as a grid function. +""" +jacobian(g::MappedGrid) = g.jacobian + + +# Indexing interface +Base.getindex(g::MappedGrid, I::Vararg{Int}) = g.physicalcoordinates[I...] +Base.eachindex(g::MappedGrid) = eachindex(g.logical_grid) + +Base.firstindex(g::MappedGrid, d) = firstindex(g.logical_grid, d) +Base.lastindex(g::MappedGrid, d) = lastindex(g.logical_grid, d) + +# Iteration interface +Base.iterate(g::MappedGrid) = iterate(g.physicalcoordinates) +Base.iterate(g::MappedGrid, state) = iterate(g.physicalcoordinates, state) + +Base.IteratorSize(::Type{<:MappedGrid{<:Any, D}}) where D = Base.HasShape{D}() +Base.length(g::MappedGrid) = length(g.logical_grid) +Base.size(g::MappedGrid) = size(g.logical_grid) +Base.size(g::MappedGrid, d) = size(g.logical_grid, d) + +boundary_identifiers(g::MappedGrid) = boundary_identifiers(g.logical_grid) +boundary_indices(g::MappedGrid, id::TensorGridBoundary) = boundary_indices(g.logical_grid, id) + +function boundary_grid(g::MappedGrid, id::TensorGridBoundary) + b_indices = boundary_indices(g.logical_grid, id) + + # Calculate indices of needed jacobian components + D = ndims(g) + all_indices = SVector{D}(1:D) + free_variable_indices = deleteat(all_indices, grid_id(id)) + jacobian_components = (:, free_variable_indices) + + # Create grid function for boundary grid jacobian + boundary_jacobian = componentview((@view g.jacobian[b_indices...]) , jacobian_components...) + boundary_physicalcoordinates = @view g.physicalcoordinates[b_indices...] + + return MappedGrid( + boundary_grid(g.logical_grid, id), + boundary_physicalcoordinates, + boundary_jacobian, + ) +end + + +""" + 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 +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) +end + +""" + mapped_grid(lg::Grid, x, J) + +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) + return MappedGrid( + lg, + map(x,lg), + map(J,lg), + ) +end + +""" + metric_tensor(g::MappedGrid) + +The metric tensor of `g` as a grid function. +""" +function metric_tensor(g::MappedGrid) + return map(jacobian(g)) do ∂x∂ξ + ∂x∂ξ'*∂x∂ξ + end +end + +function min_spacing(g::MappedGrid{T,1} where T) + n, = size(g) + + ms = Inf + for i ∈ 1:n-1 + ms = min(ms, norm(g[i+1]-g[i])) + end + + return ms +end + +function min_spacing(g::MappedGrid{T,2} where T) + n, m = size(g) + + ms = Inf + for i ∈ 1:n-1, j ∈ 1:m-1 # loop over each cell of the grid + + ms = min( + ms, + norm(g[i+1,j]-g[i,j]), + norm(g[i,j+1]-g[i,j]), + + norm(g[i+1,j]-g[i+1,j+1]), + norm(g[i,j+1]-g[i+1,j+1]), + + norm(g[i+1,j+1]-g[i,j]), + norm(g[i+1,j]-g[i,j+1]), + ) + # NOTE: This could be optimized to avoid checking all interior edges twice. + end + + return ms +end + +""" + normal(g::MappedGrid, boundary) + +The outward pointing normal as a grid function on the corresponding boundary grid. +""" +function normal(g::MappedGrid, boundary) + b_indices = boundary_indices(g, boundary) + σ = _boundary_sign(component_type(g), boundary) + + # TODO: Refactor this when `boundary_indices(g, ...)` has been made iterable. + return map(jacobian(g)[b_indices...]) do ∂x∂ξ + ∂ξ∂x = inv(∂x∂ξ) + k = grid_id(boundary) + σ*∂ξ∂x[k,:]/norm(∂ξ∂x[k,:]) + end +end + +""" + normal(g::MappedGrid, boundary, i...) + +The outward pointing normal to the specified boundary in grid point `i`. +""" +function normal(g::MappedGrid, boundary, i...) + σ = _boundary_sign(component_type(g), boundary) + ∂ξ∂x = inv(jacobian(g)[i...]) + + k = grid_id(boundary) + return σ*∂ξ∂x[k,:]/norm(∂ξ∂x[k,:]) +end + + +function _boundary_sign(T, boundary) + if boundary_id(boundary) == UpperBoundary() + return one(T) + elseif boundary_id(boundary) == LowerBoundary() + return -one(T) + else + throw(ArgumentError("The boundary identifier must be either `LowerBoundary()` or `UpperBoundary()`")) + end +end
--- a/src/Grids/tensor_grid.jl Tue Sep 17 11:20:00 2024 +0200 +++ b/src/Grids/tensor_grid.jl Sun Oct 20 21:38:09 2024 +0200 @@ -48,6 +48,12 @@ Base.size(g::TensorGrid, d) = size(g)[d] +function min_spacing(g::TensorGrid) + relevant_grids = filter(g->!isa(g,ZeroDimGrid),g.grids) + d = min_spacing.(relevant_grids) + return minimum(d) +end + refine(g::TensorGrid, r::Int) = mapreduce(g->refine(g,r), TensorGrid, g.grids) coarsen(g::TensorGrid, r::Int) = mapreduce(g->coarsen(g,r), TensorGrid, g.grids) @@ -123,7 +129,7 @@ end """ - grid_and_local_dim_index(nds, d) + grid_and_local_dim_index(nds, d) Given a tuple of number of dimensions `nds`, and a global dimension index `d`, calculate which grid index, and local dimension, `d` corresponds to.
--- a/src/LazyTensors/LazyTensors.jl Tue Sep 17 11:20:00 2024 +0200 +++ b/src/LazyTensors/LazyTensors.jl Sun Oct 20 21:38:09 2024 +0200 @@ -1,5 +1,11 @@ module LazyTensors +export LazyTensor +export apply +export apply_transpose +export range_dim, domain_dim +export range_size, domain_size + export TensorApplication export TensorTranspose export TensorComposition @@ -13,6 +19,10 @@ export DomainSizeMismatch export RangeSizeMismatch +export LazyArray +export LazyFunctionArray +export +̃, -̃, *̃, /̃ + include("lazy_tensor.jl") include("tensor_types.jl") include("lazy_array.jl")
--- a/src/LazyTensors/lazy_array.jl Tue Sep 17 11:20:00 2024 +0200 +++ b/src/LazyTensors/lazy_array.jl Sun Oct 20 21:38:09 2024 +0200 @@ -6,7 +6,6 @@ A subtype of `LazyArray` will use lazy version of `+`, `-`, `*`, `/`. """ abstract type LazyArray{T,D} <: AbstractArray{T,D} end -export LazyArray struct LazyConstantArray{T,D} <: LazyArray{T,D} val::T @@ -25,7 +24,6 @@ f::F size::NTuple{D,Int} end -export LazyFunctionArray function LazyFunctionArray(f::F, size::NTuple{D,Int}) where {F<:Function,D} T = typeof(f(ones(Int, D)...)) @@ -110,5 +108,3 @@ Base.@propagate_inbounds Base.:+(a::T, b::LazyArray{T,D}) where {T,D} = a +̃ b Base.@propagate_inbounds Base.:-(a::T, b::LazyArray{T,D}) where {T,D} = a -̃ b - -export +̃, -̃, *̃, /̃
--- a/src/LazyTensors/lazy_tensor.jl Tue Sep 17 11:20:00 2024 +0200 +++ b/src/LazyTensors/lazy_tensor.jl Sun Oct 20 21:38:09 2024 +0200 @@ -1,9 +1,3 @@ -export LazyTensor -export apply -export apply_transpose -export range_dim, domain_dim -export range_size, domain_size - """ LazyTensor{T,R,D}
--- a/src/RegionIndices/RegionIndices.jl Tue Sep 17 11:20:00 2024 +0200 +++ b/src/RegionIndices/RegionIndices.jl Sun Oct 20 21:38:09 2024 +0200 @@ -13,7 +13,7 @@ Index{R,T}(i::T) where {R<:Region,T<:Integer} = new{R,T}(i) Index{R}(i::T) where {R<:Region,T<:Integer} = new{R,T}(i) Index(i::T, ::Type{R}) where {R<:Region,T<:Integer} = Index{R,T}(i) - Index(t::Tuple{T, DataType}) where {R<:Region,T<:Integer} = Index{t[2],T}(t[1]) # TBD: This is not very specific in what types are allowed in t[2]. Can this be fixed? + Index(t::Tuple{T, DataType}) where T<:Integer = Index{t[2],T}(t[1]) # TBD: This is not very specific in what types are allowed in t[2]. Can this be fixed? end export Index
--- a/src/SbpOperators/SbpOperators.jl Tue Sep 17 11:20:00 2024 +0200 +++ b/src/SbpOperators/SbpOperators.jl Sun Oct 20 21:38:09 2024 +0200 @@ -1,5 +1,11 @@ module SbpOperators +# Stencils +export Stencil +export CenteredStencil +export NestedStencil +export CenteredNestedStencil + # Stencil set export StencilSet export read_stencil_set @@ -40,9 +46,9 @@ export sat_tensors # Using -using Sbplib.RegionIndices -using Sbplib.LazyTensors -using Sbplib.Grids +using Diffinitive.RegionIndices +using Diffinitive.LazyTensors +using Diffinitive.Grids # Includes include("stencil.jl")
--- a/src/SbpOperators/boundaryops/boundary_operator.jl Tue Sep 17 11:20:00 2024 +0200 +++ b/src/SbpOperators/boundaryops/boundary_operator.jl Sun Oct 20 21:38:09 2024 +0200 @@ -1,27 +1,27 @@ """ - BoundaryOperator{T,R,N} <: LazyTensor{T,0,1} + BoundaryOperator{T,B,N} <: LazyTensor{T,0,1} Implements the boundary operator `op` for 1D as a `LazyTensor` `op` is the restriction of a grid function to the boundary using some closure -`Stencil{T,N}`. The boundary to restrict to is determined by `R`. `op'` is the +`Stencil{T,N}`. The boundary to restrict to is determined by `B`. `op'` is the prolongation of a zero dimensional array to the whole grid using the same closure stencil. """ -struct BoundaryOperator{T,R<:Region,N} <: LazyTensor{T,0,1} +struct BoundaryOperator{T,B<:BoundaryIdentifier,N} <: LazyTensor{T,0,1} stencil::Stencil{T,N} size::Int end """ - BoundaryOperator(grid::EquidistantGrid, closure_stencil, region) + BoundaryOperator(grid::EquidistantGrid, closure_stencil, boundary) Constructs the BoundaryOperator with stencil `closure_stencil` for a `EquidistantGrid` `grid`, restricting to to the boundary specified by -`region`. +`boundary`. """ -function BoundaryOperator(grid::EquidistantGrid, closure_stencil::Stencil{T,N}, region::Region) where {T,N} - return BoundaryOperator{T,typeof(region),N}(closure_stencil,size(grid)[1]) +function BoundaryOperator(grid::EquidistantGrid, closure_stencil::Stencil{T,N}, boundary::BoundaryIdentifier) where {T,N} + return BoundaryOperator{T,typeof(boundary),N}(closure_stencil,size(grid)[1]) end """ @@ -29,24 +29,24 @@ The size of the closure stencil. """ -closure_size(::BoundaryOperator{T,R,N}) where {T,R,N} = N +closure_size(::BoundaryOperator{T,B,N}) where {T,B,N} = N LazyTensors.range_size(op::BoundaryOperator) = () LazyTensors.domain_size(op::BoundaryOperator) = (op.size,) -function LazyTensors.apply(op::BoundaryOperator{<:Any,Lower}, v::AbstractVector) +function LazyTensors.apply(op::BoundaryOperator{<:Any,LowerBoundary}, v::AbstractVector) apply_stencil(op.stencil,v,1) end -function LazyTensors.apply(op::BoundaryOperator{<:Any,Upper}, v::AbstractVector) +function LazyTensors.apply(op::BoundaryOperator{<:Any,UpperBoundary}, v::AbstractVector) apply_stencil_backwards(op.stencil,v,op.size) end -function LazyTensors.apply_transpose(op::BoundaryOperator{<:Any,Lower}, v::AbstractArray{<:Any,0}, i::Index{Lower}) +function LazyTensors.apply_transpose(op::BoundaryOperator{<:Any,LowerBoundary}, v::AbstractArray{<:Any,0}, i::Index{Lower}) return op.stencil[Int(i)-1]*v[] end -function LazyTensors.apply_transpose(op::BoundaryOperator{<:Any,Upper}, v::AbstractArray{<:Any,0}, i::Index{Upper}) +function LazyTensors.apply_transpose(op::BoundaryOperator{<:Any,UpperBoundary}, v::AbstractArray{<:Any,0}, i::Index{Upper}) return op.stencil[op.size[1] - Int(i)]*v[] end
--- a/src/SbpOperators/stencil.jl Tue Sep 17 11:20:00 2024 +0200 +++ b/src/SbpOperators/stencil.jl Sun Oct 20 21:38:09 2024 +0200 @@ -1,6 +1,3 @@ -export CenteredStencil -export CenteredNestedStencil - struct Stencil{T,N} range::UnitRange{Int64} weights::NTuple{N,T}
--- a/src/SbpOperators/volumeops/laplace/laplace.jl Tue Sep 17 11:20:00 2024 +0200 +++ b/src/SbpOperators/volumeops/laplace/laplace.jl Sun Oct 20 21:38:09 2024 +0200 @@ -60,7 +60,7 @@ condition. `H_tuning` and `R_tuning` are used to specify the strength of the penalty. -See also: [`sat`](@ref),[`DirichletCondition`](@ref), [`positivity_decomposition`](@ref). +See also: [`sat`](@ref), [`DirichletCondition`](@ref), [`positivity_decomposition`](@ref). """ function sat_tensors(Δ::Laplace, g::Grid, bc::DirichletCondition; H_tuning = 1., R_tuning = 1.) id = boundary(bc) @@ -69,7 +69,7 @@ Hᵧ = inner_product(boundary_grid(g, id), set) e = boundary_restriction(g, set, id) d = normal_derivative(g, set, id) - B = positivity_decomposition(Δ, g, bc; H_tuning, R_tuning) + B = positivity_decomposition(Δ, g, boundary(bc); H_tuning, R_tuning) penalty_tensor = H⁻¹∘(d' - B*e')∘Hᵧ return penalty_tensor, e end @@ -94,7 +94,7 @@ end """ - positivity_decomposition(Δ::Laplace, g::Grid, bc::DirichletCondition; H_tuning, R_tuning) + positivity_decomposition(Δ::Laplace, g::Grid, b::BoundaryIdentifier; H_tuning, R_tuning) Constructs the scalar `B` such that `d' - 1/2*B*e'` is symmetric positive definite with respect to the boundary quadrature. Here `d` is the normal @@ -102,28 +102,26 @@ to form a symmetric and energy stable penalty for a Dirichlet condition. The parameters `H_tuning` and `R_tuning` are used to specify the strength of the penalty and must be greater than 1. For details we refer to -https://doi.org/10.1016/j.jcp.2020.109294 +<https://doi.org/10.1016/j.jcp.2020.109294> """ -function positivity_decomposition(Δ::Laplace, g::Grid, bc::DirichletCondition; H_tuning, R_tuning) +function positivity_decomposition(Δ::Laplace, g::Grid, b::BoundaryIdentifier; H_tuning, R_tuning) @assert(H_tuning ≥ 1.) @assert(R_tuning ≥ 1.) - Nτ_H, τ_R = positivity_limits(Δ,g,bc) + Nτ_H, τ_R = positivity_limits(Δ,g,b) return H_tuning*Nτ_H + R_tuning*τ_R end -# TODO: We should consider implementing a proper BoundaryIdentifier for EquidistantGrid and then -# change bc::BoundaryCondition to id::BoundaryIdentifier -function positivity_limits(Δ::Laplace, g::EquidistantGrid, bc::DirichletCondition) +function positivity_limits(Δ::Laplace, g::EquidistantGrid, b::BoundaryIdentifier) h = spacing(g) θ_H = parse_scalar(Δ.stencil_set["H"]["closure"][1]) θ_R = parse_scalar(Δ.stencil_set["D2"]["positivity"]["theta_R"]) - τ_H = 1/(h*θ_H) - τ_R = 1/(h*θ_R) + τ_H = one(eltype(Δ))/(h*θ_H) + τ_R = one(eltype(Δ))/(h*θ_R) return τ_H, τ_R end -function positivity_limits(Δ::Laplace, g::TensorGrid, bc::DirichletCondition) - τ_H, τ_R = positivity_limits(Δ, g.grids[grid_id(boundary(bc))], bc) +function positivity_limits(Δ::Laplace, g::TensorGrid, b::BoundaryIdentifier) + τ_H, τ_R = positivity_limits(Δ, g.grids[grid_id(b)], b) return τ_H*ndims(g), τ_R end
--- a/src/Sbplib.jl Tue Sep 17 11:20:00 2024 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,16 +0,0 @@ -module Sbplib - -include("StaticDicts/StaticDicts.jl") -include("RegionIndices/RegionIndices.jl") -include("LazyTensors/LazyTensors.jl") -include("Grids/Grids.jl") -include("SbpOperators/SbpOperators.jl") -include("DiffOps/DiffOps.jl") - -export RegionIndices -export LazyTensors -export Grids -export SbpOperators -export DiffOps - -end
--- a/src/StaticDicts/StaticDicts.jl Tue Sep 17 11:20:00 2024 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,82 +0,0 @@ -module StaticDicts - -export StaticDict - -""" - StaticDict{K,V,N} <: AbstractDict{K,V} - -A static dictionary implementing the interface for an `AbstractDict`. A -`StaticDict` is fully immutable and after creation no changes can be made. - -The immutable nature means that `StaticDict` can be compared with `===`, in -constrast to regular `Dict` or `ImmutableDict` which can not. (See -<https://github.com/JuliaLang/julia/issues/4648> for details.) One important -aspect of this is that `StaticDict` can be used in a struct while still -allowing the struct to be compared using the default implementation of `==` for -structs. - -Lookups are done by linear search. - -Duplicate keys are not allowed and an error will be thrown if they are passed -to the constructor. -""" -struct StaticDict{K,V,N} <: AbstractDict{K,V} - pairs::NTuple{N,Pair{K,V}} - - function StaticDict{K,V}(pairs::Vararg{Pair,N}) where {K,V,N} - if !allunique(first.(pairs)) - throw(DomainError(pairs, "keys must be unique")) - end - return new{K,V,N}(pairs) - end -end - -function StaticDict(pairs::Vararg{Pair}) - K = typejoin(firsttype.(pairs)...) - V = typejoin(secondtype.(pairs)...) - return StaticDict{K,V}(pairs...) -end - -StaticDict(pairs::NTuple{N,Pair} where N) = StaticDict(pairs...) - -function Base.get(d::StaticDict, key, default) - for p ∈ d.pairs - if key == p.first - return p.second - end - end - - return default -end - -Base.iterate(d::StaticDict) = iterate(d.pairs) -Base.iterate(d::StaticDict, state) = iterate(d.pairs,state) -Base.length(d::StaticDict) = length(d.pairs) - - -""" - merge(d1::StaticDict, d2::StaticDict) - -Merge two `StaticDict`. Repeating keys is considered and error. This may -change in a future version. -""" -function Base.merge(d1::StaticDict, d2::StaticDict) - return StaticDict(d1.pairs..., d2.pairs...) -end - - -""" - firsttype(::Pair{T1,T2}) - -The type of the first element in the pair. -""" -firsttype(::Pair{T1,T2}) where {T1,T2} = T1 - -""" - secondtype(::Pair{T1,T2}) - -The type of the secondtype element in the pair. -""" -secondtype(::Pair{T1,T2}) where {T1,T2} = T2 - -end # module
--- a/test/DiffOps/DiffOps_test.jl Tue Sep 17 11:20:00 2024 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,195 +0,0 @@ -using Test -using Sbplib.DiffOps -using Sbplib.Grids -using Sbplib.SbpOperators -using Sbplib.RegionIndices -using Sbplib.LazyTensors - -# -# @testset "BoundaryValue" begin -# op = read_D2_operator(sbp_operators_path()*"standard_diagonal.toml"; order=4) -# g = EquidistantGrid((4,5), (0.0, 0.0), (1.0,1.0)) -# -# e_w = BoundaryValue(op, g, CartesianBoundary{1,Lower}()) -# e_e = BoundaryValue(op, g, CartesianBoundary{1,Upper}()) -# e_s = BoundaryValue(op, g, CartesianBoundary{2,Lower}()) -# e_n = BoundaryValue(op, g, CartesianBoundary{2,Upper}()) -# -# v = zeros(Float64, 4, 5) -# v[:,5] = [1, 2, 3,4] -# v[:,4] = [1, 2, 3,4] -# v[:,3] = [4, 5, 6, 7] -# v[:,2] = [7, 8, 9, 10] -# v[:,1] = [10, 11, 12, 13] -# -# @test e_w isa LazyTensor{T,2,1} where T -# @test e_w' isa LazyTensor{T,1,2} where T -# -# @test domain_size(e_w, (3,2)) == (2,) -# @test domain_size(e_e, (3,2)) == (2,) -# @test domain_size(e_s, (3,2)) == (3,) -# @test domain_size(e_n, (3,2)) == (3,) -# -# @test size(e_w'*v) == (5,) -# @test size(e_e'*v) == (5,) -# @test size(e_s'*v) == (4,) -# @test size(e_n'*v) == (4,) -# -# @test collect(e_w'*v) == [10,7,4,1.0,1] -# @test collect(e_e'*v) == [13,10,7,4,4.0] -# @test collect(e_s'*v) == [10,11,12,13.0] -# @test collect(e_n'*v) == [1,2,3,4.0] -# -# g_x = [1,2,3,4.0] -# g_y = [5,4,3,2,1.0] -# -# G_w = zeros(Float64, (4,5)) -# G_w[1,:] = g_y -# -# G_e = zeros(Float64, (4,5)) -# G_e[4,:] = g_y -# -# G_s = zeros(Float64, (4,5)) -# G_s[:,1] = g_x -# -# G_n = zeros(Float64, (4,5)) -# G_n[:,5] = g_x -# -# @test size(e_w*g_y) == (UnknownDim,5) -# @test size(e_e*g_y) == (UnknownDim,5) -# @test size(e_s*g_x) == (4,UnknownDim) -# @test size(e_n*g_x) == (4,UnknownDim) -# -# # These tests should be moved to where they are possible (i.e we know what the grid should be) -# @test_broken collect(e_w*g_y) == G_w -# @test_broken collect(e_e*g_y) == G_e -# @test_broken collect(e_s*g_x) == G_s -# @test_broken collect(e_n*g_x) == G_n -# end -# -# @testset "NormalDerivative" begin -# op = read_D2_operator(sbp_operators_path()*"standard_diagonal.toml"; order=4) -# g = EquidistantGrid((5,6), (0.0, 0.0), (4.0,5.0)) -# -# d_w = NormalDerivative(op, g, CartesianBoundary{1,Lower}()) -# d_e = NormalDerivative(op, g, CartesianBoundary{1,Upper}()) -# d_s = NormalDerivative(op, g, CartesianBoundary{2,Lower}()) -# d_n = NormalDerivative(op, g, CartesianBoundary{2,Upper}()) -# -# -# v = evalOn(g, (x,y)-> x^2 + (y-1)^2 + x*y) -# v∂x = evalOn(g, (x,y)-> 2*x + y) -# v∂y = evalOn(g, (x,y)-> 2*(y-1) + x) -# -# @test d_w isa LazyTensor{T,2,1} where T -# @test d_w' isa LazyTensor{T,1,2} where T -# -# @test domain_size(d_w, (3,2)) == (2,) -# @test domain_size(d_e, (3,2)) == (2,) -# @test domain_size(d_s, (3,2)) == (3,) -# @test domain_size(d_n, (3,2)) == (3,) -# -# @test size(d_w'*v) == (6,) -# @test size(d_e'*v) == (6,) -# @test size(d_s'*v) == (5,) -# @test size(d_n'*v) == (5,) -# -# @test collect(d_w'*v) ≈ v∂x[1,:] -# @test collect(d_e'*v) ≈ v∂x[5,:] -# @test collect(d_s'*v) ≈ v∂y[:,1] -# @test collect(d_n'*v) ≈ v∂y[:,6] -# -# -# d_x_l = zeros(Float64, 5) -# d_x_u = zeros(Float64, 5) -# for i ∈ eachindex(d_x_l) -# d_x_l[i] = op.dClosure[i-1] -# d_x_u[i] = -op.dClosure[length(d_x_u)-i] -# end -# -# d_y_l = zeros(Float64, 6) -# d_y_u = zeros(Float64, 6) -# for i ∈ eachindex(d_y_l) -# d_y_l[i] = op.dClosure[i-1] -# d_y_u[i] = -op.dClosure[length(d_y_u)-i] -# end -# -# function prod_matrix(x,y) -# G = zeros(Float64, length(x), length(y)) -# for I ∈ CartesianIndices(G) -# G[I] = x[I[1]]*y[I[2]] -# end -# -# return G -# end -# -# g_x = [1,2,3,4.0,5] -# g_y = [5,4,3,2,1.0,11] -# -# G_w = prod_matrix(d_x_l, g_y) -# G_e = prod_matrix(d_x_u, g_y) -# G_s = prod_matrix(g_x, d_y_l) -# G_n = prod_matrix(g_x, d_y_u) -# -# -# @test size(d_w*g_y) == (UnknownDim,6) -# @test size(d_e*g_y) == (UnknownDim,6) -# @test size(d_s*g_x) == (5,UnknownDim) -# @test size(d_n*g_x) == (5,UnknownDim) -# -# # These tests should be moved to where they are possible (i.e we know what the grid should be) -# @test_broken collect(d_w*g_y) ≈ G_w -# @test_broken collect(d_e*g_y) ≈ G_e -# @test_broken collect(d_s*g_x) ≈ G_s -# @test_broken collect(d_n*g_x) ≈ G_n -# end -# -# @testset "BoundaryQuadrature" begin -# op = read_D2_operator(sbp_operators_path()*"standard_diagonal.toml"; order=4) -# g = EquidistantGrid((10,11), (0.0, 0.0), (1.0,1.0)) -# -# H_w = BoundaryQuadrature(op, g, CartesianBoundary{1,Lower}()) -# H_e = BoundaryQuadrature(op, g, CartesianBoundary{1,Upper}()) -# H_s = BoundaryQuadrature(op, g, CartesianBoundary{2,Lower}()) -# H_n = BoundaryQuadrature(op, g, CartesianBoundary{2,Upper}()) -# -# v = evalOn(g, (x,y)-> x^2 + (y-1)^2 + x*y) -# -# function get_quadrature(N) -# qc = op.quadratureClosure -# q = (qc..., ones(N-2*closuresize(op))..., reverse(qc)...) -# @assert length(q) == N -# return q -# end -# -# v_w = v[1,:] -# v_e = v[10,:] -# v_s = v[:,1] -# v_n = v[:,11] -# -# q_x = spacing(g)[1].*get_quadrature(10) -# q_y = spacing(g)[2].*get_quadrature(11) -# -# @test H_w isa TensorOperator{T,1} where T -# -# @test domain_size(H_w, (3,)) == (3,) -# @test domain_size(H_n, (3,)) == (3,) -# -# @test range_size(H_w, (3,)) == (3,) -# @test range_size(H_n, (3,)) == (3,) -# -# @test size(H_w*v_w) == (11,) -# @test size(H_e*v_e) == (11,) -# @test size(H_s*v_s) == (10,) -# @test size(H_n*v_n) == (10,) -# -# @test collect(H_w*v_w) ≈ q_y.*v_w -# @test collect(H_e*v_e) ≈ q_y.*v_e -# @test collect(H_s*v_s) ≈ q_x.*v_s -# @test collect(H_n*v_n) ≈ q_x.*v_n -# -# @test collect(H_w'*v_w) == collect(H_w'*v_w) -# @test collect(H_e'*v_e) == collect(H_e'*v_e) -# @test collect(H_s'*v_s) == collect(H_s'*v_s) -# @test collect(H_n'*v_n) == collect(H_n'*v_n) -# end
--- a/test/Grids/equidistant_grid_test.jl Tue Sep 17 11:20:00 2024 +0200 +++ b/test/Grids/equidistant_grid_test.jl Sun Oct 20 21:38:09 2024 +0200 @@ -1,7 +1,6 @@ -using Sbplib.Grids +using Diffinitive.Grids using Test -using Sbplib.RegionIndices -using Sbplib.LazyTensors +using Diffinitive.LazyTensors @testset "EquidistantGrid" begin @@ -56,30 +55,35 @@ @test inverse_spacing(EquidistantGrid(0:0.1:10)) == 10 end + @testset "min_spacing" begin + @test min_spacing(EquidistantGrid(0:10)) == 1 + @test min_spacing(EquidistantGrid(0:0.1:10)) == 0.1 + end + @testset "boundary_identifiers" begin g = EquidistantGrid(0:0.1:10) - @test boundary_identifiers(g) == (Lower(), Upper()) + @test boundary_identifiers(g) == (LowerBoundary(), UpperBoundary()) @inferred boundary_identifiers(g) end @testset "boundary_grid" begin g = EquidistantGrid(0:0.1:1) - @test boundary_grid(g, Lower()) == ZeroDimGrid(0.0) - @test boundary_grid(g, Upper()) == ZeroDimGrid(1.0) + @test boundary_grid(g, LowerBoundary()) == ZeroDimGrid(0.0) + @test boundary_grid(g, UpperBoundary()) == ZeroDimGrid(1.0) end @testset "boundary_indices" begin g = EquidistantGrid(0:0.1:1) - @test boundary_indices(g, Lower()) == 1 - @test boundary_indices(g, Upper()) == 11 + @test boundary_indices(g, LowerBoundary()) == 1 + @test boundary_indices(g, UpperBoundary()) == 11 gf = collect(g) - @test gf[boundary_indices(g, Lower())] == gf[1] - @test gf[boundary_indices(g, Upper())] == gf[11] + @test gf[boundary_indices(g, LowerBoundary())] == gf[1] + @test gf[boundary_indices(g, UpperBoundary())] == gf[11] g = EquidistantGrid(2:0.1:10) - @test boundary_indices(g, Lower()) == 1 - @test boundary_indices(g, Upper()) == 81 + @test boundary_indices(g, LowerBoundary()) == 1 + @test boundary_indices(g, UpperBoundary()) == 81 end @testset "refine" begin @@ -110,6 +114,7 @@ @testset "equidistant_grid" begin @test equidistant_grid(0.0,1.0, 4) isa EquidistantGrid @test equidistant_grid((0.0,0.0),(8.0,5.0), 4, 3) isa TensorGrid + @test equidistant_grid((0.0,),(8.0,), 4) isa TensorGrid # constuctor @test_throws DomainError equidistant_grid(0.0, 1.0, 0)
--- a/test/Grids/grid_test.jl Tue Sep 17 11:20:00 2024 +0200 +++ b/test/Grids/grid_test.jl Sun Oct 20 21:38:09 2024 +0200 @@ -1,6 +1,6 @@ using Test -using Sbplib.Grids -using Sbplib.LazyTensors +using Diffinitive.Grids +using Diffinitive.LazyTensors using StaticArrays @testset "Grid" begin
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/Grids/mapped_grid_test.jl Sun Oct 20 21:38:09 2024 +0200 @@ -0,0 +1,381 @@ +using Diffinitive.Grids +using Diffinitive.RegionIndices +using Test +using StaticArrays +using LinearAlgebra + + +_skew_mapping(a,b) = (ξ̄->ξ̄[1]*a + ξ̄[2]*b, ξ̄->[a b]) + +function _partially_curved_mapping() + x̄((ξ, η)) = @SVector[ξ, η*(1+ξ*(ξ-1))] + J((ξ, η)) = @SMatrix[ + 1 0; + η*(2ξ-1) 1+ξ*(ξ-1); + ] + + return x̄, J +end + +function _fully_curved_mapping() + x̄((ξ, η)) = @SVector[2ξ + η*(1-η), 3η+(1+η/2)*ξ^2] + J((ξ, η)) = @SMatrix[ + 2 1-2η; + (2+η)*ξ 3+1/2*ξ^2; + ] + + return x̄, J +end + +@testset "MappedGrid" begin + @testset "Constructor" begin + lg = equidistant_grid((0,0), (1,1), 11, 21) + + x̄ = map(ξ̄ -> 2ξ̄, lg) + J = map(ξ̄ -> @SArray(fill(2., 2, 2)), lg) + mg = MappedGrid(lg, x̄, J) + + @test mg isa Grid{SVector{2, Float64},2} + @test jacobian(mg) isa Array{<:AbstractMatrix} + @test logical_grid(mg) isa Grid + + @test collect(mg) == x̄ + @test jacobian(mg) == J + @test logical_grid(mg) == lg + + + x̄ = map(ξ̄ -> @SVector[ξ̄[1],ξ̄[2], ξ̄[1] + ξ̄[2]], lg) + J = map(ξ̄ -> @SMatrix[1 0; 0 1; 1 1], lg) + mg = MappedGrid(lg, x̄, J) + + @test mg isa Grid{SVector{3, Float64},2} + @test jacobian(mg) isa Array{<:AbstractMatrix} + @test logical_grid(mg) isa Grid + + @test collect(mg) == x̄ + @test jacobian(mg) == J + @test logical_grid(mg) == lg + + sz1 = (10,11) + sz2 = (10,12) + @test_throws ArgumentError("Sizes must match") MappedGrid( + equidistant_grid((0,0), (1,1), sz2...), + rand(SVector{2},sz1...), + rand(SMatrix{2,2},sz1...), + ) + + @test_throws ArgumentError("Sizes must match") MappedGrid( + equidistant_grid((0,0), (1,1), sz1...), + rand(SVector{2},sz2...), + rand(SMatrix{2,2},sz1...), + ) + + @test_throws ArgumentError("Sizes must match") MappedGrid( + equidistant_grid((0,0), (1,1), sz1...), + rand(SVector{2},sz1...), + rand(SMatrix{2,2},sz2...), + ) + + err_str = "The size of the jacobian must match the dimensions of the grid and coordinates" + @test_throws ArgumentError(err_str) MappedGrid( + equidistant_grid((0,0), (1,1), 10, 11), + rand(SVector{3}, 10, 11), + rand(SMatrix{3,4}, 10, 11), + ) + + @test_throws ArgumentError(err_str) MappedGrid( + equidistant_grid((0,0), (1,1), 10, 11), + rand(SVector{3}, 10, 11), + rand(SMatrix{4,2}, 10, 11), + ) + end + + @testset "Indexing Interface" begin + lg = equidistant_grid((0,0), (1,1), 11, 21) + x̄ = map(ξ̄ -> 2ξ̄, lg) + J = map(ξ̄ -> @SArray(fill(2., 2, 2)), lg) + mg = MappedGrid(lg, x̄, J) + @test mg[1,1] == [0.0, 0.0] + @test mg[4,2] == [0.6, 0.1] + @test mg[6,10] == [1., 0.9] + + @test mg[begin, begin] == [0.0, 0.0] + @test mg[end,end] == [2.0, 2.0] + @test mg[begin,end] == [0., 2.] + + @test axes(mg) == (1:11, 1:21) + + @testset "cartesian indexing" begin + cases = [ + (1,1) , + (3,5) , + (10,6), + (1,1) , + (3,2) , + ] + + @testset "i = $is" for (lg, is) ∈ cases + @test mg[CartesianIndex(is...)] == mg[is...] + end + end + + @testset "eachindex" begin + @test eachindex(mg) == CartesianIndices((11,21)) + end + + @testset "firstindex" begin + @test firstindex(mg, 1) == 1 + @test firstindex(mg, 2) == 1 + end + + @testset "lastindex" begin + @test lastindex(mg, 1) == 11 + @test lastindex(mg, 2) == 21 + end + end + + @testset "Iterator interface" begin + lg = equidistant_grid((0,0), (1,1), 11, 21) + x̄ = map(ξ̄ -> 2ξ̄, lg) + J = map(ξ̄ -> @SArray(fill(2., 2, 2)), lg) + + mg = MappedGrid(lg, x̄, J) + + lg2 = equidistant_grid((0,0), (1,1), 15, 11) + sg = MappedGrid( + equidistant_grid((0,0), (1,1), 15, 11), + map(ξ̄ -> @SArray[ξ̄[1], ξ̄[2], -ξ̄[1]], lg2), rand(SMatrix{3,2,Float64},15,11) + ) + + @test eltype(mg) == SVector{2,Float64} + @test eltype(sg) == SVector{3,Float64} + + @test eltype(typeof(mg)) == SVector{2,Float64} + @test eltype(typeof(sg)) == SVector{3,Float64} + + @test size(mg) == (11,21) + @test size(sg) == (15,11) + + @test size(mg,2) == 21 + @test size(sg,2) == 11 + + @test length(mg) == 231 + @test length(sg) == 165 + + @test Base.IteratorSize(mg) == Base.HasShape{2}() + @test Base.IteratorSize(typeof(mg)) == Base.HasShape{2}() + + @test Base.IteratorSize(sg) == Base.HasShape{2}() + @test Base.IteratorSize(typeof(sg)) == Base.HasShape{2}() + + element, state = iterate(mg) + @test element == lg[1,1].*2 + element, _ = iterate(mg, state) + @test element == lg[2,1].*2 + + element, state = iterate(sg) + @test element == sg.physicalcoordinates[1,1] + element, _ = iterate(sg, state) + @test element == sg.physicalcoordinates[2,1] + + @test collect(mg) == 2 .* lg + end + + @testset "Base" begin + lg = equidistant_grid((0,0), (1,1), 11, 21) + x̄ = map(ξ̄ -> 2ξ̄, lg) + J = map(ξ̄ -> @SArray(fill(2., 2, 2)), lg) + mg = MappedGrid(lg, x̄, J) + + @test ndims(mg) == 2 + end + + @testset "==" begin + sz = (15,11) + lg = equidistant_grid((0,0), (1,1), sz...) + x = rand(SVector{3,Float64}, sz...) + J = rand(SMatrix{3,2,Float64}, sz...) + + sg = MappedGrid(lg, x, J) + + sg1 = MappedGrid(equidistant_grid((0,0), (1,1), sz...), copy(x), copy(J)) + + sz2 = (15,12) + lg2 = equidistant_grid((0,0), (1,1), sz2...) + x2 = rand(SVector{3,Float64}, sz2...) + J2 = rand(SMatrix{3,2,Float64}, sz2...) + sg2 = MappedGrid(lg2, x2, J2) + + sg3 = MappedGrid(lg, rand(SVector{3,Float64}, sz...), J) + sg4 = MappedGrid(lg, x, rand(SMatrix{3,2,Float64}, sz...)) + + @test sg == sg1 + @test sg != sg2 # Different size + @test sg != sg3 # Different coordinates + @test sg != sg4 # Different jacobian + end + + @testset "boundary_identifiers" begin + lg = equidistant_grid((0,0), (1,1), 11, 15) + x̄ = map(ξ̄ -> 2ξ̄, lg) + J = map(ξ̄ -> @SArray(fill(2., 2, 2)), lg) + mg = MappedGrid(lg, x̄, J) + @test boundary_identifiers(mg) == boundary_identifiers(lg) + end + + @testset "boundary_indices" begin + lg = equidistant_grid((0,0), (1,1), 11, 15) + x̄ = map(ξ̄ -> 2ξ̄, lg) + J = map(ξ̄ -> @SArray(fill(2., 2, 2)), lg) + mg = MappedGrid(lg, x̄, J) + + @test boundary_indices(mg, CartesianBoundary{1,LowerBoundary}()) == boundary_indices(lg,CartesianBoundary{1,LowerBoundary}()) + @test boundary_indices(mg, CartesianBoundary{2,LowerBoundary}()) == boundary_indices(lg,CartesianBoundary{2,LowerBoundary}()) + @test boundary_indices(mg, CartesianBoundary{1,UpperBoundary}()) == boundary_indices(lg,CartesianBoundary{1,UpperBoundary}()) + end + + @testset "boundary_grid" begin + x̄, J = _partially_curved_mapping() + mg = mapped_grid(x̄, J, 10, 11) + J1((ξ, η)) = @SMatrix[ + 1 ; + η*(2ξ-1); + ] + J2((ξ, η)) = @SMatrix[ + 0; + 1+ξ*(ξ-1); + ] + + function expected_bg(mg, bId, Jb) + lg = logical_grid(mg) + return MappedGrid( + boundary_grid(lg, bId), + map(x̄, boundary_grid(lg, bId)), + map(Jb, boundary_grid(lg, bId)), + ) + end + + let bid = TensorGridBoundary{1, LowerBoundary}() + @test boundary_grid(mg, bid) == expected_bg(mg, bid, J2) + end + + let bid = TensorGridBoundary{1, UpperBoundary}() + @test boundary_grid(mg, bid) == expected_bg(mg, bid, J2) + end + + let bid = TensorGridBoundary{2, LowerBoundary}() + @test boundary_grid(mg, bid) == expected_bg(mg, bid, J1) + end + + let bid = TensorGridBoundary{2, UpperBoundary}() + @test boundary_grid(mg, bid) == expected_bg(mg, bid, J1) + end + end +end + +@testset "mapped_grid" begin + x̄, J = _partially_curved_mapping() + mg = mapped_grid(x̄, J, 10, 11) + @test mg isa MappedGrid{SVector{2,Float64}, 2} + + lg = equidistant_grid((0,0), (1,1), 10, 11) + @test logical_grid(mg) == lg + @test collect(mg) == map(x̄, lg) + + @test mapped_grid(lg, x̄, J) == mg +end + +@testset "metric_tensor" begin + x̄((ξ, η)) = @SVector[ξ*η, ξ + η^2] + J((ξ, η)) = @SMatrix[ + η ξ; + 1 2η; + ] + + g = mapped_grid(x̄, J, 10, 11) + G = map(logical_grid(g)) do (ξ,η) + @SMatrix[ + 1+η^2 ξ*η+2η; + ξ*η+2η ξ^2 + 4η^2; + ] + end + @test metric_tensor(g) ≈ G +end + +@testset "min_spacing" begin + let g = mapped_grid(identity, x->@SMatrix[1], 11) + @test min_spacing(g) ≈ 0.1 + end + + let g = mapped_grid(x->x+x.^2/2, x->@SMatrix[1 .+ x], 11) + @test min_spacing(g) ≈ 0.105 + end + + let g = mapped_grid(x->x + x.*(1 .- x)/2, x->@SMatrix[1.5 .- x], 11) + @test min_spacing(g) ≈ 0.055 + end + + let g = mapped_grid(identity, x->@SMatrix[1 0; 0 1], 11,11) + @test min_spacing(g) ≈ 0.1 + end + + let g = mapped_grid(identity, x->@SMatrix[1 0; 0 1], 11,21) + @test min_spacing(g) ≈ 0.05 + end + + + @testset let a = @SVector[1,0], b = @SVector[1,1]/√2 + g = mapped_grid(_skew_mapping(a,b)...,11,11) + + @test min_spacing(g) ≈ 0.1*norm(b-a) + end + + @testset let a = @SVector[1,0], b = @SVector[-1,1]/√2 + g = mapped_grid(_skew_mapping(a,b)...,11,11) + + @test min_spacing(g) ≈ 0.1*norm(a+b) + end +end + +@testset "normal" begin + g = mapped_grid(_partially_curved_mapping()...,10, 11) + + @test normal(g, CartesianBoundary{1,LowerBoundary}()) == fill(@SVector[-1,0], 11) + @test normal(g, CartesianBoundary{1,UpperBoundary}()) == fill(@SVector[1,0], 11) + @test normal(g, CartesianBoundary{2,LowerBoundary}()) == fill(@SVector[0,-1], 10) + @test normal(g, CartesianBoundary{2,UpperBoundary}()) ≈ map(boundary_grid(g,CartesianBoundary{2,UpperBoundary}())|>logical_grid) do ξ̄ + α = 1-2ξ̄[1] + @SVector[α,1]/√(α^2 + 1) + end + + g = mapped_grid(_fully_curved_mapping()...,5,4) + + unit(v) = v/norm(v) + @testset let bId = CartesianBoundary{1,LowerBoundary}() + lbg = boundary_grid(logical_grid(g), bId) + @test normal(g, bId) ≈ map(lbg) do (ξ, η) + -unit(@SVector[1/2, η/3-1/6]) + end + end + + @testset let bId = CartesianBoundary{1,UpperBoundary}() + lbg = boundary_grid(logical_grid(g), bId) + @test normal(g, bId) ≈ map(lbg) do (ξ, η) + unit(@SVector[7/2, 2η-1]/(5 + 3η + 2η^2)) + end + end + + @testset let bId = CartesianBoundary{2,LowerBoundary}() + lbg = boundary_grid(logical_grid(g), bId) + @test normal(g, bId) ≈ map(lbg) do (ξ, η) + -unit(@SVector[-2ξ, 2]/(6 + ξ^2 - 2ξ)) + end + end + + @testset let bId = CartesianBoundary{2,UpperBoundary}() + lbg = boundary_grid(logical_grid(g), bId) + @test normal(g, bId) ≈ map(lbg) do (ξ, η) + unit(@SVector[-3ξ, 2]/(6 + ξ^2 + 3ξ)) + end + end +end
--- a/test/Grids/tensor_grid_test.jl Tue Sep 17 11:20:00 2024 +0200 +++ b/test/Grids/tensor_grid_test.jl Sun Oct 20 21:38:09 2024 +0200 @@ -1,7 +1,6 @@ using Test -using Sbplib.Grids +using Diffinitive.Grids using StaticArrays -using Sbplib.RegionIndices @testset "TensorGrid" begin g₁ = EquidistantGrid(range(0,1,length=11)) @@ -138,6 +137,15 @@ @test axes(g) == (1:11,1:6) end + @testset "min_spacing" begin + g₁ = EquidistantGrid(range(0,1,length=11)) + g₂ = EquidistantGrid(range(2,3,length=6)) + g₃ = ZeroDimGrid(@SVector[1,2]) + + @test min_spacing(TensorGrid(g₁, g₂)) == 1/10 + @test min_spacing(TensorGrid(g₂, g₃)) == 1/5 + end + @testset "refine" begin g1(n) = EquidistantGrid(range(0,1,length=n)) g2(n) = EquidistantGrid(range(2,3,length=n)) @@ -161,13 +169,13 @@ end @testset "boundary_identifiers" begin - @test boundary_identifiers(TensorGrid(g₁, g₂)) == map((n,id)->TensorGridBoundary{n,id}(), (1,1,2,2), (Lower,Upper,Lower,Upper)) - @test boundary_identifiers(TensorGrid(g₁, g₄)) == (TensorGridBoundary{1,Lower}(),TensorGridBoundary{1,Upper}()) + @test boundary_identifiers(TensorGrid(g₁, g₂)) == map((n,id)->TensorGridBoundary{n,id}(), (1,1,2,2), (LowerBoundary,UpperBoundary,LowerBoundary,UpperBoundary)) + @test boundary_identifiers(TensorGrid(g₁, g₄)) == (TensorGridBoundary{1,LowerBoundary}(),TensorGridBoundary{1,UpperBoundary}()) end @testset "boundary_grid" begin - @test boundary_grid(TensorGrid(g₁, g₂), TensorGridBoundary{1, Upper}()) == TensorGrid(ZeroDimGrid(g₁[end]), g₂) - @test boundary_grid(TensorGrid(g₁, g₄), TensorGridBoundary{1, Upper}()) == TensorGrid(ZeroDimGrid(g₁[end]), g₄) + @test boundary_grid(TensorGrid(g₁, g₂), TensorGridBoundary{1, UpperBoundary}()) == TensorGrid(ZeroDimGrid(g₁[end]), g₂) + @test boundary_grid(TensorGrid(g₁, g₄), TensorGridBoundary{1, UpperBoundary}()) == TensorGrid(ZeroDimGrid(g₁[end]), g₄) end @testset "boundary_indices" begin @@ -176,26 +184,26 @@ g₄ = ZeroDimGrid(@SVector[1,2]) gf = reshape(1:(11*6),11,6) - @test gf[boundary_indices(TensorGrid(g₁, g₂), TensorGridBoundary{1, Lower}())] == gf[1,:] - @test gf[boundary_indices(TensorGrid(g₁, g₂), TensorGridBoundary{1, Upper}())] == gf[11,:] - @test gf[boundary_indices(TensorGrid(g₁, g₂), TensorGridBoundary{2, Lower}())] == gf[:,1] - @test gf[boundary_indices(TensorGrid(g₁, g₂), TensorGridBoundary{2, Upper}())] == gf[:,6] + @test gf[boundary_indices(TensorGrid(g₁, g₂), TensorGridBoundary{1, LowerBoundary}())] == gf[1,:] + @test gf[boundary_indices(TensorGrid(g₁, g₂), TensorGridBoundary{1, UpperBoundary}())] == gf[11,:] + @test gf[boundary_indices(TensorGrid(g₁, g₂), TensorGridBoundary{2, LowerBoundary}())] == gf[:,1] + @test gf[boundary_indices(TensorGrid(g₁, g₂), TensorGridBoundary{2, UpperBoundary}())] == gf[:,6] gf = rand(11) - @show boundary_indices(TensorGrid(g₁, g₄), TensorGridBoundary{1, Lower}()) - @test gf[boundary_indices(TensorGrid(g₁, g₄), TensorGridBoundary{1, Lower}())] == gf[1] - @test gf[boundary_indices(TensorGrid(g₁, g₄), TensorGridBoundary{1, Upper}())] == gf[11] - @test gf[boundary_indices(TensorGrid(g₄,g₁), TensorGridBoundary{2, Lower}())]== gf[1] - @test gf[boundary_indices(TensorGrid(g₄,g₁), TensorGridBoundary{2, Upper}())]== gf[11] + @show boundary_indices(TensorGrid(g₁, g₄), TensorGridBoundary{1, LowerBoundary}()) + @test gf[boundary_indices(TensorGrid(g₁, g₄), TensorGridBoundary{1, LowerBoundary}())] == gf[1] + @test gf[boundary_indices(TensorGrid(g₁, g₄), TensorGridBoundary{1, UpperBoundary}())] == gf[11] + @test gf[boundary_indices(TensorGrid(g₄,g₁), TensorGridBoundary{2, LowerBoundary}())]== gf[1] + @test gf[boundary_indices(TensorGrid(g₄,g₁), TensorGridBoundary{2, UpperBoundary}())]== gf[11] - @test collect(boundary_indices(TensorGrid(g₁, g₂), TensorGridBoundary{1, Lower}())) == [CartesianIndex(1,i) for i ∈ 1:6] - @test collect(boundary_indices(TensorGrid(g₁, g₂), TensorGridBoundary{1, Upper}())) == [CartesianIndex(11,i) for i ∈ 1:6] - @test collect(boundary_indices(TensorGrid(g₁, g₂), TensorGridBoundary{2, Lower}())) == [CartesianIndex(i,1) for i ∈ 1:11] - @test collect(boundary_indices(TensorGrid(g₁, g₂), TensorGridBoundary{2, Upper}())) == [CartesianIndex(i,6) for i ∈ 1:11] - @test collect(boundary_indices(TensorGrid(g₁, g₄), TensorGridBoundary{1, Lower}())) == fill(1) - @test collect(boundary_indices(TensorGrid(g₁, g₄), TensorGridBoundary{1, Upper}())) == fill(11) - @test collect(boundary_indices(TensorGrid(g₄,g₁), TensorGridBoundary{2, Lower}())) == fill(1) - @test collect(boundary_indices(TensorGrid(g₄,g₁), TensorGridBoundary{2, Upper}())) == fill(11) + @test collect(boundary_indices(TensorGrid(g₁, g₂), TensorGridBoundary{1, LowerBoundary}())) == [CartesianIndex(1,i) for i ∈ 1:6] + @test collect(boundary_indices(TensorGrid(g₁, g₂), TensorGridBoundary{1, UpperBoundary}())) == [CartesianIndex(11,i) for i ∈ 1:6] + @test collect(boundary_indices(TensorGrid(g₁, g₂), TensorGridBoundary{2, LowerBoundary}())) == [CartesianIndex(i,1) for i ∈ 1:11] + @test collect(boundary_indices(TensorGrid(g₁, g₂), TensorGridBoundary{2, UpperBoundary}())) == [CartesianIndex(i,6) for i ∈ 1:11] + @test collect(boundary_indices(TensorGrid(g₁, g₄), TensorGridBoundary{1, LowerBoundary}())) == fill(1) + @test collect(boundary_indices(TensorGrid(g₁, g₄), TensorGridBoundary{1, UpperBoundary}())) == fill(11) + @test collect(boundary_indices(TensorGrid(g₄,g₁), TensorGridBoundary{2, LowerBoundary}())) == fill(1) + @test collect(boundary_indices(TensorGrid(g₄,g₁), TensorGridBoundary{2, UpperBoundary}())) == fill(11) # TBD: What do we actually expect for 1D grids? end end
--- a/test/Grids/zero_dim_grid_test.jl Tue Sep 17 11:20:00 2024 +0200 +++ b/test/Grids/zero_dim_grid_test.jl Sun Oct 20 21:38:09 2024 +0200 @@ -1,5 +1,5 @@ using Test -using Sbplib.Grids +using Diffinitive.Grids using StaticArrays @testset "ZeroDimGrid" begin
--- a/test/LazyTensors/lazy_array_test.jl Tue Sep 17 11:20:00 2024 +0200 +++ b/test/LazyTensors/lazy_array_test.jl Sun Oct 20 21:38:09 2024 +0200 @@ -1,6 +1,6 @@ using Test -using Sbplib.LazyTensors -using Sbplib.RegionIndices +using Diffinitive.LazyTensors +using Diffinitive.RegionIndices @testset "LazyArray" begin
--- a/test/LazyTensors/lazy_tensor_operations_test.jl Tue Sep 17 11:20:00 2024 +0200 +++ b/test/LazyTensors/lazy_tensor_operations_test.jl Sun Oct 20 21:38:09 2024 +0200 @@ -1,16 +1,16 @@ using Test -using Sbplib.LazyTensors -using Sbplib.RegionIndices +using Diffinitive.LazyTensors +using Diffinitive.RegionIndices using Tullio -struct DummyMapping{T,R,D} <: LazyTensor{T,R,D} end +struct TransposableDummyMapping{T,R,D} <: LazyTensor{T,R,D} end -LazyTensors.apply(m::DummyMapping{T,R}, v, I::Vararg{Any,R}) where {T,R} = :apply -LazyTensors.apply_transpose(m::DummyMapping{T,R,D}, v, I::Vararg{Any,D}) where {T,R,D} = :apply_transpose +LazyTensors.apply(m::TransposableDummyMapping{T,R}, v, I::Vararg{Any,R}) where {T,R} = :apply +LazyTensors.apply_transpose(m::TransposableDummyMapping{T,R,D}, v, I::Vararg{Any,D}) where {T,R,D} = :apply_transpose -LazyTensors.range_size(m::DummyMapping) = :range_size -LazyTensors.domain_size(m::DummyMapping) = :domain_size +LazyTensors.range_size(m::TransposableDummyMapping) = :range_size +LazyTensors.domain_size(m::TransposableDummyMapping) = :domain_size struct SizeDoublingMapping{T,R,D} <: LazyTensor{T,R,D} @@ -24,7 +24,7 @@ @testset "Mapping transpose" begin - m = DummyMapping{Float64,2,3}() + m = TransposableDummyMapping{Float64,2,3}() @test m' isa LazyTensor{Float64, 3,2} @test m'' == m @test apply(m',zeros(Float64,(0,0)), 0, 0, 0) == :apply_transpose
--- a/test/LazyTensors/lazy_tensor_test.jl Tue Sep 17 11:20:00 2024 +0200 +++ b/test/LazyTensors/lazy_tensor_test.jl Sun Oct 20 21:38:09 2024 +0200 @@ -1,5 +1,5 @@ using Test -using Sbplib.LazyTensors +using Diffinitive.LazyTensors @testset "Generic Mapping methods" begin struct DummyMapping{T,R,D} <: LazyTensor{T,R,D} end
--- a/test/LazyTensors/tensor_types_test.jl Tue Sep 17 11:20:00 2024 +0200 +++ b/test/LazyTensors/tensor_types_test.jl Sun Oct 20 21:38:09 2024 +0200 @@ -1,5 +1,5 @@ using Test -using Sbplib.LazyTensors +using Diffinitive.LazyTensors using BenchmarkTools @testset "IdentityTensor" begin
--- a/test/LazyTensors/tuple_manipulation_test.jl Tue Sep 17 11:20:00 2024 +0200 +++ b/test/LazyTensors/tuple_manipulation_test.jl Sun Oct 20 21:38:09 2024 +0200 @@ -1,5 +1,5 @@ using Test -using Sbplib.LazyTensors +using Diffinitive.LazyTensors @testset "split_index" begin @test LazyTensors.split_index(2,1,2,2, 1,2,3,4,5,6) == ((1,2,:,5,6),(3,4))
--- a/test/Manifest.toml Tue Sep 17 11:20:00 2024 +0200 +++ b/test/Manifest.toml Sun Oct 20 21:38:09 2024 +0200 @@ -1,33 +1,36 @@ # This file is machine-generated - editing it directly is not advised -julia_version = "1.10.0" +julia_version = "1.11.1" manifest_format = "2.0" -project_hash = "f2b0634c12bbed93a17efc88d466604d5a07c465" +project_hash = "9dddd5385164ee197d1b3f22302bc95701c1f5e5" [[deps.ArgTools]] uuid = "0dad84c5-d112-42e6-8d28-ef12dabb789f" -version = "1.1.1" +version = "1.1.2" [[deps.Artifacts]] uuid = "56f22d72-fd6d-98f1-02f0-08ddc0907c33" +version = "1.11.0" [[deps.Base64]] uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f" +version = "1.11.0" [[deps.BenchmarkTools]] deps = ["JSON", "Logging", "Printf", "Profile", "Statistics", "UUIDs"] -git-tree-sha1 = "f1f03a9fa24271160ed7e73051fba3c1a759b53f" +git-tree-sha1 = "f1dff6729bc61f4d49e140da1af55dcd1ac97b2f" uuid = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf" -version = "1.4.0" +version = "1.5.0" [[deps.CompilerSupportLibraries_jll]] deps = ["Artifacts", "Libdl"] uuid = "e66e0078-7015-5450-92f7-15fbd957f2ae" -version = "1.0.5+1" +version = "1.1.1+0" [[deps.Dates]] deps = ["Printf"] uuid = "ade2ca70-3891-5945-98fb-dc099432e06a" +version = "1.11.0" [[deps.DeepDiffs]] git-tree-sha1 = "9824894295b62a6a4ab6adf1c7bf337b3a9ca34c" @@ -43,6 +46,7 @@ [[deps.Distributed]] deps = ["Random", "Serialization", "Sockets"] uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b" +version = "1.11.0" [[deps.DocStringExtensions]] deps = ["LibGit2"] @@ -57,6 +61,7 @@ [[deps.FileWatching]] uuid = "7b1f6079-737a-58dc-b8bc-7a2ca5c1b5ee" +version = "1.11.0" [[deps.Glob]] git-tree-sha1 = "97285bbd5230dd766e9ef6749b80fc617126d496" @@ -66,6 +71,7 @@ [[deps.InteractiveUtils]] deps = ["Markdown"] uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240" +version = "1.11.0" [[deps.IrrationalConstants]] git-tree-sha1 = "630b497eafcc20001bba38a4651b327dcfc491d2" @@ -74,9 +80,9 @@ [[deps.JLLWrappers]] deps = ["Artifacts", "Preferences"] -git-tree-sha1 = "7e5d6779a1e09a36db2a7b6cff50942a0a7d0fca" +git-tree-sha1 = "be3dc50a92e5a386872a493a10050136d4703f9b" uuid = "692b3bcd-3c85-4b1f-b108-f13ce0eb3210" -version = "1.5.0" +version = "1.6.1" [[deps.JSON]] deps = ["Dates", "Mmap", "Parsers", "Unicode"] @@ -84,6 +90,15 @@ uuid = "682c06a0-de6a-54ab-a142-c8b1cf79cde6" version = "0.21.4" +[[deps.LRUCache]] +git-tree-sha1 = "b3cc6698599b10e652832c2f23db3cab99d51b59" +uuid = "8ac3fa9e-de4c-5943-b1dc-09c6b5f20637" +version = "1.6.1" +weakdeps = ["Serialization"] + + [deps.LRUCache.extensions] + SerializationExt = ["Serialization"] + [[deps.LibCURL]] deps = ["LibCURL_jll", "MozillaCACerts_jll"] uuid = "b27032c2-a3e7-50c8-80cd-2d36dbcbfd21" @@ -92,16 +107,17 @@ [[deps.LibCURL_jll]] deps = ["Artifacts", "LibSSH2_jll", "Libdl", "MbedTLS_jll", "Zlib_jll", "nghttp2_jll"] uuid = "deac9b47-8bc7-5906-a0fe-35ac56dc84c0" -version = "8.4.0+0" +version = "8.6.0+0" [[deps.LibGit2]] deps = ["Base64", "LibGit2_jll", "NetworkOptions", "Printf", "SHA"] uuid = "76f85450-5226-5b5a-8eaa-529ad045b433" +version = "1.11.0" [[deps.LibGit2_jll]] deps = ["Artifacts", "LibSSH2_jll", "Libdl", "MbedTLS_jll"] uuid = "e37daf67-58a4-590a-8e99-b0245dd2ffc5" -version = "1.6.4+0" +version = "1.7.2+0" [[deps.LibSSH2_jll]] deps = ["Artifacts", "Libdl", "MbedTLS_jll"] @@ -110,16 +126,18 @@ [[deps.Libdl]] uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb" +version = "1.11.0" [[deps.LinearAlgebra]] deps = ["Libdl", "OpenBLAS_jll", "libblastrampoline_jll"] uuid = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" +version = "1.11.0" [[deps.LogExpFunctions]] deps = ["DocStringExtensions", "IrrationalConstants", "LinearAlgebra"] -git-tree-sha1 = "7d6dd4e9212aebaeed356de34ccf262a3cd415aa" +git-tree-sha1 = "a2d09619db4e765091ee5c6ffe8872849de0feea" uuid = "2ab3a3ac-af41-5b50-aa03-7779005ae688" -version = "0.3.26" +version = "0.3.28" [deps.LogExpFunctions.extensions] LogExpFunctionsChainRulesCoreExt = "ChainRulesCore" @@ -133,22 +151,25 @@ [[deps.Logging]] uuid = "56ddb016-857b-54e1-b83d-db4d58db5568" +version = "1.11.0" [[deps.Markdown]] deps = ["Base64"] uuid = "d6f4376e-aef5-505a-96c1-9c027394607a" +version = "1.11.0" [[deps.MbedTLS_jll]] deps = ["Artifacts", "Libdl"] uuid = "c8ffd9c3-330d-5841-b78e-0817d7145fa1" -version = "2.28.2+1" +version = "2.28.6+0" [[deps.Mmap]] uuid = "a63ad114-7e13-5084-954f-fe012c677804" +version = "1.11.0" [[deps.MozillaCACerts_jll]] uuid = "14a3606d-f60d-562e-9121-12d972cd8159" -version = "2023.1.10" +version = "2023.12.12" [[deps.NaNMath]] deps = ["OpenLibm_jll"] @@ -163,7 +184,7 @@ [[deps.OpenBLAS_jll]] deps = ["Artifacts", "CompilerSupportLibraries_jll", "Libdl"] uuid = "4536629a-c528-5b80-bd46-f80d51c5b363" -version = "0.3.23+2" +version = "0.3.27+1" [[deps.OpenLibm_jll]] deps = ["Artifacts", "Libdl"] @@ -176,6 +197,12 @@ uuid = "efe28fd5-8261-553b-a9e1-b2916fc3738e" version = "0.5.5+0" +[[deps.PackageExtensionCompat]] +git-tree-sha1 = "fb28e33b8a95c4cee25ce296c817d89cc2e53518" +uuid = "65ce6f38-6b18-4e1d-a461-8949797d7930" +version = "1.0.2" +weakdeps = ["Requires", "TOML"] + [[deps.Parsers]] deps = ["Dates", "PrecompileTools", "UUIDs"] git-tree-sha1 = "8489905bcdbcfac64d1daa51ca07c0d8f0283821" @@ -183,37 +210,46 @@ version = "2.8.1" [[deps.Pkg]] -deps = ["Artifacts", "Dates", "Downloads", "FileWatching", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "Serialization", "TOML", "Tar", "UUIDs", "p7zip_jll"] +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.10.0" +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 = "03b4c25b43cb84cee5c90aa9b5ea0a78fd848d2f" +git-tree-sha1 = "5aa36f7049a63a1528fe8f7c3f2113413ffd4e1f" uuid = "aea7be01-6a6a-4083-8856-8a6e6704d82a" -version = "1.2.0" +version = "1.2.1" [[deps.Preferences]] deps = ["TOML"] -git-tree-sha1 = "00805cd429dcb4870060ff49ef443486c262e38e" +git-tree-sha1 = "9306f6085165d270f7e3db02af26a400d580f5c6" uuid = "21216c6a-2e73-6563-6e65-726566657250" -version = "1.4.1" +version = "1.4.3" [[deps.Printf]] deps = ["Unicode"] uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7" +version = "1.11.0" [[deps.Profile]] -deps = ["Printf"] uuid = "9abbd945-dff8-562f-b5e8-e1ebf5ef1b79" +version = "1.11.0" -[[deps.REPL]] -deps = ["InteractiveUtils", "Markdown", "Sockets", "Unicode"] -uuid = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb" +[[deps.PtrArrays]] +git-tree-sha1 = "77a42d78b6a92df47ab37e177b2deac405e1c88f" +uuid = "43287f4e-b6f4-7ad1-bb20-aadabca52c3d" +version = "1.2.1" [[deps.Random]] deps = ["SHA"] uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" +version = "1.11.0" [[deps.Requires]] deps = ["UUIDs"] @@ -227,20 +263,32 @@ [[deps.Serialization]] uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b" +version = "1.11.0" [[deps.Sockets]] uuid = "6462fe0b-24de-5631-8697-dd941f90decc" +version = "1.11.0" + +[[deps.SparseArrayKit]] +deps = ["LinearAlgebra", "PackageExtensionCompat", "TensorOperations", "TupleTools", "VectorInterface"] +git-tree-sha1 = "77769a2a6fefd92fc7c0367c0771a2a9d2b6f8e1" +uuid = "a9a3c162-d163-4c15-8926-b8794fbefed2" +version = "0.4.0" +weakdeps = ["SparseArrays"] + + [deps.SparseArrayKit.extensions] + SparseArrayKitSparseArrays = "SparseArrays" [[deps.SparseArrays]] deps = ["Libdl", "LinearAlgebra", "Random", "Serialization", "SuiteSparse_jll"] uuid = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" -version = "1.10.0" +version = "1.11.0" [[deps.SpecialFunctions]] deps = ["IrrationalConstants", "LogExpFunctions", "OpenLibm_jll", "OpenSpecFun_jll"] -git-tree-sha1 = "e2cfc4012a19088254b3950b85c3c1d8882d864d" +git-tree-sha1 = "2f5d4697f21388cbe1ff299430dd169ef97d7e14" uuid = "276daf66-3868-5448-9aa4-cd146d93841b" -version = "2.3.1" +version = "2.4.0" [deps.SpecialFunctions.extensions] SpecialFunctionsChainRulesCoreExt = "ChainRulesCore" @@ -250,9 +298,9 @@ [[deps.StaticArrays]] deps = ["LinearAlgebra", "PrecompileTools", "Random", "StaticArraysCore"] -git-tree-sha1 = "f68dd04d131d9a8a8eb836173ee8f105c360b0c5" +git-tree-sha1 = "eeafab08ae20c62c44c8399ccb9354a04b80db50" uuid = "90137ffa-7385-5640-81b9-e52037218182" -version = "1.9.1" +version = "1.9.7" [deps.StaticArrays.extensions] StaticArraysChainRulesCoreExt = "ChainRulesCore" @@ -263,19 +311,42 @@ Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" [[deps.StaticArraysCore]] -git-tree-sha1 = "36b3d696ce6366023a0ea192b4cd442268995a0d" +git-tree-sha1 = "192954ef1208c7019899fbf8049e717f92959682" uuid = "1e83bf80-4336-4d27-bf5d-d5a4f845583c" -version = "1.4.2" +version = "1.4.3" [[deps.Statistics]] -deps = ["LinearAlgebra", "SparseArrays"] +deps = ["LinearAlgebra"] +git-tree-sha1 = "ae3bb1eb3bba077cd276bc5cfc337cc65c3075c0" uuid = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" -version = "1.10.0" +version = "1.11.1" +weakdeps = ["SparseArrays"] + + [deps.Statistics.extensions] + SparseArraysExt = ["SparseArrays"] + +[[deps.Strided]] +deps = ["LinearAlgebra", "StridedViews", "TupleTools"] +git-tree-sha1 = "d85461cb47420b6dcecf51de8142fc60484dd0b3" +uuid = "5e0ebb24-38b0-5f93-81fe-25c709ecae67" +version = "2.1.1" + +[[deps.StridedViews]] +deps = ["LinearAlgebra", "PackageExtensionCompat"] +git-tree-sha1 = "2917996ce0fa6b8a3a85240a5e9ff930e2aeaa43" +uuid = "4db3bf67-4bd7-4b4e-b153-31dc3fb37143" +version = "0.3.1" + + [deps.StridedViews.extensions] + StridedViewsCUDAExt = "CUDA" + + [deps.StridedViews.weakdeps] + CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba" [[deps.SuiteSparse_jll]] deps = ["Artifacts", "Libdl", "libblastrampoline_jll"] uuid = "bea87d4a-7f5b-5778-9afe-8cc45184846c" -version = "7.2.1+1" +version = "7.7.0+0" [[deps.TOML]] deps = ["Dates"] @@ -287,15 +358,39 @@ uuid = "a4e569a6-e804-4fa4-b0f3-eef7a1d5b13e" version = "1.10.0" +[[deps.TensorOperations]] +deps = ["LRUCache", "LinearAlgebra", "PackageExtensionCompat", "PtrArrays", "Strided", "StridedViews", "TupleTools", "VectorInterface"] +git-tree-sha1 = "af2cf256cb575a62d8baf128b13e9045e1ede69c" +uuid = "6aa20fa7-93e2-5fca-9bc0-fbd0db3c71a2" +version = "5.0.2" + + [deps.TensorOperations.extensions] + TensorOperationsBumperExt = "Bumper" + TensorOperationsChainRulesCoreExt = "ChainRulesCore" + TensorOperationscuTENSORExt = ["cuTENSOR", "CUDA"] + + [deps.TensorOperations.weakdeps] + Bumper = "8ce10254-0962-460f-a3d8-1f77fea1446e" + CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba" + ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4" + cuTENSOR = "011b41b2-24ef-40a8-b3eb-fa098493e9e1" + [[deps.Test]] deps = ["InteractiveUtils", "Logging", "Random", "Serialization"] uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40" +version = "1.11.0" [[deps.TestSetExtensions]] deps = ["DeepDiffs", "Distributed", "Test"] -git-tree-sha1 = "3a2919a78b04c29a1a57b05e1618e473162b15d0" +git-tree-sha1 = "ccebd99935be339d2ad907589708ba1f0d62bab3" uuid = "98d24dd4-01ad-11ea-1b02-c9a08f80db04" -version = "2.0.0" +version = "3.0.0" + +[[deps.Tokens]] +deps = ["SparseArrayKit", "SparseArrays"] +git-tree-sha1 = "c4f40125383ce3bfcfcd49a1b206080b7afd9a34" +uuid = "040c2ec2-8d69-4aca-bf03-7d3a7092f2f6" +version = "0.1.1" [[deps.Tullio]] deps = ["DiffRules", "LinearAlgebra", "Requires"] @@ -315,12 +410,25 @@ FillArrays = "1a297f60-69ca-5386-bcde-b61e274b549b" Tracker = "9f7883ad-71c0-57eb-9f7f-b5c9e6d3789c" +[[deps.TupleTools]] +git-tree-sha1 = "41d61b1c545b06279871ef1a4b5fcb2cac2191cd" +uuid = "9d95972d-f1c8-5527-a6e0-b4b365fa01f6" +version = "1.5.0" + [[deps.UUIDs]] deps = ["Random", "SHA"] uuid = "cf7118a7-6976-5b1a-9a39-7adc72f591a4" +version = "1.11.0" [[deps.Unicode]] uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5" +version = "1.11.0" + +[[deps.VectorInterface]] +deps = ["LinearAlgebra"] +git-tree-sha1 = "7aff7d62bffad9bba9928eb6ab55226b32a351eb" +uuid = "409d34a3-91d5-4945-b6ec-7529ddf182d8" +version = "0.4.6" [[deps.Zlib_jll]] deps = ["Libdl"] @@ -330,12 +438,12 @@ [[deps.libblastrampoline_jll]] deps = ["Artifacts", "Libdl"] uuid = "8e850b90-86db-534c-a0d3-1478176c7d93" -version = "5.8.0+1" +version = "5.11.0+0" [[deps.nghttp2_jll]] deps = ["Artifacts", "Libdl"] uuid = "8e850ede-7688-5339-a07c-302acd2aaf8d" -version = "1.52.0+1" +version = "1.59.0+0" [[deps.p7zip_jll]] deps = ["Artifacts", "Libdl"]
--- a/test/Project.toml Tue Sep 17 11:20:00 2024 +0200 +++ b/test/Project.toml Sun Oct 20 21:38:09 2024 +0200 @@ -2,8 +2,11 @@ BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf" Glob = "c27321d9-0574-5035-807b-f59d2c89b15c" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" +SparseArrayKit = "a9a3c162-d163-4c15-8926-b8794fbefed2" +SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" TOML = "fa267f1f-6049-4f14-aa54-33bafae1ed76" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" TestSetExtensions = "98d24dd4-01ad-11ea-1b02-c9a08f80db04" +Tokens = "040c2ec2-8d69-4aca-bf03-7d3a7092f2f6" Tullio = "bc48ee85-29a4-5162-ae0b-a64e1601d4bc"
--- a/test/RegionIndices/RegionIndices_test.jl Tue Sep 17 11:20:00 2024 +0200 +++ b/test/RegionIndices/RegionIndices_test.jl Sun Oct 20 21:38:09 2024 +0200 @@ -1,3 +1,3 @@ -using Sbplib.RegionIndices +using Diffinitive.RegionIndices using Test
--- a/test/SbpOperators/boundary_conditions/boundary_condition_test.jl Tue Sep 17 11:20:00 2024 +0200 +++ b/test/SbpOperators/boundary_conditions/boundary_condition_test.jl Sun Oct 20 21:38:09 2024 +0200 @@ -1,8 +1,8 @@ using Test -using Sbplib.Grids -using Sbplib.RegionIndices -using Sbplib.SbpOperators +using Diffinitive.Grids +using Diffinitive.RegionIndices +using Diffinitive.SbpOperators @testset "BoundaryCondition" begin grid_1d = equidistant_grid(0.0, 1.0, 11) @@ -15,8 +15,8 @@ g = 3.14 f(x,y,z) = x^2+y^2+z^2 @testset "Constructors" begin - @test DirichletCondition(g,id_l) isa DirichletCondition{Float64,Lower} - @test NeumannCondition(f,id_b) isa NeumannCondition{<:Function,CartesianBoundary{3,Lower}} + @test DirichletCondition(g,id_l) isa DirichletCondition{Float64,LowerBoundary} + @test NeumannCondition(f,id_b) isa NeumannCondition{<:Function,CartesianBoundary{3,LowerBoundary}} end @testset "boundary" begin
--- a/test/SbpOperators/boundary_conditions/sat_test.jl Tue Sep 17 11:20:00 2024 +0200 +++ b/test/SbpOperators/boundary_conditions/sat_test.jl Sun Oct 20 21:38:09 2024 +0200 @@ -1,8 +1,8 @@ using Test -using Sbplib.Grids -using Sbplib.LazyTensors -using Sbplib.SbpOperators +using Diffinitive.Grids +using Diffinitive.LazyTensors +using Diffinitive.SbpOperators stencil_set = read_stencil_set(sbp_operators_path()*"standard_diagonal.toml"; order = 4)
--- a/test/SbpOperators/boundaryops/boundary_operator_test.jl Tue Sep 17 11:20:00 2024 +0200 +++ b/test/SbpOperators/boundaryops/boundary_operator_test.jl Sun Oct 20 21:38:09 2024 +0200 @@ -1,11 +1,11 @@ using Test -using Sbplib.LazyTensors -using Sbplib.SbpOperators -using Sbplib.Grids -using Sbplib.RegionIndices -import Sbplib.SbpOperators.Stencil -import Sbplib.SbpOperators.BoundaryOperator +using Diffinitive.LazyTensors +using Diffinitive.SbpOperators +using Diffinitive.Grids +using Diffinitive.RegionIndices +import Diffinitive.SbpOperators.Stencil +import Diffinitive.SbpOperators.BoundaryOperator @testset "BoundaryOperator" begin @@ -13,12 +13,12 @@ g_1D = EquidistantGrid(range(0,1,length=11)) @testset "Constructors" begin - @test BoundaryOperator(g_1D, closure_stencil, Lower()) isa LazyTensor{T,0,1} where T - @test BoundaryOperator(g_1D, closure_stencil, Upper()) isa LazyTensor{T,0,1} where T + @test BoundaryOperator(g_1D, closure_stencil, LowerBoundary()) isa LazyTensor{T,0,1} where T + @test BoundaryOperator(g_1D, closure_stencil, UpperBoundary()) isa LazyTensor{T,0,1} where T end - op_l = BoundaryOperator(g_1D, closure_stencil, Lower()) - op_r = BoundaryOperator(g_1D, closure_stencil, Upper()) + op_l = BoundaryOperator(g_1D, closure_stencil, LowerBoundary()) + op_r = BoundaryOperator(g_1D, closure_stencil, UpperBoundary()) @testset "Sizes" begin @test domain_size(op_l) == (11,)
--- a/test/SbpOperators/boundaryops/boundary_restriction_test.jl Tue Sep 17 11:20:00 2024 +0200 +++ b/test/SbpOperators/boundaryops/boundary_restriction_test.jl Sun Oct 20 21:38:09 2024 +0200 @@ -1,10 +1,10 @@ using Test -using Sbplib.SbpOperators -using Sbplib.Grids -using Sbplib.LazyTensors -using Sbplib.RegionIndices -using Sbplib.SbpOperators: BoundaryOperator, Stencil +using Diffinitive.SbpOperators +using Diffinitive.Grids +using Diffinitive.LazyTensors +using Diffinitive.RegionIndices +using Diffinitive.SbpOperators: BoundaryOperator, Stencil @testset "boundary_restriction" begin stencil_set = read_stencil_set(sbp_operators_path()*"standard_diagonal.toml"; order = 4) @@ -14,19 +14,19 @@ @testset "boundary_restriction" begin @testset "1D" begin - e_l = boundary_restriction(g_1D,stencil_set,Lower()) - @test e_l == BoundaryOperator(g_1D,Stencil{Float64}(e_closure),Lower()) - @test e_l isa BoundaryOperator{T,Lower} where T + e_l = boundary_restriction(g_1D,stencil_set,LowerBoundary()) + @test e_l == BoundaryOperator(g_1D,Stencil{Float64}(e_closure),LowerBoundary()) + @test e_l isa BoundaryOperator{T,LowerBoundary} where T @test e_l isa LazyTensor{T,0,1} where T - e_r = boundary_restriction(g_1D,stencil_set,Upper()) - @test e_r == BoundaryOperator(g_1D,Stencil{Float64}(e_closure),Upper()) - @test e_r isa BoundaryOperator{T,Upper} where T + e_r = boundary_restriction(g_1D,stencil_set,UpperBoundary()) + @test e_r == BoundaryOperator(g_1D,Stencil{Float64}(e_closure),UpperBoundary()) + @test e_r isa BoundaryOperator{T,UpperBoundary} where T @test e_r isa LazyTensor{T,0,1} where T end @testset "2D" begin - e_w = boundary_restriction(g_2D,stencil_set,CartesianBoundary{1,Upper}()) + e_w = boundary_restriction(g_2D,stencil_set,CartesianBoundary{1,UpperBoundary}()) @test e_w isa InflatedTensor @test e_w isa LazyTensor{T,1,2} where T end
--- a/test/SbpOperators/boundaryops/normal_derivative_test.jl Tue Sep 17 11:20:00 2024 +0200 +++ b/test/SbpOperators/boundaryops/normal_derivative_test.jl Sun Oct 20 21:38:09 2024 +0200 @@ -1,10 +1,10 @@ using Test -using Sbplib.SbpOperators -using Sbplib.Grids -using Sbplib.LazyTensors -using Sbplib.RegionIndices -import Sbplib.SbpOperators.BoundaryOperator +using Diffinitive.SbpOperators +using Diffinitive.Grids +using Diffinitive.LazyTensors +using Diffinitive.RegionIndices +import Diffinitive.SbpOperators.BoundaryOperator @testset "normal_derivative" begin g_1D = equidistant_grid(0.0, 1.0, 11) @@ -12,19 +12,19 @@ @testset "normal_derivative" begin stencil_set = read_stencil_set(sbp_operators_path()*"standard_diagonal.toml"; order=4) @testset "1D" begin - d_l = normal_derivative(g_1D, stencil_set, Lower()) - @test d_l == normal_derivative(g_1D, stencil_set, Lower()) - @test d_l isa BoundaryOperator{T,Lower} where T + d_l = normal_derivative(g_1D, stencil_set, LowerBoundary()) + @test d_l == normal_derivative(g_1D, stencil_set, LowerBoundary()) + @test d_l isa BoundaryOperator{T,LowerBoundary} where T @test d_l isa LazyTensor{T,0,1} where T end @testset "2D" begin - d_w = normal_derivative(g_2D, stencil_set, CartesianBoundary{1,Lower}()) - d_n = normal_derivative(g_2D, stencil_set, CartesianBoundary{2,Upper}()) + d_w = normal_derivative(g_2D, stencil_set, CartesianBoundary{1,LowerBoundary}()) + d_n = normal_derivative(g_2D, stencil_set, CartesianBoundary{2,UpperBoundary}()) Ix = IdentityTensor{Float64}((size(g_2D)[1],)) Iy = IdentityTensor{Float64}((size(g_2D)[2],)) - d_l = normal_derivative(g_2D.grids[1], stencil_set, Lower()) - d_r = normal_derivative(g_2D.grids[2], stencil_set, Upper()) - @test d_w == normal_derivative(g_2D, stencil_set, CartesianBoundary{1,Lower}()) + d_l = normal_derivative(g_2D.grids[1], stencil_set, LowerBoundary()) + d_r = normal_derivative(g_2D.grids[2], stencil_set, UpperBoundary()) + @test d_w == normal_derivative(g_2D, stencil_set, CartesianBoundary{1,LowerBoundary}()) @test d_w == d_l⊗Iy @test d_n == Ix⊗d_r @test d_w isa LazyTensor{T,1,2} where T
--- a/test/SbpOperators/stencil_set_test.jl Tue Sep 17 11:20:00 2024 +0200 +++ b/test/SbpOperators/stencil_set_test.jl Sun Oct 20 21:38:09 2024 +0200 @@ -1,10 +1,10 @@ using Test using TOML -using Sbplib.SbpOperators +using Diffinitive.SbpOperators -import Sbplib.SbpOperators.Stencil -import Sbplib.SbpOperators.NestedStencil +import Diffinitive.SbpOperators.Stencil +import Diffinitive.SbpOperators.NestedStencil @testset "readoperator" begin toml_str = """
--- a/test/SbpOperators/stencil_test.jl Tue Sep 17 11:20:00 2024 +0200 +++ b/test/SbpOperators/stencil_test.jl Sun Oct 20 21:38:09 2024 +0200 @@ -1,10 +1,10 @@ using Test -using Sbplib.SbpOperators +using Diffinitive.SbpOperators using StaticArrays -import Sbplib.SbpOperators.Stencil -import Sbplib.SbpOperators.NestedStencil -import Sbplib.SbpOperators.scale -import Sbplib.SbpOperators: apply_stencil, apply_stencil_backwards +import Diffinitive.SbpOperators.Stencil +import Diffinitive.SbpOperators.NestedStencil +import Diffinitive.SbpOperators.scale +import Diffinitive.SbpOperators: apply_stencil, apply_stencil_backwards @testset "Stencil" begin s = Stencil(-2:2, (1.,2.,2.,3.,4.))
--- a/test/SbpOperators/volumeops/constant_interior_scaling_operator_test.jl Tue Sep 17 11:20:00 2024 +0200 +++ b/test/SbpOperators/volumeops/constant_interior_scaling_operator_test.jl Sun Oct 20 21:38:09 2024 +0200 @@ -1,9 +1,9 @@ using Test -using Sbplib.LazyTensors -using Sbplib.SbpOperators -import Sbplib.SbpOperators: ConstantInteriorScalingOperator -using Sbplib.Grids +using Diffinitive.LazyTensors +using Diffinitive.SbpOperators +import Diffinitive.SbpOperators: ConstantInteriorScalingOperator +using Diffinitive.Grids @testset "ConstantInteriorScalingOperator" begin @test ConstantInteriorScalingOperator(1, (2,3), 10) isa ConstantInteriorScalingOperator{Int,2}
--- a/test/SbpOperators/volumeops/derivatives/dissipation_test.jl Tue Sep 17 11:20:00 2024 +0200 +++ b/test/SbpOperators/volumeops/derivatives/dissipation_test.jl Sun Oct 20 21:38:09 2024 +0200 @@ -1,32 +1,21 @@ using Test -using Sbplib.SbpOperators -using Sbplib.Grids -using Sbplib.LazyTensors - -using Sbplib.SbpOperators: Stencil +using Diffinitive.SbpOperators +using Diffinitive.Grids +using Diffinitive.LazyTensors -using Sbplib.SbpOperators: dissipation_interior_weights -using Sbplib.SbpOperators: dissipation_interior_stencil, dissipation_transpose_interior_stencil -using Sbplib.SbpOperators: midpoint, midpoint_transpose -using Sbplib.SbpOperators: dissipation_lower_closure_size, dissipation_upper_closure_size -using Sbplib.SbpOperators: dissipation_lower_closure_stencils,dissipation_upper_closure_stencils -using Sbplib.SbpOperators: dissipation_transpose_lower_closure_stencils, dissipation_transpose_upper_closure_stencils +using Diffinitive.SbpOperators: Stencil -""" - monomial(x,k) +using Diffinitive.SbpOperators: dissipation_interior_weights +using Diffinitive.SbpOperators: dissipation_interior_stencil, dissipation_transpose_interior_stencil +using Diffinitive.SbpOperators: midpoint, midpoint_transpose +using Diffinitive.SbpOperators: dissipation_lower_closure_size, dissipation_upper_closure_size +using Diffinitive.SbpOperators: dissipation_lower_closure_stencils,dissipation_upper_closure_stencils +using Diffinitive.SbpOperators: dissipation_transpose_lower_closure_stencils, dissipation_transpose_upper_closure_stencils -Evaluates ``x^k/k!` with the convetion that it is ``0`` for all ``k<0``. -Has the property that ``d/dx monomial(x,k) = monomial(x,k-1)`` -""" -function monomial(x,k) - if k < 0 - return zero(x) - end - x^k/factorial(k) -end @testset "undivided_skewed04" begin + monomial(x,k) = k < 0 ? zero(x) : x^k/factorial(k) g = equidistant_grid(0., 11., 20) D,Dᵀ = undivided_skewed04(g, 1)
--- a/test/SbpOperators/volumeops/derivatives/first_derivative_test.jl Tue Sep 17 11:20:00 2024 +0200 +++ b/test/SbpOperators/volumeops/derivatives/first_derivative_test.jl Sun Oct 20 21:38:09 2024 +0200 @@ -1,24 +1,11 @@ using Test -using Sbplib.SbpOperators -using Sbplib.Grids -using Sbplib.LazyTensors - -using Sbplib.SbpOperators: closure_size, Stencil, VolumeOperator - -""" - monomial(x,k) +using Diffinitive.SbpOperators +using Diffinitive.Grids +using Diffinitive.LazyTensors -Evaluates ``x^k/k!` with the convetion that it is ``0`` for all ``k<0``. -Has the property that ``d/dx monomial(x,k) = monomial(x,k-1)`` -""" -function monomial(x,k) - if k < 0 - return zero(x) - end - x^k/factorial(k) -end +using Diffinitive.SbpOperators: closure_size, Stencil, VolumeOperator @testset "first_derivative" begin @testset "Constructors" begin @@ -39,6 +26,8 @@ @testset "Accuracy conditions" begin N = 20 g = equidistant_grid(0//1, 2//1, N) + + monomial(x,k) = k < 0 ? zero(x) : x^k/factorial(k) @testset for order ∈ [2,4] stencil_set = read_stencil_set(sbp_operators_path()*"standard_diagonal.toml"; order) D₁ = first_derivative(g, stencil_set)
--- a/test/SbpOperators/volumeops/derivatives/second_derivative_test.jl Tue Sep 17 11:20:00 2024 +0200 +++ b/test/SbpOperators/volumeops/derivatives/second_derivative_test.jl Sun Oct 20 21:38:09 2024 +0200 @@ -1,10 +1,10 @@ using Test -using Sbplib.SbpOperators -using Sbplib.Grids -using Sbplib.LazyTensors +using Diffinitive.SbpOperators +using Diffinitive.Grids +using Diffinitive.LazyTensors -import Sbplib.SbpOperators.VolumeOperator +import Diffinitive.SbpOperators.VolumeOperator # TODO: Refactor these test to look more like the tests in first_derivative_test.jl.
--- a/test/SbpOperators/volumeops/derivatives/second_derivative_variable_test.jl Tue Sep 17 11:20:00 2024 +0200 +++ b/test/SbpOperators/volumeops/derivatives/second_derivative_variable_test.jl Sun Oct 20 21:38:09 2024 +0200 @@ -1,10 +1,10 @@ using Test -using Sbplib.Grids -using Sbplib.LazyTensors -using Sbplib.SbpOperators -using Sbplib.RegionIndices -using Sbplib.SbpOperators: NestedStencil, CenteredNestedStencil, SecondDerivativeVariable +using Diffinitive.Grids +using Diffinitive.LazyTensors +using Diffinitive.SbpOperators +using Diffinitive.RegionIndices +using Diffinitive.SbpOperators: NestedStencil, CenteredNestedStencil, SecondDerivativeVariable using LinearAlgebra
--- a/test/SbpOperators/volumeops/inner_products/inner_product_test.jl Tue Sep 17 11:20:00 2024 +0200 +++ b/test/SbpOperators/volumeops/inner_products/inner_product_test.jl Sun Oct 20 21:38:09 2024 +0200 @@ -1,10 +1,10 @@ using Test -using Sbplib.SbpOperators -using Sbplib.Grids -using Sbplib.LazyTensors +using Diffinitive.SbpOperators +using Diffinitive.Grids +using Diffinitive.LazyTensors -import Sbplib.SbpOperators.ConstantInteriorScalingOperator +import Diffinitive.SbpOperators.ConstantInteriorScalingOperator @testset "Diagonal-stencil inner_product" begin Lx = π/2.
--- a/test/SbpOperators/volumeops/inner_products/inverse_inner_product_test.jl Tue Sep 17 11:20:00 2024 +0200 +++ b/test/SbpOperators/volumeops/inner_products/inverse_inner_product_test.jl Sun Oct 20 21:38:09 2024 +0200 @@ -1,10 +1,10 @@ using Test -using Sbplib.SbpOperators -using Sbplib.Grids -using Sbplib.LazyTensors +using Diffinitive.SbpOperators +using Diffinitive.Grids +using Diffinitive.LazyTensors -import Sbplib.SbpOperators.ConstantInteriorScalingOperator +import Diffinitive.SbpOperators.ConstantInteriorScalingOperator @testset "Diagonal-stencil inverse_inner_product" begin Lx = π/2.
--- a/test/SbpOperators/volumeops/laplace/laplace_test.jl Tue Sep 17 11:20:00 2024 +0200 +++ b/test/SbpOperators/volumeops/laplace/laplace_test.jl Sun Oct 20 21:38:09 2024 +0200 @@ -1,8 +1,8 @@ using Test -using Sbplib.SbpOperators -using Sbplib.Grids -using Sbplib.LazyTensors +using Diffinitive.SbpOperators +using Diffinitive.Grids +using Diffinitive.LazyTensors @testset "Laplace" begin # Default stencils (4th order)
--- a/test/SbpOperators/volumeops/stencil_operator_distinct_closures_test.jl Tue Sep 17 11:20:00 2024 +0200 +++ b/test/SbpOperators/volumeops/stencil_operator_distinct_closures_test.jl Sun Oct 20 21:38:09 2024 +0200 @@ -1,11 +1,11 @@ using Test -using Sbplib.SbpOperators -using Sbplib.Grids -using Sbplib.LazyTensors +using Diffinitive.SbpOperators +using Diffinitive.Grids +using Diffinitive.LazyTensors -import Sbplib.SbpOperators.Stencil -import Sbplib.SbpOperators.StencilOperatorDistinctClosures +import Diffinitive.SbpOperators.Stencil +import Diffinitive.SbpOperators.StencilOperatorDistinctClosures @testset "StencilOperatorDistinctClosures" begin g = equidistant_grid(0., 1., 11)
--- a/test/SbpOperators/volumeops/volume_operator_test.jl Tue Sep 17 11:20:00 2024 +0200 +++ b/test/SbpOperators/volumeops/volume_operator_test.jl Sun Oct 20 21:38:09 2024 +0200 @@ -1,14 +1,14 @@ using Test -using Sbplib.SbpOperators -using Sbplib.Grids -using Sbplib.RegionIndices -using Sbplib.LazyTensors +using Diffinitive.SbpOperators +using Diffinitive.Grids +using Diffinitive.RegionIndices +using Diffinitive.LazyTensors -import Sbplib.SbpOperators.Stencil -import Sbplib.SbpOperators.VolumeOperator -import Sbplib.SbpOperators.odd -import Sbplib.SbpOperators.even +import Diffinitive.SbpOperators.Stencil +import Diffinitive.SbpOperators.VolumeOperator +import Diffinitive.SbpOperators.odd +import Diffinitive.SbpOperators.even @testset "VolumeOperator" begin
--- a/test/StaticDicts/StaticDicts_test.jl Tue Sep 17 11:20:00 2024 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,68 +0,0 @@ -using Test -using Sbplib.StaticDicts - -@testset "StaticDicts" begin - -@testset "StaticDict" begin - @testset "constructor" begin - @test (StaticDict{Int,Int,N} where N) <: AbstractDict - - d = StaticDict(1=>2, 3=>4) - @test d isa StaticDict{Int,Int} - @test d[1] == 2 - @test d[3] == 4 - - @test StaticDict((1=>2, 3=>4)) == d - - @test StaticDict() isa StaticDict - @test StaticDict{Int,String}() isa StaticDict{Int,String,0} - - @test StaticDict(1=>3, 2=>4.) isa StaticDict{Int,Real} - @test StaticDict(1. =>3, 2=>4) isa StaticDict{Real,Int} - @test StaticDict(1. =>3, 2=>4.) isa StaticDict{Real,Real} - - @test_throws DomainError StaticDict(1=>3, 1=>3) - end - - @testset "length" begin - @test length(StaticDict()) == 0 - @test length(StaticDict(1=>1)) == 1 - @test length(StaticDict(1=>1, 2=>2)) == 2 - end - - @testset "equality" begin - @test StaticDict(1=>1) == StaticDict(1=>1) - @test StaticDict(2=>1) != StaticDict(1=>1) - @test StaticDict(1=>2) != StaticDict(1=>1) - - @test StaticDict(1=>1) === StaticDict(1=>1) #not true for a regular Dict - @test StaticDict(2=>1) !== StaticDict(1=>1) - @test StaticDict(1=>2) !== StaticDict(1=>1) - end - - @testset "get" begin - d = StaticDict(1=>2, 3=>4) - - @test get(d,1,6) == 2 - @test get(d,3,6) == 4 - @test get(d,5,6) == 6 - end - - @testset "iterate" begin - pairs = [1=>2, 3=>4, 5=>6] - - d = StaticDict(pairs...) - @test collect(d) == pairs - end - - @testset "merge" begin - @test merge( - StaticDict(1=>3, 2=> 4), - StaticDict(3=>5,4=>6)) == StaticDict( - 1=>3, 2=>4, 3=>5, 4=>6 - ) - @test_throws DomainError merge(StaticDict(1=>3),StaticDict(1=>3)) - end -end - -end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/ext/sparse_array_kit_test.jl Sun Oct 20 21:38:09 2024 +0200 @@ -0,0 +1,35 @@ +using Test + +using Diffinitive +using Diffinitive.Grids +using Diffinitive.SbpOperators + +using SparseArrayKit +using Tokens +using Tullio + + +@testset "SparseArray" begin + g = equidistant_grid((0,0),(1,2), 20,30) + stencil_set = read_stencil_set(sbp_operators_path()*"standard_diagonal.toml"; order=4) + + + @testset let Δ = laplace(g, stencil_set), M = SparseArray(Δ) + @test ndims(M) == 4 + @test size(M) == (20,30,20,30) + + v = rand(size(g)...) + @tullio Mv[i,j] := M[i,j,k,l]*v[k,l] + + @test Mv ≈ Δ*v + end + + @testset let dₙ = normal_derivative(g, stencil_set,CartesianBoundary{1,LowerBoundary}()), M = SparseArray(dₙ) + @test ndims(M) == 3 + @test size(M) == (30,20,30) + + v = rand(size(g)...) + @tullio Mv[i] := M[i,j,k]*v[j,k] + @test Mv ≈ dₙ*v + end +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/ext/sparse_arrays_test.jl Sun Oct 20 21:38:09 2024 +0200 @@ -0,0 +1,34 @@ +using Test + +using Diffinitive +using Diffinitive.Grids +using Diffinitive.SbpOperators + +using SparseArrays +using Tokens + + +@testset "SparseArray" begin + g = equidistant_grid((0,0),(1,2), 20,30) + stencil_set = read_stencil_set(sbp_operators_path()*"standard_diagonal.toml"; order=4) + + + @testset let Δ = laplace(g, stencil_set), M = sparse(Δ) + @test ndims(M) == 2 + @test size(M) == (20*30,20*30) + + v = rand(size(g)...) + + Mv = M*reshape(v,:) + @test Mv ≈ reshape(Δ*v,:) + end + + @testset let dₙ = normal_derivative(g, stencil_set,CartesianBoundary{1,LowerBoundary}()), M = sparse(dₙ) + @test ndims(M) == 2 + @test size(M) == (30,20*30) + + v = rand(size(g)...) + Mv = M*reshape(v,:) + @test Mv ≈ reshape(dₙ*v,:) + end +end
--- a/test/runtests.jl Tue Sep 17 11:20:00 2024 +0200 +++ b/test/runtests.jl Sun Oct 20 21:38:09 2024 +0200 @@ -45,7 +45,7 @@ end end -testsetname = isempty(ARGS) ? "Sbplib.jl" : "["*join(ARGS, ", ")*"]" +testsetname = isempty(ARGS) ? "Diffinitive.jl" : "["*join(ARGS, ", ")*"]" @testset "$testsetname" begin run_testfiles(ARGS)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/update_manifest.jl Sun Oct 20 21:38:09 2024 +0200 @@ -0,0 +1,12 @@ +using Pkg + +function update_directory(d) + Pkg.activate(d) + Pkg.update() + println() +end + +update_directory(".") +update_directory("benchmark") +update_directory("docs") +update_directory("test")