Skip to content

Commit

Permalink
Add conversion dispatch for ForestWrapper. (#76)
Browse files Browse the repository at this point in the history
* Adding cleanup logic.

* Applying review comments and adding a test.

* Applied review suggestions.

* Adding format utility.

* Renamed formatter.

* Removed trixi formatter.

* Limited folders to format.

* Applie formatter.

* Fixed error in code.

* Updated formatter.

* Formatted examples.

* Revised package version.

* Downgraded formatter.

* Fixed version number of formatter.

* Applied formater with version x.x.60.

* Fixing compats.

* Bumped MPIPreferences.

* Update Project.toml

Co-authored-by: Joshua Lampert <[email protected]>

* Update test/Project.toml

Co-authored-by: Joshua Lampert <[email protected]>

* Refining test.

* Added test evals.

* Added further test eval.

* Adding convenient dispatch on type conversion.

* Version bump.

* Refined comment.

* Update src/T8code.jl

Co-authored-by: Joshua Lampert <[email protected]>

---------

Co-authored-by: Johannes Markert <[email protected]>
Co-authored-by: Joshua Lampert <[email protected]>
  • Loading branch information
3 people authored Nov 26, 2024
1 parent 235b47f commit fb5967f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
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

0 comments on commit fb5967f

Please sign in to comment.