Mercurial > repos > public > sbplib_julia
diff 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 |
line wrap: on
line diff
--- a/Notes.md Thu Apr 25 14:42:30 2024 +0200 +++ b/Notes.md Sun Jun 09 23:27:11 2024 +0200 @@ -1,5 +1,26 @@ # Notes +## How to dispatch for different operators +We have a problem in how dispatch for different operators work. + * We want to keep the types simple and flat (Awkward to forward `apply`) + * We want to dispatch SATs on the parameters of the continuous operator. (a * div for example) + * We want to allow keeping the same stencil_set across different calls. (maybe not so bad for the user to be responsible) + +Could remove the current opset idea and introduce a description of continuous operators + ```julia +abstract type DifferentialOperator end + +struct Laplace <: DifferentialOperator end +struct Advection <: DifferentialOperator + v +end + +difference_operator(::Laplace, grid, stencil_set) = ... # Returns a plain LazyTensor. Replaces the current `laplace()` function. +sat_tensors(::Laplace, grid, stencil_set, bc) = ... + +sat(::DifferentialOperator, grid, stencil_set, bc) = ... + ``` + ## Reading operators Jonatan's suggestion is to add methods to `Laplace`, `SecondDerivative` and