Refactor Layer types
Basic idea is for Layer
s to include Process
es as fields, e.g:
struct MyLayer{Tpara,Tproc} <: SubSurface{Tproc}
para::Tpara
proc::Tproc
end
with the following dispatch pattern:
prognosticstep!(layer::MyLayer, state) = prognosticstep!(layer, layer.proc, state)
prognosticstep!(layer::MyLayer, ::SomeProcess, state) = ... # implementation here
which maintains consistency with the existing API
. This is slightly redundant since the type information Tproc
occurs twice in the second method definition. However, this will be a more convenient dispatch pattern for layer types which include other fields, as with para
above. By convention, the process type should always be the last type parameter for a Layer
implementation, so as to prioritize dispatch on other potential layer specializations, e.g:
prognosticstep!(::MyLayer{<:SomeParameterization}, ::SomeProcess, state)
The base dispatch prognosticstep!(::MyLayer, state)
can also be overridden when necessary.