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

Add conversion dispatch for ForestWrapper. #76

Merged
merged 27 commits into from
Nov 26, 2024
Merged
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
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "T8code"
uuid = "d0cc0030-9a40-4274-8435-baadcfd54fa1"
authors = ["Johannes Markert <[email protected]>"]
version = "0.7.1"
version = "0.7.2"

[deps]
CEnum = "fa961155-64e5-5f13-b03f-caf6b980ea82"
Expand Down
7 changes: 7 additions & 0 deletions src/T8code.jl
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,13 @@ mutable struct ForestWrapper
end
end

Base.pointer(fw::ForestWrapper) = fw.pointer
# This dispatched conversion allows to conveniently pass a ForestWrapper object
# to `t8_forest_...` calls. The following link leads to a lengthy discussion
# about if this is a valid way to achieve this:
# https://discourse.julialang.org/t/how-to-use-ccall-cconvert-and-unsafe-convert-in-a-convenient-and-memory-safe-way/41932/18
Base.unsafe_convert(::Type{Ptr{t8_forest}}, fw::ForestWrapper) = fw.pointer

function clean_up()
# Finalize all registered t8code objects before MPI shuts down.
while length(T8CODE_OBJECT_TRACKER) > 0
Expand Down
Loading