Actual source code: sfregi.c

petsc-3.9.1 2018-04-29
Report Typos and Errors
  1:  #include <petsc/private/sfimpl.h>

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

  8: PetscFunctionList PetscSFList;
  9: PetscBool         PetscSFRegisterAllCalled;

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

 14:    Not Collective

 16:    Level: advanced

 18: .keywords: PetscSF, register, all

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

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

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

 39:    Not collective

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

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

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

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

 58:    Level: advanced

 60: .keywords: PetscSF, register

 62: .seealso: PetscSFRegisterAll(), PetscSFInitializePackage()
 63: @*/
 64: PetscErrorCode  PetscSFRegister(const char name[],PetscErrorCode (*create)(PetscSF))
 65: {

 69:   PetscFunctionListAdd(&PetscSFList,name,create);
 70:   return(0);
 71: }