-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26 from bmad-sim/work
Work
- Loading branch information
Showing
10 changed files
with
188 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
module Misc | ||
using ..GTPSA: @FastGTPSA!, GTPSA, evaluate!, TPS | ||
import ..BeamTracking: track! | ||
using ..BeamTracking | ||
using ..BeamTracking: get_work | ||
export track! | ||
|
||
Base.@kwdef struct Taylor{T<:TPS,U<:Union{Nothing,Quaternion{<:T}}} | ||
v::Coord{T} | ||
q::U | ||
end | ||
|
||
function track!(beam::Beam, ele::Misc.Taylor) | ||
|
||
end | ||
|
||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,25 @@ | ||
""" | ||
get_orbit_work(beam::Beam, n::Integer) | ||
get_work(beam::Beam, ::Val{N}) where N -> work | ||
Returns an array of `n` `StructArray{<:Coord}` based on the | ||
passed `Beam` struct which may be used as temporaries. | ||
Returns a tuple of `N` arrays of type `eltype(Beam.v.x)` and | ||
length `length(Beam.v.x)` which may be used as temporaries. | ||
### Arguments | ||
- `beam` -- Beam to extract types and number of particles from | ||
- `n` -- Number of `StructArray{<:Coord}` temporaries desired | ||
- `beam` -- Beam to extract types and number of particles from | ||
- `::Val{N}` -- Number of `N` temporary arrays desired | ||
""" | ||
function get_work(beam::Beam, n::Integer) | ||
function get_work(beam::Beam, ::Val{N}) where {N} | ||
sample = first(beam.v.x) | ||
T = typeof(sample) | ||
N_particle = length(beam.v.x) | ||
|
||
# Instead of using zeros, we do this to ensure | ||
# same GTPSA descriptor if T isa TPS. | ||
return ntuple(Val{N}()) do t | ||
r = Vector{T}(undef, N_particle) | ||
for idx in eachindex(r) | ||
r[idx] = zero(sample) | ||
end | ||
r | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.