Open Sbozzolo opened 1 year ago
We should just call float
on the argument, which will promote it to a float.
SphereDomain
is defined as
struct SphereDomain{FT} <: AbstractDomain where {FT <: AbstractFloat}
radius::FT
end
So, I am surprised we can pass Int
s here.
Oh, that's an interesting one. This isn't actually specifying what we want. It's actually parsing as
struct SphereDomain{FT} <: (AbstractDomain where {FT <: AbstractFloat})
radius::FT
end
However since
julia> AbstractDomain where {FT<:AbstractFloat}
AbstractDomain
this is the same as simply saying
struct SphereDomain{FT} <: AbstractDomain
radius::FT
end
What we actually want is
struct SphereDomain{FT<:AbstractFloat} <: AbstractDomain
radius::FT
end
@Sbozzolo care to make the change (and add a test?)
struct SphereDomain{FT<:AbstractFloat} <: AbstractDomain radius::FT end
Do we want it <: AbstractFloat
or <: Real
?
struct SphereDomain{FT<:AbstractFloat} <: AbstractDomain radius::FT end
Do we want it
<: AbstractFloat
or<: Real
?
I guess <:AbstractFloat
, given that the external package GaussQuadrature
wants floats.
I'll convert Int
s to Floats.
I think <: AbstractFloat
Returns