Skip to content
Snippets Groups Projects
Commit 3b660313 authored by Florian Atteneder's avatar Florian Atteneder
Browse files

wip: extend test, but failing due to discontinuous index

parent bebc0ac1
Branches hilbert
No related tags found
No related merge requests found
...@@ -187,54 +187,58 @@ end ...@@ -187,54 +187,58 @@ end
@testset "Tree" begin @testset "Tree" begin
t1d = Tree1d(5) for layout in [ :snake, :hilbert ]
t2d = Tree2d(5,6)
t3d = Tree3d(5,6,7) t1d = Tree1d(4, layout=layout)
t2d = Tree2d(2,4, layout=layout)
@test n_cells(t1d) == 5 t3d = Tree3d(2,4,8, layout=layout)
@test n_cells(t2d) == 5*6
@test n_cells(t3d) == 5*6*7 @test n_cells(t1d) == 4
@test n_cells(t2d) == 2*4
# t1d = Tree1d(5, periodic=(true,)) @test n_cells(t3d) == 2*4*8
# t2d = Tree2d(5,6, periodic=(true,false))
# t3d = Tree3d(5,6,7, periodic=(true,false,true)) # t1d = Tree1d(5, periodic=(true,))
# t2d = Tree2d(5,6, periodic=(true,false))
# call show # t3d = Tree3d(5,6,7, periodic=(true,false,true))
println(t1d)
println(t2d) # call show
println(t3d) println(t1d)
println(t2d)
# iterator interface println(t3d)
length_t1d = 0
for c in t1d # iterator interface
length_t1d += 1 length_t1d = 0
end for c in t1d
@test length_t1d == n_cells(t1d) length_t1d += 1
end
length_t2d = 0 @test length_t1d == n_cells(t1d)
for c in t2d
length_t2d += 1 length_t2d = 0
end for c in t2d
@test length_t2d == n_cells(t2d) length_t2d += 1
end
@test length_t2d == n_cells(t2d)
length_t3d = 0
for c in t3d
length_t3d += 1
end
@test length_t3d == n_cells(t3d)
x_extends, y_extends, z_extends = (-2.0,2.0), (-10.0,0.0), (1.0,3.0)
boxes1d = place_boxes(t1d, x_extends)
boxes2d = place_boxes(t2d, x_extends, y_extends)
boxes3d = place_boxes(t3d, x_extends, y_extends, z_extends)
# # TODO Visualize generated trees to check for correctness
# # TODO How to check if periodic boundaries are connected?
# # Perhaps also save is_boundarycell info and color boundary cells.
# # for (name, tree) in [ ("tree1d", t1d), ("tree2d", t2d), ("tree3d", t3d) ]
# # open(filename, "w") do file
# # writedlm(file, tree.coords)
# # end
# # end
length_t3d = 0
for c in t3d
length_t3d += 1
end end
@test length_t3d == n_cells(t3d)
x_extends, y_extends, z_extends = (-2.0,2.0), (-10.0,0.0), (1.0,3.0)
boxes1d = place_boxes(t1d, x_extends)
boxes2d = place_boxes(t2d, x_extends, y_extends)
boxes3d = place_boxes(t3d, x_extends, y_extends, z_extends)
# # TODO Visualize generated trees to check for correctness
# # TODO How to check if periodic boundaries are connected?
# # Perhaps also save is_boundarycell info and color boundary cells.
# # for (name, tree) in [ ("tree1d", t1d), ("tree2d", t2d), ("tree3d", t3d) ]
# # open(filename, "w") do file
# # writedlm(file, tree.coords)
# # end
# # end
end end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment