1 #include <petsc-private/sfimpl.h> /*I "petscsf.h" I*/ 2 3 #if defined(PETSC_HAVE_MPI_WIN_CREATE) 4 PETSC_EXTERN_C PetscErrorCode PetscSFCreate_Window(PetscSF); 5 #endif 6 PETSC_EXTERN_C PetscErrorCode PetscSFCreate_Basic(PetscSF); 7 8 PetscFunctionList PetscSFunctionList; 9 10 #undef __FUNCT__ 11 #define __FUNCT__ "PetscSFRegisterAll" 12 /*@C 13 PetscSFRegisterAll - Registers all the PetscSF communication implementations 14 15 Not Collective 16 17 Level: advanced 18 19 .keywords: PetscSF, register, all 20 21 .seealso: PetscSFRegisterDestroy() 22 @*/ 23 PetscErrorCode PetscSFRegisterAll(const char path[]) 24 { 25 PetscErrorCode ierr; 26 27 PetscFunctionBegin; 28 PetscSFRegisterAllCalled = PETSC_TRUE; 29 #if defined(PETSC_HAVE_MPI_WIN_CREATE) && defined(PETSC_HAVE_MPI_TYPE_DUP) 30 ierr = PetscSFRegisterDynamic(PETSCSFWINDOW, path,"PetscSFCreate_Window", PetscSFCreate_Window);CHKERRQ(ierr); 31 #endif 32 ierr = PetscSFRegisterDynamic(PETSCSFBASIC, path,"PetscSFCreate_Basic", PetscSFCreate_Basic);CHKERRQ(ierr); 33 PetscFunctionReturn(0); 34 } 35 36 #undef __FUNCT__ 37 #define __FUNCT__ "PetscSFRegister" 38 /*@C 39 PetscSFRegister - See PetscSFRegisterDynamic() 40 41 Level: advanced 42 @*/ 43 PetscErrorCode PetscSFRegister(const char sname[],const char path[],const char name[],PetscErrorCode (*function)(PetscSF)) 44 { 45 char fullname[PETSC_MAX_PATH_LEN]; 46 PetscErrorCode ierr; 47 48 PetscFunctionBegin; 49 ierr = PetscFunctionListConcat(path,name,fullname);CHKERRQ(ierr); 50 ierr = PetscFunctionListAdd(PETSC_COMM_WORLD,&PetscSFunctionList,sname,fullname,(void (*)(void))function);CHKERRQ(ierr); 51 PetscFunctionReturn(0); 52 } 53 54 #undef __FUNCT__ 55 #define __FUNCT__ "PetscSFRegisterDestroy" 56 /*@ 57 PetscSFRegisterDestroy - Frees the list of communication implementations registered by PetscSFRegisterDynamic() 58 59 Not Collective 60 61 Level: advanced 62 63 .keywords: PetscSF, register, destroy 64 65 .seealso: PetscSFRegisterAll() 66 @*/ 67 PetscErrorCode PetscSFRegisterDestroy(void) 68 { 69 PetscErrorCode ierr; 70 71 PetscFunctionBegin; 72 ierr = PetscFunctionListDestroy(&PetscSFunctionList);CHKERRQ(ierr); 73 74 PetscSFRegisterAllCalled = PETSC_FALSE; 75 PetscFunctionReturn(0); 76 } 77