ceed-qfunctioncontext.c (ad6481ce28fcfada16ee6d8a13bbacd137fe686a) ceed-qfunctioncontext.c (6ed4cbd191d517965186f3811b93d597bbe58673)
1// Copyright (c) 2017-2022, Lawrence Livermore National Security, LLC and other CEED contributors.
2// All Rights Reserved. See the top-level LICENSE and NOTICE files for details.
3//
4// SPDX-License-Identifier: BSD-2-Clause
5//
6// This file is part of CEED: http://github.com/ceed
7
8#include <ceed-impl.h>

--- 636 unchanged lines hidden (view full) ---

645 return CeedError(ctx->ceed, 1, "Cannot grant CeedQFunctionContext data access, the access lock is already in use");
646 // LCOV_EXCL_STOP
647 }
648
649 bool has_borrowed_data_of_type = true;
650 CeedCall(CeedQFunctionContextHasBorrowedDataOfType(ctx, mem_type, &has_borrowed_data_of_type));
651 if (!has_borrowed_data_of_type) {
652 // LCOV_EXCL_START
1// Copyright (c) 2017-2022, Lawrence Livermore National Security, LLC and other CEED contributors.
2// All Rights Reserved. See the top-level LICENSE and NOTICE files for details.
3//
4// SPDX-License-Identifier: BSD-2-Clause
5//
6// This file is part of CEED: http://github.com/ceed
7
8#include <ceed-impl.h>

--- 636 unchanged lines hidden (view full) ---

645 return CeedError(ctx->ceed, 1, "Cannot grant CeedQFunctionContext data access, the access lock is already in use");
646 // LCOV_EXCL_STOP
647 }
648
649 bool has_borrowed_data_of_type = true;
650 CeedCall(CeedQFunctionContextHasBorrowedDataOfType(ctx, mem_type, &has_borrowed_data_of_type));
651 if (!has_borrowed_data_of_type) {
652 // LCOV_EXCL_START
653 return CeedError(ctx->ceed, CEED_ERROR_BACKEND, "CeedQFunctionContext has no borowed %s data, must set data with CeedQFunctionContextSetData",
653 return CeedError(ctx->ceed, CEED_ERROR_BACKEND, "CeedQFunctionContext has no borrowed %s data, must set data with CeedQFunctionContextSetData",
654 CeedMemTypes[mem_type]);
655 // LCOV_EXCL_STOP
656 }
657
658 void *temp_data = NULL;
659 CeedCall(ctx->TakeData(ctx, mem_type, &temp_data));
660 if (data) (*(void **)data) = temp_data;
661 return CEED_ERROR_SUCCESS;

--- 275 unchanged lines hidden (view full) ---

937
938 @param[in,out] ctx CeedQFunctionContext to destroy
939
940 @return An error code: 0 - success, otherwise - failure
941
942 @ref User
943**/
944int CeedQFunctionContextDestroy(CeedQFunctionContext *ctx) {
654 CeedMemTypes[mem_type]);
655 // LCOV_EXCL_STOP
656 }
657
658 void *temp_data = NULL;
659 CeedCall(ctx->TakeData(ctx, mem_type, &temp_data));
660 if (data) (*(void **)data) = temp_data;
661 return CEED_ERROR_SUCCESS;

--- 275 unchanged lines hidden (view full) ---

937
938 @param[in,out] ctx CeedQFunctionContext to destroy
939
940 @return An error code: 0 - success, otherwise - failure
941
942 @ref User
943**/
944int CeedQFunctionContextDestroy(CeedQFunctionContext *ctx) {
945 if (!*ctx || --(*ctx)->ref_count > 0) {
946 *ctx = NULL;
947 return CEED_ERROR_SUCCESS;
948 }
945 if (!*ctx || --(*ctx)->ref_count > 0) return CEED_ERROR_SUCCESS;
946
949 if ((*ctx) && ((*ctx)->state % 2) == 1) {
950 // LCOV_EXCL_START
951 return CeedError((*ctx)->ceed, 1, "Cannot destroy CeedQFunctionContext, the access lock is in use");
952 // LCOV_EXCL_STOP
953 }
954
955 CeedCall(CeedQFunctionContextDestroyData(*ctx));
956 if ((*ctx)->Destroy) CeedCall((*ctx)->Destroy(*ctx));

--- 13 unchanged lines hidden ---
947 if ((*ctx) && ((*ctx)->state % 2) == 1) {
948 // LCOV_EXCL_START
949 return CeedError((*ctx)->ceed, 1, "Cannot destroy CeedQFunctionContext, the access lock is in use");
950 // LCOV_EXCL_STOP
951 }
952
953 CeedCall(CeedQFunctionContextDestroyData(*ctx));
954 if ((*ctx)->Destroy) CeedCall((*ctx)->Destroy(*ctx));

--- 13 unchanged lines hidden ---