2.4.9. Writing Application Codes with PETSc

Up: Contents Next: Referencing PETSc Previous: Compiling and Running Programs

The examples throughout the library demonstrate thesoftware usage and can serve as templates for developing custom applications. We suggest that new PETSc users examine programs in the directories

  ${PETSC_DIR}/src/<component>/examples/tutorials, 
where <component> denotes any of the PETSc components (listed in the following section), such as snes or sles. The HTML version of the manual pages located at
   ${PETSC_DIR}/docs/manualpages/index.html or  
   http://www.mcs.anl.gov/petsc/docs/manualpages/index.html 
provides indices (organized by both routine names and concepts) to the tutorial examples.

To write a new application program using PETSc, we suggest the following procedure:

    1. Install and test PETSc according to the instructions in ${}PETSC_DIR/docs/installation.html.
    2. Copy one of the many PETSc examples in the component directory that corresponds to the class of problem of interest (e.g., for linear solvers, see ${}PETSC_DIR/src/sles/examples/tutorials).
    3. Copy the corresponding makefile within the example directory; compile and run the example program.
    4. Use the example program as a starting point for developing a custom code.


Up: Contents Next: Referencing PETSc Previous: Compiling and Running Programs