changeset 1580:fdee60ab8c4e feature/grids/manifolds

Add ndims method for ParameterSpace
author Jonatan Werpers <jonatan@werpers.com>
date Thu, 25 Apr 2024 22:15:12 +0200
parents 14d79b13b54f
children f77c5309dd2b
files src/Grids/manifolds.jl test/Grids/manifolds_test.jl
diffstat 2 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/Grids/manifolds.jl	Thu Apr 25 22:14:46 2024 +0200
+++ b/src/Grids/manifolds.jl	Thu Apr 25 22:15:12 2024 +0200
@@ -18,6 +18,7 @@
 [`Simplex`](@ref),
 """
 abstract type ParameterSpace{D} end
+Base.ndims(::ParameterSpace{D}) where D = D
 
 struct HyperBox{T,D} <: ParameterSpace{D}
     a::SVector{D,T}
--- a/test/Grids/manifolds_test.jl	Thu Apr 25 22:14:46 2024 +0200
+++ b/test/Grids/manifolds_test.jl	Thu Apr 25 22:15:12 2024 +0200
@@ -6,6 +6,11 @@
 
 # using StaticArrays
 
+@testset "ParameterSpace" begin
+    @test ndims(HyperBox([1,1], [2,2])) == 2
+    @test ndims(unittetrahedron()) == 3
+end
+
 @testset "HyperBox" begin
     @test HyperBox([1,1], [2,2]) isa HyperBox{Int, 2}