Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
KM3io.jl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
common
KM3io.jl
Commits
ef69993b
Verified
Commit
ef69993b
authored
1 month ago
by
Tamas Gal
Browse files
Options
Downloads
Patches
Plain Diff
Fix Direction constructor and improve Position
parent
5b6ea2a8
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/KM3io.jl
+2
-1
2 additions, 1 deletion
src/KM3io.jl
src/types.jl
+5
-2
5 additions, 2 deletions
src/types.jl
with
7 additions
and
3 deletions
src/KM3io.jl
+
2
−
1
View file @
ef69993b
...
@@ -23,7 +23,8 @@ const version = let
...
@@ -23,7 +23,8 @@ const version = let
end
end
using
DocStringExtensions
using
DocStringExtensions
using
StaticArrays
:
FieldVector
,
@SArray
,
SVector
using
StaticArrays
:
FieldVector
,
@SArray
,
SVector
,
Size
import
StaticArrays
:
similar_type
import
UnROOT
import
UnROOT
using
HDF5
using
HDF5
...
...
This diff is collapsed.
Click to expand it.
src/types.jl
+
5
−
2
View file @
ef69993b
...
@@ -12,6 +12,7 @@ struct Position{T} <: FieldVector{3, T}
...
@@ -12,6 +12,7 @@ struct Position{T} <: FieldVector{3, T}
y
::
T
y
::
T
z
::
T
z
::
T
end
end
similar_type
(
::
Type
{
<:
Position
},
::
Type
{
T
},
s
::
Size
{(
3
,)})
where
{
T
}
=
Position
{
T
}
"""
"""
A vector to represent a direction in 3D.
A vector to represent a direction in 3D.
...
@@ -20,14 +21,16 @@ struct Direction{T<:AbstractFloat} <: FieldVector{3, T}
...
@@ -20,14 +21,16 @@ struct Direction{T<:AbstractFloat} <: FieldVector{3, T}
x
::
T
x
::
T
y
::
T
y
::
T
z
::
T
z
::
T
function
Direction
(
x
,
y
,
z
)
function
Direction
{
U
}
(
x
,
y
,
z
)
where
U
T
=
promote_type
(
typeof
(
x
),
typeof
(
y
),
typeof
(
z
))
T
=
promote_type
(
typeof
(
x
),
typeof
(
y
),
typeof
(
z
)
,
U
)
if
!
(
T
<:
AbstractFloat
)
if
!
(
T
<:
AbstractFloat
)
throw
(
ArgumentError
(
"All elements must be convertible to an AbstractFloat"
))
throw
(
ArgumentError
(
"All elements must be convertible to an AbstractFloat"
))
end
end
new
{
T
}(
x
,
y
,
z
)
new
{
T
}(
x
,
y
,
z
)
end
end
end
end
similar_type
(
::
Type
{
<:
Direction
},
::
Type
{
T
},
s
::
Size
{(
3
,)})
where
{
T
}
=
Direction
{
T
}
"""
"""
Fallback constructor to show a proper error message.
Fallback constructor to show a proper error message.
"""
"""
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment