1 static char help[] = "Tests PetscStack.\n\n"; 2 3 #include <petscsys.h> 4 5 #if !defined(PETSCSTACKSIZE) 6 #define PETSCSTACKSIZE 64 7 #endif 8 9 PetscErrorCode correct() 10 { 11 PetscFunctionBegin; 12 PetscFunctionReturn(0); 13 } 14 15 PetscErrorCode correctu() 16 { 17 PetscFunctionBeginUser; 18 PetscFunctionReturn(0); 19 } 20 21 PetscErrorCode foo() 22 { 23 PetscFunctionReturn(0); 24 } 25 26 PetscErrorCode bar() 27 { 28 PetscFunctionBegin; 29 return 0; 30 } 31 32 PetscErrorCode baru() 33 { 34 PetscFunctionBeginUser; 35 return 0; 36 } 37 38 int main(int argc,char **argv) 39 { 40 PetscErrorCode ierr; 41 PetscBool flg = PETSC_FALSE; 42 43 ierr = PetscInitialize(&argc,&argv,(char*)0,help);if (ierr) return ierr; 44 #if defined(PETSC_USE_DEBUG) 45 ierr = PetscOptionsGetBool(NULL,NULL,"-checkstack",&flg,NULL);CHKERRQ(ierr); 46 #endif 47 ierr = PetscPrintf(PETSC_COMM_WORLD,"%s for stack\n",flg ? "Checking" : "Not checking");CHKERRQ(ierr); 48 for (PetscInt i = 0; i < PETSCSTACKSIZE+1; i++) { ierr = correct();CHKERRQ(ierr); } 49 for (PetscInt i = 0; i < PETSCSTACKSIZE+1; i++) { ierr = foo();CHKERRQ(ierr); } 50 for (PetscInt i = 0; i < PETSCSTACKSIZE+1; i++) { ierr = bar();CHKERRQ(ierr); } 51 for (PetscInt i = 0; i < PETSCSTACKSIZE+1; i++) { ierr = foo();CHKERRQ(ierr); } 52 for (PetscInt i = 0; i < PETSCSTACKSIZE+1; i++) { ierr = baru();CHKERRQ(ierr); } 53 for (PetscInt i = 0; i < PETSCSTACKSIZE+1; i++) { ierr = foo();CHKERRQ(ierr); } 54 ierr = PetscFinalize(); 55 return ierr; 56 } 57 58 /*TEST 59 60 test: 61 62 TEST*/ 63