Actual source code: dmfieldregi.c
petsc-3.10.5 2019-03-28
Report Typos and Errors

      1:  #include <petsc/private/dmfieldimpl.h>

      3: PETSC_EXTERN PetscErrorCode DMFieldCreate_DA(DMField);
      4: PETSC_EXTERN PetscErrorCode DMFieldCreate_DS(DMField);
      5: PETSC_EXTERN PetscErrorCode DMFieldCreate_Shell(DMField);

      7: PetscFunctionList DMFieldList;

      9: /*@C
     10:    DMFieldRegisterAll - Registers all the DMField implementations

     12:    Not Collective

     14:    Level: advanced

     16: .keywords: DMField, register, all

     18: .seealso:  DMFieldRegisterDestroy()
     19: @*/
     20: PetscErrorCode  DMFieldRegisterAll(void)
     21: {

     25:   if (DMFieldRegisterAllCalled) return(0);
     26:   DMFieldRegisterAllCalled = PETSC_TRUE;
     27:   DMFieldRegister(DMFIELDDA,    DMFieldCreate_DA);
     28:   DMFieldRegister(DMFIELDDS,    DMFieldCreate_DS);
     29:   DMFieldRegister(DMFIELDSHELL, DMFieldCreate_Shell);
     30:   return(0);
     31: }

     33: /*@C
     34:   DMFieldRegister  - Adds an implementation of the DMField object.

     36:    Not collective

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

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

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

     50:    Then, this implementation can be chosen with the procedural interface via
     51: $     DMFieldSetType(tagger,"my_impl")

     53:    Level: advanced

     55: .keywords: DMField, register

     57: .seealso: DMFieldRegisterAll(), DMFieldRegisterDestroy()
     58: @*/
     59: PetscErrorCode  DMFieldRegister(const char sname[],PetscErrorCode (*function)(DMField))
     60: {

     64:   PetscFunctionListAdd(&DMFieldList,sname,function);
     65:   return(0);
     66: }