Skip to content

Commit

Permalink
Add dispatch for getneighborhood of edges in sdim=2 (#942)
Browse files Browse the repository at this point in the history
Ensures correct and fast code-path for 2d grids, closes #941
  • Loading branch information
koehlerson committed Jun 17, 2024
1 parent 6dfa0e4 commit 1b04df4
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/Grid/topology.jl
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,14 @@ function getneighborhood(top::ExclusiveTopology, grid::AbstractGrid, faceidx::Fa
end
end

function getneighborhood(top::ExclusiveTopology, grid::AbstractGrid{2}, edgeidx::EdgeIndex, include_self=false)
if include_self
return [top.edge_edge_neighbor[edgeidx[1],edgeidx[2]].neighbor_info; edgeidx]
else
return top.edge_edge_neighbor[edgeidx[1],edgeidx[2]].neighbor_info
end
end

function getneighborhood(top::ExclusiveTopology, grid::AbstractGrid, vertexidx::VertexIndex, include_self=false)
cellid, local_vertexid = vertexidx[1], vertexidx[2]
cell_vertices = vertices(getcells(grid,cellid))
Expand All @@ -274,7 +282,7 @@ function getneighborhood(top::ExclusiveTopology, grid::AbstractGrid, vertexidx::
return self_reference_local
end

function getneighborhood(top::ExclusiveTopology, grid::AbstractGrid, edgeidx::EdgeIndex, include_self=false)
function getneighborhood(top::ExclusiveTopology, grid::AbstractGrid{3}, edgeidx::EdgeIndex, include_self=false)
cellid, local_edgeidx = edgeidx[1], edgeidx[2]
cell_edges = edges(getcells(grid,cellid))
nonlocal_edgeid = cell_edges[local_edgeidx]
Expand Down

0 comments on commit 1b04df4

Please sign in to comment.