2: static char help[] = "Reads a PETSc vector from a socket connection, then sends it back within a loop 1000 times. 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 */ 10: PetscInt i; 13: PetscInitialize(&argc, &args, (char *)0, help); 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 0; 24: }