diff options
author | Thomas White <taw@physics.org> | 2024-01-21 12:20:09 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2024-02-06 16:59:35 +0100 |
commit | d371a2b753fd20da36ec6a46f06e4bc8f058f1fa (patch) | |
tree | 570791e3edcc7c5ec99743d3c6764f25795e1187 /julia/CrystFEL | |
parent | 85a57decf6cafc353b792cd52f476eed4ade3915 (diff) |
Julia: Add push!(image, crystal, reflections)
New method needed following "Crystals shouldn't own RefLists" patch
series.
Diffstat (limited to 'julia/CrystFEL')
-rw-r--r-- | julia/CrystFEL/src/image.jl | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/julia/CrystFEL/src/image.jl b/julia/CrystFEL/src/image.jl index 020117e7..33af3252 100644 --- a/julia/CrystFEL/src/image.jl +++ b/julia/CrystFEL/src/image.jl @@ -217,6 +217,21 @@ function Base.push!(image::Image, cr::Crystal) end +function Base.push!(image::Image, cr::Crystal, reflections::RefList{UnmergedReflection}) + @ccall libcrystfel.image_add_crystal_refls(image.internalptr::Ptr{InternalImage}, + cr.internalptr::Ptr{InternalCrystal}, + reflections.internalptr::Ptr{InternalRefList})::Cvoid + idata = unsafe_load(image.internalptr) + ncryst = idata.n_crystals + pairptr = unsafe_load(idata.crystals, ncryst) + pairptr.owns_crystal = 0 + pairptr.owns_reflist = 0 + unsafe_store!(idata.crystals, pairptr, ncryst) + push!(getfield(image, :crystals), cr) + push!(getfield(image, :reflists), reflections) +end + + """ Image(dtempl::DataTemplate) |