Mercurial > repos > public > sbplib_julia
changeset 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 | 8abbe0a842ac |
children | 559b623e6a95 07c213167f7c |
files | src/SbpOperators/volumeops/derivatives/dissipation.jl |
diffstat | 1 files changed, 10 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/SbpOperators/volumeops/derivatives/dissipation.jl Fri Feb 03 10:20:40 2023 +0100 +++ b/src/SbpOperators/volumeops/derivatives/dissipation.jl Tue Feb 07 21:06:48 2023 +0100 @@ -59,8 +59,16 @@ dissipation_lower_closure_size(weights) = midpoint(weights) - 1 dissipation_upper_closure_size(weights) = length(weights) - midpoint(weights) -dissipation_lower_closure_stencils(interior_weights) = ntuple(i->Stencil(interior_weights..., center=i ), dissipation_lower_closure_size(interior_weights)) -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)) +function dissipation_lower_closure_stencils(interior_weights) + stencil(i) = Stencil(interior_weights..., center=i) + return ntuple(i->stencil(i), dissipation_lower_closure_size(interior_weights)) +end + +function dissipation_upper_closure_stencils(interior_weights) + center(i) = length(interior_weights) - dissipation_upper_closure_size(interior_weights) + i + stencil(i) = Stencil(interior_weights..., center=center(i)) + return ntuple(i->stencil(i), dissipation_upper_closure_size(interior_weights)) +end function dissipation_transpose_lower_closure_stencils(interior_weights) closure = ntuple(i->dissipation_transpose_lower_closure_stencil(interior_weights, i), length(interior_weights))