comparison Notes.md @ 1076:101b88d13cf3 feature/first_derivative

Merge default
author Jonatan Werpers <jonatan@werpers.com>
date Thu, 07 Apr 2022 20:28:08 +0200
parents 396278072f18
children eeecdf135912 c0bff9f6e0fb 6757cc9ba22e 5f677cd6f0b6 e2f6dafb5d83
comparison
equal deleted inserted replaced
1047:d12ab8120d29 1076:101b88d13cf3
144 - [ ] How do we handle mixes of periodic and non-periodic grids? Seems it should be supported on the grid level and on the 1d operator level. Between there it should be transparent. 144 - [ ] How do we handle mixes of periodic and non-periodic grids? Seems it should be supported on the grid level and on the 1d operator level. Between there it should be transparent.
145 - [ ] Can we have a trait to tell if a LazyTensor is transposable? 145 - [ ] Can we have a trait to tell if a LazyTensor is transposable?
146 - [ ] Is it ok to have "Constructors" for abstract types which create subtypes? For example a Grids() functions that gives different kind of grids based on input? 146 - [ ] Is it ok to have "Constructors" for abstract types which create subtypes? For example a Grids() functions that gives different kind of grids based on input?
147 - [ ] Figure out how to treat the borrowing parameters of operators. Include in into the struct? Expose via function dispatched on the operator type and grid? 147 - [ ] Figure out how to treat the borrowing parameters of operators. Include in into the struct? Expose via function dispatched on the operator type and grid?
148 148
149 ## Identifiers for regions
150 The identifiers (`Upper`, `Lower`, `Interior`) used for region indecies should probabily be included in the grid module. This allows new grid types to come with their own regions.
151
149 ## Regions and tensormappings 152 ## Regions and tensormappings
150 - [ ] Use a trait to indicate if a LazyTensor uses indices with regions. 153 - [ ] Use a trait to indicate if a LazyTensor uses indices with regions.
151 The default should be that they do NOT. 154 The default should be that they do NOT.
152 - [ ] What to name this trait? Can we call it IndexStyle but not export it to avoid conflicts with Base.IndexStyle? 155 - [ ] What to name this trait? Can we call it IndexStyle but not export it to avoid conflicts with Base.IndexStyle?
153 - [ ] Figure out repeated application of regioned LazyTensors. Maybe an instance of a tensor mapping needs to know the exact size of the range and domain for this to work? 156 - [ ] Figure out repeated application of regioned LazyTensors. Maybe an instance of a tensor mapping needs to know the exact size of the range and domain for this to work?
157
158 ### Ideas for information sharing functions
159 ```julia
160 using StaticArrays
161
162 function regions(op::SecondDerivativeVariable)
163 t = ntuple(i->(Interior(),),range_dim(op))
164 return Base.setindex(t, (Lower(), Interior(), Upper()), derivative_direction(op))
165 end
166
167 function regionsizes(op::SecondDerivativeVariable)
168 sz = tuple.(range_size(op))
169
170 cl = closuresize(op)
171 return Base.setindex(sz, (cl, n-2cl, cl), derivative_direction(op))
172 end
173
174
175 g = EquidistantGrid((11,9), (0.,0.), (10.,8.)) # h = 1
176 c = evalOn(g, (x,y)->x+y)
177
178 D₂ᶜ = SecondDerivativeVariable(g, c, interior_stencil, closure_stencils,1)
179 @test regions(D₂ᶜ) == (
180 (Lower(), Interior(), Upper()),
181 (Interior(),),
182 )
183 @test regionsizes(D₂ᶜ) == ((1,9,1),(9,))
184
185
186 D₂ᶜ = SecondDerivativeVariable(g, c, interior_stencil, closure_stencils,2)
187 @test regions(D₂ᶜ) == (
188 (Interior(),),
189 (Lower(), Interior(), Upper()),
190 )
191 @test regionsizes(D₂ᶜ) == ((11,),(1,7,1))
192 ```
193
154 194
155 ## Boundschecking and dimension checking 195 ## Boundschecking and dimension checking
156 Does it make sense to have boundschecking only in getindex methods? 196 Does it make sense to have boundschecking only in getindex methods?
157 This would mean no bounds checking in applys, however any indexing that they do would be boundschecked. The only loss would be readability of errors. But users aren't really supposed to call apply directly anyway. 197 This would mean no bounds checking in applys, however any indexing that they do would be boundschecked. The only loss would be readability of errors. But users aren't really supposed to call apply directly anyway.
158 198