comparison src/Grids/tensor_grid.jl @ 1492:d9d9ab18cdfc feature/grids/curvilinear

Merge default
author Jonatan Werpers <jonatan@werpers.com>
date Fri, 01 Dec 2023 11:52:26 +0100
parents 0322c181a1cd de4e15924d26
children b02917bcd7d5
comparison
equal deleted inserted replaced
1451:2e08f3444354 1492:d9d9ab18cdfc
73 return map(bid -> TensorGridBoundary{i, typeof(bid)}(), boundary_identifiers(g.grids[i])) 73 return map(bid -> TensorGridBoundary{i, typeof(bid)}(), boundary_identifiers(g.grids[i]))
74 end 74 end
75 return LazyTensors.concatenate_tuples(per_grid...) 75 return LazyTensors.concatenate_tuples(per_grid...)
76 end 76 end
77 77
78
79 """ 78 """
80 boundary_grid(g::TensorGrid, id::TensorGridBoundary) 79 boundary_grid(g::TensorGrid, id::TensorGridBoundary)
81 80
82 The grid for the boundary of `g` specified by `id`. 81 The grid for the boundary of `g` specified by `id`.
83 """ 82 """
85 local_boundary_grid = boundary_grid(g.grids[grid_id(id)], boundary_id(id)) 84 local_boundary_grid = boundary_grid(g.grids[grid_id(id)], boundary_id(id))
86 new_grids = Base.setindex(g.grids, local_boundary_grid, grid_id(id)) 85 new_grids = Base.setindex(g.grids, local_boundary_grid, grid_id(id))
87 return TensorGrid(new_grids...) 86 return TensorGrid(new_grids...)
88 end 87 end
89 88
89 function boundary_indices(g::TensorGrid, id::TensorGridBoundary)
90 per_grid_ind = map(g.grids) do g
91 ntuple(i->:, ndims(g))
92 end
93
94 local_b_ind = boundary_indices(g.grids[grid_id(id)], boundary_id(id))
95 b_ind = Base.setindex(per_grid_ind, local_b_ind, grid_id(id))
96
97 return LazyTensors.concatenate_tuples(b_ind...)
98 end
90 99
91 function combined_coordinate_vector_type(coordinate_types...) 100 function combined_coordinate_vector_type(coordinate_types...)
92 combined_coord_length = mapreduce(_ncomponents, +, coordinate_types) 101 combined_coord_length = mapreduce(_ncomponents, +, coordinate_types)
93 combined_coord_type = mapreduce(eltype, promote_type, coordinate_types) 102 combined_coord_type = mapreduce(eltype, promote_type, coordinate_types)
94 103