Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

T8coeMesh: Switching to t8_cmesh_new_brick_{2,3}d. #1939

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions src/meshes/t8code_mesh.jl
Original file line number Diff line number Diff line change
Expand Up @@ -294,15 +294,11 @@ function T8codeMesh(trees_per_dimension; polydeg = 1,

do_partition = 0
if NDIMS == 2
conn = T8code.Libt8.p4est_connectivity_new_brick(trees_per_dimension...,
periodicity...)
cmesh = t8_cmesh_new_from_p4est(conn, mpi_comm(), do_partition)
T8code.Libt8.p4est_connectivity_destroy(conn)
cmesh = t8_cmesh_new_brick_2d(trees_per_dimension..., periodicity...,
sc_MPI_COMM_WORLD)
elseif NDIMS == 3
conn = T8code.Libt8.p8est_connectivity_new_brick(trees_per_dimension...,
periodicity...)
cmesh = t8_cmesh_new_from_p8est(conn, mpi_comm(), do_partition)
T8code.Libt8.p8est_connectivity_destroy(conn)
cmesh = t8_cmesh_new_brick_3d(trees_per_dimension..., periodicity...,
sc_MPI_COMM_WORLD)
end

do_face_ghost = mpi_isparallel()
Expand Down Expand Up @@ -332,7 +328,7 @@ function T8codeMesh(trees_per_dimension; polydeg = 1,
end
end

# Note, `p*est_connectivity_new_brick` converts a domain of `[0,nx] x [0,ny] x ....`.
# Note, `t8_cmesh_new_brick_*d` converts a domain of `[0,nx] x [0,ny] x ....`.
# Hence, transform mesh coordinates to reference space [-1,1]^NDIMS before applying user defined mapping.
mapping_(xyz...) = mapping((x * 2.0 / tpd - 1.0 for (x, tpd) in zip(xyz,
trees_per_dimension))...)
Expand Down
1 change: 1 addition & 0 deletions test/test_t8code_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ end
# actually is `Ptr{P4est.LibP4est.p4est_connectivity}`.
conn = Trixi.P4est.LibP4est.p4est_connectivity_new_brick(2, 3, 1, 1)
mesh = T8codeMesh(conn)
Trixi.p4est_connectivity_destroy(conn)
all(size(mesh.tree_node_coordinates) .== (2, 2, 2, 6))
end
end
Expand Down
1 change: 1 addition & 0 deletions test/test_t8code_3d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ mkdir(outdir)
# actually is `Ptr{P4est.LibP4est.p8est_connectivity}`.
conn = Trixi.P4est.LibP4est.p8est_connectivity_new_brick(2, 3, 4, 1, 1, 1)
mesh = T8codeMesh(conn)
Trixi.p8est_connectivity_destroy(conn)
all(size(mesh.tree_node_coordinates) .== (3, 2, 2, 2, 24))
end
end
Expand Down
Loading