Actual source code: dlregisdmfield.c

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

      3: PetscClassId DMFIELD_CLASSID;

      5: static PetscBool DMFieldPackageInitialized = PETSC_FALSE;

      7: PetscBool DMFieldRegisterAllCalled;

      9: /*@C
     10:   DMFieldInitializePackage - Initialize `DMField` package

     12:   Logically Collective

     14:   Level: developer

     16: .seealso: `DMFieldFinalizePackage()`
     17: @*/
     18: PetscErrorCode DMFieldInitializePackage(void)
     19: {
     20:   PetscFunctionBegin;
     21:   if (DMFieldPackageInitialized) PetscFunctionReturn(PETSC_SUCCESS);
     22:   DMFieldPackageInitialized = PETSC_TRUE;

     24:   PetscCall(PetscClassIdRegister("Field over DM", &DMFIELD_CLASSID));
     25:   PetscCall(DMFieldRegisterAll());
     26:   PetscCall(PetscRegisterFinalize(DMFieldFinalizePackage));
     27:   PetscFunctionReturn(PETSC_SUCCESS);
     28: }

     30: /*@C
     31:   DMFieldFinalizePackage - Finalize `DMField` package, it is called from `PetscFinalize()`

     33:   Logically Collective

     35:   Level: developer

     37: .seealso: `DMFieldInitializePackage()`
     38: @*/
     39: PetscErrorCode DMFieldFinalizePackage(void)
     40: {
     41:   PetscFunctionBegin;
     42:   PetscCall(PetscFunctionListDestroy(&DMFieldList));
     43:   DMFieldPackageInitialized = PETSC_FALSE;
     44:   DMFieldRegisterAllCalled  = PETSC_FALSE;
     45:   PetscFunctionReturn(PETSC_SUCCESS);
     46: }