comparison src/Grids/grid.jl @ 1419:715f1c16f1fc bugfix/grids/complete_interface_impl

Merge default
author Jonatan Werpers <jonatan@werpers.com>
date Fri, 25 Aug 2023 08:43:08 +0200
parents 2ad518182b37
children 455e6b4c8b02
comparison
equal deleted inserted replaced
1418:e82240df974d 1419:715f1c16f1fc
74 # TBD: Can we implement a version here that accepts multiple ids and grouped boundaries? Maybe we need multiblock stuff? 74 # TBD: Can we implement a version here that accepts multiple ids and grouped boundaries? Maybe we need multiblock stuff?
75 75
76 """ 76 """
77 eval_on(g::Grid, f) 77 eval_on(g::Grid, f)
78 78
79 Lazy evaluation `f` on the grid. `f` can either be on the form `f(x,y,...)` 79 Lazy evaluation of `f` on the grid. `f` can either be on the form `f(x,y,...)`
80 with each coordinate as an argument, or on the form `f(x̄)` taking a 80 with each coordinate as an argument, or on the form `f(x̄)` taking a
81 coordinate vector. 81 coordinate vector.
82 82
83 For concrete array grid functions `map(f,g)` can be used instead. 83 For concrete array grid functions `map(f,g)` can be used instead.
84 """ 84 """
89 else 89 else
90 return LazyTensors.LazyFunctionArray((I...)->f(g[I...]...), size(g)) 90 return LazyTensors.LazyFunctionArray((I...)->f(g[I...]...), size(g))
91 end 91 end
92 end 92 end
93 93
94 """
95 eval_on(g::Grid, f::Number)
96
97 Lazy evaluation of a scalar `f` on the grid.
98 """
99 eval_on(g::Grid, f::Number) = return LazyTensors.LazyConstantArray(f, size(g))
100
94 _ncomponents(::Type{<:Number}) = 1 101 _ncomponents(::Type{<:Number}) = 1
95 _ncomponents(T::Type{<:SVector}) = length(T) 102 _ncomponents(T::Type{<:SVector}) = length(T)