1 static char help[] = "Example for PetscOptionsInsertFileYAML\n"; 2 3 4 #include <petscsys.h> 5 #include <petscviewer.h> 6 7 int main(int argc,char **argv) 8 { 9 PetscErrorCode ierr; 10 char filename[PETSC_MAX_PATH_LEN]; 11 PetscBool flg; 12 13 ierr = PetscInitialize(&argc,&argv,(char*)0,help);if (ierr) return ierr; 14 ierr = PetscOptionsGetString(NULL,NULL,"-f",filename,sizeof(filename),&flg); 15 if (flg) { 16 ierr = PetscOptionsInsertFileYAML(PETSC_COMM_WORLD,filename,PETSC_TRUE);CHKERRQ(ierr); 17 } 18 ierr = PetscOptionsView(NULL,PETSC_VIEWER_STDOUT_WORLD);CHKERRQ(ierr); 19 ierr = PetscFinalize(); 20 return ierr; 21 } 22 23 24 25 /*TEST 26 27 build: 28 requires: yaml 29 30 test: 31 suffix: 1 32 requires: yaml 33 args: -f petsc.yml -options_left 0 34 filter: egrep -v "(malloc_dump|malloc_test|saws_port_auto_select|display|check_pointer_intensity|error_output_stdout|nox)" 35 localrunfiles: petsc.yml 36 37 test: 38 suffix: 2 39 requires: yaml 40 args: -options_file_yaml petsc.yml -options_left 0 41 filter: egrep -v "(malloc_dump|malloc_test|saws_port_auto_select|display|check_pointer_intensity|error_output_stdout|nox)" 42 localrunfiles: petsc.yml 43 44 TEST*/ 45