comparison src/Grids/grid.jl @ 2036:33c127692a09 feature/grids/geometry_functions

Merge default
author Jonatan Werpers <jonatan@werpers.com>
date Wed, 04 Feb 2026 09:44:01 +0100
parents 1fa47cacd3dd
children b3268d0bd5bc
comparison
equal deleted inserted replaced
2015:5c2448d6a201 2036:33c127692a09
72 CT = typeof(first(v)[component_index...]) 72 CT = typeof(first(v)[component_index...])
73 return new{CT, eltype(v), ndims(v), typeof(v), typeof(component_index)}(v,component_index) 73 return new{CT, eltype(v), ndims(v), typeof(v), typeof(component_index)}(v,component_index)
74 end 74 end
75 end 75 end
76 76
77 _array_type(v::ArrayComponentView) = typeof(v)
78 _array_type(::Type{ArrayComponentView{CT,T,D,AT,IT}}) where {CT,T,D,AT,IT} = AT
79
77 Base.size(cv::ArrayComponentView) = size(cv.v) 80 Base.size(cv::ArrayComponentView) = size(cv.v)
78 Base.getindex(cv::ArrayComponentView, i::Int) = cv.v[i][cv.component_index...] 81 Base.getindex(cv::ArrayComponentView, i::Int) = cv.v[i][cv.component_index...]
79 Base.getindex(cv::ArrayComponentView, I::Vararg{Int}) = cv.v[I...][cv.component_index...] 82 Base.getindex(cv::ArrayComponentView, I::Vararg{Int}) = cv.v[I...][cv.component_index...]
80 IndexStyle(::Type{<:ArrayComponentView{<:Any,<:Any,AT}}) where AT = IndexStyle(AT) 83 IndexStyle(ACT::Type{ArrayComponentView}) = IndexStyle(_array_type(ACT))
81 84
82 # TODO: Implement `setindex!`? 85 # TODO: Implement `setindex!`?
83 # TODO: Implement a more general ComponentView that can handle non-AbstractArrays. 86 # TODO: Implement a more general ComponentView that can handle non-AbstractArrays.
84 87
85 88