|
182 | 182 |
|
183 | 183 | @test getcells(grid, "cell_set") == [getcells(grid, 1)] |
184 | 184 |
|
| 185 | + # cellnodes via empty DofHandler |
| 186 | + nodeids = zeros(Int, 9) |
| 187 | + dh = DofHandler(grid) |
| 188 | + close!(dh) |
| 189 | + Ferrite.cellnodes!(nodeids, dh, 1) |
| 190 | + # Note that the return types typically differ (Vector vs Tuple) |
| 191 | + @test all(nodeids .== Ferrite.get_node_ids(getcells(grid, 1))) |
| 192 | + |
185 | 193 | # CellIterator on a grid without DofHandler |
186 | 194 | grid = generate_grid(Triangle, (4, 4)) |
187 | 195 | n = 0 |
|
546 | 554 | Line((6, 7)), |
547 | 555 | ] |
548 | 556 | nodes = [Node(coord) for coord in zeros(Vec{2, Float64}, 18)] |
549 | | - grid = Grid(cells, nodes) |
550 | 557 | @test_throws ErrorException ExclusiveTopology(grid) |
551 | 558 | # topology = ExclusiveTopology(grid) |
552 | 559 | # @test_throws ArgumentError Ferrite.facetskeleton(topology, grid) |
|
585 | 592 | @test Set(Ferrite.getstencil(stars, quadgrid, VertexIndex(5, 4))) == Set([VertexIndex(4, 2), VertexIndex(4, 4), VertexIndex(5, 1), VertexIndex(5, 3), VertexIndex(7, 1), VertexIndex(7, 3), VertexIndex(8, 2), VertexIndex(8, 4), VertexIndex(4, 3), VertexIndex(5, 4), VertexIndex(7, 2), VertexIndex(8, 1)]) |
586 | 593 | @test Set(Ferrite.toglobal.((quadgrid,), Ferrite.getstencil(stars, quadgrid, VertexIndex(1, 1)))) == Set([1, 2, 5]) |
587 | 594 | @test Set(Ferrite.toglobal.((quadgrid,), Ferrite.getstencil(stars, quadgrid, VertexIndex(2, 1)))) == Set([2, 1, 6, 3]) |
588 | | - @test Set(Ferrite.toglobal.((quadgrid,), Ferrite.getstencil(stars, quadgrid, VertexIndex(5, 4)))) == Set([10, 6, 9, 11, 14]) |
| 595 | + @test Set(Ferrite.toglobal(quadgrid, collect(Ferrite.getstencil(stars, quadgrid, VertexIndex(5, 4))))) == Set([10, 6, 9, 11, 14]) |
589 | 596 |
|
590 | 597 | face_skeleton = Ferrite.facetskeleton(topology, quadgrid) |
591 | 598 | @test Set(face_skeleton) == Set( |
|
707 | 714 | close!(dh) |
708 | 715 | @test celldofs(dh, 1) == [1, 2, 3, 4, 5, 6, 7, 9, 8, 10] |
709 | 716 | @test celldofs(dh, 2) == [2, 11, 3, 12, 13, 15, 14, 7, 6, 16] |
| 717 | + # Should also agree with the remaining celldofs API |
| 718 | + dofs = zeros(Int, 10) |
| 719 | + celldofs!(dofs, dh, 1) |
| 720 | + @test dofs == celldofs(dh, 1) |
| 721 | + celldofs!(dofs, dh, 2) |
| 722 | + @test dofs == celldofs(dh, 2) |
| 723 | + celldofs!(view(dofs, :), dh, 1) |
| 724 | + @test dofs == celldofs(dh, 1) |
| 725 | + celldofs!(view(dofs, :), dh, 2) |
| 726 | + @test dofs == celldofs(dh, 2) |
710 | 727 |
|
711 | 728 | ## Lagrange{RefTriangle,3} |
712 | 729 | # First dof per position per triangle |
|
723 | 740 | close!(dh) |
724 | 741 | @test celldofs(dh, 1) == [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 17, 18, 15, 16, 19, 20] |
725 | 742 | @test celldofs(dh, 2) == [3, 4, 21, 22, 5, 6, 23, 24, 25, 26, 29, 30, 27, 28, 13, 14, 11, 12, 31, 32] |
| 743 | + # Should also agree with the remaining celldofs API |
| 744 | + dofs = zeros(Int, 20) |
| 745 | + celldofs!(dofs, dh, 1) |
| 746 | + @test dofs == celldofs(dh, 1) |
| 747 | + celldofs!(dofs, dh, 2) |
| 748 | + @test dofs == celldofs(dh, 2) |
| 749 | + celldofs!(view(dofs, :), dh, 1) |
| 750 | + @test dofs == celldofs(dh, 1) |
| 751 | + celldofs!(view(dofs, :), dh, 2) |
| 752 | + @test dofs == celldofs(dh, 2) |
726 | 753 | end |
727 | 754 |
|
728 | 755 | @testset "vectorization layer compat" begin |
|
0 commit comments