Mercurial > repos > public > sbplib_julia
diff DiffOps/src/DiffOps.jl @ 223:b3506cfbb9d8 package_refactor
Add some missing exports
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Wed, 26 Jun 2019 13:57:50 +0200 |
parents | 235f0a771c8f |
children | eb8525066f9b 5acef2d5db2e |
line wrap: on
line diff
--- a/DiffOps/src/DiffOps.jl Wed Jun 26 13:31:35 2019 +0200 +++ b/DiffOps/src/DiffOps.jl Wed Jun 26 13:57:50 2019 +0200 @@ -4,6 +4,8 @@ using SbpOperators using Grids +export Laplace + abstract type DiffOp end # TBD: The "error("not implemented")" thing seems to be hiding good error information. How to fix that? Different way of saying that these should be implemented? @@ -29,6 +31,7 @@ return nothing end +export apply! function apply_region!(D::DiffOpCartesian{2}, u::AbstractArray{T,2}, v::AbstractArray{T,2}) where T apply_region!(D, u, v, Lower, Lower) @@ -51,6 +54,7 @@ end return nothing end +export apply_region! function apply_tiled!(D::DiffOpCartesian{2}, u::AbstractArray{T,2}, v::AbstractArray{T,2}) where T apply_region_tiled!(D, u, v, Lower, Lower) @@ -77,6 +81,7 @@ end return nothing end +export apply_region_tiled! function apply(D::DiffOp, v::AbstractVector)::AbstractVector u = zeros(eltype(v), size(v)) @@ -84,6 +89,8 @@ return u end +export apply + struct NormalDerivative{N,M,K} op::D2{Float64,N,M,K} grid::EquidistantGrid @@ -150,8 +157,8 @@ grid::EquidistantGrid{Dim,T} a::T op::D2{Float64,N,M,K} - e::BoundaryValue - d::NormalDerivative + # e::BoundaryValue + # d::NormalDerivative end function apply(L::Laplace{Dim}, v::AbstractArray{T,Dim} where T, I::CartesianIndex{Dim}) where Dim @@ -160,17 +167,18 @@ # u = L*v function apply(L::Laplace{1}, v::AbstractVector, i::Int) - uᵢ = L.a * apply(L.op, L.grid.spacing[1], v, i) + uᵢ = L.a * SbpOperators.apply(L.op, L.grid.spacing[1], v, i) return uᵢ end @inline function apply(L::Laplace{2}, v::AbstractArray{T,2} where T, I::Tuple{Index{R1}, Index{R2}}) where {R1, R2} # 2nd x-derivative @inbounds vx = view(v, :, Int(I[2])) - @inbounds uᵢ = L.a*apply(L.op, L.grid.inverse_spacing[1], vx , I[1]) + @inbounds uᵢ = L.a*SbpOperators.apply(L.op, L.grid.inverse_spacing[1], vx , I[1]) # 2nd y-derivative @inbounds vy = view(v, Int(I[1]), :) - @inbounds uᵢ += L.a*apply(L.op, L.grid.inverse_spacing[2], vy, I[2]) + @inbounds uᵢ += L.a*SbpOperators.apply(L.op, L.grid.inverse_spacing[2], vy, I[2]) + # NOTE: the package qualifier 'SbpOperators' can problably be removed once all "applying" objects use LazyTensors return uᵢ end