Actual source code: ex51.c
petsc-3.11.4 2019-09-28
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*/
12: #include <petscsys.h>
13: int main(int argc,char **argv)
14: {
16: PetscBool found;
17: char localname[PETSC_MAX_PATH_LEN];
18: const char url[] = "http://www.mcs.anl.gov/petsc/index.html";
20: /*
21: Every PETSc routine should begin with the PetscInitialize() routine.
22: argc, argv - These command line arguments are taken to extract the options
23: supplied to PETSc and options supplied to MPI.
24: help - When PETSc executable is invoked with the option -help,
25: it prints the various options that can be applied at
26: runtime. The user can use the "help" variable place
27: additional help messages in this printout.
28: */
29: PetscInitialize(&argc,&argv,(char*)0,help);if (ierr) return ierr;
30: PetscFileRetrieve(PETSC_COMM_WORLD,url,localname,PETSC_MAX_PATH_LEN,&found);
31: if (found) {
32: PetscPrintf(PETSC_COMM_WORLD,"Successfully download file %s\n",localname);
33: } else SETERRQ1(PETSC_COMM_WORLD,PETSC_ERR_PLIB,"Unable to download url %s\n",url);
35: PetscFinalize();
36: return ierr;
37: }
40: /*TEST
42: test:
43: requires: define(PETSC_HAVE_POPEN)
45: TEST*/