1777ff853SJeremy L Thompson // Copyright (c) 2017, Lawrence Livermore National Security, LLC. Produced at 2777ff853SJeremy L Thompson // the Lawrence Livermore National Laboratory. LLNL-CODE-734707. All Rights 3777ff853SJeremy L Thompson // reserved. See files LICENSE and NOTICE for details. 4777ff853SJeremy L Thompson // 5777ff853SJeremy L Thompson // This file is part of CEED, a collection of benchmarks, miniapps, software 6777ff853SJeremy L Thompson // libraries and APIs for efficient high-order finite element and spectral 7777ff853SJeremy L Thompson // element discretizations for exascale applications. For more information and 8777ff853SJeremy L Thompson // source code availability see http://github.com/ceed. 9777ff853SJeremy L Thompson // 10777ff853SJeremy L Thompson // The CEED research is supported by the Exascale Computing Project 17-SC-20-SC, 11777ff853SJeremy L Thompson // a collaborative effort of two U.S. Department of Energy organizations (Office 12777ff853SJeremy L Thompson // of Science and the National Nuclear Security Administration) responsible for 13777ff853SJeremy L Thompson // the planning and preparation of a capable exascale ecosystem, including 14777ff853SJeremy L Thompson // software, applications, hardware, advanced system engineering and early 15777ff853SJeremy L Thompson // testbed platforms, in support of the nation's exascale computing imperative. 16777ff853SJeremy L Thompson 17ec3da8bcSJed Brown #include <ceed/ceed.h> 18ec3da8bcSJed Brown #include <ceed/backend.h> 193d576824SJeremy L Thompson #include <ceed-impl.h> 203d576824SJeremy L Thompson #include <stdint.h> 213d576824SJeremy L Thompson #include <stdio.h> 22777ff853SJeremy L Thompson 23777ff853SJeremy L Thompson /// @file 24777ff853SJeremy L Thompson /// Implementation of public CeedQFunctionContext interfaces 25777ff853SJeremy L Thompson 26777ff853SJeremy L Thompson /// ---------------------------------------------------------------------------- 27777ff853SJeremy L Thompson /// CeedQFunctionContext Backend API 28777ff853SJeremy L Thompson /// ---------------------------------------------------------------------------- 29777ff853SJeremy L Thompson /// @addtogroup CeedQFunctionBackend 30777ff853SJeremy L Thompson /// @{ 31777ff853SJeremy L Thompson 32777ff853SJeremy L Thompson /** 33777ff853SJeremy L Thompson @brief Get the Ceed associated with a CeedQFunctionContext 34777ff853SJeremy L Thompson 35777ff853SJeremy L Thompson @param ctx CeedQFunctionContext 36777ff853SJeremy L Thompson @param[out] ceed Variable to store Ceed 37777ff853SJeremy L Thompson 38777ff853SJeremy L Thompson @return An error code: 0 - success, otherwise - failure 39777ff853SJeremy L Thompson 40777ff853SJeremy L Thompson @ref Backend 41777ff853SJeremy L Thompson **/ 42777ff853SJeremy L Thompson int CeedQFunctionContextGetCeed(CeedQFunctionContext ctx, Ceed *ceed) { 43777ff853SJeremy L Thompson *ceed = ctx->ceed; 44e15f9bd0SJeremy L Thompson return CEED_ERROR_SUCCESS; 45777ff853SJeremy L Thompson } 46777ff853SJeremy L Thompson 47777ff853SJeremy L Thompson /** 48777ff853SJeremy L Thompson @brief Get the state of a CeedQFunctionContext 49777ff853SJeremy L Thompson 50777ff853SJeremy L Thompson @param ctx CeedQFunctionContext to retrieve state 51777ff853SJeremy L Thompson @param[out] state Variable to store state 52777ff853SJeremy L Thompson 53777ff853SJeremy L Thompson @return An error code: 0 - success, otherwise - failure 54777ff853SJeremy L Thompson 55777ff853SJeremy L Thompson @ref Backend 56777ff853SJeremy L Thompson **/ 57777ff853SJeremy L Thompson int CeedQFunctionContextGetState(CeedQFunctionContext ctx, uint64_t *state) { 58777ff853SJeremy L Thompson *state = ctx->state; 59e15f9bd0SJeremy L Thompson return CEED_ERROR_SUCCESS; 60777ff853SJeremy L Thompson } 61777ff853SJeremy L Thompson 62777ff853SJeremy L Thompson /** 63777ff853SJeremy L Thompson @brief Get data size for a Context 64777ff853SJeremy L Thompson 65777ff853SJeremy L Thompson @param ctx CeedQFunctionContext 66d1d35e2fSjeremylt @param[out] ctx_size Variable to store size of context data values 67777ff853SJeremy L Thompson 68777ff853SJeremy L Thompson @return An error code: 0 - success, otherwise - failure 69777ff853SJeremy L Thompson 70777ff853SJeremy L Thompson @ref Backend 71777ff853SJeremy L Thompson **/ 72777ff853SJeremy L Thompson int CeedQFunctionContextGetContextSize(CeedQFunctionContext ctx, 73d1d35e2fSjeremylt size_t *ctx_size) { 74d1d35e2fSjeremylt *ctx_size = ctx->ctx_size; 75e15f9bd0SJeremy L Thompson return CEED_ERROR_SUCCESS; 76777ff853SJeremy L Thompson } 77777ff853SJeremy L Thompson 78777ff853SJeremy L Thompson /** 79777ff853SJeremy L Thompson @brief Get backend data of a CeedQFunctionContext 80777ff853SJeremy L Thompson 81777ff853SJeremy L Thompson @param ctx CeedQFunctionContext 82777ff853SJeremy L Thompson @param[out] data Variable to store data 83777ff853SJeremy L Thompson 84777ff853SJeremy L Thompson @return An error code: 0 - success, otherwise - failure 85777ff853SJeremy L Thompson 86777ff853SJeremy L Thompson @ref Backend 87777ff853SJeremy L Thompson **/ 88777ff853SJeremy L Thompson int CeedQFunctionContextGetBackendData(CeedQFunctionContext ctx, void *data) { 89777ff853SJeremy L Thompson *(void **)data = ctx->data; 90e15f9bd0SJeremy L Thompson return CEED_ERROR_SUCCESS; 91777ff853SJeremy L Thompson } 92777ff853SJeremy L Thompson 93777ff853SJeremy L Thompson /** 94777ff853SJeremy L Thompson @brief Set backend data of a CeedQFunctionContext 95777ff853SJeremy L Thompson 96777ff853SJeremy L Thompson @param[out] ctx CeedQFunctionContext 97777ff853SJeremy L Thompson @param data Data to set 98777ff853SJeremy L Thompson 99777ff853SJeremy L Thompson @return An error code: 0 - success, otherwise - failure 100777ff853SJeremy L Thompson 101777ff853SJeremy L Thompson @ref Backend 102777ff853SJeremy L Thompson **/ 103777ff853SJeremy L Thompson int CeedQFunctionContextSetBackendData(CeedQFunctionContext ctx, void *data) { 104777ff853SJeremy L Thompson ctx->data = data; 105e15f9bd0SJeremy L Thompson return CEED_ERROR_SUCCESS; 106777ff853SJeremy L Thompson } 107777ff853SJeremy L Thompson 10834359f16Sjeremylt /** 10934359f16Sjeremylt @brief Increment the reference counter for a CeedQFunctionContext 11034359f16Sjeremylt 11134359f16Sjeremylt @param ctx CeedQFunctionContext to increment the reference counter 11234359f16Sjeremylt 11334359f16Sjeremylt @return An error code: 0 - success, otherwise - failure 11434359f16Sjeremylt 11534359f16Sjeremylt @ref Backend 11634359f16Sjeremylt **/ 1179560d06aSjeremylt int CeedQFunctionContextReference(CeedQFunctionContext ctx) { 11834359f16Sjeremylt ctx->ref_count++; 11934359f16Sjeremylt return CEED_ERROR_SUCCESS; 12034359f16Sjeremylt } 12134359f16Sjeremylt 122777ff853SJeremy L Thompson /// @} 123777ff853SJeremy L Thompson 124777ff853SJeremy L Thompson /// ---------------------------------------------------------------------------- 125777ff853SJeremy L Thompson /// CeedQFunctionContext Public API 126777ff853SJeremy L Thompson /// ---------------------------------------------------------------------------- 127777ff853SJeremy L Thompson /// @addtogroup CeedQFunctionUser 128777ff853SJeremy L Thompson /// @{ 129777ff853SJeremy L Thompson 130777ff853SJeremy L Thompson /** 131777ff853SJeremy L Thompson @brief Create a CeedQFunctionContext for storing CeedQFunction user context data 132777ff853SJeremy L Thompson 133777ff853SJeremy L Thompson @param ceed A Ceed object where the CeedQFunctionContext will be created 134777ff853SJeremy L Thompson @param[out] ctx Address of the variable where the newly created 135777ff853SJeremy L Thompson CeedQFunctionContext will be stored 136777ff853SJeremy L Thompson 137777ff853SJeremy L Thompson @return An error code: 0 - success, otherwise - failure 138777ff853SJeremy L Thompson 139777ff853SJeremy L Thompson @ref User 140777ff853SJeremy L Thompson **/ 141777ff853SJeremy L Thompson int CeedQFunctionContextCreate(Ceed ceed, CeedQFunctionContext *ctx) { 142777ff853SJeremy L Thompson int ierr; 143777ff853SJeremy L Thompson 144777ff853SJeremy L Thompson if (!ceed->QFunctionContextCreate) { 145777ff853SJeremy L Thompson Ceed delegate; 146777ff853SJeremy L Thompson ierr = CeedGetObjectDelegate(ceed, &delegate, "Context"); CeedChk(ierr); 147777ff853SJeremy L Thompson 148777ff853SJeremy L Thompson if (!delegate) 149777ff853SJeremy L Thompson // LCOV_EXCL_START 150e15f9bd0SJeremy L Thompson return CeedError(ceed, CEED_ERROR_UNSUPPORTED, 151e15f9bd0SJeremy L Thompson "Backend does not support ContextCreate"); 152777ff853SJeremy L Thompson // LCOV_EXCL_STOP 153777ff853SJeremy L Thompson 154777ff853SJeremy L Thompson ierr = CeedQFunctionContextCreate(delegate, ctx); CeedChk(ierr); 155e15f9bd0SJeremy L Thompson return CEED_ERROR_SUCCESS; 156777ff853SJeremy L Thompson } 157777ff853SJeremy L Thompson 158777ff853SJeremy L Thompson ierr = CeedCalloc(1, ctx); CeedChk(ierr); 159777ff853SJeremy L Thompson (*ctx)->ceed = ceed; 1609560d06aSjeremylt ierr = CeedReference(ceed); CeedChk(ierr); 161d1d35e2fSjeremylt (*ctx)->ref_count = 1; 162777ff853SJeremy L Thompson ierr = ceed->QFunctionContextCreate(*ctx); CeedChk(ierr); 163e15f9bd0SJeremy L Thompson return CEED_ERROR_SUCCESS; 164777ff853SJeremy L Thompson } 165777ff853SJeremy L Thompson 166777ff853SJeremy L Thompson /** 1679560d06aSjeremylt @brief Copy the pointer to a CeedQFunctionContext. Both pointers should 1689560d06aSjeremylt be destroyed with `CeedQFunctionContextDestroy()`; 1699560d06aSjeremylt Note: If `*ctx_copy` is non-NULL, then it is assumed that 1709560d06aSjeremylt `*ctx_copy` is a pointer to a CeedQFunctionContext. This 1719560d06aSjeremylt CeedQFunctionContext will be destroyed if `*ctx_copy` is the 1729560d06aSjeremylt only reference to this CeedQFunctionContext. 1739560d06aSjeremylt 1749560d06aSjeremylt @param ctx CeedQFunctionContext to copy reference to 1759560d06aSjeremylt @param[out] ctx_copy Variable to store copied reference 1769560d06aSjeremylt 1779560d06aSjeremylt @return An error code: 0 - success, otherwise - failure 1789560d06aSjeremylt 1799560d06aSjeremylt @ref User 1809560d06aSjeremylt **/ 1819560d06aSjeremylt int CeedQFunctionContextReferenceCopy(CeedQFunctionContext ctx, 1829560d06aSjeremylt CeedQFunctionContext *ctx_copy) { 1839560d06aSjeremylt int ierr; 1849560d06aSjeremylt 1859560d06aSjeremylt ierr = CeedQFunctionContextReference(ctx); CeedChk(ierr); 1869560d06aSjeremylt ierr = CeedQFunctionContextDestroy(ctx_copy); CeedChk(ierr); 1879560d06aSjeremylt *ctx_copy = ctx; 1889560d06aSjeremylt return CEED_ERROR_SUCCESS; 1899560d06aSjeremylt } 1909560d06aSjeremylt 1919560d06aSjeremylt /** 192777ff853SJeremy L Thompson @brief Set the data used by a CeedQFunctionContext, freeing any previously allocated 193777ff853SJeremy L Thompson data if applicable. The backend may copy values to a different 194777ff853SJeremy L Thompson memtype, such as during @ref CeedQFunctionApply(). 195777ff853SJeremy L Thompson See also @ref CeedQFunctionContextTakeData(). 196777ff853SJeremy L Thompson 197777ff853SJeremy L Thompson @param ctx CeedQFunctionContext 198d1d35e2fSjeremylt @param mem_type Memory type of the data being passed 199d1d35e2fSjeremylt @param copy_mode Copy mode for the data 200*891038deSjeremylt @param size Size of data, in bytes 201777ff853SJeremy L Thompson @param data Data to be used 202777ff853SJeremy L Thompson 203777ff853SJeremy L Thompson @return An error code: 0 - success, otherwise - failure 204777ff853SJeremy L Thompson 205777ff853SJeremy L Thompson @ref User 206777ff853SJeremy L Thompson **/ 207d1d35e2fSjeremylt int CeedQFunctionContextSetData(CeedQFunctionContext ctx, CeedMemType mem_type, 208d1d35e2fSjeremylt CeedCopyMode copy_mode, 209777ff853SJeremy L Thompson size_t size, void *data) { 210777ff853SJeremy L Thompson int ierr; 211777ff853SJeremy L Thompson 212777ff853SJeremy L Thompson if (!ctx->SetData) 213777ff853SJeremy L Thompson // LCOV_EXCL_START 214e15f9bd0SJeremy L Thompson return CeedError(ctx->ceed, CEED_ERROR_UNSUPPORTED, 215e15f9bd0SJeremy L Thompson "Backend does not support ContextSetData"); 216777ff853SJeremy L Thompson // LCOV_EXCL_STOP 217777ff853SJeremy L Thompson 218777ff853SJeremy L Thompson if (ctx->state % 2 == 1) 219777ff853SJeremy L Thompson // LCOV_EXCL_START 220777ff853SJeremy L Thompson return CeedError(ctx->ceed, 1, 221777ff853SJeremy L Thompson "Cannot grant CeedQFunctionContext data access, the " 222777ff853SJeremy L Thompson "access lock is already in use"); 223777ff853SJeremy L Thompson // LCOV_EXCL_STOP 224777ff853SJeremy L Thompson 225d1d35e2fSjeremylt ctx->ctx_size = size; 226d1d35e2fSjeremylt ierr = ctx->SetData(ctx, mem_type, copy_mode, data); CeedChk(ierr); 227777ff853SJeremy L Thompson ctx->state += 2; 228e15f9bd0SJeremy L Thompson return CEED_ERROR_SUCCESS; 229777ff853SJeremy L Thompson } 230777ff853SJeremy L Thompson 231777ff853SJeremy L Thompson /** 232*891038deSjeremylt @brief Take ownership of the data in a CeedQFunctionContext via the specified memory type. 233*891038deSjeremylt The caller is responsible for managing and freeing the memory. 234*891038deSjeremylt 235*891038deSjeremylt @param ctx CeedQFunctionContext to access 236*891038deSjeremylt @param mem_type Memory type on which to access the data. If the backend 237*891038deSjeremylt uses a different memory type, this will perform a copy. 238*891038deSjeremylt @param[out] data Data on memory type mem_type 239*891038deSjeremylt 240*891038deSjeremylt @return An error code: 0 - success, otherwise - failure 241*891038deSjeremylt 242*891038deSjeremylt @ref User 243*891038deSjeremylt **/ 244*891038deSjeremylt int CeedQFunctionContextTakeData(CeedQFunctionContext ctx, CeedMemType mem_type, 245*891038deSjeremylt void *data) { 246*891038deSjeremylt int ierr; 247*891038deSjeremylt 248*891038deSjeremylt if (!ctx->TakeData) 249*891038deSjeremylt // LCOV_EXCL_START 250*891038deSjeremylt return CeedError(ctx->ceed, CEED_ERROR_UNSUPPORTED, 251*891038deSjeremylt "Backend does not support TakeData"); 252*891038deSjeremylt // LCOV_EXCL_STOP 253*891038deSjeremylt 254*891038deSjeremylt if (ctx->state % 2 == 1) 255*891038deSjeremylt // LCOV_EXCL_START 256*891038deSjeremylt return CeedError(ctx->ceed, 1, 257*891038deSjeremylt "Cannot grant CeedQFunctionContext data access, the " 258*891038deSjeremylt "access lock is already in use"); 259*891038deSjeremylt // LCOV_EXCL_STOP 260*891038deSjeremylt 261*891038deSjeremylt void *temp_data = NULL; 262*891038deSjeremylt ierr = ctx->TakeData(ctx, mem_type, &temp_data); CeedChk(ierr); 263*891038deSjeremylt if (data) (*(void **)data) = temp_data; 264*891038deSjeremylt return CEED_ERROR_SUCCESS; 265*891038deSjeremylt } 266*891038deSjeremylt 267*891038deSjeremylt /** 268777ff853SJeremy L Thompson @brief Get read/write access to a CeedQFunctionContext via the specified memory type. 269777ff853SJeremy L Thompson Restore access with @ref CeedQFunctionContextRestoreData(). 270777ff853SJeremy L Thompson 271777ff853SJeremy L Thompson @param ctx CeedQFunctionContext to access 272d1d35e2fSjeremylt @param mem_type Memory type on which to access the data. If the backend 273777ff853SJeremy L Thompson uses a different memory type, this will perform a copy. 274d1d35e2fSjeremylt @param[out] data Data on memory type mem_type 275777ff853SJeremy L Thompson 276777ff853SJeremy L Thompson @note The CeedQFunctionContextGetData() and @ref CeedQFunctionContextRestoreData() functions 277777ff853SJeremy L Thompson provide access to array pointers in the desired memory space. Pairing 278777ff853SJeremy L Thompson get/restore allows the Context to track access. 279777ff853SJeremy L Thompson 280777ff853SJeremy L Thompson @return An error code: 0 - success, otherwise - failure 281777ff853SJeremy L Thompson 282777ff853SJeremy L Thompson @ref User 283777ff853SJeremy L Thompson **/ 284d1d35e2fSjeremylt int CeedQFunctionContextGetData(CeedQFunctionContext ctx, CeedMemType mem_type, 285777ff853SJeremy L Thompson void *data) { 286777ff853SJeremy L Thompson int ierr; 287777ff853SJeremy L Thompson 288777ff853SJeremy L Thompson if (!ctx->GetData) 289777ff853SJeremy L Thompson // LCOV_EXCL_START 290e15f9bd0SJeremy L Thompson return CeedError(ctx->ceed, CEED_ERROR_UNSUPPORTED, 291e15f9bd0SJeremy L Thompson "Backend does not support GetData"); 292777ff853SJeremy L Thompson // LCOV_EXCL_STOP 293777ff853SJeremy L Thompson 294777ff853SJeremy L Thompson if (ctx->state % 2 == 1) 295777ff853SJeremy L Thompson // LCOV_EXCL_START 296777ff853SJeremy L Thompson return CeedError(ctx->ceed, 1, 297777ff853SJeremy L Thompson "Cannot grant CeedQFunctionContext data access, the " 298777ff853SJeremy L Thompson "access lock is already in use"); 299777ff853SJeremy L Thompson // LCOV_EXCL_STOP 300777ff853SJeremy L Thompson 301d1d35e2fSjeremylt ierr = ctx->GetData(ctx, mem_type, data); CeedChk(ierr); 302777ff853SJeremy L Thompson ctx->state += 1; 303e15f9bd0SJeremy L Thompson return CEED_ERROR_SUCCESS; 304777ff853SJeremy L Thompson } 305777ff853SJeremy L Thompson 306777ff853SJeremy L Thompson /** 307777ff853SJeremy L Thompson @brief Restore data obtained using @ref CeedQFunctionContextGetData() 308777ff853SJeremy L Thompson 309777ff853SJeremy L Thompson @param ctx CeedQFunctionContext to restore 310777ff853SJeremy L Thompson @param data Data to restore 311777ff853SJeremy L Thompson 312777ff853SJeremy L Thompson @return An error code: 0 - success, otherwise - failure 313777ff853SJeremy L Thompson 314777ff853SJeremy L Thompson @ref User 315777ff853SJeremy L Thompson **/ 316777ff853SJeremy L Thompson int CeedQFunctionContextRestoreData(CeedQFunctionContext ctx, void *data) { 317777ff853SJeremy L Thompson int ierr; 318777ff853SJeremy L Thompson 319777ff853SJeremy L Thompson if (!ctx->RestoreData) 320777ff853SJeremy L Thompson // LCOV_EXCL_START 321e15f9bd0SJeremy L Thompson return CeedError(ctx->ceed, CEED_ERROR_UNSUPPORTED, 322e15f9bd0SJeremy L Thompson "Backend does not support RestoreData"); 323777ff853SJeremy L Thompson // LCOV_EXCL_STOP 324777ff853SJeremy L Thompson 325777ff853SJeremy L Thompson if (ctx->state % 2 != 1) 326777ff853SJeremy L Thompson // LCOV_EXCL_START 327777ff853SJeremy L Thompson return CeedError(ctx->ceed, 1, 328777ff853SJeremy L Thompson "Cannot restore CeedQFunctionContext array access, " 329777ff853SJeremy L Thompson "access was not granted"); 330777ff853SJeremy L Thompson // LCOV_EXCL_STOP 331777ff853SJeremy L Thompson 332777ff853SJeremy L Thompson ierr = ctx->RestoreData(ctx); CeedChk(ierr); 333777ff853SJeremy L Thompson *(void **)data = NULL; 334777ff853SJeremy L Thompson ctx->state += 1; 335e15f9bd0SJeremy L Thompson return CEED_ERROR_SUCCESS; 336777ff853SJeremy L Thompson } 337777ff853SJeremy L Thompson 338777ff853SJeremy L Thompson /** 339777ff853SJeremy L Thompson @brief View a CeedQFunctionContext 340777ff853SJeremy L Thompson 341777ff853SJeremy L Thompson @param[in] ctx CeedQFunctionContext to view 342777ff853SJeremy L Thompson @param[in] stream Filestream to write to 343777ff853SJeremy L Thompson 344777ff853SJeremy L Thompson @return An error code: 0 - success, otherwise - failure 345777ff853SJeremy L Thompson 346777ff853SJeremy L Thompson @ref User 347777ff853SJeremy L Thompson **/ 348777ff853SJeremy L Thompson int CeedQFunctionContextView(CeedQFunctionContext ctx, FILE *stream) { 349777ff853SJeremy L Thompson fprintf(stream, "CeedQFunctionContext\n"); 350d1d35e2fSjeremylt fprintf(stream, " Context Data Size: %ld\n", ctx->ctx_size); 351e15f9bd0SJeremy L Thompson return CEED_ERROR_SUCCESS; 352777ff853SJeremy L Thompson } 353777ff853SJeremy L Thompson 354777ff853SJeremy L Thompson /** 355777ff853SJeremy L Thompson @brief Destroy a CeedQFunctionContext 356777ff853SJeremy L Thompson 357777ff853SJeremy L Thompson @param ctx CeedQFunctionContext to destroy 358777ff853SJeremy L Thompson 359777ff853SJeremy L Thompson @return An error code: 0 - success, otherwise - failure 360777ff853SJeremy L Thompson 361777ff853SJeremy L Thompson @ref User 362777ff853SJeremy L Thompson **/ 363777ff853SJeremy L Thompson int CeedQFunctionContextDestroy(CeedQFunctionContext *ctx) { 364777ff853SJeremy L Thompson int ierr; 365777ff853SJeremy L Thompson 366d1d35e2fSjeremylt if (!*ctx || --(*ctx)->ref_count > 0) 367e15f9bd0SJeremy L Thompson return CEED_ERROR_SUCCESS; 368777ff853SJeremy L Thompson 369777ff853SJeremy L Thompson if ((*ctx) && ((*ctx)->state % 2) == 1) 370777ff853SJeremy L Thompson // LCOV_EXCL_START 371777ff853SJeremy L Thompson return CeedError((*ctx)->ceed, 1, 372777ff853SJeremy L Thompson "Cannot destroy CeedQFunctionContext, the access " 373777ff853SJeremy L Thompson "lock is in use"); 374777ff853SJeremy L Thompson // LCOV_EXCL_STOP 375777ff853SJeremy L Thompson 376777ff853SJeremy L Thompson if ((*ctx)->Destroy) { 377777ff853SJeremy L Thompson ierr = (*ctx)->Destroy(*ctx); CeedChk(ierr); 378777ff853SJeremy L Thompson } 379777ff853SJeremy L Thompson ierr = CeedDestroy(&(*ctx)->ceed); CeedChk(ierr); 380777ff853SJeremy L Thompson ierr = CeedFree(ctx); CeedChk(ierr); 381e15f9bd0SJeremy L Thompson return CEED_ERROR_SUCCESS; 382777ff853SJeremy L Thompson } 383777ff853SJeremy L Thompson 384777ff853SJeremy L Thompson /// @} 385