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 galerkinplans. The single input space X is used for both test and trial roles, so one tree is sufficient.

using CompScienceMeshes
using BEAST
using H2Trees

m = meshicosphere(25, 1.0)
X = raviartthomas(m)
tree = TwoNTree(X, 0.0; minvalues=100)
TwoNTree{3, BoxData{3, Float64}, Float64}
 level: 1 with 1 node(s) with on average 18750.0 points and 8.0 children and halfsize: 0.9995217120782627
- level: 2 with 8 node(s) with on average 2343.75 points and 7.0 children and halfsize: 0.49976085603913134
-- level: 3 with 56 node(s) with on average 334.82 points and 4.71 children and halfsize: 0.24988042801956567
--- level: 4 with 264 node(s) with on average 69.39 points and 1.82 children and halfsize: 0.12494021400978284
---- level: 5 with 480 node(s) with on average 16.59 points and 0.0 children and halfsize: 0.06247010700489142

1. Define the translating nodes iterator

tfiterator = H2Trees.TranslatingNodesIterator(;
    isnear=H2Trees.isnear(; additionalbufferboxes=1)
)

aggregatenode = H2Trees.istranslatingnode(; TranslatingNodesIterator=tfiterator)
H2Trees._IsTranslatingNodeFunctor{H2Trees._WellSeparatedIteratorFunctor{H2Trees._IsWellSeparatedFunctor{H2Trees.IsNearFunctor{Base.Pairs{Symbol, Int64, Nothing, @NamedTuple{additionalbufferboxes::Int64}}}}}}(H2Trees._WellSeparatedIteratorFunctor{H2Trees._IsWellSeparatedFunctor{H2Trees.IsNearFunctor{Base.Pairs{Symbol, Int64, Nothing, @NamedTuple{additionalbufferboxes::Int64}}}}}(H2Trees._IsWellSeparatedFunctor{H2Trees.IsNearFunctor{Base.Pairs{Symbol, Int64, Nothing, @NamedTuple{additionalbufferboxes::Int64}}}}(H2Trees.IsNearFunctor{Base.Pairs{Symbol, Int64, Nothing, @NamedTuple{additionalbufferboxes::Int64}}}(Base.Pairs(:additionalbufferboxes => 1)))))
  • tfiterator defines how near and far interactions are separated.
  • aggregatenode marks which nodes should be treated as translating nodes in the plan construction.

2. Construct plans in AggregateMode()

plans = H2Trees.galerkinplans(tree, aggregatenode, tfiterator, H2Trees.AggregateMode())

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.

3. Construct plans in AggregateTranslateMode()

plans = H2Trees.galerkinplans(tree, aggregatenode, tfiterator, 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.