Actual source code: dmceed.c

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

  3: #ifdef PETSC_HAVE_LIBCEED
  4: #include <petscdmceed.h>

  6: /*@C
  7:   DMGetCeed - Get the LibCEED context associated with this DM

  9:   Not collective

 11:   Input Parameter:
 12: . DM   - The DM

 14:   Output Parameter:
 15: . ceed - The LibCEED context

 17:   Level: intermediate

 19: .seealso: DMCreate()
 20: @*/
 21: PetscErrorCode DMGetCeed(DM dm, Ceed *ceed)
 22: {

 28:   if (!dm->ceed) {
 29:     char        ceedresource[PETSC_MAX_PATH_LEN]; /* libCEED resource specifier */
 30:     const char *prefix;

 32:     PetscStrcpy(ceedresource, "/cpu/self");
 33:     PetscObjectGetOptionsPrefix((PetscObject) dm, &prefix);
 34:     PetscOptionsGetString(NULL, prefix, "-dm_ceed", ceedresource, sizeof(ceedresource), NULL);
 35:     CeedInit(ceedresource, &dm->ceed);
 36:   }
 37:   *ceed = dm->ceed;
 38:   return(0);
 39: }

 41: #endif