Aggregate Plan

Aggregation Tree

AggregatePlan describes the upward aggregation traversal on a tree. It specifies:

  • which nodes are visited per level during aggregation,
  • which node moments must be stored for later phases, and

This is a non-translating aggregation plan. Its counterpart for a matrix-vector product is DisaggregateTranslatePlan.

Building an AggregatePlan

Conceptually, AggregatePlan is built from a tree and a function aggregatenode(node).

  • If aggregatenode(node) is true, that node is marked for storage.
  • If not, the node is still included in traversal when one of its ancestors is a storing node.
  • Aggregation levels are organized from leaves toward the root.

This ensures aggregation paths remain complete for all moments that must be available later.

Fields

An AggregatePlan stores:

  • nodes: aggregation nodes grouped by level.
  • levels: aggregation levels, ordered leaves-to-root.
  • storenode: booleans indicating which node moments are stored.
  • rootoffset: offset used to convert node ids to compact 1-based indices.
  • tree: the tree associated with the plan.

Example

The example below constructs Galerkin plans in AggregateMode() and extracts the trial-side AggregatePlan.

plans = H2Trees.buildplans(
    tree;
    builder=H2Trees.PlanBuilder(;
        isnear=H2Trees.isnear(; additionalbufferboxes=1),
        aggregationmode=H2Trees.AggregateMode(),
    ),
)
aggregateplan = plans.trialaggregationplan
aggregateplan
AggregatePlan{TwoNTree{3, BoxData{3, Float64}, Float64, Base.RefValue{TreeIndex}}}([[66, 67, 68, 69, 70, 71, 72, 73, 74, 75  …  320, 321, 322, 323, 324, 325, 326, 327, 328, 329], [10, 11, 12, 13, 14, 15, 16, 17, 18, 19  …  56, 57, 58, 59, 60, 61, 62, 63, 64, 65]], 4:-1:3, Bool[0, 0, 0, 0, 0, 0, 0, 0, 0, 1  …  1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 0, TwoNTree{3,Float64}(nodes=329, leaves=272, levels=1:4, root=1))