Actual source code: dlregisregressor.c

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

      3: static PetscBool PetscRegressorPackageInitialized = PETSC_FALSE;

      5: /*@C
      6:   PetscRegressorInitializePackage - Initialize `PetscRegressor` package

      8:   Logically Collective

     10:   Level: developer

     12: .seealso: `PetscRegressorFinalizePackage()`
     13: @*/
     14: PetscErrorCode PetscRegressorInitializePackage(void)
     15: {
     16:   PetscFunctionBegin;
     17:   if (PetscRegressorPackageInitialized) PetscFunctionReturn(PETSC_SUCCESS);
     18:   PetscRegressorPackageInitialized = PETSC_TRUE;
     19:   /* Register Class */
     20:   PetscCall(PetscClassIdRegister("Regressor", &PETSCREGRESSOR_CLASSID));
     21:   /* Register Constructors */
     22:   PetscCall(PetscRegressorRegisterAll());
     23:   /* Register Events */
     24:   PetscCall(PetscLogEventRegister("PetscRegressorSetUp", PETSCREGRESSOR_CLASSID, &PetscRegressor_SetUp));
     25:   PetscCall(PetscLogEventRegister("PetscRegressorFit", PETSCREGRESSOR_CLASSID, &PetscRegressor_Fit));
     26:   PetscCall(PetscLogEventRegister("PetscRegressorPredict", PETSCREGRESSOR_CLASSID, &PetscRegressor_Predict));
     27:   /* Process Info */
     28:   {
     29:     PetscClassId classids[1];

     31:     classids[0] = PETSCREGRESSOR_CLASSID;
     32:     PetscCall(PetscInfoProcessClass("petscregressor", 1, classids));
     33:   }
     34:   /* Register package finalizer */
     35:   PetscCall(PetscRegisterFinalize(PetscRegressorFinalizePackage));
     36:   PetscFunctionReturn(PETSC_SUCCESS);
     37: }

     39: /*@C
     40:   PetscRegressorFinalizePackage - Finalize `PetscRegressor` package; it is called from `PetscFinalize()`

     42:   Logically Collective

     44:   Level: developer

     46: .seealso: `PetscRegressorInitializePackage()`
     47: @*/
     48: PetscErrorCode PetscRegressorFinalizePackage(void)
     49: {
     50:   PetscFunctionBegin;
     51:   PetscCall(PetscFunctionListDestroy(&PetscRegressorList));
     52:   PetscRegressorPackageInitialized = PETSC_FALSE;
     53:   PetscRegressorRegisterAllCalled  = PETSC_FALSE;
     54:   PetscFunctionReturn(PETSC_SUCCESS);
     55: }