DUNE PDELab (2.8)
When solving vector-valued PDEs the result at each grid point must be a vector. When doing this the ordering of the global indices can be chosen, e.g. lexicographic or entity blocked. For many solvers, e.g. AMG, the ordering makes a difference in the efficiency of the solver. Further options, such as choosing to aggregate over the blocks and specifying the norm to be used can produce faster results.
First, we have to define one or more scalar grid function spaces to combine
There are two ways to define a vector-valued grid function space. If all scalar grid function spaces are the same a power grid function space can be used. In contrast a composite grid function space allows for different scalar grid function spaces. Both can be used with different blocking.
Let's first define a power grid function space with lexiographic ordering
And then a composite grid function space with entity blocked ordering
Full example code: recipe-blocking.cc