Mercurial > repos > public > sbplib_julia
comparison test/Grids/parameter_space_test.jl @ 1954:b0915f43b122 feature/sbp_operators/laplace_curvilinear
Merge feature/grids/geometry_functions
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Sat, 08 Feb 2025 09:38:58 +0100 |
parents | 15be190a40cd |
children | 77ff0a2acbe5 |
comparison
equal
deleted
inserted
replaced
1953:835b1dcee38e | 1954:b0915f43b122 |
---|---|
1 using Test | |
2 | |
3 using Diffinitive.Grids | |
4 | |
5 @testset "ParameterSpace" begin | |
6 @test ndims(HyperBox([1,1], [2,2])) == 2 | |
7 @test ndims(unittetrahedron()) == 3 | |
8 end | |
9 | |
10 @testset "Interval" begin | |
11 @test Interval <: ParameterSpace{1} | |
12 | |
13 @test Interval(0,1) isa Interval{Int} | |
14 @test Interval(0,1.) isa Interval{Float64} | |
15 | |
16 @test unitinterval() isa Interval{Float64} | |
17 @test unitinterval() == Interval(0.,1.) | |
18 @test limits(unitinterval()) == (0.,1.) | |
19 | |
20 @test unitinterval(Int) isa Interval{Int} | |
21 @test unitinterval(Int) == Interval(0,1) | |
22 @test limits(unitinterval(Int)) == (0,1) | |
23 | |
24 @test boundary_identifiers(unitinterval()) == (LowerBoundary(), UpperBoundary()) | |
25 end | |
26 | |
27 @testset "HyperBox" begin | |
28 @test HyperBox{<:Any, 2} <: ParameterSpace{2} | |
29 @test HyperBox([1,1], [2,2]) isa HyperBox{Int, 2} | |
30 | |
31 @test HyperBox([1,2], [1.,2.]) isa HyperBox{Float64,2} | |
32 | |
33 @test limits(HyperBox([1,2], [3,4])) == ([1,2], [3,4]) | |
34 @test limits(HyperBox([1,2], [3,4]), 1) == (1,3) | |
35 @test limits(HyperBox([1,2], [3,4]), 2) == (2,4) | |
36 | |
37 @test unitsquare() isa HyperBox{Float64,2} | |
38 @test limits(unitsquare()) == ([0,0],[1,1]) | |
39 | |
40 @test unitcube() isa HyperBox{Float64,3} | |
41 @test limits(unitcube()) == ([0,0,0],[1,1,1]) | |
42 | |
43 @test unithyperbox(4) isa HyperBox{Float64,4} | |
44 @test limits(unithyperbox(4)) == ([0,0,0,0],[1,1,1,1]) | |
45 | |
46 | |
47 @test boundary_identifiers(unitsquare()) == [ | |
48 CartesianBoundary{1,LowerBoundary}(), | |
49 CartesianBoundary{1,UpperBoundary}(), | |
50 CartesianBoundary{2,LowerBoundary}(), | |
51 CartesianBoundary{2,UpperBoundary}(), | |
52 ] | |
53 | |
54 @test boundary_identifiers(unitcube()) == [ | |
55 CartesianBoundary{1,LowerBoundary}(), | |
56 CartesianBoundary{1,UpperBoundary}(), | |
57 CartesianBoundary{2,LowerBoundary}(), | |
58 CartesianBoundary{2,UpperBoundary}(), | |
59 CartesianBoundary{3,LowerBoundary}(), | |
60 CartesianBoundary{3,UpperBoundary}(), | |
61 ] | |
62 end | |
63 | |
64 @testset "Simplex" begin | |
65 @test Simplex{<:Any, 3} <: ParameterSpace{3} | |
66 @test Simplex([1,2], [3,4]) isa Simplex{Int, 2} | |
67 @test Simplex([1,2,3], [4,5,6],[1,1,1]) isa Simplex{Int, 3} | |
68 | |
69 @test Simplex([1,2], [3.,4.]) isa Simplex{Float64, 2} | |
70 | |
71 @test verticies(Simplex([1,2], [3,4])) == ([1,2], [3,4]) | |
72 | |
73 @test unittriangle() isa Simplex{Float64,2} | |
74 @test verticies(unittriangle()) == ([0,0], [1,0], [0,1]) | |
75 | |
76 @test unittetrahedron() isa Simplex{Float64,3} | |
77 @test verticies(unittetrahedron()) == ([0,0,0], [1,0,0], [0,1,0],[0,0,1]) | |
78 | |
79 @test unitsimplex(4) isa Simplex{Float64,4} | |
80 end |