changeset 1919:71d218593cac feature/grids/manifolds

Add implementation for size to CartesianAtlas
author Jonatan Werpers <jonatan@werpers.com>
date Wed, 05 Feb 2025 09:05:46 +0100
parents b1560da986f3
children ae83c91286a2
files src/Grids/manifolds.jl test/Grids/manifolds_test.jl
diffstat 2 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/Grids/manifolds.jl	Tue Feb 04 21:53:31 2025 +0100
+++ b/src/Grids/manifolds.jl	Wed Feb 05 09:05:46 2025 +0100
@@ -64,6 +64,8 @@
 
 charts(a::CartesianAtlas) = a.charts
 connections(a::CartesianAtlas) = nothing
+Base.size(a::CartesianAtlas) = size(a.charts)
+
 
 struct UnstructuredAtlas <: Atlas
     charts::Vector{Chart}
--- a/test/Grids/manifolds_test.jl	Tue Feb 04 21:53:31 2025 +0100
+++ b/test/Grids/manifolds_test.jl	Wed Feb 05 09:05:46 2025 +0100
@@ -21,6 +21,13 @@
     @test a isa Atlas
     @test charts(a) == [c c; c c]
 
+
+    @testset "size" begin
+        @test size(CartesianAtlas([c c; c c])) == (2,2)
+        @test size(CartesianAtlas([c c c; c c c])) == (2,3)
+        @test size(CartesianAtlas([c c; c c; c c])) == (3,2)
+    end
+
     west = CartesianBoundary{1,LowerBoundary}
     east = CartesianBoundary{1,UpperBoundary}
     south = CartesianBoundary{2,LowerBoundary}