next up previous contents
Next: Preconditioner Application Up: Program structure Previous: Example program structure

Common Setup

   The setup for all preconditioners in the ParPre package has some common elements.

Assume that the following variables have been declared:

#include "petsc.h"
#include "parpre.h"
#include "mat.h"
#include "pc.h"

  MPI_Comm comm;
  Mat A;
  PC the_pc;
  int ierr;
(The Mat type is a Petsc datastructure; the conversion of user structures to such a type is explained in section 3.)

The setup then takes the following steps[*].

In order to create the preconditioner, first the data structure has to be created:

  ierr = PCCreate(comm,&the_pc);
Next, the name of the method needs to be declared. This can be done by a direct call in the program, eg,
  PCSetType(the_pc,PCNONE);
or the type can be set by a runtime option[*], eg,
 mpirun -pctype none [other parameters and options]
In addition to the preconditioner type declaration some auxiliary setup calls may be required. The declaration ends with:
  ierr = ParPreSetup(comm,A,the_pc);

The available preconditioners and the applicable auxiliary functions are listed and explained in part II.



Victor Eijkhout
7/27/1998