Date: 2022-03-04T17:38:48+00:00

Actual source code: dmfieldregi.c

      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: .seealso:  DMFieldRegisterDestroy()
     17: @*/
     18: PetscErrorCode  DMFieldRegisterAll(void)
     19: {

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

     31: /*@C
     32:   DMFieldRegister  - Adds an implementation of the DMField object.

     34:    Not collective

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

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

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

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

     51:    Level: advanced

     53: .seealso: DMFieldRegisterAll(), DMFieldRegisterDestroy()
     54: @*/
     55: PetscErrorCode  DMFieldRegister(const char sname[],PetscErrorCode (*function)(DMField))
     56: {

     60:   PetscFunctionListAdd(&DMFieldList,sname,function);
     61:   return(0);
     62: }