@@ -129,35 +129,35 @@ end
129129 This will, e.g., work with ` u_ode ` . Internally, KernelAbstractions.jl's ` get_backend `
130130 will be called, i.e., KernelAbstractions.jl has to know the type of ` x ` .
131131
132- ``` julia
133- backend = trixi_backend (u_ode)
134- ```
132+ ``` julia
133+ backend = trixi_backend (u_ode)
134+ ```
135135
1361363 . Add a new argument ` backend ` to ` trixi_rhs_fct ` used for dispatch.
137137 When ` backend ` is ` nothing ` , the legacy implementation should be used:
138- ``` julia
139- function trixi_rhs_fct(backend::Nothing, mesh, equations, solver, cache, args)
140- @unpack unpacked_args = cache
141- @threaded for element in eachelement(solver, cache)
142- rhs_fct_per_element(element, unpacked_args, args)
143- end
144- end
145- ```
138+ ``` julia
139+ function trixi_rhs_fct (backend:: Nothing , mesh, equations, solver, cache, args)
140+ @unpack unpacked_args = cache
141+ @threaded for element in eachelement (solver, cache)
142+ rhs_fct_per_element (element, unpacked_args, args)
143+ end
144+ end
145+ ```
146146
1471474 . When ` backend ` is a ` Backend ` (a type defined by KernelAbstractions.jl), write a
148148 KernelAbstractions.jl kernel:
149- ``` julia
150- function trixi_rhs_fct(backend::Backend, mesh, equations, solver, cache, args)
151- nelements(solver, cache) == 0 && return nothing # return early when there are no elements
152- @unpack unpacked_args = cache
153- kernel! = rhs_fct_kernel!(backend)
154- kernel!(unpacked_args, args,
155- ndrange = nelements(solver, cache))
156- return nothing
157- end
158-
159- @kernel function rhs_fct_kernel!(unpacked_args, args)
160- element = @index(Global)
161- rhs_fct_per_element(element, unpacked_args, args)
162- end
163- ```
149+ ``` julia
150+ function trixi_rhs_fct (backend:: Backend , mesh, equations, solver, cache, args)
151+ nelements (solver, cache) == 0 && return nothing # return early when there are no elements
152+ @unpack unpacked_args = cache
153+ kernel! = rhs_fct_kernel! (backend)
154+ kernel! (unpacked_args, args,
155+ ndrange = nelements (solver, cache))
156+ return nothing
157+ end
158+
159+ @kernel function rhs_fct_kernel! (unpacked_args, args)
160+ element = @index (Global)
161+ rhs_fct_per_element (element, unpacked_args, args)
162+ end
163+ ```
0 commit comments