Another common method for solving PDEs is to use a fast Poisson
solver. This method involves applying a Fast
Fourier Transform based sine transform to each column of the array
of data representing the right hand side of the equation.
This is followed by solving tridiagonal systems of equations associated
with each row.
When this is complete, another sine transform of each column will yield the
solution.
In this case it is best to view the grid as a distributed vector
of vectors, where the vector class has a special member function
for computing the sine transform, .
The distributed vector collection must have a special function for the
parallel solution of tridiagonal systems of equations.
In our case we use a standard cyclic reduction scheme.
This is accomplished by building a collection
class DistributedTridiagonal which is a subclass of
DistributedVector.
This class has a public function which takes two
parameters which correspond to the diagonal and off-diagonal elements
of the matrix which are stored in each element.
The cyclic reduction function is organized as two
phases of parallel operations.
The first phase is the forward elimination, the second is the back
solve step.
Communication only happens within the element function
and
.
The final poisson solver uses two collections
and
which
represent the initial data and the final solution.
Both are of type distributed tridiagonal of vector which is easily mapped
to a one dimensional template.