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: {
25: if (!dm->ceed) {
26: char ceedresource[PETSC_MAX_PATH_LEN]; /* libCEED resource specifier */
27: const char *prefix;
29: PetscStrcpy(ceedresource, "/cpu/self");
30: PetscObjectGetOptionsPrefix((PetscObject)dm, &prefix);
31: PetscOptionsGetString(NULL, prefix, "-dm_ceed", ceedresource, sizeof(ceedresource), NULL);
32: CeedInit(ceedresource, &dm->ceed);
33: }
34: *ceed = dm->ceed;
35: return 0;
36: }
38: #endif