ceed-operator.c (ad6481ce28fcfada16ee6d8a13bbacd137fe686a) ceed-operator.c (0126412d32e96658dcd899fe3d8b989fdf201e32)
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>

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

1421 }
1422 }
1423 }
1424
1425 return CEED_ERROR_SUCCESS;
1426}
1427
1428/**
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>

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

1421 }
1422 }
1423 }
1424
1425 return CEED_ERROR_SUCCESS;
1426}
1427
1428/**
1429 @brief Get CeedQFunction global context for a CeedOperator.
1430 Note: The caller is responsible for destroying `ctx` returned from this function via `CeedQFunctionContextDestroy()`.
1431 Note: If the value of `ctx` passed into this function is non-NULL, then it is assumed that `ctx` is a valid pointer to a
1432 CeedQFunctionContext. This CeedQFunctionContext will be destroyed if `ctx` is the only reference to this CeedQFunctionContext.
1433
1434 @param[in] qf CeedQFunction
1435 @param[out] ctx Variable to store CeedQFunctionContext
1436
1437 @return An error code: 0 - success, otherwise - failure
1438
1439 @ref Backend
1440**/
1441int CeedOperatorGetContext(CeedOperator op, CeedQFunctionContext *ctx) {
1442 bool is_composite;
1443
1444 CeedCall(CeedOperatorIsComposite(op, &is_composite));
1445 if (is_composite) return CeedError(op->ceed, CEED_ERROR_INCOMPATIBLE, "Cannot retrieve QFunctionContext for composite operator");
1446
1447 if (op->qf->ctx) CeedCall(CeedQFunctionContextReferenceCopy(op->qf->ctx, ctx));
1448 else *ctx = NULL;
1449 return CEED_ERROR_SUCCESS;
1450}
1451
1452/**
1429 @brief Get label for a registered QFunctionContext field, or `NULL` if no field has been registered with this `field_name`.
1430
1431 @param[in] op CeedOperator
1432 @param[in] field_name Name of field to retrieve label
1433 @param[out] field_label Variable to field label
1434
1435 @return An error code: 0 - success, otherwise - failure
1436

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

1726
1727 @param[in,out] op CeedOperator to destroy
1728
1729 @return An error code: 0 - success, otherwise - failure
1730
1731 @ref User
1732**/
1733int CeedOperatorDestroy(CeedOperator *op) {
1453 @brief Get label for a registered QFunctionContext field, or `NULL` if no field has been registered with this `field_name`.
1454
1455 @param[in] op CeedOperator
1456 @param[in] field_name Name of field to retrieve label
1457 @param[out] field_label Variable to field label
1458
1459 @return An error code: 0 - success, otherwise - failure
1460

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

1750
1751 @param[in,out] op CeedOperator to destroy
1752
1753 @return An error code: 0 - success, otherwise - failure
1754
1755 @ref User
1756**/
1757int CeedOperatorDestroy(CeedOperator *op) {
1734 if (!*op || --(*op)->ref_count > 0) {
1735 *op = NULL;
1736 return CEED_ERROR_SUCCESS;
1737 }
1758 if (!*op || --(*op)->ref_count > 0) return CEED_ERROR_SUCCESS;
1738 if ((*op)->Destroy) CeedCall((*op)->Destroy(*op));
1739 CeedCall(CeedDestroy(&(*op)->ceed));
1740 // Free fields
1741 for (CeedInt i = 0; i < (*op)->num_fields; i++) {
1742 if ((*op)->input_fields[i]) {
1743 if ((*op)->input_fields[i]->elem_rstr != CEED_ELEMRESTRICTION_NONE) {
1744 CeedCall(CeedElemRestrictionDestroy(&(*op)->input_fields[i]->elem_rstr));
1745 }

--- 55 unchanged lines hidden ---
1759 if ((*op)->Destroy) CeedCall((*op)->Destroy(*op));
1760 CeedCall(CeedDestroy(&(*op)->ceed));
1761 // Free fields
1762 for (CeedInt i = 0; i < (*op)->num_fields; i++) {
1763 if ((*op)->input_fields[i]) {
1764 if ((*op)->input_fields[i]->elem_rstr != CEED_ELEMRESTRICTION_NONE) {
1765 CeedCall(CeedElemRestrictionDestroy(&(*op)->input_fields[i]->elem_rstr));
1766 }

--- 55 unchanged lines hidden ---