Actual source code: scoarsen.c


  2: #include <petscmat.h>
  3: #include <petsc/private/matimpl.h>

  5: PETSC_EXTERN PetscErrorCode MatCoarsenCreate_MIS(MatCoarsen);
  6: PETSC_EXTERN PetscErrorCode MatCoarsenCreate_HEM(MatCoarsen);
  7: PETSC_EXTERN PetscErrorCode MatCoarsenCreate_MISK(MatCoarsen);

  9: /*@C
 10:   MatCoarsenRegisterAll - Registers all of the matrix Coarsen routines in PETSc.

 12:   Not Collective

 14:   Level: developer

 16:   Adding new methods:
 17:   To add a new method to the registry. Copy this routine and
 18:   modify it to incorporate a call to MatCoarsenRegister() for
 19:   the new method, after the current list.

 21:   Restricting the choices: To prevent all of the methods from being
 22:   registered and thus save memory, copy this routine and modify it to
 23:   register a zero, instead of the function name, for those methods you
 24:  do not wish to register.  Make sure that the replacement routine is
 25:   linked before libpetscmat.a.

 27: .seealso: `MatCoarsen`, `MatCoarsenType`, `MatCoarsenRegister()`, `MatCoarsenRegisterDestroy()`
 28:  @*/
 29: PetscErrorCode MatCoarsenRegisterAll(void)
 30: {
 31:   PetscFunctionBegin;
 32:   if (MatCoarsenRegisterAllCalled) PetscFunctionReturn(PETSC_SUCCESS);
 33:   MatCoarsenRegisterAllCalled = PETSC_TRUE;

 35:   PetscCall(MatCoarsenRegister(MATCOARSENMIS, MatCoarsenCreate_MIS));
 36:   PetscCall(MatCoarsenRegister(MATCOARSENHEM, MatCoarsenCreate_HEM));
 37:   PetscCall(MatCoarsenRegister(MATCOARSENMISK, MatCoarsenCreate_MISK));

 39:   PetscFunctionReturn(PETSC_SUCCESS);
 40: }