Galerkin Plans

In the Galerkin case, the test tree and trial tree are the same. For distinct test and trial trees, see Petrov Plans.

This page shows how to build Galerkin plans with buildplans. The single input space X is used for both test and trial roles, so one tree is sufficient. The result is a PlanSet; see Plans Overview for accessors and named-tuple interoperability.

using CompScienceMeshes
using BEAST
using H2Trees

m = meshicosphere(25, 1.0)
X = raviartthomas(m)
tree = buildtree(X; builder=TwoNTreeBuilder(; minhalfsize=0.0, minvalues=100))
TwoNTree{3,Float64}
level   nodes         avg values    avg children  halfsize      
1       1             18750.0       8.0           0.9995217120782627
2       8             2343.75       7.0           0.49976085603913134
3       56            334.82        4.71          0.24988042801956567
4       264           69.39         0.0           0.12494021400978284

1. Construct plans in AggregateMode()

plans = H2Trees.buildplans(
    tree;
    builder=H2Trees.PlanBuilder(;
        isnear=H2Trees.isnear(; additionalbufferboxes=1),
        aggregationmode=H2Trees.AggregateMode(),
    ),
)

PlanBuilder's translatingnodesiterator and aggregatenode both default from isnear, so overriding isnear alone (as above) keeps them consistent without reconstructing either by hand. Pass translatingnodesiterator/aggregatenode explicitly only when they need to differ from what isnear alone would produce.

In AggregateMode() the forward pair is:

  • trialaggregationplan: AggregatePlan
  • testdisaggregationplan: DisaggregateTranslatePlan

The transposed plans are built automatically:

  • testaggregationplan: AggregateTranslatePlan
  • trialdisaggregationplan: DisaggregatePlan

The relevantlevels field contains the levels where the operations are active. Equivalent accessors such as H2Trees.relevantlevels(plans) and H2Trees.trialaggregationplan(plans) are also available.

2. Construct plans in AggregateTranslateMode()

plans = H2Trees.buildplans(
    tree;
    builder=H2Trees.PlanBuilder(;
        isnear=H2Trees.isnear(; additionalbufferboxes=1),
        aggregationmode=H2Trees.AggregateTranslateMode(),
    ),
)

In AggregateTranslateMode() the forward pair is swapped:

  • trialaggregationplan: AggregateTranslatePlan
  • testdisaggregationplan: DisaggregatePlan

And the automatically built transposed plans become:

  • testaggregationplan: AggregatePlan
  • trialdisaggregationplan: DisaggregateTranslatePlan

The relevantlevels field again contains the levels where the operations are active.