Skip to content
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
23 changes: 16 additions & 7 deletions ext/SolidStateDetectorsLegendHDF5IOExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,24 @@ function SolidStateDetectors.simulate_waveforms( mcevents::AbstractVector{<:Name
end


# Add support for reading and writing CartesianPoint and CylindricalPoint using LegendHDF5IO
function __init__()
LegendHDF5IO._datatype_dict["cartesianpoint"] = CartesianPoint
LegendHDF5IO._datatype_dict["cylindricalpoint"] = CylindricalPoint
# Add support for reading and writing CartesianPoint and CylindricalPoint using LegendHDF5IO.
# LegendHDF5IO v0.2 registers datatype names with `register_datatype!`, v0.1 through its
# datatype dictionary and `datatype_to_string`:
if isdefined(LegendHDF5IO, :register_datatype!)
function __init__()
LegendHDF5IO.register_datatype!("cartesianpoint", CartesianPoint)
LegendHDF5IO.register_datatype!("cylindricalpoint", CylindricalPoint)
end
else
function __init__()
LegendHDF5IO._datatype_dict["cartesianpoint"] = CartesianPoint
LegendHDF5IO._datatype_dict["cylindricalpoint"] = CylindricalPoint
end

LegendHDF5IO.datatype_to_string(::Type{<:CartesianPoint}) = "cartesianpoint"
LegendHDF5IO.datatype_to_string(::Type{<:CylindricalPoint}) = "cylindricalpoint"
end

LegendHDF5IO.datatype_to_string(::Type{<:CartesianPoint}) = "cartesianpoint"
LegendHDF5IO.datatype_to_string(::Type{<:CylindricalPoint}) = "cylindricalpoint"



# support writing points to HDF5 file using LH5Array
Expand Down
2 changes: 1 addition & 1 deletion test/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"
[compat]
Geant4 = "0.3.1"
LegendDataTypes = "0.1.3"
LegendHDF5IO = "0.1"
LegendHDF5IO = "0.1, 0.2"
Loading