Skip to content

Commit

Permalink
removed QEDbase namespace usage (#91)
Browse files Browse the repository at this point in the history
Co-authored-by: Uwe Hernandez Acosta <u.hernandez@hzdr.de>
  • Loading branch information
szabo137 and Uwe Hernandez Acosta authored Dec 4, 2024
1 parent 8a9976a commit 30ad709
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 29 deletions.
21 changes: 8 additions & 13 deletions src/coordinate_map/cached.jl
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,7 @@ out_coord_map(out_coords)
"""
struct CoordinateMapCached{
P<:AbstractProcessDefinition,
M<:AbstractModelDefinition,
PSL<:QEDbase.AbstractPhaseSpaceLayout,
TM,
P<:AbstractProcessDefinition,M<:AbstractModelDefinition,PSL<:AbstractPhaseSpaceLayout,TM
} <: AbstractCoordinateMap
proc::P
model::M
Expand All @@ -80,38 +77,36 @@ end
function CoordinateMapCached(
proc::AbstractProcessDefinition,
model::AbstractModelDefinition,
psl::QEDbase.AbstractInPhaseSpaceLayout,
psl::AbstractInPhaseSpaceLayout,
in_coords::NTuple{N,T},
) where {N,T<:Real}
in_moms = QEDbase.build_momenta(proc, model, psl, in_coords)
in_moms = build_momenta(proc, model, psl, in_coords)
return CoordinateMapCached(proc, model, psl, in_moms)
end

function CoordinateMapCached(
proc::AbstractProcessDefinition,
model::AbstractModelDefinition,
psl::QEDbase.AbstractOutPhaseSpaceLayout,
psl::AbstractOutPhaseSpaceLayout,
in_coords::NTuple{N,T},
) where {N,T<:Real}
in_moms = QEDbase.build_momenta(
proc, model, QEDbase.in_phase_space_layout(psl), in_coords
)
in_moms = build_momenta(proc, model, in_phase_space_layout(psl), in_coords)
return CoordinateMapCached(proc, model, psl, in_moms)
end

# make the transform callable: for in_psl maps return the cached
@inline function (
coord_map::CoordinateMapCached{P,M,PSL}
)() where {P,M,PSL<:QEDbase.AbstractInPhaseSpaceLayout}
)() where {P,M,PSL<:AbstractInPhaseSpaceLayout}
return getfield(coord_map, :in_moms)
end

# make the transform callable: for out_psl maps
@inline function (coord_map::CoordinateMapCached{P,M,PSL})(
out_coords::Tuple
) where {P,M,PSL<:QEDbase.AbstractOutPhaseSpaceLayout}
) where {P,M,PSL<:AbstractOutPhaseSpaceLayout}
in_moms = coord_map.in_moms
return QEDbase.build_momenta(
return build_momenta(
coord_map.proc, coord_map.model, in_moms, coord_map.psl, out_coords
)
end
19 changes: 7 additions & 12 deletions src/coordinate_map/map.jl
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ coord_map(in_coords, out_coords)
and momentum conservation for the process.
"""
struct CoordinateMap{P,M,PSL<:QEDbase.AbstractPhaseSpaceLayout} <: AbstractCoordinateMap
struct CoordinateMap{P,M,PSL<:AbstractPhaseSpaceLayout} <: AbstractCoordinateMap
proc::P
model::M
psl::PSL
Expand All @@ -75,22 +75,17 @@ end
# make the transform callable
@inline function (coord_map::CoordinateMap{P,M,PSL})(
in_coords::Tuple
) where {P,M,PSL<:QEDbase.AbstractInPhaseSpaceLayout}
return QEDbase.build_momenta(coord_map.proc, coord_map.model, coord_map.psl, in_coords)
) where {P,M,PSL<:AbstractInPhaseSpaceLayout}
return build_momenta(coord_map.proc, coord_map.model, coord_map.psl, in_coords)
end

# make the transform callable
@inline function (coord_map::CoordinateMap{P,M,PSL})(
in_coords::Tuple, out_coords::Tuple
) where {P,M,PSL<:QEDbase.AbstractOutPhaseSpaceLayout}
in_moms = QEDbase.build_momenta(
coord_map.proc,
coord_map.model,
QEDbase.in_phase_space_layout(coord_map.psl),
in_coords,
) where {P,M,PSL<:AbstractOutPhaseSpaceLayout}
in_moms = build_momenta(
coord_map.proc, coord_map.model, in_phase_space_layout(coord_map.psl), in_coords
)
return in_moms,
QEDbase.build_momenta(
coord_map.proc, coord_map.model, in_moms, coord_map.psl, out_coords
)
build_momenta(coord_map.proc, coord_map.model, in_moms, coord_map.psl, out_coords)
end
2 changes: 1 addition & 1 deletion src/phase_space_layouts/in_channel/two_body/general.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ processes can be modeled flexibly and accurately within phase space calculations
- [`AbstractTwoBodyRestSystem`](@ref): A subtype representing two-body systems where one
particle is at rest.
"""
abstract type AbstractTwoBodyInPhaseSpaceLayout <: QEDbase.AbstractInPhaseSpaceLayout end
abstract type AbstractTwoBodyInPhaseSpaceLayout <: AbstractInPhaseSpaceLayout end
2 changes: 1 addition & 1 deletion test/coordinates.jl
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ end

@testset "utility" begin
@test coordinate_names(test_coord_set) == COORD_NAMES
@test QEDbase.phase_space_dimension(test_coord_set) == DIM
@test phase_space_dimension(test_coord_set) == DIM
end

@testset "error handling" begin
Expand Down
4 changes: 2 additions & 2 deletions test/test_implementation/test_phase_space_layout.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
### Trivial phase-space layouts

# maps all components onto four momenta
struct TrivialInPSL <: QEDbase.AbstractInPhaseSpaceLayout end
struct TrivialInPSL <: AbstractInPhaseSpaceLayout end

@inline QEDbase.phase_space_dimension(
proc::AbstractProcessDefinition, ::AbstractModelDefinition, ::TrivialInPSL
Expand All @@ -14,7 +14,7 @@ struct TrivialInPSL <: QEDbase.AbstractInPhaseSpaceLayout end
end

# maps componets of N-1 particles onto four-momenta and uses energy-momentum conservation
struct TrivialOutPSL <: QEDbase.AbstractOutPhaseSpaceLayout{TrivialInPSL}
struct TrivialOutPSL <: AbstractOutPhaseSpaceLayout{TrivialInPSL}
in_psl::TrivialInPSL
end

Expand Down

0 comments on commit 30ad709

Please sign in to comment.