Skip to content

Commit

Permalink
Simplify type annotation in get_QQ_local! by using AbstractArray
Browse files Browse the repository at this point in the history
  • Loading branch information
johnomotani authored Dec 11, 2023
1 parent 425d9c1 commit ee12e1a
Showing 1 changed file with 17 additions and 21 deletions.
38 changes: 17 additions & 21 deletions src/gauss_legendre.jl
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,9 @@ function setup_gausslegendre_pseudospectral_radau(coord;init_YY=true)
return gausslegendre_base_info(Dmat,M0,M1,M2,S0,S1,
K0,K1,K2,P0,P1,P2,D0,Y00,Y01,Y10,Y11,Y20,Y21,Y30,Y31)
end


function elementwise_derivative!(coord, ff, gausslegendre::gausslegendre_info)
df = coord.scratch_2d
df = coord.scratch_2d
# define local variable nelement for convenience
nelement = coord.nelement_local
# check array bounds
Expand Down Expand Up @@ -261,14 +261,14 @@ function elementwise_derivative!(coord, ff, gausslegendre::gausslegendre_info)

return nothing
end

# Spectral element method does not use upwinding within an element
function elementwise_derivative!(coord, ff, adv_fac, spectral::gausslegendre_info)
return elementwise_derivative!(coord, ff, spectral)
end

# Spectral element method does not use upwinding within an element
function elementwise_derivative!(coord, ff, adv_fac, spectral::gausslegendre_info)
return elementwise_derivative!(coord, ff, spectral)
end

function elementwise_apply_Kmat!(coord, ff, gausslegendre::gausslegendre_info)
df = coord.scratch_2d
df = coord.scratch_2d
# define local variable nelement for convenience
nelement = coord.nelement_local
# check array bounds
Expand Down Expand Up @@ -307,7 +307,7 @@ function elementwise_apply_Kmat!(coord, ff, gausslegendre::gausslegendre_info)
end

function elementwise_apply_Lmat!(coord, ff, gausslegendre::gausslegendre_info)
df = coord.scratch_2d
df = coord.scratch_2d
# define local variable nelement for convenience
nelement = coord.nelement_local
# check array bounds
Expand Down Expand Up @@ -485,15 +485,15 @@ function GaussLegendre_weak_product_matrix!(QQ::Array{mk_float,2},ngrid,x,wgts,o
# appropriate inner product of Legendre polys
# definition depends on required matrix
# for M0: AA = < P_i P_j >
# for M1: AA = < P_i P_j x >
# for M1: AA = < P_i P_j x >
# for M2: AA = < P_i P_j x^2 >
# for S0: AA = -< P'_i P_j >
# for S1: AA = -< P'_i P_j x >
# for K0: AA = -< P'_i P'_j >
# for K1: AA = -< P'_i P'_j x >
# for K1: AA = -< P'_i P'_j x >
# for K2: AA = -< P'_i P'_j x^2 >
# for P0: AA = < P_i P'_j >
# for P1: AA = < P_i P'_j x >
# for P0: AA = < P_i P'_j >
# for P1: AA = < P_i P'_j x >
# for P2: AA = < P_i P'_j x^2 >
AA = allocate_float(ngrid,ngrid)
nquad = 2*ngrid
Expand Down Expand Up @@ -622,13 +622,13 @@ function GaussLegendre_weak_product_matrix!(QQ::Array{mk_float,3},ngrid,x,wgts,o
# appropriate inner product of Legendre polys
# definition depends on required matrix
# for Y00: AA = < P_i P_j P_k >
# for Y01: AA = < P_i P_j P_k x >
# for Y01: AA = < P_i P_j P_k x >
# for Y10: AA = < P_i P_j P'_k >
# for Y11: AA = < P_i P_j P'_k x >
# for Y11: AA = < P_i P_j P'_k x >
# for Y20: AA = < P_i P'_j P'_k >
# for Y21: AA = < P_i P'_j P'_k x >
# for Y31: AA = < P_i P'_j P_k x >
# for Y30: AA = < P_i P'_j P_k >
# for Y30: AA = < P_i P'_j P_k >
AA = allocate_float(ngrid,ngrid,ngrid)
nquad = 2*ngrid
zz, wz = gausslegendre(nquad)
Expand Down Expand Up @@ -1185,11 +1185,7 @@ construction function for nonlinear diffusion matrices, only
used in the assembly of the collision operator
"""

function get_QQ_local!(QQ::Union{Array{mk_float,3},
SubArray{Float64, 3, Array{Float64, 4},
Tuple{Base.Slice{Base.OneTo{Int64}},
Base.Slice{Base.OneTo{Int64}},
Base.Slice{Base.OneTo{Int64}}, Int64}, true}},
function get_QQ_local!(QQ::AbstractArray{mk_float,3},
ielement,lobatto::gausslegendre_base_info,
radau::gausslegendre_base_info,
coord,option)
Expand Down

0 comments on commit ee12e1a

Please sign in to comment.