Skip to content

Fuse quadrule and momintegrals! into integrate! to avoid dynamic dispatch - #210

Merged
krcools merged 2 commits into
krcools:masterfrom
djukic14:perf/quadrule-integrate-fusion
Aug 18, 2026
Merged

Fuse quadrule and momintegrals! into integrate! to avoid dynamic dispatch#210
krcools merged 2 commits into
krcools:masterfrom
djukic14:perf/quadrule-integrate-fusion

Conversation

@djukic14

@djukic14 djukic14 commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

momintegrals! is renamed to integrate!. The quadrule methods used by
IntegralOperator assembly (dispatching on AbstractQuadStrat) now build
their quadrature rule and call integrate! on it directly, from within
the same method/branch, instead of returning it to assemblechunk_body!
for a separate call.

Which behavior results is controlled by a new action keyword:

  • action=ApplyIntegrate() (default) evaluates the rule
  • action=ReturnQRule() returns the rule unevaluated, e.g. for
    quadinfo (which now returns the rule instead of nothing)
  • action=ApplyIntegrateNonConforming() is used by
    NonConformingOverlapQRule/NonConformingTouchQRule, whose integrate!
    methods only have local refspaces in scope, not a full Space

quadrule methods outside this family (LocalOperator, excitations,
farfield/nearfield postprocessing) are untouched and keep their name.

Adds test/test_quadrule_integrate_dispatch.jl, an allocation-based
regression test proving the fusion avoids the union-boxing that the
old two-step call pattern incurred.

Updates CHANGELOG.md and the quadrule/quadstrat/assemble docs to
match, including docstrings for the new action types and integrate!/
quadrule/quadinfo.

I’m happy to discuss the naming and adjust it as needed.
The solution for NonConformingOverlapQRule / NonConformingTouchQRule isn’t quite as elegant, but it’s the best approach I came up with.

@djukic14
djukic14 force-pushed the perf/quadrule-integrate-fusion branch from 836858d to a6e0d86 Compare August 8, 2026 07:09
@krcools
krcools merged commit ac4cc29 into krcools:master Aug 18, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants