Skip to content

Commit

Permalink
use anonymous function syntax for transform parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
j-fu committed Dec 7, 2024
1 parent a14daf9 commit 370efa6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
6 changes: 2 additions & 4 deletions src/subgrid.jl
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ Base.isless(x::XIPair, y::XIPair) = (x.x < y.x)
"""
subgrid(parent,
subregions::AbstractArray;
transform::T=function(a,b) @views a.=b[1:length(a)] end,
transform::T = (a, b) -> a .= b[1:length(a)],
boundary=false,
coordinatesystem=codim1_coordinatesystem(parent[CoordinateSystem]),
project=true) where T
Expand All @@ -105,9 +105,7 @@ A subgrid is of type `ExtendableGrid` and stores two additional components:
function subgrid(
parent,
subregions::AbstractArray;
transform::T = function(a, b)
return @views a .= b[1:length(a)]
end,
transform::T = (a, b) -> a .= b[1:length(a)],
boundary = false,
support = ON_CELLS,
project = true,
Expand Down
6 changes: 3 additions & 3 deletions test/test_gridstuff.jl
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,9 @@ function run_grid_tests()
grid = simplexgrid(X, X)
@test all(grid[CellVolumes] .> 0)
sub = subgrid(
grid, [2], transform = function(a, b)
return a[1] = b[2]
end, boundary = true
grid, [2],
transform = (a, b) -> a[1] = b[2],
boundary = true
)
@test check_cellfinder(sub)

Expand Down

0 comments on commit 370efa6

Please sign in to comment.