Mercurial > repos > public > sbplib_julia
changeset 1937:755fc0907e99 feature/grids/manifolds
Add tetss for construcors and getters for UnstructuredAtlas
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Fri, 07 Feb 2025 13:44:12 +0100 |
parents | a7c9d04b57e0 |
children | 91d467b5444b |
files | src/Grids/Grids.jl src/Grids/manifolds.jl test/Grids/manifolds_test.jl |
diffstat | 3 files changed, 40 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/Grids/Grids.jl Fri Feb 07 13:36:17 2025 +0100 +++ b/src/Grids/Grids.jl Fri Feb 07 13:44:12 2025 +0100 @@ -31,6 +31,7 @@ export connections export boundaries export CartesianAtlas +export UnstructuredAtlas export parameterspace
--- a/src/Grids/manifolds.jl Fri Feb 07 13:36:17 2025 +0100 +++ b/src/Grids/manifolds.jl Fri Feb 07 13:44:12 2025 +0100 @@ -106,9 +106,9 @@ end -struct UnstructuredAtlas <: Atlas - charts::Vector{Chart} - connections::Vector{Tuple{MultiBlockBoundary, MultiBlockBoundary}} +struct UnstructuredAtlas{C<:Chart, CN<:Tuple{MultiBlockBoundary,MultiBlockBoundary}, CV<:AbstractVector{C}, CNV<:AbstractVector{CN}} <: Atlas + charts::CV + connections::CNV end charts(a::UnstructuredAtlas) = a.charts
--- a/test/Grids/manifolds_test.jl Fri Feb 07 13:36:17 2025 +0100 +++ b/test/Grids/manifolds_test.jl Fri Feb 07 13:44:12 2025 +0100 @@ -147,6 +147,42 @@ end @testset "UnstructuredAtlas" begin + @testset "Constructors" begin + c1 = Chart(identity, unitsquare()) + c2 = Chart(x->2x, unitsquare()) + cn = [ + (MultiBlockBoundary{1, south}(), MultiBlockBoundary{2, south}()), + (MultiBlockBoundary{2, south}(), MultiBlockBoundary{3, south}()), + (MultiBlockBoundary{3, east}(), MultiBlockBoundary{1, east}()), + ] + + @test UnstructuredAtlas([c1, c1, c1], cn) isa UnstructuredAtlas + @test UnstructuredAtlas([c1, c2, c1, c2], cn) isa UnstructuredAtlas + + + cn = @SVector[ + (MultiBlockBoundary{1, south}(), MultiBlockBoundary{2, south}()), + (MultiBlockBoundary{2, south}(), MultiBlockBoundary{3, south}()), + (MultiBlockBoundary{3, east}(), MultiBlockBoundary{1, east}()), + ] + @test UnstructuredAtlas(@SVector[c1, c1, c1], cn) isa UnstructuredAtlas + @test UnstructuredAtlas(@SVector[c1, c2, c1, c2], cn) isa UnstructuredAtlas + end + + @testset "Getters" begin + c = Chart(identity, unitsquare()) + cn = [ + (MultiBlockBoundary{1, south}(), MultiBlockBoundary{2, south}()), + (MultiBlockBoundary{2, south}(), MultiBlockBoundary{3, south}()), + (MultiBlockBoundary{3, east}(), MultiBlockBoundary{1, east}()), + ] + + a = UnstructuredAtlas([c, c, c], cn) + + @test charts(a) == [c,c,c] + @test connections(a) == cn + end + @testset "boundaries" begin @test_broken false end