diff --git a/test/test_interfacevalues.jl b/test/test_interfacevalues.jl index 3254014a58..6e0aced047 100644 --- a/test/test_interfacevalues.jl +++ b/test/test_interfacevalues.jl @@ -1,21 +1,12 @@ -############################################################################### -# Function to test for possible allocations/dynamic dispatch when iterating # -############################################################################### -@check_allocs function testallocs_iterate(iterator) - for _ in iterator end - return nothing -end - @testset "InterfaceValues" begin - function test_interfacevalues(grid::Ferrite.AbstractGrid, iv::InterfaceValues; tol = 0) + function test_interfacevalues(iv::InterfaceValues, args...; tol = 0) ip_here = Ferrite.function_interpolation(iv.here) ip_there = Ferrite.function_interpolation(iv.there) rdim = Ferrite.getrefdim(ip_here) n_basefuncs = getnbasefunctions(ip_here) + getnbasefunctions(ip_there) @test getnbasefunctions(iv) == n_basefuncs - - for ic in InterfaceIterator(grid) + for ic in InterfaceIterator(args...) reinit!(iv, ic) coords_here, coords_there = getcoordinates(ic) nqp = getnquadpoints(iv) @@ -160,7 +151,7 @@ end for func_interpol in (scalar_interpol, VectorizedInterpolation(scalar_interpol)) iv = cell_shape ∈ (QuadraticLine, QuadraticQuadrilateral, QuadraticTriangle, QuadraticTetrahedron) ? InterfaceValues(quad_rule, func_interpol, ip) : InterfaceValues(quad_rule, func_interpol) - test_interfacevalues(grid, iv) + test_interfacevalues(iv, grid) end end # Custom quadrature @@ -190,7 +181,7 @@ end end for func_interpol in (scalar_interpol, VectorizedInterpolation(scalar_interpol)) iv = InterfaceValues(quad_rule, func_interpol) - test_interfacevalues(grid, iv; tol = 5 * eps(Float64)) + test_interfacevalues(iv, grid; tol = 5 * eps(Float64)) end end @testset "Mixed elements 2D grids" begin @@ -203,11 +194,31 @@ end grid = Grid(cells, nodes) topology = ExclusiveTopology(grid) - test_interfacevalues( - grid, - DiscontinuousLagrange{RefQuadrilateral, 1}(), FacetQuadratureRule{RefQuadrilateral}(2), - DiscontinuousLagrange{RefTriangle, 1}(), FacetQuadratureRule{RefTriangle}(2) - ) + qr_facet_quad = FacetQuadratureRule{RefQuadrilateral}(2) + qr_facet_tri = FacetQuadratureRule{RefTriangle}(2) + ip_quad = DiscontinuousLagrange{RefQuadrilateral, 1}() + ip_tri = DiscontinuousLagrange{RefTriangle, 1}() + dh = DofHandler(grid) + sdh_quad = SubDofHandler(dh, Set([1])) + sdh_tri = SubDofHandler(dh, Set([2])) + add!(sdh_quad, :u, ip_quad) + add!(sdh_tri, :u, ip_tri) + qr_collection = (qr_facet_quad, qr_facet_tri) + ip_collection = (ip_quad, ip_tri) + close!(dh) + for (sdh_here_idx, sdh_here) in enumerate(dh.subdofhandlers) + for (sdh_there_idx, sdh_there) in enumerate(dh.subdofhandlers) + sdh_there_idx < sdh_here_idx && continue + iv = InterfaceValues( + qr_collection[sdh_here_idx], ip_collection[sdh_here_idx], + qr_collection[sdh_there_idx], ip_collection[sdh_there_idx] + ) + test_interfacevalues( + iv, sdh_here, sdh_there + ) + end + end + end @testset "Unordered nodes 3D" begin dim = 2 @@ -224,8 +235,8 @@ end grid = Grid(cells, nodes) test_interfacevalues( - grid, - InterfaceValues(FacetQuadratureRule{RefHexahedron}(2), DiscontinuousLagrange{RefHexahedron, 1}()) + InterfaceValues(FacetQuadratureRule{RefHexahedron}(2), DiscontinuousLagrange{RefHexahedron, 1}()), + grid ) end @testset "Interface dof_range" begin diff --git a/test/test_iterators.jl b/test/test_iterators.jl index a389ff32bc..cd011799b7 100644 --- a/test/test_iterators.jl +++ b/test/test_iterators.jl @@ -1,43 +1,84 @@ -@testset "CellIterator" begin - @testset "Single domain" begin - grid = generate_grid(Hexahedron, (2, 2, 2)) - ip = Lagrange{RefHexahedron, 1}() - dh = DofHandler(grid) - add!(dh, :u, ip) - close!(dh) - - ci_dh = CellIterator(dh) - ci_grid = CellIterator(grid) - @test ci_dh.set == ci_grid.set - # Test for allocations - # TODO: find a way to avoid resize for single sdh - # @test (testallocs_iterate(ci_dh)) === nothing - # Iterators over grid can allocate due to potential resize! - @test_throws AllocCheckFailure testallocs_iterate(ci_grid) +@testset "Iterators" begin + ############################################################################### + # Function to test for possible allocations/dynamic dispatch when iterating # + ############################################################################### + @check_allocs function testallocs_iterate(iterator) + for _ in iterator end + return nothing end - - @testset "subdomains" begin - @testset "same cell type" begin + @testset "CellIterator" begin + @testset "Single domain" begin grid = generate_grid(Hexahedron, (2, 2, 2)) ip = Lagrange{RefHexahedron, 1}() dh = DofHandler(grid) - sdh1 = SubDofHandler(dh, Set(collect(1:4))) - sdh2 = SubDofHandler(dh, Set(collect(5:8))) - add!(sdh1, :u, ip^3) - add!(sdh2, :p, ip) + add!(dh, :u, ip) close!(dh) - ci_sdh1 = CellIterator(sdh1, Set(collect(1:4))) - ci_sdh2 = CellIterator(sdh2, Set(collect(5:8))) ci_dh = CellIterator(dh) - + ci_grid = CellIterator(grid) + @test ci_dh.set == ci_grid.set # Test for allocations - @test (testallocs_iterate(ci_sdh1)) === nothing - @test (testallocs_iterate(ci_sdh2)) === nothing - @test_throws AllocCheckFailure testallocs_iterate(ci_dh) + # TODO: find a way to avoid resize for single sdh + # @test (testallocs_iterate(ci_dh)) === nothing + # Iterators over grid can allocate due to potential resize! + @test_throws AllocCheckFailure testallocs_iterate(ci_grid) end - @testset "mixed cell types" begin + @testset "subdomains" begin + @testset "same cell type" begin + grid = generate_grid(Hexahedron, (2, 2, 2)) + ip = Lagrange{RefHexahedron, 1}() + dh = DofHandler(grid) + sdh1 = SubDofHandler(dh, Set(collect(1:4))) + sdh2 = SubDofHandler(dh, Set(collect(5:8))) + add!(sdh1, :u, ip^3) + add!(sdh2, :p, ip) + close!(dh) + + ci_sdh1 = CellIterator(sdh1, Set(collect(1:4))) + ci_sdh2 = CellIterator(sdh2, Set(collect(5:8))) + ci_dh = CellIterator(dh) + + # Test for allocations + @test (testallocs_iterate(ci_sdh1)) === nothing + @test (testallocs_iterate(ci_sdh2)) === nothing + @test_throws AllocCheckFailure testallocs_iterate(ci_dh) + end + + @testset "mixed cell types" begin + nodes = [Node((-1.0, 0.0)), Node((0.0, 0.0)), Node((1.0, 0.0)), Node((-1.0, 1.0)), Node((0.0, 1.0))] + cells = [ + Quadrilateral((1, 2, 5, 4)), + Triangle((3, 5, 2)), + ] + grid = Grid(cells, nodes) + ip_quad = Lagrange{RefQuadrilateral, 1}() + ip_tri = Lagrange{RefTriangle, 1}() + dh = DofHandler(grid) + sdh_quad = SubDofHandler(dh, Set([1])) + sdh_tri = SubDofHandler(dh, Set([2])) + add!(sdh_quad, :u, ip_quad) + add!(sdh_tri, :u, ip_tri) + close!(dh) + + ci_quad = CellIterator(sdh_quad, Set([1])) + ci_tri = CellIterator(sdh_tri, Set([2])) + ci_dh = CellIterator(dh, Set([1])) + + # Test for allocations + try + testallocs_iterate(ci_quad) + + catch err + @info err.errors[3] + end + @test (testallocs_iterate(ci_quad)) === nothing + @test (testallocs_iterate(ci_tri)) === nothing + @test_throws AllocCheckFailure testallocs_iterate(ci_dh) + end + end + + @testset "error paths" begin nodes = [Node((-1.0, 0.0)), Node((0.0, 0.0)), Node((1.0, 0.0)), Node((-1.0, 1.0)), Node((0.0, 1.0))] cells = [ Quadrilateral((1, 2, 5, 4)), @@ -52,84 +93,83 @@ add!(sdh_quad, :u, ip_quad) add!(sdh_tri, :u, ip_tri) close!(dh) - - ci_quad = CellIterator(sdh_quad, Set([1])) - ci_tri = CellIterator(sdh_tri, Set([2])) - ci_dh = CellIterator(dh, Set([1])) - - # Test for allocations - try - testallocs_iterate(ci_quad) - - catch err - @info err.errors[3] - end - @test (testallocs_iterate(ci_quad)) === nothing - @test (testallocs_iterate(ci_tri)) === nothing - @test_throws AllocCheckFailure testallocs_iterate(ci_dh) + @test_throws ErrorException("The cells in the cellset are not all of the same celltype.") CellIterator(dh) end end - @testset "error paths" begin - nodes = [Node((-1.0, 0.0)), Node((0.0, 0.0)), Node((1.0, 0.0)), Node((-1.0, 1.0)), Node((0.0, 1.0))] - cells = [ - Quadrilateral((1, 2, 5, 4)), - Triangle((3, 5, 2)), - ] - grid = Grid(cells, nodes) - ip_quad = Lagrange{RefQuadrilateral, 1}() - ip_tri = Lagrange{RefTriangle, 1}() - dh = DofHandler(grid) - sdh_quad = SubDofHandler(dh, Set([1])) - sdh_tri = SubDofHandler(dh, Set([2])) - add!(sdh_quad, :u, ip_quad) - add!(sdh_tri, :u, ip_tri) - close!(dh) - @test_throws ErrorException("The cells in the cellset are not all of the same celltype.") CellIterator(dh) - end -end - -@testset "FacetIterator" begin - @testset "Single domain" begin - grid = generate_grid(Hexahedron, (2, 2, 2)) - ip = Lagrange{RefHexahedron, 1}() - dh = DofHandler(grid) - add!(dh, :u, ip) - close!(dh) - topology = ExclusiveTopology(grid) - fi_dh = FacetIterator(dh, topology) - fi_grid = FacetIterator(grid, topology) - @test fi_dh.set == fi_grid.set - - # Test for allocations - # TODO: find a way to avoid resize for single sdh - # @test (testallocs_iterate(fi_dh)) === nothing - # Iterators over grid can allocate due to potential resize! - @test_throws AllocCheckFailure testallocs_iterate(fi_grid) - end - - @testset "subdomains" begin - @testset "same cell type" begin + @testset "FacetIterator" begin + @testset "Single domain" begin grid = generate_grid(Hexahedron, (2, 2, 2)) ip = Lagrange{RefHexahedron, 1}() dh = DofHandler(grid) - sdh1 = SubDofHandler(dh, Set(collect(1:4))) - sdh2 = SubDofHandler(dh, Set(collect(5:8))) - add!(sdh1, :u, ip^3) - add!(sdh2, :p, ip) + add!(dh, :u, ip) close!(dh) topology = ExclusiveTopology(grid) + fi_dh = FacetIterator(dh, topology) + fi_grid = FacetIterator(grid, topology) + @test fi_dh.set == fi_grid.set - fi_sdh1 = FacetIterator(sdh1, topology) - fi_sdh2 = FacetIterator(sdh2, topology) - @test isempty(fi_sdh1.set ∩ fi_sdh2.set) - @test length(fi_sdh1.set) == 12 # Test for allocations - @test (testallocs_iterate(fi_sdh1)) === nothing - @test (testallocs_iterate(fi_sdh2)) === nothing + # TODO: find a way to avoid resize for single sdh + # @test (testallocs_iterate(fi_dh)) === nothing + # Iterators over grid can allocate due to potential resize! + @test_throws AllocCheckFailure testallocs_iterate(fi_grid) end - @testset "mixed cell types" begin + @testset "subdomains" begin + @testset "same cell type" begin + grid = generate_grid(Hexahedron, (2, 2, 2)) + ip = Lagrange{RefHexahedron, 1}() + dh = DofHandler(grid) + sdh1 = SubDofHandler(dh, Set(collect(1:4))) + sdh2 = SubDofHandler(dh, Set(collect(5:8))) + add!(sdh1, :u, ip^3) + add!(sdh2, :p, ip) + close!(dh) + topology = ExclusiveTopology(grid) + + fi_sdh1 = FacetIterator(sdh1, topology) + fi_sdh2 = FacetIterator(sdh2, topology) + @test isempty(fi_sdh1.set ∩ fi_sdh2.set) + @test length(fi_sdh1.set) == 12 + # Test for allocations + @test (testallocs_iterate(fi_sdh1)) === nothing + @test (testallocs_iterate(fi_sdh2)) === nothing + end + + @testset "mixed cell types" begin + nodes = [Node((-1.0, 0.0)), Node((0.0, 0.0)), Node((1.0, 0.0)), Node((-1.0, 1.0)), Node((0.0, 1.0))] + cells = [ + Quadrilateral((1, 2, 5, 4)), + Triangle((3, 5, 2)), + ] + grid = Grid(cells, nodes) + topology = ExclusiveTopology(grid) + ip_quad = Lagrange{RefQuadrilateral, 1}() + ip_tri = Lagrange{RefTriangle, 1}() + dh = DofHandler(grid) + sdh_quad = SubDofHandler(dh, Set([1])) + sdh_tri = SubDofHandler(dh, Set([2])) + add!(sdh_quad, :u, ip_quad) + add!(sdh_tri, :u, ip_tri) + close!(dh) + + fi_quad = FacetIterator(sdh_quad, topology) + fi_tri = FacetIterator(sdh_tri, topology) + @test isempty(fi_quad.set ∩ fi_tri.set) + # Test for allocations + @test (testallocs_iterate(fi_quad)) === nothing + @test (testallocs_iterate(fi_tri)) === nothing + end + end + + @testset "FacetIndex" begin + # checkmate, codecov bot! + @test isequal(FacetIndex(1, 2), (1, 2)) + @test isequal((1, 2), FacetIndex(1, 2)) + end + + @testset "error paths" begin nodes = [Node((-1.0, 0.0)), Node((0.0, 0.0)), Node((1.0, 0.0)), Node((-1.0, 1.0)), Node((0.0, 1.0))] cells = [ Quadrilateral((1, 2, 5, 4)), @@ -145,97 +185,102 @@ end add!(sdh_quad, :u, ip_quad) add!(sdh_tri, :u, ip_tri) close!(dh) - - fi_quad = FacetIterator(sdh_quad, topology) - fi_tri = FacetIterator(sdh_tri, topology) - @test isempty(fi_quad.set ∩ fi_tri.set) - # Test for allocations - @test (testallocs_iterate(fi_quad)) === nothing - @test (testallocs_iterate(fi_tri)) === nothing + @test_throws ErrorException("The cells in the set (set of FacetIndex) are not all of the same celltype.") FacetIterator(dh, topology) end end - @testset "FacetIndex" begin - # checkmate, codecov bot! - @test isequal(FacetIndex(1, 2), (1, 2)) - @test isequal((1, 2), FacetIndex(1, 2)) - end - - @testset "error paths" begin - nodes = [Node((-1.0, 0.0)), Node((0.0, 0.0)), Node((1.0, 0.0)), Node((-1.0, 1.0)), Node((0.0, 1.0))] - cells = [ - Quadrilateral((1, 2, 5, 4)), - Triangle((3, 5, 2)), - ] - grid = Grid(cells, nodes) - topology = ExclusiveTopology(grid) - ip_quad = Lagrange{RefQuadrilateral, 1}() - ip_tri = Lagrange{RefTriangle, 1}() - dh = DofHandler(grid) - sdh_quad = SubDofHandler(dh, Set([1])) - sdh_tri = SubDofHandler(dh, Set([2])) - add!(sdh_quad, :u, ip_quad) - add!(sdh_tri, :u, ip_tri) - close!(dh) - @test_throws ErrorException("The cells in the set (set of FacetIndex) are not all of the same celltype.") FacetIterator(dh, topology) - end -end - -@testset "InterfaceIterator" begin - @testset "Single domain" begin - grid = generate_grid(Hexahedron, (1000, 2, 1)) - ip = Lagrange{RefHexahedron, 1}() - dh = DofHandler(grid) - add!(dh, :u, ip) - close!(dh) - topology = ExclusiveTopology(grid) - - ii_dh_top = InterfaceIterator(dh, topology) - ii_dh = InterfaceIterator(dh) - ii_grid_top = InterfaceIterator(grid, topology) - ii_grid = InterfaceIterator(grid) - @test ii_dh.set == ii_dh_top.set == ii_grid.set == ii_grid_top.set - # Test that topology has no effect on iterator type - @test typeof(ii_dh) == typeof(ii_dh_top) - @test typeof(ii_grid) == typeof(ii_grid_top) - # Test for allocations - # TODO: find a way to avoid resize for single sdh - # @test (testallocs_iterate(ii_dh_top)) === nothing - # @test (testallocs_iterate(ii_dh)) === nothing - # Iterators over grid can allocate due to potential resize! - @test_throws AllocCheckFailure testallocs_iterate(ii_grid) - @test_throws AllocCheckFailure testallocs_iterate(ii_grid_top) - end - - @testset "subdomains" begin - @testset "same cell type" begin + @testset "InterfaceIterator" begin + @testset "Single domain" begin grid = generate_grid(Hexahedron, (1000, 2, 1)) ip = Lagrange{RefHexahedron, 1}() dh = DofHandler(grid) - sdh1 = SubDofHandler(dh, Set([collect(1:500)..., collect(1501:2000)...])) - sdh2 = SubDofHandler(dh, Set([collect(501:1500)...])) - add!(sdh1, :u, ip) - add!(sdh2, :u, ip) + add!(dh, :u, ip) close!(dh) topology = ExclusiveTopology(grid) - ii_sdh_top = InterfaceIterator(sdh1, sdh2, topology) - ii_sdh = InterfaceIterator(sdh1, sdh2) - ii_same_sdh = InterfaceIterator(sdh1, sdh1) - @test ii_sdh.set == ii_sdh_top.set - @test length(ii_sdh.set) == 1002 - @test count(interface_index -> interface_index[1] == interface_index[3] - 1000, ii_sdh.set) == 500 - @test count(interface_index -> interface_index[1] == interface_index[3] + 1000, ii_sdh.set) == 500 - ii_sdh_flipped = InterfaceIterator(sdh2, sdh1) - @test all(interface -> InterfaceIndex(interface[3], interface[4], interface[1], interface[2]) ∈ ii_sdh_flipped.set, ii_sdh.set) + ii_dh_top = InterfaceIterator(dh, topology) + ii_dh = InterfaceIterator(dh) + ii_grid_top = InterfaceIterator(grid, topology) + ii_grid = InterfaceIterator(grid) + @test ii_dh.set == ii_dh_top.set == ii_grid.set == ii_grid_top.set # Test that topology has no effect on iterator type - @test typeof(ii_sdh) == typeof(ii_sdh_top) + @test typeof(ii_dh) == typeof(ii_dh_top) + @test typeof(ii_grid) == typeof(ii_grid_top) # Test for allocations - @test (testallocs_iterate(ii_sdh)) === nothing - @test (testallocs_iterate(ii_same_sdh)) === nothing + # TODO: find a way to avoid resize for single sdh + # @test (testallocs_iterate(ii_dh_top)) === nothing + # @test (testallocs_iterate(ii_dh)) === nothing + # Iterators over grid can allocate due to potential resize! + @test_throws AllocCheckFailure testallocs_iterate(ii_grid) + @test_throws AllocCheckFailure testallocs_iterate(ii_grid_top) end - @testset "mixed cell types" begin + @testset "subdomains" begin + @testset "same cell type" begin + grid = generate_grid(Hexahedron, (1000, 2, 1)) + ip = Lagrange{RefHexahedron, 1}() + dh = DofHandler(grid) + sdh1 = SubDofHandler(dh, Set([collect(1:500)..., collect(1501:2000)...])) + sdh2 = SubDofHandler(dh, Set([collect(501:1500)...])) + add!(sdh1, :u, ip) + add!(sdh2, :u, ip) + close!(dh) + topology = ExclusiveTopology(grid) + + ii_sdh_top = InterfaceIterator(sdh1, sdh2, topology) + ii_sdh = InterfaceIterator(sdh1, sdh2) + ii_same_sdh = InterfaceIterator(sdh1, sdh1) + @test ii_sdh.set == ii_sdh_top.set + @test length(ii_sdh.set) == 1002 + @test count(interface_index -> interface_index[1] == interface_index[3] - 1000, ii_sdh.set) == 500 + @test count(interface_index -> interface_index[1] == interface_index[3] + 1000, ii_sdh.set) == 500 + ii_sdh_flipped = InterfaceIterator(sdh2, sdh1) + @test all(interface -> InterfaceIndex(interface[3], interface[4], interface[1], interface[2]) ∈ ii_sdh_flipped.set, ii_sdh.set) + # Test that topology has no effect on iterator type + @test typeof(ii_sdh) == typeof(ii_sdh_top) + # Test for allocations + @test (testallocs_iterate(ii_sdh)) === nothing + @test (testallocs_iterate(ii_same_sdh)) === nothing + end + + @testset "mixed cell types" begin + nodes = [Node((-1.0, 0.0)), Node((0.0, 0.0)), Node((1.0, 0.0)), Node((-1.0, 1.0)), Node((0.0, 1.0))] + cells = [ + Quadrilateral((1, 2, 5, 4)), + Triangle((3, 5, 2)), + ] + grid = Grid(cells, nodes) + topology = ExclusiveTopology(grid) + ip_quad = Lagrange{RefQuadrilateral, 1}() + ip_tri = Lagrange{RefTriangle, 1}() + dh = DofHandler(grid) + sdh_quad = SubDofHandler(dh, Set([1])) + sdh_tri = SubDofHandler(dh, Set([2])) + add!(sdh_quad, :u, ip_quad) + add!(sdh_tri, :u, ip_tri) + close!(dh) + + ii_sdh_top = InterfaceIterator(sdh_quad, sdh_tri, topology) + ii_sdh = InterfaceIterator(sdh_quad, sdh_tri) + @test ii_sdh.set == ii_sdh_top.set + @test ii_sdh.set == Set([InterfaceIndex(1, 2, 2, 2)]) + ii_sdh_flipped = InterfaceIterator(sdh_tri, sdh_quad) + @test ii_sdh_flipped.set == Set([InterfaceIndex(2, 2, 1, 2)]) + # Test that topology has no effect on iterator type + @test typeof(ii_sdh) == typeof(ii_sdh_top) + # Test for allocations + @test (testallocs_iterate(ii_sdh_top)) === nothing + @test (testallocs_iterate(ii_sdh)) === nothing + end + end + + @testset "InterfaceIndex" begin + # checkmate, codecov bot! + @test isequal(InterfaceIndex(1, 2, 3, 4), (1, 2, 3, 4)) + @test isequal((1, 2, 3, 4), InterfaceIndex(1, 2, 3, 4)) + end + + @testset "error paths" begin nodes = [Node((-1.0, 0.0)), Node((0.0, 0.0)), Node((1.0, 0.0)), Node((-1.0, 1.0)), Node((0.0, 1.0))] cells = [ Quadrilateral((1, 2, 5, 4)), @@ -251,43 +296,7 @@ end add!(sdh_quad, :u, ip_quad) add!(sdh_tri, :u, ip_tri) close!(dh) - - ii_sdh_top = InterfaceIterator(sdh_quad, sdh_tri, topology) - ii_sdh = InterfaceIterator(sdh_quad, sdh_tri) - @test ii_sdh.set == ii_sdh_top.set - @test ii_sdh.set == Set([InterfaceIndex(1, 2, 2, 2)]) - ii_sdh_flipped = InterfaceIterator(sdh_tri, sdh_quad) - @test ii_sdh_flipped.set == Set([InterfaceIndex(2, 2, 1, 2)]) - # Test that topology has no effect on iterator type - @test typeof(ii_sdh) == typeof(ii_sdh_top) - # Test for allocations - @test (testallocs_iterate(ii_sdh_top)) === nothing - @test (testallocs_iterate(ii_sdh)) === nothing + @test_throws ErrorException("The cells in the set (set of InterfaceIndex) are not all of the same celltype on each side.") InterfaceIterator(sdh_quad, sdh_tri, Set([InterfaceIndex(2, 2, 1, 2)])) end end - - @testset "InterfaceIndex" begin - # checkmate, codecov bot! - @test isequal(InterfaceIndex(1, 2, 3, 4), (1, 2, 3, 4)) - @test isequal((1, 2, 3, 4), InterfaceIndex(1, 2, 3, 4)) - end - - @testset "error paths" begin - nodes = [Node((-1.0, 0.0)), Node((0.0, 0.0)), Node((1.0, 0.0)), Node((-1.0, 1.0)), Node((0.0, 1.0))] - cells = [ - Quadrilateral((1, 2, 5, 4)), - Triangle((3, 5, 2)), - ] - grid = Grid(cells, nodes) - topology = ExclusiveTopology(grid) - ip_quad = Lagrange{RefQuadrilateral, 1}() - ip_tri = Lagrange{RefTriangle, 1}() - dh = DofHandler(grid) - sdh_quad = SubDofHandler(dh, Set([1])) - sdh_tri = SubDofHandler(dh, Set([2])) - add!(sdh_quad, :u, ip_quad) - add!(sdh_tri, :u, ip_tri) - close!(dh) - @test_throws ErrorException("The cells in the set (set of InterfaceIndex) are not all of the same celltype on each side.") InterfaceIterator(sdh_quad, sdh_tri, Set([InterfaceIndex(2, 2, 1, 2)])) - end end