Date: 2022-03-31T04:46:21+00:00

Actual source code: taggerregi.c

      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: {
     22:   if (VecTaggerRegisterAllCalled) return 0;
     23:   VecTaggerRegisterAllCalled = PETSC_TRUE;
     24:   VecTaggerRegister(VECTAGGERABSOLUTE, VecTaggerCreate_Absolute);
     25:   VecTaggerRegister(VECTAGGERRELATIVE, VecTaggerCreate_Relative);
     26:   VecTaggerRegister(VECTAGGERCDF,      VecTaggerCreate_CDF);
     27:   VecTaggerRegister(VECTAGGEROR,       VecTaggerCreate_Or);
     28:   VecTaggerRegister(VECTAGGERAND,      VecTaggerCreate_And);
     29:   return 0;
     30: }

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

     35:    Not collective

     37:    Input Parameters:
     38: +  name_impl - name of a new user-defined implementation
     39: -  routine_create - routine to create method context

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

     44:    Sample usage:
     45: .vb
     46:    VecTaggerRegister("my_impl",MyImplCreate);
     47: .ve

     49:    Then, this implementation can be chosen with the procedural interface via
     50: $     VecTaggerSetType(tagger,"my_impl")
     51:    or at runtime via the option
     52: $     -snes_type my_solver

     54:    Level: advanced

     56: .seealso: VecTaggerRegisterAll(), VecTaggerRegisterDestroy()
     57: @*/
     58: PetscErrorCode  VecTaggerRegister(const char sname[],PetscErrorCode (*function)(VecTagger))
     59: {
     60:   PetscFunctionListAdd(&VecTaggerList,sname,function);
     61:   return 0;
     62: }