Skip to content

Commit

Permalink
Merge pull request #1975 from CliMA/ck/tstability_quad
Browse files Browse the repository at this point in the history
Fix type instability in quadratures
  • Loading branch information
charleskawczynski authored Sep 6, 2024
2 parents 4788064 + 380080c commit fde6717
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Quadratures/Quadratures.jl
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ struct Uniform{Nq} <: QuadratureStyle end
@inline degrees_of_freedom(::Uniform{Nq}) where {Nq} = Int(Nq)

@generated function quadrature_points(::Type{FT}, ::Uniform{Nq}) where {FT, Nq}
points = SVector{Nq}(range(-1 + 1 / Nq, step = 2 / Nq, length = Nq))
weights = SVector{Nq}(ntuple(i -> 2 / Nq, Nq))
points = SVector{Nq}(range(-1 + FT(1 / Nq), step = FT(2 / Nq), length = Nq))
weights = SVector{Nq}(ntuple(i -> FT(2 / Nq), Nq))
:($points, $weights)
end

Expand All @@ -110,9 +110,9 @@ struct ClosedUniform{Nq} <: QuadratureStyle end
) where {FT, Nq}
points = SVector{Nq}(range(FT(-1), FT(1), length = Nq))
weights = SVector{Nq}(
1 / (Nq - 1),
ntuple(i -> 2 / (Nq - 1), Nq - 2)...,
1 / (Nq - 1),
FT(1 / (Nq - 1)),
ntuple(i -> FT(2 / (Nq - 1)), Nq - 2)...,
FT(1 / (Nq - 1)),
)
:($points, $weights)
end
Expand Down

0 comments on commit fde6717

Please sign in to comment.