Actual source code: taggerregi.c

petsc-3.9.0 2018-04-07
Report Typos and Errors
  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: .keywords: VecTagger, register, all

 20: .seealso:  VecTaggerRegisterDestroy()
 21: @*/
 22: PetscErrorCode  VecTaggerRegisterAll(void)
 23: {

 27:   if (VecTaggerRegisterAllCalled) return(0);
 28:   VecTaggerRegisterAllCalled = PETSC_TRUE;
 29:   VecTaggerRegister(VECTAGGERABSOLUTE, VecTaggerCreate_Absolute);
 30:   VecTaggerRegister(VECTAGGERRELATIVE, VecTaggerCreate_Relative);
 31:   VecTaggerRegister(VECTAGGERCDF,      VecTaggerCreate_CDF);
 32:   VecTaggerRegister(VECTAGGEROR,       VecTaggerCreate_Or);
 33:   VecTaggerRegister(VECTAGGERAND,      VecTaggerCreate_And);
 34:   return(0);
 35: }

 37: /*@C
 38:   VecTaggerRegister  - Adds an implementation of the VecTagger communication protocol.

 40:    Not collective

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

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

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

 54:    Then, this implementation can be chosen with the procedural interface via
 55: $     VecTaggerSetType(tagger,"my_impl")
 56:    or at runtime via the option
 57: $     -snes_type my_solver

 59:    Level: advanced

 61: .keywords: VecTagger, register

 63: .seealso: VecTaggerRegisterAll(), VecTaggerRegisterDestroy()
 64: @*/
 65: PetscErrorCode  VecTaggerRegister(const char sname[],PetscErrorCode (*function)(VecTagger))
 66: {

 70:   PetscFunctionListAdd(&VecTaggerList,sname,function);
 71:   return(0);
 72: }