Actual source code: ex1.c
petsc-3.3-p7 2013-05-11
2: /* Program usage: mpiexec -n <procs> ex2 [-help] [all PETSc options] */
4: static char help[] = "Appends to an ASCII file.\n\n";
6: /*T
7: Concepts: Viewer, append
8: T*/
10: #include <petscviewer.h>
14: int main(int argc,char **args)
15: {
16: PetscViewer viewer;
17: PetscInt i;
20: PetscInitialize(&argc,&args,(char *)0,help);
21: PetscViewerCreate(PETSC_COMM_WORLD, &viewer);
22: PetscViewerSetType(viewer, PETSCVIEWERASCII);
23: PetscViewerFileSetMode(viewer, FILE_MODE_APPEND);
24: PetscViewerFileSetName(viewer, "test.txt");
25: for(i = 0; i < 10; ++i) {
26: PetscViewerASCIIPrintf(viewer, "test line %d\n", i);
27: }
28: PetscFinalize();
29: return 0;
30: }