Skip to content

Commit

Permalink
Add macro for t8_geom_load_tree_data_fn (#71)
Browse files Browse the repository at this point in the history
  • Loading branch information
bennibolm authored Sep 18, 2024
1 parent baa52ff commit 226dc40
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/T8code.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ include("Libt8.jl")

export @t8_adapt_callback
export @t8_replace_callback
export @t8_load_tree_data
export @T8_ASSERT
export t8_free

Expand Down Expand Up @@ -213,6 +214,20 @@ macro t8_replace_callback(callback)
Cint, t8_locidx_t)))
end

# typedef void (*t8_geom_load_tree_data_fn) (t8_cmesh_t cmesh,
# t8_gloidx_t gtreeid,
# const void **tree_data);
"""
@t8_load_tree_data(callback)
Wrap the Julia function `callback` in an `@cfunction` with the appropriate
signature required for callback functions in [`t8_geom_load_tree_data_fn`](@ref).
"""
macro t8_load_tree_data(callback)
:(@cfunction($callback, Cvoid,
(t8_cmesh_t, t8_gloidx_t, Ptr{Cvoid})))
end

function __init__()
if !preferences_set_correctly()
@warn "System MPI version detected, but not a system t8code version. To make T8code.jl work, you need to set the preferences, see https://github.com/DLR-AMR/T8code.jl#using-a-custom-version-of-mpi-andor-t8code."
Expand Down

0 comments on commit 226dc40

Please sign in to comment.