Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonReinhard committed May 22, 2024
1 parent b47c7fd commit 9375d99
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 30 deletions.
12 changes: 8 additions & 4 deletions src/interfaces/process_interface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -155,16 +155,20 @@ end
Convenience function dispatching to [`incoming_particles`](@ref) or [`outgoing_particles`](@ref) depending on the given direction.
"""
@inline particles(proc_def::AbstractProcessDefinition, ::Incoming) = incoming_particles(proc_def)
@inline particles(proc_def::AbstractProcessDefinition, ::Outgoing) = outgoing_particles(proc_def)
@inline particles(proc_def::AbstractProcessDefinition, ::Incoming) =
incoming_particles(proc_def)
@inline particles(proc_def::AbstractProcessDefinition, ::Outgoing) =
outgoing_particles(proc_def)

"""
number_particles(proc_def::AbstractProcessDefinition, ::ParticleDirection)
Convenience function dispatching to [`number_incoming_particles`](@ref) or [`number_outgoing_particles`](@ref) depending on the given direction.
"""
@inline number_particles(proc_def::AbstractProcessDefinition, ::Incoming) = number_incoming_particles(proc_def)
@inline number_particles(proc_def::AbstractProcessDefinition, ::Outgoing) = number_outgoing_particles(proc_def)
@inline number_particles(proc_def::AbstractProcessDefinition, ::Incoming) =
number_incoming_particles(proc_def)
@inline number_particles(proc_def::AbstractProcessDefinition, ::Outgoing) =
number_outgoing_particles(proc_def)

"""
in_phase_space_dimension(
Expand Down
31 changes: 8 additions & 23 deletions src/phase_spaces/utility.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@

# function assembling the correct type information for the tuple of ParticleStatefuls in a phasespace point constructed from momenta
@inline function _assemble_tuple_type(
particle_types::Tuple{SPECIES_T,Vararg{AbstractParticleType}},
dir::DIR_T,
ELTYPE::Type,
particle_types::Tuple{SPECIES_T,Vararg{AbstractParticleType}}, dir::DIR_T, ELTYPE::Type
) where {SPECIES_T<:AbstractParticleType,DIR_T<:ParticleDirection}
return (
ParticleStateful{DIR_T,SPECIES_T,ELTYPE},
Expand Down Expand Up @@ -40,7 +38,7 @@ end
}
throw(
InvalidInputError(
"expected $(dir) $(SPECIES_T()) but got $(DIR_IN_T()) $(SPECIES_IN_T())",
"expected $(dir) $(SPECIES_T()) but got $(DIR_IN_T()) $(SPECIES_IN_T())"
),
)
return nothing
Expand All @@ -55,10 +53,7 @@ end
end

@inline function _check_psp(
in_proc::P_IN_Ts,
out_proc::P_OUT_Ts,
in_p::IN_Ts,
out_p::OUT_Ts,
in_proc::P_IN_Ts, out_proc::P_OUT_Ts, in_p::IN_Ts, out_p::OUT_Ts
) where {
P_IN_Ts<:Tuple{Vararg{AbstractParticleType}},
P_OUT_Ts<:Tuple{Vararg{AbstractParticleType}},
Expand All @@ -72,10 +67,7 @@ end
end

@inline function _check_psp(
in_proc::P_IN_Ts,
out_proc::P_OUT_Ts,
in_p::IN_Ts,
out_p::OUT_Ts,
in_proc::P_IN_Ts, out_proc::P_OUT_Ts, in_p::IN_Ts, out_p::OUT_Ts
) where {
P_IN_Ts<:Tuple{Vararg{AbstractParticleType}},
P_OUT_Ts<:Tuple{Vararg{AbstractParticleType}},
Expand All @@ -89,10 +81,7 @@ end
end

@inline function _check_psp(
in_proc::P_IN_Ts,
out_proc::P_OUT_Ts,
in_p::IN_Ts,
out_p::OUT_Ts,
in_proc::P_IN_Ts, out_proc::P_OUT_Ts, in_p::IN_Ts, out_p::OUT_Ts
) where {
P_IN_Ts<:Tuple{Vararg{AbstractParticleType}},
P_OUT_Ts<:Tuple{Vararg{AbstractParticleType}},
Expand Down Expand Up @@ -123,7 +112,7 @@ SFourMomentum
```
"""
@inline function _eltype_from_psp_type(
type::Type{T},
type::Type{T}
) where {P,M,D,I,O,E,T<:PhaseSpacePoint{P,M,D,I,O,E}}
return E
end
Expand All @@ -146,18 +135,14 @@ SFourMomentum

# convenience function building a type stable tuple of ParticleStatefuls from the given process, momenta, and direction
function _build_particle_statefuls(
proc::AbstractProcessDefinition,
moms::NTuple{N,ELEMENT},
dir::ParticleDirection,
proc::AbstractProcessDefinition, moms::NTuple{N,ELEMENT}, dir::ParticleDirection
) where {N,ELEMENT<:AbstractFourMomentum}
N == number_particles(proc, dir) || throw(
InvalidInputError(
"expected $(number_particles(proc, dir)) $(dir) particles for the process but got $(N)",
),
)
res = Union{
Tuple{_assemble_tuple_type(particles(proc, dir), dir, ELEMENT)...}
}(
res = Union{Tuple{_assemble_tuple_type(particles(proc, dir), dir, ELEMENT)...}}(
ParticleStateful(dir, particle, mom) for
(particle, mom) in zip(particles(proc, dir), moms)
)
Expand Down
4 changes: 1 addition & 3 deletions test/test_implementation/test_process.jl
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,7 @@ struct TestPhasespaceDef_FAIL <: AbstractPhasespaceDefinition end

# dummy implementation of the process interface

function QEDprocesses._incident_flux(
in_psp::InPhaseSpacePoint{<:TestProcess,<:TestModel}
)
function QEDprocesses._incident_flux(in_psp::InPhaseSpacePoint{<:TestProcess,<:TestModel})
return _groundtruth_incident_flux(momenta(in_psp, Incoming()))
end

Expand Down

0 comments on commit 9375d99

Please sign in to comment.