Mercurial > repos > public > sbplib_julia
changeset 1343:fa3695f634de refactor/grids
More clean up of todos and notes
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Mon, 15 May 2023 22:37:33 +0200 |
parents | c0c1189c5f2e |
children | 760a4a1ec4b7 |
files | TODO.md grid_refactor.md src/Grids/grid.jl test/Grids/grid_test.jl |
diffstat | 4 files changed, 8 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/TODO.md Fri May 12 15:50:09 2023 +0200 +++ b/TODO.md Mon May 15 22:37:33 2023 +0200 @@ -35,3 +35,9 @@ - [ ] Multiblock grids - [ ] Periodic grids - [ ] Grids with modified boundary closures + + +### Benchmarks + - [ ] Benchmarks for all grid indexing (focused on allocation) + - [ ] Benchmarks for indexing of lazy grid functions + - [ ] Add benchmarks for range type in EquidistantGrid. (LinRange vs StepRange)
--- a/grid_refactor.md Fri May 12 15:50:09 2023 +0200 +++ b/grid_refactor.md Mon May 15 22:37:33 2023 +0200 @@ -1,9 +1,5 @@ # Grids refactor -## Goals before merging -* A somewhat clear path towards multi-block grids and their grid functions. -* A somewhat clear path towards implementations of div() and rot() or the elastic operator (See Notes.md) - ## Change summary * `EquidistantGrid` is now only a 1D thing. * Higher dimensions are supported through `TensorGrid`. @@ -13,18 +9,6 @@ * Grids are now expected to support Julia's indexing and iteration interface. * `eval_on` can be called with both `f(x,y,...)` and `f(x̄)`. - ## TODO -* Add benchmarks or allocation tests for eval_on and indexing grids. -* Add benchmarks for range type in EquidistantGrid. (LinRange vs StepRange) -* Write about the design choices in the docs. -* Merge and run benchmarks - * Clean out Notes.md of any solved issues * Delete this document, move remaining notes to Notes.md - -## Frågor - -### Implement the tensor product operator for grids? -Yes! -This could be a useful way to create grids with mixes of different kinds of 1d grids. An example could be a grid which is periodic in one direction and bounded in one.
--- a/src/Grids/grid.jl Fri May 12 15:50:09 2023 +0200 +++ b/src/Grids/grid.jl Mon May 15 22:37:33 2023 +0200 @@ -82,9 +82,9 @@ with each coordinate as an argument, or on the form `f(x̄)` taking a coordinate vector. -TODO: Mention map(f,g) if you want a concrete array +If the goal is a concrete array `map(f,g)` can be used instead. """ -eval_on(g::Grid, f) = eval_on(g, f, Base.IteratorSize(g)) # TBD: Borde f vara först som i alla map, sum, och dylikt +eval_on(g::Grid, f) = eval_on(g, f, Base.IteratorSize(g)) function eval_on(g::Grid, f, ::Base.HasShape) if hasmethod(f, (Any,)) return LazyTensors.LazyFunctionArray((I...)->f(g[I...]), size(g))