Martin,
I am trying to use this very cool new MarixFree-technique together with
PETSc and distributed triangulations, or in other words, I want to
combine step-37 with step-40. But one of the problems is, that
PETScWrappers::SolverBase only accept PETScWrappers::MatrixBase as
matrix-typ and I see no other way, than to derive the LaplaceOperator
(the class that implements the matrix operations) from
PETScWrappers::MatrixBase and to implement all the methods needed, but
maybe I missed something and someone knows a much easier way ....??
I am not a PETSc expert but I imagine that PETSc has a way to create a
'Mat' handle in such a way that it represents a matrix-free object that
can be given to solvers. In fact, I just found how:
http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatCreateShell.html
The MatrixBase class stores the 'Mat' handle of such objects, and so I
would suggest that you derive a class that represents such objects in
the following way:
class PETScWrappers::MatrixFree : PETScWrappers::MatrixBase
{
// overload existing virtual functions
virtual
void vmult (Vector &dst, Vector &src) const = 0;
};
This class would set up things in such a way that it calls
MatCreateShell in the beginning and then registers some callback with
MatShellSetOperation in such a way that whenever the callback is called,
it in turn calls the vmult() function above. Then you can implement your
LaplaceOperator class in terms of this MatrixFree interface. Ideally,
the vmult function is the only one that you'd need to implement in a
derived class.
Best
W.
PS: Of course we'd love to have this PETScWrappers::MatrixFree class if
you decide to go this route :-)
------------------------------------------------------------------------
Wolfgang Bangerth email: [email protected]
www: http://www.math.tamu.edu/~bangerth/
_______________________________________________
dealii mailing list http://poisson.dealii.org/mailman/listinfo/dealii