Actual source code: ex7.c

petsc-3.4.5 2014-06-29
  2: static char help[] = "Demonstrates using PetscWebServe().\nRun with -random_view ams\n\n";

  4: /*T
  5:    Concepts: introduction to PETSc;
  6:    Concepts: printing^in parallel
  7:    Processors: n
  8: T*/

 10: #include <petscsys.h>

 12: int main(int argc,char **argv)
 13: {
 15:   PetscRandom    rand1,rand2;

 17:   /*
 18:     Every PETSc routine should begin with the PetscInitialize() routine.
 19:     argc, argv - These command line arguments are taken to extract the options
 20:                  supplied to PETSc and options supplied to MPI.
 21:     help       - When PETSc executable is invoked with the option -help,
 22:                  it prints the various options that can be applied at
 23:                  runtime.  The user can use the "help" variable place
 24:                  additional help messages in this printout.
 25:   */
 26:   PetscInitialize(&argc,&argv,(char*)0,help);
 27:   PetscRandomCreate(PETSC_COMM_WORLD,&rand1);
 28:   PetscRandomSetFromOptions(rand1);
 29:   PetscRandomCreate(PETSC_COMM_WORLD,&rand2);
 30:   PetscRandomSetFromOptions(rand2);
 31: #if defined(PETSC_USE_SERVER)
 32:   PetscPrintf(PETSC_COMM_WORLD,"Starting up PetscWebServe()\n");
 33:   PetscWebServe(PETSC_COMM_WORLD,PETSC_DEFAULT);
 34:   while (1) ;
 35: #endif
 36:   PetscRandomDestroy(&rand1);
 37:   PetscRandomDestroy(&rand2);
 38:   /*
 39:      Always call PetscFinalize() before exiting a program.  This routine
 40:        - finalizes the PETSc libraries as well as MPI
 41:        - provides summary and diagnostic information if certain runtime
 42:          options are chosen (e.g., -log_summary).  See PetscFinalize()
 43:      manpage for more information.
 44:   */
 45:   PetscFinalize();
 46:   return 0;
 47: }