Skip to content

Commit 87bda34

Browse files
authored
Format code blocks to make it render (#2553)
Currently the julia code is not being rendered correctly. Hopefully this fixes it. https://trixi-framework.github.io/TrixiDocumentation/stable/heterogeneous/#Example
1 parent 0821209 commit 87bda34

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

docs/src/heterogeneous.md

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -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

136136
3. 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

147147
4. 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

Comments
 (0)