From b9f121bbc6e3c8454533e282b7c65ea9e2518511 Mon Sep 17 00:00:00 2001 From: fjebaker Date: Sat, 23 Nov 2024 15:20:42 +0000 Subject: [PATCH] feat(thick_disc): add inner and outer radii fields 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. --- src/geometry/discs/thick-disc.jl | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/geometry/discs/thick-disc.jl b/src/geometry/discs/thick-disc.jl index d14221e3..f9dca54a 100644 --- a/src/geometry/discs/thick-disc.jl +++ b/src/geometry/discs/thick-disc.jl @@ -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...)