-
Notifications
You must be signed in to change notification settings - Fork 4
/
cartesian_field_operators.jl
46 lines (37 loc) · 1.26 KB
/
cartesian_field_operators.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
for (dim, coord) in enumerate((:x, :y, :z))
_l = Symbol(:left, coord)
_r = Symbol(:right, coord)
_δ = Symbol(:δ, coord)
_∂ = Symbol(:∂, coord)
@eval begin
export $_δ, $_∂, $_l, $_r
"""
$($_l)(f, I)
"left side" of a field (`[1:end-1]`) in $($(string(coord))) direction.
"""
@add_cartesian function $_l(f::AbstractField, I::Vararg{Integer,N}) where {N}
left(f, Dim($dim), I...)
end
"""
$($_r)(f, I)
"right side" of a field (`[2:end]`) in $($(string(coord))) direction.
"""
@add_cartesian function $_r(f::AbstractField, I::Vararg{Integer,N}) where {N}
right(f, Dim($dim), I...)
end
"""
$($_δ)(f, I)
Finite difference in $($(string(coord))) direction.
"""
@add_cartesian function $_δ(f::AbstractField, I::Vararg{Integer,N}) where {N}
δ(f, Dim($dim), I...)
end
"""
$($_∂)(f, grid, I)
Directional partial derivative in $($(string(coord))) direction.
"""
@add_cartesian function $_∂(f::AbstractField, grid, I::Vararg{Integer,N}) where {N}
∂(f, grid, Dim($dim), I...)
end
end
end