PetscErrorCode PetscStackCreate(void) { PetscStack *petscstack_in; PetscInt i; if (PetscStackActive()) return 0; petscstack_in = (PetscStack*)malloc(sizeof(PetscStack)); petscstack_in->currentsize = 0; petscstack_in->hotdepth = 0; for (i=0; i<PETSCSTACKSIZE; i++) { petscstack_in->function[i] = 0; petscstack_in->file[i] = 0; } PetscThreadLocalSetValue((PetscThreadKey*)&petscstack,petscstack_in); #if defined(PETSC_HAVE_SAWS) { PetscBool flg = PETSC_FALSE; PetscOptionsHasName(NULL,"-stack_view",&flg); if (flg) PetscStackViewSAWs(); } #endif return 0; }
PetscErrorCode PetscStackDestroy(void) { if (PetscStackActive()) { PetscStack *petscstack_in; petscstack_in = (PetscStack*)PetscThreadLocalGetValue(petscstack); free(petscstack_in); PetscThreadLocalSetValue((PetscThreadKey*)&petscstack,NULL); } return 0; }
PetscErrorCode PetscStackDestroy_kernel(PetscInt trank) { if(PetscStackActive) { PetscStack *petscstack_in; petscstack_in = (PetscStack*)PetscThreadLocalGetValue(petscstack); free(petscstack_in); PetscThreadLocalSetValue(petscstack,(PetscStack*)0); } return 0; }
PetscErrorCode PetscStackCreate_kernel(PetscInt trank) { PetscStack *petscstack_in; if(PetscStackActive) return 0; petscstack_in = (PetscStack*)malloc(sizeof(PetscStack)); petscstack_in->currentsize = 0; PetscThreadLocalSetValue(petscstack,petscstack_in); return 0; }
PetscErrorCode PetscStackCreate(void) { PetscStack *petscstack_in; if (PetscStackActive()) return 0; petscstack_in = (PetscStack*)malloc(sizeof(PetscStack)); petscstack_in->currentsize = 0; PetscThreadLocalSetValue((PetscThreadKey*)&petscstack,petscstack_in); #if defined(PETSC_HAVE_AMS) { PetscBool flg = PETSC_FALSE; PetscOptionsHasName(NULL,"-stack_view",&flg); if (flg) PetscStackViewAMS(); } #endif return 0; }