Actual source code: sfregi.c

petsc-3.8.3 2017-12-09
Report Typos and Errors
  1:  #include <petsc/private/sfimpl.h>

  3: #if defined(PETSC_HAVE_MPI_WIN_CREATE)
  4: PETSC_EXTERN PetscErrorCode PetscSFCreate_Window(PetscSF);
  5: #endif
  6: PETSC_EXTERN PetscErrorCode PetscSFCreate_Basic(PetscSF);

  8: PetscFunctionList PetscSFList;

 10: /*@C
 11:    PetscSFRegisterAll - Registers all the PetscSF communication implementations

 13:    Not Collective

 15:    Level: advanced

 17: .keywords: PetscSF, register, all

 19: .seealso:  PetscSFRegisterDestroy()
 20: @*/
 21: PetscErrorCode  PetscSFRegisterAll(void)
 22: {

 26:   if (PetscSFRegisterAllCalled) return(0);
 27:   PetscSFRegisterAllCalled = PETSC_TRUE;
 28: #if defined(PETSC_HAVE_MPI_WIN_CREATE) && defined(PETSC_HAVE_MPI_TYPE_DUP)
 29:   PetscSFRegister(PETSCSFWINDOW, PetscSFCreate_Window);
 30: #endif
 31:   PetscSFRegister(PETSCSFBASIC,  PetscSFCreate_Basic);
 32:   return(0);
 33: }

 35: /*@C
 36:   PetscSFRegister  - Adds an implementation of the PetscSF communication protocol.

 38:    Not collective

 40:    Input Parameters:
 41: +  name_impl - name of a new user-defined implementation
 42: -  routine_create - routine to create method context

 44:    Notes:
 45:    PetscSFRegister() may be called multiple times to add several user-defined implementations.

 47:    Sample usage:
 48: .vb
 49:    PetscSFRegister("my_impl",MyImplCreate);
 50: .ve

 52:    Then, this implementation can be chosen with the procedural interface via
 53: $     PetscSFSetType(sf,"my_impl")
 54:    or at runtime via the option
 55: $     -snes_type my_solver

 57:    Level: advanced

 59: .keywords: PetscSF, register

 61: .seealso: PetscSFRegisterAll(), PetscSFRegisterDestroy()
 62: @*/
 63: PetscErrorCode  PetscSFRegister(const char sname[],PetscErrorCode (*function)(PetscSF))
 64: {

 68:   PetscFunctionListAdd(&PetscSFList,sname,function);
 69:   return(0);
 70: }