Petrov Plans

This page shows how to build Petrov plans with petrovplans. In the Petrov case, the test tree and trial tree are generally different. For identical test and trial trees, see Galerkin Plans.

Because test and trial spaces are different (X and Y), the construction uses distinct test and trial trees.

using CompScienceMeshes
using BEAST
using H2Trees

mx = meshicosphere(25, 1.0)
my = meshicosphere(30, 2.0)
translate!(my, [0.0, 0.0, 5.0])

X = raviartthomas(mx)
Y = raviartthomas(my)

tree = TwoNTree(X, Y, 0.0; testminvalues=100, trialminvalues=100)
BlockTree{TwoNTree{3, BoxData{3, Float64}, Float64}}(TwoNTree{3, BoxData{3, Float64}, Float64}
 level: 2 with 1 node(s) with on average 18750.0 points and 8.0 children and halfsize: 0.9995217120782627
- level: 3 with 8 node(s) with on average 2343.75 points and 7.0 children and halfsize: 0.49976085603913134
-- level: 4 with 56 node(s) with on average 334.82 points and 4.71 children and halfsize: 0.24988042801956567
--- level: 5 with 264 node(s) with on average 69.39 points and 1.82 children and halfsize: 0.12494021400978284
---- level: 6 with 480 node(s) with on average 16.59 points and 0.0 children and halfsize: 0.06247010700489142
, TwoNTree{3, BoxData{3, Float64}, Float64}
 level: 1 with 1 node(s) with on average 27000.0 points and 8.0 children and halfsize: 1.9990434241565254
- level: 2 with 8 node(s) with on average 3375.0 points and 7.0 children and halfsize: 0.9995217120782627
-- level: 3 with 56 node(s) with on average 482.14 points and 4.71 children and halfsize: 0.49976085603913134
--- level: 4 with 264 node(s) with on average 99.91 points and 3.09 children and halfsize: 0.24988042801956567
---- level: 5 with 816 node(s) with on average 24.93 points and 0.0 children and halfsize: 0.12494021400978284
)

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.petrovplans(tree, aggregatenode, tfiterator, H2Trees.AggregateMode())

In AggregateMode() the forward pair is:

  • trialaggregationplan: AggregatePlan
  • testdisaggregationplan: DisaggregateTranslatePlan

The transposed companion plans are built automatically:

  • testaggregationplan: AggregateTranslatePlan
  • trialdisaggregationplan: DisaggregatePlan

The relevantlevels field contains the levels where the operations are active. The mintranslationlevel field gives the first level where translations occur.

3. Construct plans in AggregateTranslateMode()

plans = H2Trees.petrovplans(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 contains the levels where the operations are active. The mintranslationlevel field gives the first level where translations occur.