Actual source code: ex7.c
petsc-3.3-p7 2013-05-11
2: /* Program usage: mpiexec ex1 [-help] [all PETSc options] */
4: static char help[] = "Demonstrates using PetscWebServe().\nRun with -ams_publish_objects\n\n";
6: /*T
7: Concepts: introduction to PETSc;
8: Concepts: printing^in parallel
9: Processors: n
10: T*/
11:
12: #include <petscsys.h>
13: #include <petscksp.h>
14: int main(int argc,char **argv)
15: {
17: PetscRandom rand1,rand2;
19: /*
20: Every PETSc routine should begin with the PetscInitialize() routine.
21: argc, argv - These command line arguments are taken to extract the options
22: supplied to PETSc and options supplied to MPI.
23: help - When PETSc executable is invoked with the option -help,
24: it prints the various options that can be applied at
25: runtime. The user can use the "help" variable place
26: additional help messages in this printout.
27: */
28: PetscInitialize(&argc,&argv,(char *)0,help);
29: PetscRandomCreate(PETSC_COMM_WORLD,&rand1);
30: PetscRandomSetFromOptions(rand1);
31: PetscRandomCreate(PETSC_COMM_WORLD,&rand2);
32: PetscRandomSetFromOptions(rand2);
33: #if defined(PETSC_USE_SERVER)
34: PetscPrintf(PETSC_COMM_WORLD,"Starting up PetscWebServe()\n");
35: PetscWebServe(PETSC_COMM_WORLD,PETSC_DEFAULT);
36: while (1) {;}
37: #endif
38: PetscRandomDestroy(&rand1);
39: PetscRandomDestroy(&rand2);
40: /*
41: Always call PetscFinalize() before exiting a program. This routine
42: - finalizes the PETSc libraries as well as MPI
43: - provides summary and diagnostic information if certain runtime
44: options are chosen (e.g., -log_summary). See PetscFinalize()
45: manpage for more information.
46: */
47: PetscFinalize();
48: return 0;
49: }