Skip to content

Commit

Permalink
replace high order fix with @zkk960317 suggestion and add more regres…
Browse files Browse the repository at this point in the history
…sion tests for higher order
  • Loading branch information
koehlerson committed Oct 18, 2022
1 parent 9e8de23 commit c60ffd1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Grid/grid.jl
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,8 @@ function ExclusiveTopology(cells::Vector{C}) where C <: AbstractCell
cell_neighbor_table[cellid] = EntityNeighborhood(CellIndex.(cell_neighbors))

for neighbor in cell_neighbors
neighbor_local_ids = findall(x->x in vertices(cell), vertices(cells[neighbor]))
cell_local_ids = findall(x->x in vertices(cells[neighbor]), vertices(cell))
neighbor_local_ids = findall(x->x in cell_vertices_table[cellid], cell_vertices_table[neighbor])
cell_local_ids = findall(x->x in cell_vertices_table[neighbor], cell_vertices_table[cellid])
# vertex neighbor
if length(cell_local_ids) == 1
_vertex_neighbor!(V_vertex, I_vertex, J_vertex, cellid, cell, neighbor_local_ids, neighbor, cells[neighbor])
Expand Down
10 changes: 10 additions & 0 deletions test/test_grid_dofhandler_vtk.jl
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,11 @@ end
@test topology.face_neighbor[3,3] == Ferrite.EntityNeighborhood(FaceIndex(4,5))
@test topology.face_neighbor[4,2] == Ferrite.EntityNeighborhood(FaceIndex(2,4))
@test topology.face_neighbor[4,5] == Ferrite.EntityNeighborhood(FaceIndex(3,3))
serendipitygrid = generate_grid(Cell{3,20,6},(2,2,1))
stopology = ExclusiveTopology(serendipitygrid)
# regression for https://github.com/Ferrite-FEM/Ferrite.jl/issues/518
@test all(stopology.face_neighbor .== topology.face_neighbor)
@test all(stopology.vertex_neighbor .== topology.vertex_neighbor)

# +-----+-----+
# |\ 6 |\ 8 |
Expand All @@ -298,6 +303,11 @@ end
trigrid = generate_grid(Triangle,(2,2))
topology = ExclusiveTopology(trigrid)
@test topology.vertex_neighbor[3,3] == Ferrite.EntityNeighborhood([VertexIndex(5,2),VertexIndex(6,1),VertexIndex(7,1)])
quadtrigrid = generate_grid(QuadraticTriangle,(2,2))
quadtopology = ExclusiveTopology(trigrid)
# add more regression for https://github.com/Ferrite-FEM/Ferrite.jl/issues/518
@test all(quadtopology.face_neighbor .== topology.face_neighbor)
@test all(quadtopology.vertex_neighbor .== topology.vertex_neighbor)

# test mixed grid
cells = [
Expand Down

0 comments on commit c60ffd1

Please sign in to comment.