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 */ 10: PetscInt i; 12: PetscInitialize(&argc,&args,(char*)0,help); 13: fd = PETSC_VIEWER_SOCKET_WORLD; 15: for (i=0; i<1000; i++) { 16: VecCreate(PETSC_COMM_WORLD,&b); 17: VecLoad(b,fd); 18: VecView(b,fd); 19: VecDestroy(&b); 20: } 21: PetscFinalize(); 22: return 0; 23: }