Actual source code: ex42.c

petsc-3.13.6 2020-09-29
Report Typos and Errors

  2: static char help[] = "Reads a PETSc vector from a socket connection, then sends it back within a loop. Works with ex42.m or ex42a.c\n";

  4:  #include <petscvec.h>

  6: int main(int argc,char **args)
  7: {
  8:   Vec            b;
  9:   PetscViewer    fd;               /* viewer */
 11:   PetscInt       i;

 13:   PetscInitialize(&argc,&args,(char*)0,help);if (ierr) return ierr;
 14:   fd = PETSC_VIEWER_SOCKET_WORLD;

 16:   for (i=0; i<1000; i++) {
 17:     VecCreate(PETSC_COMM_WORLD,&b);
 18:     VecLoad(b,fd);
 19:     VecView(b,fd);
 20:     VecDestroy(&b);
 21:   }
 22:   PetscFinalize();
 23:   return ierr;
 24: }