Actual source code: taggerregi.c
petsc-3.13.3 2020-07-01
1: #include <petsc/private/vecimpl.h>
3: PETSC_EXTERN PetscErrorCode VecTaggerCreate_Absolute(VecTagger);
4: PETSC_EXTERN PetscErrorCode VecTaggerCreate_Relative(VecTagger);
5: PETSC_EXTERN PetscErrorCode VecTaggerCreate_CDF(VecTagger);
6: PETSC_EXTERN PetscErrorCode VecTaggerCreate_Or(VecTagger);
7: PETSC_EXTERN PetscErrorCode VecTaggerCreate_And(VecTagger);
9: PetscFunctionList VecTaggerList;
11: /*@C
12: VecTaggerRegisterAll - Registers all the VecTagger communication implementations
14: Not Collective
16: Level: advanced
18: .seealso: VecTaggerRegisterDestroy()
19: @*/
20: PetscErrorCode VecTaggerRegisterAll(void)
21: {
25: if (VecTaggerRegisterAllCalled) return(0);
26: VecTaggerRegisterAllCalled = PETSC_TRUE;
27: VecTaggerRegister(VECTAGGERABSOLUTE, VecTaggerCreate_Absolute);
28: VecTaggerRegister(VECTAGGERRELATIVE, VecTaggerCreate_Relative);
29: VecTaggerRegister(VECTAGGERCDF, VecTaggerCreate_CDF);
30: VecTaggerRegister(VECTAGGEROR, VecTaggerCreate_Or);
31: VecTaggerRegister(VECTAGGERAND, VecTaggerCreate_And);
32: return(0);
33: }
35: /*@C
36: VecTaggerRegister - Adds an implementation of the VecTagger 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: VecTaggerRegister() may be called multiple times to add several user-defined implementations.
47: Sample usage:
48: .vb
49: VecTaggerRegister("my_impl",MyImplCreate);
50: .ve
52: Then, this implementation can be chosen with the procedural interface via
53: $ VecTaggerSetType(tagger,"my_impl")
54: or at runtime via the option
55: $ -snes_type my_solver
57: Level: advanced
59: .seealso: VecTaggerRegisterAll(), VecTaggerRegisterDestroy()
60: @*/
61: PetscErrorCode VecTaggerRegister(const char sname[],PetscErrorCode (*function)(VecTagger))
62: {
66: PetscFunctionListAdd(&VecTaggerList,sname,function);
67: return(0);
68: }