diff --git a/src/Interpolations/mpvalue.jl b/src/Interpolations/mpvalue.jl index 050b229e..87c20930 100644 --- a/src/Interpolations/mpvalue.jl +++ b/src/Interpolations/mpvalue.jl @@ -1,3 +1,4 @@ +abstract type Interpolation end abstract type Kernel <: Interpolation end #= @@ -17,6 +18,8 @@ function create_property(::Type{T}, it::Interpolation, mesh::CartesianMesh{dim}; error("wrong differentiation type, choose `nothing`, `gradient` and `hessian`") end +NeighboringNodesType(::Interpolation, ::CartesianMesh{dim}) where {dim} = CartesianIndices{dim, NTuple{dim, UnitRange{Int}}} + """ MPValue(Vec{dim}, interpolation) MPValue(Vec{dim, T}, interpolation) @@ -73,10 +76,14 @@ end @inline neighboringnodes(mp::MPValue) = getfield(mp, :indices)[] @inline function neighboringnodes(mp::MPValue, grid::Grid) + neighboringnodes(mp, get_mesh(grid)) +end +@inline function neighboringnodes(mp::MPValue, mesh::CartesianMesh) inds = neighboringnodes(mp) - @boundscheck checkbounds(grid, inds) + @boundscheck checkbounds(mesh, inds) inds end +# SpGrid always use CartesianMesh @inline function neighboringnodes(mp::MPValue, grid::SpGrid) inds = neighboringnodes(mp) spinds = get_spinds(grid) diff --git a/src/Tesserae.jl b/src/Tesserae.jl index 4f1a3b0c..81b47fdf 100644 --- a/src/Tesserae.jl +++ b/src/Tesserae.jl @@ -82,8 +82,6 @@ export closevtm, closepvd -abstract type Interpolation end - include("utils.jl") include("mesh.jl") include("blockspace.jl") diff --git a/src/grid.jl b/src/grid.jl index 750e92be..ae6dc93c 100644 --- a/src/grid.jl +++ b/src/grid.jl @@ -12,7 +12,7 @@ spacing_inv(grid::Grid) = spacing_inv(get_mesh(grid)) # SpGrid # ########## -const SpGrid{N, T, NT <: NamedTuple{<: Any, <: Tuple{AbstractMesh, SpArray, Vararg{SpArray}}}, I} = StructArray{T, N, NT, I} +const SpGrid{N, T, NT <: NamedTuple{<: Any, <: Tuple{CartesianMesh, SpArray, Vararg{SpArray}}}, I} = StructArray{T, N, NT, I} function check_gridproperty(::Type{GridProp}, ::Type{Vec{dim, T}}) where {GridProp, dim, T} V = fieldtype(GridProp, 1) diff --git a/src/mesh.jl b/src/mesh.jl index 668554de..bc695439 100644 --- a/src/mesh.jl +++ b/src/mesh.jl @@ -137,8 +137,6 @@ CartesianIndices((1:5,)) end @inline EmptyCartesianIndices(::Val{dim}) where {dim} = CartesianIndices(nfill(1:0, Val(dim))) -NeighboringNodesType(::Interpolation, ::CartesianMesh{dim}) where {dim} = CartesianIndices{dim, NTuple{dim, UnitRange{Int}}} - """ whichcell(x::Vec, mesh::CartesianMesh)