comparison Notes.md @ 1610:bb4c119e91fa

Add note about idea for how to handle dispatch and continuous operators
author Jonatan Werpers <jonatan@werpers.com>
date Sun, 09 Jun 2024 23:27:11 +0200
parents 8b9cdadb845a
children 8141c184cc2f
comparison
equal deleted inserted replaced
1575:efe1fc4cb6b0 1610:bb4c119e91fa
1 # Notes 1 # Notes
2
3 ## How to dispatch for different operators
4 We have a problem in how dispatch for different operators work.
5 * We want to keep the types simple and flat (Awkward to forward `apply`)
6 * We want to dispatch SATs on the parameters of the continuous operator. (a * div for example)
7 * We want to allow keeping the same stencil_set across different calls. (maybe not so bad for the user to be responsible)
8
9 Could remove the current opset idea and introduce a description of continuous operators
10 ```julia
11 abstract type DifferentialOperator end
12
13 struct Laplace <: DifferentialOperator end
14 struct Advection <: DifferentialOperator
15 v
16 end
17
18 difference_operator(::Laplace, grid, stencil_set) = ... # Returns a plain LazyTensor. Replaces the current `laplace()` function.
19 sat_tensors(::Laplace, grid, stencil_set, bc) = ...
20
21 sat(::DifferentialOperator, grid, stencil_set, bc) = ...
22 ```
2 23
3 ## Reading operators 24 ## Reading operators
4 25
5 Jonatan's suggestion is to add methods to `Laplace`, `SecondDerivative` and 26 Jonatan's suggestion is to add methods to `Laplace`, `SecondDerivative` and
6 similar functions that take in a filename from which to read stencils. These 27 similar functions that take in a filename from which to read stencils. These