Skip to content
This repository was archived by the owner on Jul 19, 2023. It is now read-only.

Commit 98d6c10

Browse files
SVector boundary handling
1 parent 7f89237 commit 98d6c10

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/derivative_operators/derivative_operator.jl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ struct DerivativeOperator{T<:Real,S1<:SVector,S2<:SVector} <: AbstractDerivative
77
stencil_coefs :: S1
88
boundary_stencil_length :: Int
99
boundary_point_count :: Int
10-
low_boundary_coefs :: Vector{S2}
11-
high_boundary_coefs :: Vector{S2}
10+
low_boundary_coefs :: S2
11+
high_boundary_coefs :: S2
1212
end
1313

1414
function CenteredDifference(derivative_order::Int,
@@ -26,8 +26,9 @@ function CenteredDifference(derivative_order::Int,
2626
boundary_deriv_spots = boundary_x[2:div(stencil_length,2)]
2727

2828
stencil_coefs = convert(SVector{stencil_length, T}, calculate_weights(derivative_order, zero(T), dummy_x))
29-
low_boundary_coefs = SVector{boundary_stencil_length, T}[convert(SVector{boundary_stencil_length, T}, calculate_weights(derivative_order, oneunit(T)*x0, boundary_x)) for x0 in boundary_deriv_spots]
30-
high_boundary_coefs = reverse([reverse(low_boundary_coefs[i]) for i in 1:boundary_point_count])
29+
_low_boundary_coefs = SVector{boundary_stencil_length, T}[convert(SVector{boundary_stencil_length, T}, calculate_weights(derivative_order, oneunit(T)*x0, boundary_x)) for x0 in boundary_deriv_spots]
30+
low_boundary_coefs = convert(SVector{boundary_point_count},_low_boundary_coefs)
31+
high_boundary_coefs = convert(SVector{boundary_point_count},reverse(SVector{boundary_stencil_length, T}[reverse(low_boundary_coefs[i]) for i in 1:boundary_point_count]))
3132

3233
DerivativeOperator(derivative_order, approximation_order, dx, dimension, stencil_length,
3334
stencil_coefs,

0 commit comments

Comments
 (0)