changeset 1564:35fe4375b35f feature/grids/manifolds

Export things and fix ConcreteChart and Simplex
author Jonatan Werpers <jonatan@werpers.com>
date Thu, 25 Apr 2024 13:17:48 +0200
parents 81e97d3bec8c
children c3425b4302b8
files src/Grids/Grids.jl src/Grids/manifolds.jl test/Grids/manifolds_test.jl
diffstat 3 files changed, 9 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/Grids/Grids.jl	Wed Apr 24 13:26:30 2024 +0200
+++ b/src/Grids/Grids.jl	Thu Apr 25 13:17:48 2024 +0200
@@ -19,6 +19,9 @@
 export unitcube
 export unithyperbox
 
+export Chart
+export ConcreteChart
+
 # Grid
 export Grid
 export coordinate_size
--- a/src/Grids/manifolds.jl	Wed Apr 24 13:26:30 2024 +0200
+++ b/src/Grids/manifolds.jl	Thu Apr 25 13:17:48 2024 +0200
@@ -47,6 +47,8 @@
     verticies::NTuple{D,SVector{D,T}}
 end
 
+Simplex(verticies::Vararg{AbstractArray}) = Simplex(Tuple(SVector(v...) for v ∈ verticies))
+
 Triangle{T} = Simplex{T,2}
 Tetrahedron{T} = Simplex{T,3}
 
@@ -84,9 +86,9 @@
 (c::Chart{D})(x̄::SVector{D}) where D = c(x̄...)
 
 
-struct ConcereteChart{PST<:ParameterSpace, MT}
+struct ConcreteChart{D, PST<:ParameterSpace{D}, MT} <: Chart{D}
+    mapping::MT
     parameterspace::PST
-    mapping::MT
 end
 
 (c::Chart)(x̄) = c.mapping(x̄)
--- a/test/Grids/manifolds_test.jl	Wed Apr 24 13:26:30 2024 +0200
+++ b/test/Grids/manifolds_test.jl	Thu Apr 25 13:17:48 2024 +0200
@@ -31,11 +31,11 @@
 
 @testset "Simplex" begin
     @test Simplex([1,2], [3,4]) isa Simplex{Int, 2}
-    @test Simplex([1,2,3], [4,5,6]) isa Simplex{Int, 3}
+    @test Simplex([1,2,3], [4,5,6],[1,1,1]) isa Simplex{Int, 3}
 end
 
 @testset "Chart" begin
-
+    @test ConcreteChart(x->2x, unitsquare()) isa Chart{2}
 end
 
 @testset "Atlas" begin