#include /*I "petscdm.h" I*/ #ifdef PETSC_HAVE_LIBCEED #include /*@C DMGetCeed - Get the LibCEED context associated with this DM Not collective Input Parameter: . DM - The DM Output Parameter: . ceed - The LibCEED context Level: intermediate .seealso: DMCreate() @*/ PetscErrorCode DMGetCeed(DM dm, Ceed *ceed) { PetscFunctionBegin; PetscValidHeaderSpecific(dm, DM_CLASSID, 1); PetscValidPointer(ceed, 2); if (!dm->ceed) { char ceedresource[PETSC_MAX_PATH_LEN]; /* libCEED resource specifier */ const char *prefix; CHKERRQ(PetscStrcpy(ceedresource, "/cpu/self")); CHKERRQ(PetscObjectGetOptionsPrefix((PetscObject) dm, &prefix)); CHKERRQ(PetscOptionsGetString(NULL, prefix, "-dm_ceed", ceedresource, sizeof(ceedresource), NULL)); CHKERRQ_CEED(CeedInit(ceedresource, &dm->ceed)); } *ceed = dm->ceed; PetscFunctionReturn(0); } #endif