Actual source code: ex51.c
2: static char help[] = "Demonstrates PetscFileRetrieve().\n\n";
4: /*T
5: Concepts: introduction to PETSc;
6: Concepts: printing^in parallel
7: Processors: n
8: T*/
10: #include <petscsys.h>
11: int main(int argc,char **argv)
12: {
14: PetscBool found;
15: char localname[PETSC_MAX_PATH_LEN];
16: const char url[] = "https://www.mcs.anl.gov/petsc/index.html";
18: /*
19: Every PETSc routine should begin with the PetscInitialize() routine.
20: argc, argv - These command line arguments are taken to extract the options
21: supplied to PETSc and options supplied to MPI.
22: help - When PETSc executable is invoked with the option -help,
23: it prints the various options that can be applied at
24: runtime. The user can use the "help" variable place
25: additional help messages in this printout.
26: */
27: PetscInitialize(&argc,&argv,(char*)0,help);if (ierr) return ierr;
28: PetscFileRetrieve(PETSC_COMM_WORLD,url,localname,PETSC_MAX_PATH_LEN,&found);
29: if (found) {
30: PetscPrintf(PETSC_COMM_WORLD,"Successfully download file %s\n",localname);
31: } else SETERRQ1(PETSC_COMM_WORLD,PETSC_ERR_PLIB,"Unable to download url %s\n",url);
33: PetscFinalize();
34: return ierr;
35: }
37: /*TEST
39: test:
40: requires: defined(PETSC_HAVE_POPEN)
42: TEST*/