Skip to content

Commit

Permalink
Use new GaussLegendre fields
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeingold authored Dec 4, 2024
1 parent 167c3bd commit b5e5113
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/integral.jl
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,16 @@ function _integral(
N = Meshes.paramdim(geometry)

# Get Gauss-Legendre nodes and weights of type FP for a region [-1,1]ᴺ
xs, ws = FastGaussQuadrature.gausslegendre(rule.n)
xsFP = Iterators.map(FP, xs)
wsFP = Iterators.map(FP, ws)
weight_grid = Iterators.product(ntuple(Returns(wsFP), N)...)
node_grid = Iterators.product(ntuple(Returns(xsFP), N)...)
xs = Iterators.map(FP, rule.nodes)
ws = Iterators.map(FP, rule.weights)
weight_grid = Iterators.product(ntuple(Returns(ws), N)...)
node_grid = Iterators.product(ntuple(Returns(xs), N)...)

# Domain transformation: x [-1,1] ↦ t [0,1]
t(x) = (1 // 2) * x + (1 // 2)

function integrand((weights, nodes))
# Transforms nodes/xs, store in an NTuple
# ts = t.(nodes), but non-allocating
ts = ntuple(i -> t(nodes[i]), length(nodes))
# Integrand function
prod(weights) * f(geometry(ts...)) * differential(geometry, ts, diff_method)
Expand Down

0 comments on commit b5e5113

Please sign in to comment.