Skip to content

Commit

Permalink
feat(thick_disc): add inner and outer radii fields
Browse files Browse the repository at this point in the history
Added inner_radius and outer_radius fields to the thick disc struct. The
default values are zero and infinity, but now the `inner_radius()`
distaptch for ThickDisc will actually correctly resolve.
  • Loading branch information
fjebaker committed Nov 23, 2024
1 parent 4c8a22b commit b9f121b
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions src/geometry/discs/thick-disc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,24 @@ end
"""
struct ThickDisc{T,F,P} <: AbstractThickAccretionDisc{T}
inner_radius::T
outer_radius::T
f::F
params::P
end

ThickDisc(::Number, ::Number) =
error("Invalid constructor (you probably meant ThinDisc, not ThickDisc).")

function ThickDisc(cross_section::F) where {F}
# todo: float bit generic???
ThickDisc{Float64,F,Nothing}(cross_section, nothing)
end

function ThickDisc(cross_section::F, parameters::P) where {F,P}
# todo: float bit generic???
ThickDisc{Float64,F,P}(cross_section, parameters)
ThickDisc(cross_section; kwargs...) = ThickDisc(cross_section, nothing; kwargs...)

# todo: float bit generic???
function ThickDisc(
cross_section::F,
parameters::P;
inner_radius = zero(Float64),
outer_radius = Inf64,
) where {F,P}
ThickDisc{Float64,F,P}(inner_radius, outer_radius, cross_section, parameters)
end

cross_section(d::ThickDisc, ρ) = d.f(ρ, d.params...)
Expand Down

0 comments on commit b9f121b

Please sign in to comment.