comparison test/Grids/equidistant_grid_test.jl @ 1748:03894fd7b132 feature/grids/manifolds

Merge feature/grids/curvilinear
author Jonatan Werpers <jonatan@werpers.com>
date Wed, 11 Sep 2024 15:41:58 +0200
parents a4c52ae93b11 471a948cd2b2
children a93d2b668446
comparison
equal deleted inserted replaced
1695:a4c52ae93b11 1748:03894fd7b132
1 using Sbplib.Grids 1 using Diffinitive.Grids
2 using Test 2 using Test
3 using Sbplib.RegionIndices 3 using Diffinitive.LazyTensors
4 using Sbplib.LazyTensors
5 using StaticArrays 4 using StaticArrays
6 5
7 6
8 @testset "EquidistantGrid" begin 7 @testset "EquidistantGrid" begin
9 @test EquidistantGrid(0:0.1:10) isa EquidistantGrid 8 @test EquidistantGrid(0:0.1:10) isa EquidistantGrid
62 @test min_spacing(EquidistantGrid(0:0.1:10)) == 0.1 61 @test min_spacing(EquidistantGrid(0:0.1:10)) == 0.1
63 end 62 end
64 63
65 @testset "boundary_identifiers" begin 64 @testset "boundary_identifiers" begin
66 g = EquidistantGrid(0:0.1:10) 65 g = EquidistantGrid(0:0.1:10)
67 @test boundary_identifiers(g) == (Lower(), Upper()) 66 @test boundary_identifiers(g) == (LowerBoundary(), UpperBoundary())
68 @inferred boundary_identifiers(g) 67 @inferred boundary_identifiers(g)
69 end 68 end
70 69
71 @testset "boundary_grid" begin 70 @testset "boundary_grid" begin
72 g = EquidistantGrid(0:0.1:1) 71 g = EquidistantGrid(0:0.1:1)
73 @test boundary_grid(g, Lower()) == ZeroDimGrid(0.0) 72 @test boundary_grid(g, LowerBoundary()) == ZeroDimGrid(0.0)
74 @test boundary_grid(g, Upper()) == ZeroDimGrid(1.0) 73 @test boundary_grid(g, UpperBoundary()) == ZeroDimGrid(1.0)
75 end 74 end
76 75
77 @testset "boundary_indices" begin 76 @testset "boundary_indices" begin
78 g = EquidistantGrid(0:0.1:1) 77 g = EquidistantGrid(0:0.1:1)
79 @test boundary_indices(g, Lower()) == (1,) 78 @test boundary_indices(g, LowerBoundary()) == (1,)
80 @test boundary_indices(g, Upper()) == (11,) 79 @test boundary_indices(g, UpperBoundary()) == (11,)
81 80
82 g = EquidistantGrid(2:0.1:10) 81 g = EquidistantGrid(2:0.1:10)
83 @test boundary_indices(g, Lower()) == (1,) 82 @test boundary_indices(g, LowerBoundary()) == (1,)
84 @test boundary_indices(g, Upper()) == (81,) 83 @test boundary_indices(g, UpperBoundary()) == (81,)
85 84
86 end 85 end
87 86
88 @testset "refine" begin 87 @testset "refine" begin
89 g = EquidistantGrid(0:0.1:1) 88 g = EquidistantGrid(0:0.1:1)