comparison src/SbpOperators/volumeops/derivatives/dissipation.jl @ 1212:d60a10ad6579 feature/dissipation_operators

Rewrite functions to avoid long lines
author Jonatan Werpers <jonatan@werpers.com>
date Tue, 07 Feb 2023 21:06:48 +0100
parents 99df343c7f61
children 356ec6a72974
comparison
equal deleted inserted replaced
1206:8abbe0a842ac 1212:d60a10ad6579
57 end 57 end
58 58
59 dissipation_lower_closure_size(weights) = midpoint(weights) - 1 59 dissipation_lower_closure_size(weights) = midpoint(weights) - 1
60 dissipation_upper_closure_size(weights) = length(weights) - midpoint(weights) 60 dissipation_upper_closure_size(weights) = length(weights) - midpoint(weights)
61 61
62 dissipation_lower_closure_stencils(interior_weights) = ntuple(i->Stencil(interior_weights..., center=i ), dissipation_lower_closure_size(interior_weights)) 62 function dissipation_lower_closure_stencils(interior_weights)
63 dissipation_upper_closure_stencils(interior_weights) = ntuple(i->Stencil(interior_weights..., center=length(interior_weights)-dissipation_upper_closure_size(interior_weights)+i), dissipation_upper_closure_size(interior_weights)) 63 stencil(i) = Stencil(interior_weights..., center=i)
64 return ntuple(i->stencil(i), dissipation_lower_closure_size(interior_weights))
65 end
66
67 function dissipation_upper_closure_stencils(interior_weights)
68 center(i) = length(interior_weights) - dissipation_upper_closure_size(interior_weights) + i
69 stencil(i) = Stencil(interior_weights..., center=center(i))
70 return ntuple(i->stencil(i), dissipation_upper_closure_size(interior_weights))
71 end
64 72
65 function dissipation_transpose_lower_closure_stencils(interior_weights) 73 function dissipation_transpose_lower_closure_stencils(interior_weights)
66 closure = ntuple(i->dissipation_transpose_lower_closure_stencil(interior_weights, i), length(interior_weights)) 74 closure = ntuple(i->dissipation_transpose_lower_closure_stencil(interior_weights, i), length(interior_weights))
67 75
68 N = maximum(s->length(s.weights), closure) 76 N = maximum(s->length(s.weights), closure)