Actual source code: sfregi.c
petsc-3.12.5 2020-03-29
1: #include <petsc/private/sfimpl.h>
3: PETSC_INTERN PetscErrorCode PetscSFCreate_Basic(PetscSF);
4: #if defined(PETSC_HAVE_MPI_WIN_CREATE) && defined(PETSC_HAVE_MPI_TYPE_DUP)
5: PETSC_INTERN PetscErrorCode PetscSFCreate_Window(PetscSF);
6: #endif
7: PETSC_INTERN PetscErrorCode PetscSFCreate_Allgatherv(PetscSF);
8: PETSC_INTERN PetscErrorCode PetscSFCreate_Allgather(PetscSF);
9: PETSC_INTERN PetscErrorCode PetscSFCreate_Gatherv(PetscSF);
10: PETSC_INTERN PetscErrorCode PetscSFCreate_Gather(PetscSF);
11: PETSC_INTERN PetscErrorCode PetscSFCreate_Alltoall(PetscSF);
12: #if defined(PETSC_HAVE_MPI_NEIGHBORHOOD_COLLECTIVES)
13: PETSC_INTERN PetscErrorCode PetscSFCreate_Neighbor(PetscSF);
14: #endif
16: PetscFunctionList PetscSFList;
17: PetscBool PetscSFRegisterAllCalled;
19: /*@C
20: PetscSFRegisterAll - Registers all the PetscSF communication implementations
22: Not Collective
24: Level: advanced
26: .seealso: PetscSFRegisterDestroy()
27: @*/
28: PetscErrorCode PetscSFRegisterAll(void)
29: {
33: if (PetscSFRegisterAllCalled) return(0);
34: PetscSFRegisterAllCalled = PETSC_TRUE;
35: PetscSFRegister(PETSCSFBASIC, PetscSFCreate_Basic);
36: #if defined(PETSC_HAVE_MPI_WIN_CREATE) && defined(PETSC_HAVE_MPI_TYPE_DUP)
37: PetscSFRegister(PETSCSFWINDOW, PetscSFCreate_Window);
38: #endif
39: PetscSFRegister(PETSCSFALLGATHERV,PetscSFCreate_Allgatherv);
40: PetscSFRegister(PETSCSFALLGATHER, PetscSFCreate_Allgather);
41: PetscSFRegister(PETSCSFGATHERV, PetscSFCreate_Gatherv);
42: PetscSFRegister(PETSCSFGATHER, PetscSFCreate_Gather);
43: PetscSFRegister(PETSCSFALLTOALL, PetscSFCreate_Alltoall);
44: #if defined(PETSC_HAVE_MPI_NEIGHBORHOOD_COLLECTIVES)
45: PetscSFRegister(PETSCSFNEIGHBOR, PetscSFCreate_Neighbor);
46: #endif
47: return(0);
48: }
50: /*@C
51: PetscSFRegister - Adds an implementation of the PetscSF communication protocol.
53: Not collective
55: Input Parameters:
56: + name - name of a new user-defined implementation
57: - create - routine to create method context
59: Notes:
60: PetscSFRegister() may be called multiple times to add several user-defined implementations.
62: Sample usage:
63: .vb
64: PetscSFRegister("my_impl",MyImplCreate);
65: .ve
67: Then, this implementation can be chosen with the procedural interface via
68: $ PetscSFSetType(sf,"my_impl")
69: or at runtime via the option
70: $ -sf_type my_impl
72: Level: advanced
74: .seealso: PetscSFRegisterAll(), PetscSFInitializePackage()
75: @*/
76: PetscErrorCode PetscSFRegister(const char name[],PetscErrorCode (*create)(PetscSF))
77: {
81: PetscSFInitializePackage();
82: PetscFunctionListAdd(&PetscSFList,name,create);
83: return(0);
84: }