Mercurial > repos > public > sbplib_julia
comparison src/Grids/tensor_grid.jl @ 1530:46a1ad30f861 bugfix/sbp_operators/stencil_return_type
Merge default
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Thu, 11 Apr 2024 22:47:31 +0200 |
parents | de4e15924d26 |
children | d9d9ab18cdfc 611ae2308aa1 |
comparison
equal
deleted
inserted
replaced
1446:d744b01be520 | 1530:46a1ad30f861 |
---|---|
71 return map(bid -> TensorGridBoundary{i, typeof(bid)}(), boundary_identifiers(g.grids[i])) | 71 return map(bid -> TensorGridBoundary{i, typeof(bid)}(), boundary_identifiers(g.grids[i])) |
72 end | 72 end |
73 return LazyTensors.concatenate_tuples(per_grid...) | 73 return LazyTensors.concatenate_tuples(per_grid...) |
74 end | 74 end |
75 | 75 |
76 | |
77 """ | 76 """ |
78 boundary_grid(g::TensorGrid, id::TensorGridBoundary) | 77 boundary_grid(g::TensorGrid, id::TensorGridBoundary) |
79 | 78 |
80 The grid for the boundary of `g` specified by `id`. | 79 The grid for the boundary of `g` specified by `id`. |
81 """ | 80 """ |
83 local_boundary_grid = boundary_grid(g.grids[grid_id(id)], boundary_id(id)) | 82 local_boundary_grid = boundary_grid(g.grids[grid_id(id)], boundary_id(id)) |
84 new_grids = Base.setindex(g.grids, local_boundary_grid, grid_id(id)) | 83 new_grids = Base.setindex(g.grids, local_boundary_grid, grid_id(id)) |
85 return TensorGrid(new_grids...) | 84 return TensorGrid(new_grids...) |
86 end | 85 end |
87 | 86 |
87 function boundary_indices(g::TensorGrid, id::TensorGridBoundary) | |
88 per_grid_ind = map(g.grids) do g | |
89 ntuple(i->:, ndims(g)) | |
90 end | |
91 | |
92 local_b_ind = boundary_indices(g.grids[grid_id(id)], boundary_id(id)) | |
93 b_ind = Base.setindex(per_grid_ind, local_b_ind, grid_id(id)) | |
94 | |
95 return LazyTensors.concatenate_tuples(b_ind...) | |
96 end | |
88 | 97 |
89 function combined_coordinate_vector_type(coordinate_types...) | 98 function combined_coordinate_vector_type(coordinate_types...) |
90 combined_coord_length = mapreduce(_ncomponents, +, coordinate_types) | 99 combined_coord_length = mapreduce(_ncomponents, +, coordinate_types) |
91 combined_coord_type = mapreduce(eltype, promote_type, coordinate_types) | 100 combined_coord_type = mapreduce(eltype, promote_type, coordinate_types) |
92 | 101 |