aboutsummaryrefslogtreecommitdiff
path: root/julia
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2024-02-07 11:14:23 +0100
committerThomas White <taw@physics.org>2024-02-07 11:14:23 +0100
commit2710d085345f766afd885a41050b8d98ccab74d3 (patch)
treeff06b2df36895c7fbabe4771d6b18b522d4c281d /julia
parent55c02192fad40514a9dd8456aac9381561641cfe (diff)
Julia: RefList: index using tuple
I realised that separate h k l parameters leads to a profusion of argument splatting.
Diffstat (limited to 'julia')
-rw-r--r--julia/CrystFEL/src/reflists.jl9
-rw-r--r--julia/CrystFEL/src/symmetry.jl4
2 files changed, 7 insertions, 6 deletions
diff --git a/julia/CrystFEL/src/reflists.jl b/julia/CrystFEL/src/reflists.jl
index e1766f83..6629b186 100644
--- a/julia/CrystFEL/src/reflists.jl
+++ b/julia/CrystFEL/src/reflists.jl
@@ -93,11 +93,12 @@ Base.length(reflist::RefList) = ccall((:num_reflections, libcrystfel),
Cint, (Ptr{InternalRefList},), reflist.internalptr)
-function Base.getindex(reflist::RefList{T}, h, k, l) where T
+function Base.getindex(reflist::RefList{T}, indices) where T
- refl = ccall((:find_refl, libcrystfel),
- Ptr{InternalReflection}, (Ptr{InternalRefList},Cint,Cint,Cint),
- reflist.internalptr, h, k, l)
+ refl = @ccall libcrystfel.find_refl(reflist.internalptr::Ptr{InternalRefList},
+ indices[1]::Cint,
+ indices[2]::Cint,
+ indices[3]::Cint)::Ptr{InternalReflection}
if refl == C_NULL
return nothing
diff --git a/julia/CrystFEL/src/symmetry.jl b/julia/CrystFEL/src/symmetry.jl
index d6d2e477..4b4caa4d 100644
--- a/julia/CrystFEL/src/symmetry.jl
+++ b/julia/CrystFEL/src/symmetry.jl
@@ -100,12 +100,12 @@ function Base.iterate(sym::SymOpList, i)
end
-function asymmetricindices(sym::SymOpList, h, k, l)
+function asymmetricindices(sym::SymOpList, indices)
ho = Ref{Cint}(0)
ko = Ref{Cint}(0)
lo = Ref{Cint}(0)
@ccall libcrystfel.get_asymm(sym.internalptr::Ptr{InternalSymOpList},
- h::Cint, k::Cint, l::Cint,
+ indices[1]::Cint, indices[2]::Cint, indices[3]::Cint,
ho::Ref{Cint}, ko::Ref{Cint}, lo::Ref{Cint})::Cvoid
(ho[], ko[], lo[])
end