ceed-operator.c (ca94c3ddc8f82b7d93a79f9e4812e99b8be840ff) ceed-operator.c (bafebce16a7da2c6afe5a069f690fc31b8ccb4ef)
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>

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

21/// @addtogroup CeedOperatorDeveloper
22/// @{
23
24/**
25 @brief Check if a `CeedOperator` Field matches the `CeedQFunction` Field
26
27 @param[in] ceed `Ceed` object for error handling
28 @param[in] qf_field `CeedQFunction` Field matching `CeedOperator` Field
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>

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

21/// @addtogroup CeedOperatorDeveloper
22/// @{
23
24/**
25 @brief Check if a `CeedOperator` Field matches the `CeedQFunction` Field
26
27 @param[in] ceed `Ceed` object for error handling
28 @param[in] qf_field `CeedQFunction` Field matching `CeedOperator` Field
29 @param[in] r `CeedOperator` Field `CeedElemRestriction`
30 @param[in] b `CeedOperator` Field `CeedBasis`
29 @param[in] rstr `CeedOperator` Field `CeedElemRestriction`
30 @param[in] basis `CeedOperator` Field `CeedBasis`
31
32 @return An error code: 0 - success, otherwise - failure
33
34 @ref Developer
35**/
31
32 @return An error code: 0 - success, otherwise - failure
33
34 @ref Developer
35**/
36static int CeedOperatorCheckField(Ceed ceed, CeedQFunctionField qf_field, CeedElemRestriction r, CeedBasis b) {
36static int CeedOperatorCheckField(Ceed ceed, CeedQFunctionField qf_field, CeedElemRestriction rstr, CeedBasis basis) {
37 CeedInt dim = 1, num_comp = 1, q_comp = 1, rstr_num_comp = 1, size = qf_field->size;
38 CeedEvalMode eval_mode = qf_field->eval_mode;
39
40 // Restriction
37 CeedInt dim = 1, num_comp = 1, q_comp = 1, rstr_num_comp = 1, size = qf_field->size;
38 CeedEvalMode eval_mode = qf_field->eval_mode;
39
40 // Restriction
41 CeedCheck((r == CEED_ELEMRESTRICTION_NONE) == (eval_mode == CEED_EVAL_WEIGHT), ceed, CEED_ERROR_INCOMPATIBLE,
41 CeedCheck((rstr == CEED_ELEMRESTRICTION_NONE) == (eval_mode == CEED_EVAL_WEIGHT), ceed, CEED_ERROR_INCOMPATIBLE,
42 "CEED_ELEMRESTRICTION_NONE and CEED_EVAL_WEIGHT must be used together.");
42 "CEED_ELEMRESTRICTION_NONE and CEED_EVAL_WEIGHT must be used together.");
43 if (r != CEED_ELEMRESTRICTION_NONE) {
44 CeedCall(CeedElemRestrictionGetNumComponents(r, &rstr_num_comp));
43 if (rstr != CEED_ELEMRESTRICTION_NONE) {
44 CeedCall(CeedElemRestrictionGetNumComponents(rstr, &rstr_num_comp));
45 }
46 // Basis
45 }
46 // Basis
47 CeedCheck((b == CEED_BASIS_NONE) == (eval_mode == CEED_EVAL_NONE), ceed, CEED_ERROR_INCOMPATIBLE,
47 CeedCheck((basis == CEED_BASIS_NONE) == (eval_mode == CEED_EVAL_NONE), ceed, CEED_ERROR_INCOMPATIBLE,
48 "CEED_BASIS_NONE and CEED_EVAL_NONE must be used together.");
48 "CEED_BASIS_NONE and CEED_EVAL_NONE must be used together.");
49 if (b != CEED_BASIS_NONE) {
50 CeedCall(CeedBasisGetDimension(b, &dim));
51 CeedCall(CeedBasisGetNumComponents(b, &num_comp));
52 CeedCall(CeedBasisGetNumQuadratureComponents(b, eval_mode, &q_comp));
53 CeedCheck(r == CEED_ELEMRESTRICTION_NONE || rstr_num_comp == num_comp, ceed, CEED_ERROR_DIMENSION,
49 if (basis != CEED_BASIS_NONE) {
50 CeedCall(CeedBasisGetDimension(basis, &dim));
51 CeedCall(CeedBasisGetNumComponents(basis, &num_comp));
52 CeedCall(CeedBasisGetNumQuadratureComponents(basis, eval_mode, &q_comp));
53 CeedCheck(rstr == CEED_ELEMRESTRICTION_NONE || rstr_num_comp == num_comp, ceed, CEED_ERROR_DIMENSION,
54 "Field '%s' of size %" CeedInt_FMT " and EvalMode %s: CeedElemRestriction has %" CeedInt_FMT
55 " components, but CeedBasis has %" CeedInt_FMT " components",
56 qf_field->field_name, qf_field->size, CeedEvalModes[qf_field->eval_mode], rstr_num_comp, num_comp);
57 }
58 // Field size
59 switch (eval_mode) {
60 case CEED_EVAL_NONE:
61 CeedCheck(size == rstr_num_comp, ceed, CEED_ERROR_DIMENSION,

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

73 case CEED_EVAL_WEIGHT:
74 // No additional checks required
75 break;
76 }
77 return CEED_ERROR_SUCCESS;
78}
79
80/**
54 "Field '%s' of size %" CeedInt_FMT " and EvalMode %s: CeedElemRestriction has %" CeedInt_FMT
55 " components, but CeedBasis has %" CeedInt_FMT " components",
56 qf_field->field_name, qf_field->size, CeedEvalModes[qf_field->eval_mode], rstr_num_comp, num_comp);
57 }
58 // Field size
59 switch (eval_mode) {
60 case CEED_EVAL_NONE:
61 CeedCheck(size == rstr_num_comp, ceed, CEED_ERROR_DIMENSION,

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

73 case CEED_EVAL_WEIGHT:
74 // No additional checks required
75 break;
76 }
77 return CEED_ERROR_SUCCESS;
78}
79
80/**
81 @brief View a field of a `CeedOperator`
81 @brief View a field of a `CeedOperator`
82
83 @param[in] field `CeedOperator` Field to view
84 @param[in] qf_field `CeedQFunction` Field (carries field name)
85 @param[in] field_number Number of field being viewed
86 @param[in] sub true indicates sub-operator, which increases indentation; false for top-level operator
87 @param[in] input true for an input field; false for output field
88 @param[in] stream Stream to view to, e.g., `stdout`
89

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

104 fprintf(stream, "%s EvalMode: %s\n", pre, CeedEvalModes[qf_field->eval_mode]);
105 if (field->basis == CEED_BASIS_NONE) fprintf(stream, "%s No basis\n", pre);
106 if (field->vec == CEED_VECTOR_ACTIVE) fprintf(stream, "%s Active vector\n", pre);
107 else if (field->vec == CEED_VECTOR_NONE) fprintf(stream, "%s No vector\n", pre);
108 return CEED_ERROR_SUCCESS;
109}
110
111/**
82
83 @param[in] field `CeedOperator` Field to view
84 @param[in] qf_field `CeedQFunction` Field (carries field name)
85 @param[in] field_number Number of field being viewed
86 @param[in] sub true indicates sub-operator, which increases indentation; false for top-level operator
87 @param[in] input true for an input field; false for output field
88 @param[in] stream Stream to view to, e.g., `stdout`
89

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

104 fprintf(stream, "%s EvalMode: %s\n", pre, CeedEvalModes[qf_field->eval_mode]);
105 if (field->basis == CEED_BASIS_NONE) fprintf(stream, "%s No basis\n", pre);
106 if (field->vec == CEED_VECTOR_ACTIVE) fprintf(stream, "%s Active vector\n", pre);
107 else if (field->vec == CEED_VECTOR_NONE) fprintf(stream, "%s No vector\n", pre);
108 return CEED_ERROR_SUCCESS;
109}
110
111/**
112 @brief View a single `CeedOperator`
112 @brief View a single `CeedOperator`
113
114 @param[in] op `CeedOperator` to view
115 @param[in] sub Boolean flag for sub-operator
116 @param[in] stream Stream to write; typically `stdout` or a file
117
118 @return Error code: 0 - success, otherwise - failure
119
120 @ref Utility

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

136 fprintf(stream, "%s %" CeedInt_FMT " output field%s:\n", pre, op->qf->num_output_fields, op->qf->num_output_fields > 1 ? "s" : "");
137 for (CeedInt i = 0; i < op->qf->num_output_fields; i++) {
138 CeedCall(CeedOperatorFieldView(op->output_fields[i], op->qf->output_fields[i], i, sub, 0, stream));
139 }
140 return CEED_ERROR_SUCCESS;
141}
142
143/**
113
114 @param[in] op `CeedOperator` to view
115 @param[in] sub Boolean flag for sub-operator
116 @param[in] stream Stream to write; typically `stdout` or a file
117
118 @return Error code: 0 - success, otherwise - failure
119
120 @ref Utility

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

136 fprintf(stream, "%s %" CeedInt_FMT " output field%s:\n", pre, op->qf->num_output_fields, op->qf->num_output_fields > 1 ? "s" : "");
137 for (CeedInt i = 0; i < op->qf->num_output_fields; i++) {
138 CeedCall(CeedOperatorFieldView(op->output_fields[i], op->qf->output_fields[i], i, sub, 0, stream));
139 }
140 return CEED_ERROR_SUCCESS;
141}
142
143/**
144 @brief Find the active input vector `CeedBasis` for a non-composite `CeedOperator`
144 @brief Find the active input vector `CeedBasis` for a non-composite `CeedOperator`
145
146 @param[in] op `CeedOperator` to find active `CeedBasis` for
147 @param[out] active_basis `CeedBasis` for active input vector or `NULL` for composite operator
148
149 @return An error code: 0 - success, otherwise - failure
150
151 @ref Developer
152**/
153int CeedOperatorGetActiveBasis(CeedOperator op, CeedBasis *active_basis) {
154 CeedCall(CeedOperatorGetActiveBases(op, active_basis, NULL));
155 return CEED_ERROR_SUCCESS;
156}
157
158/**
145
146 @param[in] op `CeedOperator` to find active `CeedBasis` for
147 @param[out] active_basis `CeedBasis` for active input vector or `NULL` for composite operator
148
149 @return An error code: 0 - success, otherwise - failure
150
151 @ref Developer
152**/
153int CeedOperatorGetActiveBasis(CeedOperator op, CeedBasis *active_basis) {
154 CeedCall(CeedOperatorGetActiveBases(op, active_basis, NULL));
155 return CEED_ERROR_SUCCESS;
156}
157
158/**
159 @brief Find the active input and output vector `CeedBasis` for a non-composite `CeedOperator`
159 @brief Find the active input and output vector `CeedBasis` for a non-composite `CeedOperator`
160
161 @param[in] op `CeedOperator` to find active `CeedBasis` for
162 @param[out] active_input_basis `CeedBasis` for active input vector or `NULL` for composite operator
163 @param[out] active_output_basis `CeedBasis` for active output vector or `NULL` for composite operator
164
165 @return An error code: 0 - success, otherwise - failure
166
167 @ref Developer

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

195 }
196 CeedCheck(*active_output_basis, ceed, CEED_ERROR_INCOMPLETE, "No active output CeedBasis found");
197 }
198 }
199 return CEED_ERROR_SUCCESS;
200}
201
202/**
160
161 @param[in] op `CeedOperator` to find active `CeedBasis` for
162 @param[out] active_input_basis `CeedBasis` for active input vector or `NULL` for composite operator
163 @param[out] active_output_basis `CeedBasis` for active output vector or `NULL` for composite operator
164
165 @return An error code: 0 - success, otherwise - failure
166
167 @ref Developer

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

195 }
196 CeedCheck(*active_output_basis, ceed, CEED_ERROR_INCOMPLETE, "No active output CeedBasis found");
197 }
198 }
199 return CEED_ERROR_SUCCESS;
200}
201
202/**
203 @brief Find the active vector `CeedElemRestriction` for a non-composite `CeedOperator`
203 @brief Find the active vector `CeedElemRestriction` for a non-composite `CeedOperator`
204
205 @param[in] op `CeedOperator` to find active `CeedElemRestriction` for
206 @param[out] active_rstr `CeedElemRestriction` for active input vector or NULL for composite operator
207
208 @return An error code: 0 - success, otherwise - failure
209
210 @ref Utility
211**/
212int CeedOperatorGetActiveElemRestriction(CeedOperator op, CeedElemRestriction *active_rstr) {
213 CeedCall(CeedOperatorGetActiveElemRestrictions(op, active_rstr, NULL));
214 return CEED_ERROR_SUCCESS;
215}
216
217/**
204
205 @param[in] op `CeedOperator` to find active `CeedElemRestriction` for
206 @param[out] active_rstr `CeedElemRestriction` for active input vector or NULL for composite operator
207
208 @return An error code: 0 - success, otherwise - failure
209
210 @ref Utility
211**/
212int CeedOperatorGetActiveElemRestriction(CeedOperator op, CeedElemRestriction *active_rstr) {
213 CeedCall(CeedOperatorGetActiveElemRestrictions(op, active_rstr, NULL));
214 return CEED_ERROR_SUCCESS;
215}
216
217/**
218 @brief Find the active input and output vector `CeedElemRestriction` for a non-composite `CeedOperator`
218 @brief Find the active input and output vector `CeedElemRestriction` for a non-composite `CeedOperator`
219
220 @param[in] op `CeedOperator` to find active `CeedElemRestriction` for
221 @param[out] active_input_rstr `CeedElemRestriction` for active input vector or NULL for composite operator
222 @param[out] active_output_rstr `CeedElemRestriction` for active output vector or NULL for composite operator
223
224 @return An error code: 0 - success, otherwise - failure
225
226 @ref Utility

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

259}
260
261/**
262 @brief Set `CeedQFunctionContext` field values of the specified type.
263
264 For composite operators, the value is set in all sub-operator `CeedQFunctionContext` that have a matching `field_name`.
265 A non-zero error code is returned for single operators that do not have a matching field of the same type or composite operators that do not have any field of a matching type.
266
219
220 @param[in] op `CeedOperator` to find active `CeedElemRestriction` for
221 @param[out] active_input_rstr `CeedElemRestriction` for active input vector or NULL for composite operator
222 @param[out] active_output_rstr `CeedElemRestriction` for active output vector or NULL for composite operator
223
224 @return An error code: 0 - success, otherwise - failure
225
226 @ref Utility

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

259}
260
261/**
262 @brief Set `CeedQFunctionContext` field values of the specified type.
263
264 For composite operators, the value is set in all sub-operator `CeedQFunctionContext` that have a matching `field_name`.
265 A non-zero error code is returned for single operators that do not have a matching field of the same type or composite operators that do not have any field of a matching type.
266
267 @param[in,out] op `CeedOperator`
267 @param[in,out] op `CeedOperator`
268 @param[in] field_label Label of field to set
269 @param[in] field_type Type of field to set
270 @param[in] values Values to set
271
272 @return An error code: 0 - success, otherwise - failure
273
274 @ref User
275**/

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

313}
314
315/**
316 @brief Get `CeedQFunctionContext` field values of the specified type, read-only.
317
318 For composite operators, the values retrieved are for the first sub-operator `CeedQFunctionContext` that have a matching `field_name`.
319 A non-zero error code is returned for single operators that do not have a matching field of the same type or composite operators that do not have any field of a matching type.
320
268 @param[in] field_label Label of field to set
269 @param[in] field_type Type of field to set
270 @param[in] values Values to set
271
272 @return An error code: 0 - success, otherwise - failure
273
274 @ref User
275**/

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

313}
314
315/**
316 @brief Get `CeedQFunctionContext` field values of the specified type, read-only.
317
318 For composite operators, the values retrieved are for the first sub-operator `CeedQFunctionContext` that have a matching `field_name`.
319 A non-zero error code is returned for single operators that do not have a matching field of the same type or composite operators that do not have any field of a matching type.
320
321 @param[in,out] op `CeedOperator`
321 @param[in,out] op `CeedOperator`
322 @param[in] field_label Label of field to set
323 @param[in] field_type Type of field to set
324 @param[out] num_values Number of values of type `field_type` in array `values`
325 @param[out] values Values in the label
326
327 @return An error code: 0 - success, otherwise - failure
328
329 @ref User

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

372}
373
374/**
375 @brief Restore `CeedQFunctionContext` field values of the specified type, read-only.
376
377 For composite operators, the values restored are for the first sub-operator `CeedQFunctionContext` that have a matching `field_name`.
378 A non-zero error code is returned for single operators that do not have a matching field of the same type or composite operators that do not have any field of a matching type.
379
322 @param[in] field_label Label of field to set
323 @param[in] field_type Type of field to set
324 @param[out] num_values Number of values of type `field_type` in array `values`
325 @param[out] values Values in the label
326
327 @return An error code: 0 - success, otherwise - failure
328
329 @ref User

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

372}
373
374/**
375 @brief Restore `CeedQFunctionContext` field values of the specified type, read-only.
376
377 For composite operators, the values restored are for the first sub-operator `CeedQFunctionContext` that have a matching `field_name`.
378 A non-zero error code is returned for single operators that do not have a matching field of the same type or composite operators that do not have any field of a matching type.
379
380 @param[in,out] op `CeedOperator`
380 @param[in,out] op `CeedOperator`
381 @param[in] field_label Label of field to set
382 @param[in] field_type Type of field to set
383 @param[in] values Values array to restore
384
385 @return An error code: 0 - success, otherwise - failure
386
387 @ref User
388**/

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

429
430/// ----------------------------------------------------------------------------
431/// CeedOperator Backend API
432/// ----------------------------------------------------------------------------
433/// @addtogroup CeedOperatorBackend
434/// @{
435
436/**
381 @param[in] field_label Label of field to set
382 @param[in] field_type Type of field to set
383 @param[in] values Values array to restore
384
385 @return An error code: 0 - success, otherwise - failure
386
387 @ref User
388**/

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

429
430/// ----------------------------------------------------------------------------
431/// CeedOperator Backend API
432/// ----------------------------------------------------------------------------
433/// @addtogroup CeedOperatorBackend
434/// @{
435
436/**
437 @brief Get the number of arguments associated with a `CeedOperator`
437 @brief Get the number of arguments associated with a `CeedOperator`
438
438
439 @param[in] op `CeedOperator`
439 @param[in] op `CeedOperator`
440 @param[out] num_args Variable to store vector number of arguments
441
442 @return An error code: 0 - success, otherwise - failure
443
444 @ref Backend
445**/
446int CeedOperatorGetNumArgs(CeedOperator op, CeedInt *num_args) {
447 CeedCheck(!op->is_composite, op->ceed, CEED_ERROR_MINOR, "Not defined for composite operators");
448 *num_args = op->num_fields;
449 return CEED_ERROR_SUCCESS;
450}
451
452/**
440 @param[out] num_args Variable to store vector number of arguments
441
442 @return An error code: 0 - success, otherwise - failure
443
444 @ref Backend
445**/
446int CeedOperatorGetNumArgs(CeedOperator op, CeedInt *num_args) {
447 CeedCheck(!op->is_composite, op->ceed, CEED_ERROR_MINOR, "Not defined for composite operators");
448 *num_args = op->num_fields;
449 return CEED_ERROR_SUCCESS;
450}
451
452/**
453 @brief Get the setup status of a `CeedOperator`
453 @brief Get the setup status of a `CeedOperator`
454
454
455 @param[in] op `CeedOperator`
455 @param[in] op `CeedOperator`
456 @param[out] is_setup_done Variable to store setup status
457
458 @return An error code: 0 - success, otherwise - failure
459
460 @ref Backend
461**/
462int CeedOperatorIsSetupDone(CeedOperator op, bool *is_setup_done) {
463 *is_setup_done = op->is_backend_setup;
464 return CEED_ERROR_SUCCESS;
465}
466
467/**
456 @param[out] is_setup_done Variable to store setup status
457
458 @return An error code: 0 - success, otherwise - failure
459
460 @ref Backend
461**/
462int CeedOperatorIsSetupDone(CeedOperator op, bool *is_setup_done) {
463 *is_setup_done = op->is_backend_setup;
464 return CEED_ERROR_SUCCESS;
465}
466
467/**
468 @brief Get the `CeedQFunction` associated with a `CeedOperator`
468 @brief Get the `CeedQFunction` associated with a `CeedOperator`
469
469
470 @param[in] op `CeedOperator`
471 @param[out] qf Variable to store `CeedQFunction`
470 @param[in] op `CeedOperator`
471 @param[out] qf Variable to store `CeedQFunction`
472
473 @return An error code: 0 - success, otherwise - failure
474
475 @ref Backend
476**/
477int CeedOperatorGetQFunction(CeedOperator op, CeedQFunction *qf) {
478 CeedCheck(!op->is_composite, op->ceed, CEED_ERROR_MINOR, "Not defined for composite operator");
479 *qf = op->qf;
480 return CEED_ERROR_SUCCESS;
481}
482
483/**
484 @brief Get a boolean value indicating if the `CeedOperator` is composite
485
472
473 @return An error code: 0 - success, otherwise - failure
474
475 @ref Backend
476**/
477int CeedOperatorGetQFunction(CeedOperator op, CeedQFunction *qf) {
478 CeedCheck(!op->is_composite, op->ceed, CEED_ERROR_MINOR, "Not defined for composite operator");
479 *qf = op->qf;
480 return CEED_ERROR_SUCCESS;
481}
482
483/**
484 @brief Get a boolean value indicating if the `CeedOperator` is composite
485
486 @param[in] op `CeedOperator`
486 @param[in] op `CeedOperator`
487 @param[out] is_composite Variable to store composite status
488
489 @return An error code: 0 - success, otherwise - failure
490
491 @ref Backend
492**/
493int CeedOperatorIsComposite(CeedOperator op, bool *is_composite) {
494 *is_composite = op->is_composite;
495 return CEED_ERROR_SUCCESS;
496}
497
498/**
487 @param[out] is_composite Variable to store composite status
488
489 @return An error code: 0 - success, otherwise - failure
490
491 @ref Backend
492**/
493int CeedOperatorIsComposite(CeedOperator op, bool *is_composite) {
494 *is_composite = op->is_composite;
495 return CEED_ERROR_SUCCESS;
496}
497
498/**
499 @brief Get the backend data of a `CeedOperator`
499 @brief Get the backend data of a `CeedOperator`
500
500
501 @param[in] op `CeedOperator`
501 @param[in] op `CeedOperator`
502 @param[out] data Variable to store data
503
504 @return An error code: 0 - success, otherwise - failure
505
506 @ref Backend
507**/
508int CeedOperatorGetData(CeedOperator op, void *data) {
509 *(void **)data = op->data;
510 return CEED_ERROR_SUCCESS;
511}
512
513/**
502 @param[out] data Variable to store data
503
504 @return An error code: 0 - success, otherwise - failure
505
506 @ref Backend
507**/
508int CeedOperatorGetData(CeedOperator op, void *data) {
509 *(void **)data = op->data;
510 return CEED_ERROR_SUCCESS;
511}
512
513/**
514 @brief Set the backend data of a `CeedOperator`
514 @brief Set the backend data of a `CeedOperator`
515
515
516 @param[in,out] op `CeedOperator`
516 @param[in,out] op `CeedOperator`
517 @param[in] data Data to set
518
519 @return An error code: 0 - success, otherwise - failure
520
521 @ref Backend
522**/
523int CeedOperatorSetData(CeedOperator op, void *data) {
524 op->data = data;
525 return CEED_ERROR_SUCCESS;
526}
527
528/**
517 @param[in] data Data to set
518
519 @return An error code: 0 - success, otherwise - failure
520
521 @ref Backend
522**/
523int CeedOperatorSetData(CeedOperator op, void *data) {
524 op->data = data;
525 return CEED_ERROR_SUCCESS;
526}
527
528/**
529 @brief Increment the reference counter for a `CeedOperator`
529 @brief Increment the reference counter for a `CeedOperator`
530
531 @param[in,out] op `CeedOperator` to increment the reference counter
532
533 @return An error code: 0 - success, otherwise - failure
534
535 @ref Backend
536**/
537int CeedOperatorReference(CeedOperator op) {
538 op->ref_count++;
539 return CEED_ERROR_SUCCESS;
540}
541
542/**
543 @brief Set the setup flag of a `CeedOperator` to `true`
544
530
531 @param[in,out] op `CeedOperator` to increment the reference counter
532
533 @return An error code: 0 - success, otherwise - failure
534
535 @ref Backend
536**/
537int CeedOperatorReference(CeedOperator op) {
538 op->ref_count++;
539 return CEED_ERROR_SUCCESS;
540}
541
542/**
543 @brief Set the setup flag of a `CeedOperator` to `true`
544
545 @param[in,out] op `CeedOperator`
545 @param[in,out] op `CeedOperator`
546
547 @return An error code: 0 - success, otherwise - failure
548
549 @ref Backend
550**/
551int CeedOperatorSetSetupDone(CeedOperator op) {
552 op->is_backend_setup = true;
553 return CEED_ERROR_SUCCESS;

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

561/// @addtogroup CeedOperatorUser
562/// @{
563
564/**
565 @brief Create a `CeedOperator` and associate a `CeedQFunction`.
566
567 A `CeedBasis` and `CeedElemRestriction` can be associated with `CeedQFunction` fields with @ref CeedOperatorSetField().
568
546
547 @return An error code: 0 - success, otherwise - failure
548
549 @ref Backend
550**/
551int CeedOperatorSetSetupDone(CeedOperator op) {
552 op->is_backend_setup = true;
553 return CEED_ERROR_SUCCESS;

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

561/// @addtogroup CeedOperatorUser
562/// @{
563
564/**
565 @brief Create a `CeedOperator` and associate a `CeedQFunction`.
566
567 A `CeedBasis` and `CeedElemRestriction` can be associated with `CeedQFunction` fields with @ref CeedOperatorSetField().
568
569 @param[in] ceed `Ceed` object used to create the `CeedOperator`
569 @param[in] ceed `Ceed` object used to create the `CeedOperator`
570 @param[in] qf `CeedQFunction` defining the action of the operator at quadrature points
571 @param[in] dqf `CeedQFunction` defining the action of the Jacobian of `qf` (or @ref CEED_QFUNCTION_NONE)
572 @param[in] dqfT `CeedQFunction` defining the action of the transpose of the Jacobian of `qf` (or @ref CEED_QFUNCTION_NONE)
573 @param[out] op Address of the variable where the newly created `CeedOperator` will be stored
574
575 @return An error code: 0 - success, otherwise - failure
576
577 @ref User

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

604}
605
606/**
607 @brief Create a `CeedOperator` for evaluation at evaluation at arbitrary points in each element.
608
609 A `CeedBasis` and `CeedElemRestriction` can be associated with `CeedQFunction` fields with `CeedOperator` SetField.
610 The locations of each point are set with @ref CeedOperatorAtPointsSetPoints().
611
570 @param[in] qf `CeedQFunction` defining the action of the operator at quadrature points
571 @param[in] dqf `CeedQFunction` defining the action of the Jacobian of `qf` (or @ref CEED_QFUNCTION_NONE)
572 @param[in] dqfT `CeedQFunction` defining the action of the transpose of the Jacobian of `qf` (or @ref CEED_QFUNCTION_NONE)
573 @param[out] op Address of the variable where the newly created `CeedOperator` will be stored
574
575 @return An error code: 0 - success, otherwise - failure
576
577 @ref User

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

604}
605
606/**
607 @brief Create a `CeedOperator` for evaluation at evaluation at arbitrary points in each element.
608
609 A `CeedBasis` and `CeedElemRestriction` can be associated with `CeedQFunction` fields with `CeedOperator` SetField.
610 The locations of each point are set with @ref CeedOperatorAtPointsSetPoints().
611
612 @param[in] ceed `Ceed` object used to create the `CeedOperator`
612 @param[in] ceed `Ceed` object used to create the `CeedOperator`
613 @param[in] qf `CeedQFunction` defining the action of the operator at quadrature points
614 @param[in] dqf `CeedQFunction` defining the action of the Jacobian of @a qf (or @ref CEED_QFUNCTION_NONE)
615 @param[in] dqfT `CeedQFunction` defining the action of the transpose of the Jacobian of @a qf (or @ref CEED_QFUNCTION_NONE)
616 @param[out] op Address of the variable where the newly created CeedOperator will be stored
617
618 @return An error code: 0 - success, otherwise - failure
619
620 @ref User

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

643 CeedCall(CeedQFunctionAssemblyDataCreate(ceed, &(*op)->qf_assembled));
644 CeedCall(CeedCalloc(CEED_FIELD_MAX, &(*op)->input_fields));
645 CeedCall(CeedCalloc(CEED_FIELD_MAX, &(*op)->output_fields));
646 CeedCall(ceed->OperatorCreateAtPoints(*op));
647 return CEED_ERROR_SUCCESS;
648}
649
650/**
613 @param[in] qf `CeedQFunction` defining the action of the operator at quadrature points
614 @param[in] dqf `CeedQFunction` defining the action of the Jacobian of @a qf (or @ref CEED_QFUNCTION_NONE)
615 @param[in] dqfT `CeedQFunction` defining the action of the transpose of the Jacobian of @a qf (or @ref CEED_QFUNCTION_NONE)
616 @param[out] op Address of the variable where the newly created CeedOperator will be stored
617
618 @return An error code: 0 - success, otherwise - failure
619
620 @ref User

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

643 CeedCall(CeedQFunctionAssemblyDataCreate(ceed, &(*op)->qf_assembled));
644 CeedCall(CeedCalloc(CEED_FIELD_MAX, &(*op)->input_fields));
645 CeedCall(CeedCalloc(CEED_FIELD_MAX, &(*op)->output_fields));
646 CeedCall(ceed->OperatorCreateAtPoints(*op));
647 return CEED_ERROR_SUCCESS;
648}
649
650/**
651 @brief Create a composite `CeedOperator` that composes the action of several `CeedOperator`
651 @brief Create a composite `CeedOperator` that composes the action of several `CeedOperator`
652
652
653 @param[in] ceed `Ceed` object used to create the `CeedOperator`
653 @param[in] ceed `Ceed` object used to create the `CeedOperator`
654 @param[out] op Address of the variable where the newly created composite `CeedOperator` will be stored
655
656 @return An error code: 0 - success, otherwise - failure
657
658 @ref User
659 */
660int CeedCompositeOperatorCreate(Ceed ceed, CeedOperator *op) {
661 if (!ceed->CompositeOperatorCreate) {

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

701 *op_copy = op;
702 return CEED_ERROR_SUCCESS;
703}
704
705/**
706 @brief Provide a field to a `CeedOperator` for use by its `CeedQFunction`.
707
708 This function is used to specify both active and passive fields to a `CeedOperator`.
654 @param[out] op Address of the variable where the newly created composite `CeedOperator` will be stored
655
656 @return An error code: 0 - success, otherwise - failure
657
658 @ref User
659 */
660int CeedCompositeOperatorCreate(Ceed ceed, CeedOperator *op) {
661 if (!ceed->CompositeOperatorCreate) {

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

701 *op_copy = op;
702 return CEED_ERROR_SUCCESS;
703}
704
705/**
706 @brief Provide a field to a `CeedOperator` for use by its `CeedQFunction`.
707
708 This function is used to specify both active and passive fields to a `CeedOperator`.
709 For passive fields, a `CeedVector` `v` must be provided.
709 For passive fields, a `CeedVector` `vec` must be provided.
710 Passive fields can inputs or outputs (updated in-place when operator is applied).
711
712 Active fields must be specified using this function, but their data (in a `CeedVector`) is passed in @ref CeedOperatorApply().
713 There can be at most one active input `CeedVector` and at most one active output@ref CeedVector passed to @ref CeedOperatorApply().
714
715 The number of quadrature points must agree across all points.
710 Passive fields can inputs or outputs (updated in-place when operator is applied).
711
712 Active fields must be specified using this function, but their data (in a `CeedVector`) is passed in @ref CeedOperatorApply().
713 There can be at most one active input `CeedVector` and at most one active output@ref CeedVector passed to @ref CeedOperatorApply().
714
715 The number of quadrature points must agree across all points.
716 When using @ref CEED_BASIS_NONE, the number of quadrature points is determined by the element size of `r`.
716 When using @ref CEED_BASIS_NONE, the number of quadrature points is determined by the element size of `rstr`.
717
718 @param[in,out] op `CeedOperator` on which to provide the field
719 @param[in] field_name Name of the field (to be matched with the name used by `CeedQFunction`)
717
718 @param[in,out] op `CeedOperator` on which to provide the field
719 @param[in] field_name Name of the field (to be matched with the name used by `CeedQFunction`)
720 @param[in] r `CeedElemRestriction`
721 @param[in] b `CeedBasis` in which the field resides or @ref CEED_BASIS_NONE if collocated with quadrature points
722 @param[in] v `CeedVector` to be used by CeedOperator or @ref CEED_VECTOR_ACTIVE if field is active or @ref CEED_VECTOR_NONE if using @ref CEED_EVAL_WEIGHT in the `CeedQFunction`
720 @param[in] rstr `CeedElemRestriction`
721 @param[in] basis `CeedBasis` in which the field resides or @ref CEED_BASIS_NONE if collocated with quadrature points
722 @param[in] vec `CeedVector` to be used by CeedOperator or @ref CEED_VECTOR_ACTIVE if field is active or @ref CEED_VECTOR_NONE if using @ref CEED_EVAL_WEIGHT in the `CeedQFunction`
723
724 @return An error code: 0 - success, otherwise - failure
725
726 @ref User
727**/
723
724 @return An error code: 0 - success, otherwise - failure
725
726 @ref User
727**/
728int CeedOperatorSetField(CeedOperator op, const char *field_name, CeedElemRestriction r, CeedBasis b, CeedVector v) {
728int CeedOperatorSetField(CeedOperator op, const char *field_name, CeedElemRestriction rstr, CeedBasis basis, CeedVector vec) {
729 bool is_input = true;
730 CeedInt num_elem = 0, num_qpts = 0;
731 CeedQFunctionField qf_field;
732 CeedOperatorField *op_field;
733
734 CeedCheck(!op->is_composite, op->ceed, CEED_ERROR_INCOMPATIBLE, "Cannot add field to composite operator.");
735 CeedCheck(!op->is_immutable, op->ceed, CEED_ERROR_MAJOR, "Operator cannot be changed after set as immutable");
729 bool is_input = true;
730 CeedInt num_elem = 0, num_qpts = 0;
731 CeedQFunctionField qf_field;
732 CeedOperatorField *op_field;
733
734 CeedCheck(!op->is_composite, op->ceed, CEED_ERROR_INCOMPATIBLE, "Cannot add field to composite operator.");
735 CeedCheck(!op->is_immutable, op->ceed, CEED_ERROR_MAJOR, "Operator cannot be changed after set as immutable");
736 CeedCheck(r, op->ceed, CEED_ERROR_INCOMPATIBLE, "CeedElemRestriction r for field \"%s\" must be non-NULL.", field_name);
737 CeedCheck(b, op->ceed, CEED_ERROR_INCOMPATIBLE, "CeedBasis b for field \"%s\" must be non-NULL.", field_name);
738 CeedCheck(v, op->ceed, CEED_ERROR_INCOMPATIBLE, "CeedVector v for field \"%s\" must be non-NULL.", field_name);
736 CeedCheck(rstr, op->ceed, CEED_ERROR_INCOMPATIBLE, "CeedElemRestriction rstr for field \"%s\" must be non-NULL.", field_name);
737 CeedCheck(basis, op->ceed, CEED_ERROR_INCOMPATIBLE, "CeedBasis basis for field \"%s\" must be non-NULL.", field_name);
738 CeedCheck(vec, op->ceed, CEED_ERROR_INCOMPATIBLE, "CeedVector vec for field \"%s\" must be non-NULL.", field_name);
739
739
740 CeedCall(CeedElemRestrictionGetNumElements(r, &num_elem));
741 CeedCheck(r == CEED_ELEMRESTRICTION_NONE || !op->has_restriction || op->num_elem == num_elem, op->ceed, CEED_ERROR_DIMENSION,
740 CeedCall(CeedElemRestrictionGetNumElements(rstr, &num_elem));
741 CeedCheck(rstr == CEED_ELEMRESTRICTION_NONE || !op->has_restriction || op->num_elem == num_elem, op->ceed, CEED_ERROR_DIMENSION,
742 "CeedElemRestriction with %" CeedInt_FMT " elements incompatible with prior %" CeedInt_FMT " elements", num_elem, op->num_elem);
743 {
744 CeedRestrictionType rstr_type;
745
742 "CeedElemRestriction with %" CeedInt_FMT " elements incompatible with prior %" CeedInt_FMT " elements", num_elem, op->num_elem);
743 {
744 CeedRestrictionType rstr_type;
745
746 CeedCall(CeedElemRestrictionGetType(r, &rstr_type));
746 CeedCall(CeedElemRestrictionGetType(rstr, &rstr_type));
747 if (rstr_type == CEED_RESTRICTION_POINTS) {
748 CeedCheck(op->is_at_points, op->ceed, CEED_ERROR_UNSUPPORTED, "CeedElemRestriction AtPoints not supported for standard operator fields");
747 if (rstr_type == CEED_RESTRICTION_POINTS) {
748 CeedCheck(op->is_at_points, op->ceed, CEED_ERROR_UNSUPPORTED, "CeedElemRestriction AtPoints not supported for standard operator fields");
749 CeedCheck(b == CEED_BASIS_NONE, op->ceed, CEED_ERROR_UNSUPPORTED, "CeedElemRestriction AtPoints must be used with CEED_BASIS_NONE");
749 CeedCheck(basis == CEED_BASIS_NONE, op->ceed, CEED_ERROR_UNSUPPORTED, "CeedElemRestriction AtPoints must be used with CEED_BASIS_NONE");
750 if (!op->first_points_rstr) {
750 if (!op->first_points_rstr) {
751 CeedCall(CeedElemRestrictionReferenceCopy(r, &op->first_points_rstr));
751 CeedCall(CeedElemRestrictionReferenceCopy(rstr, &op->first_points_rstr));
752 } else {
753 bool are_compatible;
754
752 } else {
753 bool are_compatible;
754
755 CeedCall(CeedElemRestrictionAtPointsAreCompatible(op->first_points_rstr, r, &are_compatible));
755 CeedCall(CeedElemRestrictionAtPointsAreCompatible(op->first_points_rstr, rstr, &are_compatible));
756 CeedCheck(are_compatible, op->ceed, CEED_ERROR_INCOMPATIBLE,
757 "CeedElemRestriction must have compatible offsets with previously set CeedElemRestriction");
758 }
759 }
760 }
761
756 CeedCheck(are_compatible, op->ceed, CEED_ERROR_INCOMPATIBLE,
757 "CeedElemRestriction must have compatible offsets with previously set CeedElemRestriction");
758 }
759 }
760 }
761
762 if (b == CEED_BASIS_NONE) CeedCall(CeedElemRestrictionGetElementSize(r, &num_qpts));
763 else CeedCall(CeedBasisGetNumQuadraturePoints(b, &num_qpts));
762 if (basis == CEED_BASIS_NONE) CeedCall(CeedElemRestrictionGetElementSize(rstr, &num_qpts));
763 else CeedCall(CeedBasisGetNumQuadraturePoints(basis, &num_qpts));
764 CeedCheck(op->num_qpts == 0 || op->num_qpts == num_qpts, op->ceed, CEED_ERROR_DIMENSION,
765 "%s must correspond to the same number of quadrature points as previously added CeedBases. Found %" CeedInt_FMT
766 " quadrature points but expected %" CeedInt_FMT " quadrature points.",
764 CeedCheck(op->num_qpts == 0 || op->num_qpts == num_qpts, op->ceed, CEED_ERROR_DIMENSION,
765 "%s must correspond to the same number of quadrature points as previously added CeedBases. Found %" CeedInt_FMT
766 " quadrature points but expected %" CeedInt_FMT " quadrature points.",
767 b == CEED_BASIS_NONE ? "CeedElemRestriction" : "CeedBasis", num_qpts, op->num_qpts);
767 basis == CEED_BASIS_NONE ? "CeedElemRestriction" : "CeedBasis", num_qpts, op->num_qpts);
768 for (CeedInt i = 0; i < op->qf->num_input_fields; i++) {
769 if (!strcmp(field_name, (*op->qf->input_fields[i]).field_name)) {
770 qf_field = op->qf->input_fields[i];
771 op_field = &op->input_fields[i];
772 goto found;
773 }
774 }
775 is_input = false;
776 for (CeedInt i = 0; i < op->qf->num_output_fields; i++) {
777 if (!strcmp(field_name, (*op->qf->output_fields[i]).field_name)) {
778 qf_field = op->qf->output_fields[i];
779 op_field = &op->output_fields[i];
780 goto found;
781 }
782 }
783 // LCOV_EXCL_START
784 return CeedError(op->ceed, CEED_ERROR_INCOMPLETE, "CeedQFunction has no knowledge of field '%s'", field_name);
785 // LCOV_EXCL_STOP
786found:
768 for (CeedInt i = 0; i < op->qf->num_input_fields; i++) {
769 if (!strcmp(field_name, (*op->qf->input_fields[i]).field_name)) {
770 qf_field = op->qf->input_fields[i];
771 op_field = &op->input_fields[i];
772 goto found;
773 }
774 }
775 is_input = false;
776 for (CeedInt i = 0; i < op->qf->num_output_fields; i++) {
777 if (!strcmp(field_name, (*op->qf->output_fields[i]).field_name)) {
778 qf_field = op->qf->output_fields[i];
779 op_field = &op->output_fields[i];
780 goto found;
781 }
782 }
783 // LCOV_EXCL_START
784 return CeedError(op->ceed, CEED_ERROR_INCOMPLETE, "CeedQFunction has no knowledge of field '%s'", field_name);
785 // LCOV_EXCL_STOP
786found:
787 CeedCall(CeedOperatorCheckField(op->ceed, qf_field, r, b));
787 CeedCall(CeedOperatorCheckField(op->ceed, qf_field, rstr, basis));
788 CeedCall(CeedCalloc(1, op_field));
789
788 CeedCall(CeedCalloc(1, op_field));
789
790 if (v == CEED_VECTOR_ACTIVE) {
790 if (vec == CEED_VECTOR_ACTIVE) {
791 CeedSize l_size;
792
791 CeedSize l_size;
792
793 CeedCall(CeedElemRestrictionGetLVectorSize(r, &l_size));
793 CeedCall(CeedElemRestrictionGetLVectorSize(rstr, &l_size));
794 if (is_input) {
795 if (op->input_size == -1) op->input_size = l_size;
796 CeedCheck(l_size == op->input_size, op->ceed, CEED_ERROR_INCOMPATIBLE, "LVector size %td does not match previous size %td", l_size,
797 op->input_size);
798 } else {
799 if (op->output_size == -1) op->output_size = l_size;
800 CeedCheck(l_size == op->output_size, op->ceed, CEED_ERROR_INCOMPATIBLE, "LVector size %td does not match previous size %td", l_size,
801 op->output_size);
802 }
803 }
804
794 if (is_input) {
795 if (op->input_size == -1) op->input_size = l_size;
796 CeedCheck(l_size == op->input_size, op->ceed, CEED_ERROR_INCOMPATIBLE, "LVector size %td does not match previous size %td", l_size,
797 op->input_size);
798 } else {
799 if (op->output_size == -1) op->output_size = l_size;
800 CeedCheck(l_size == op->output_size, op->ceed, CEED_ERROR_INCOMPATIBLE, "LVector size %td does not match previous size %td", l_size,
801 op->output_size);
802 }
803 }
804
805 CeedCall(CeedVectorReferenceCopy(v, &(*op_field)->vec));
806 CeedCall(CeedElemRestrictionReferenceCopy(r, &(*op_field)->elem_rstr));
807 if (r != CEED_ELEMRESTRICTION_NONE && !op->has_restriction) {
805 CeedCall(CeedVectorReferenceCopy(vec, &(*op_field)->vec));
806 CeedCall(CeedElemRestrictionReferenceCopy(rstr, &(*op_field)->elem_rstr));
807 if (rstr != CEED_ELEMRESTRICTION_NONE && !op->has_restriction) {
808 op->num_elem = num_elem;
809 op->has_restriction = true; // Restriction set, but num_elem may be 0
810 }
808 op->num_elem = num_elem;
809 op->has_restriction = true; // Restriction set, but num_elem may be 0
810 }
811 CeedCall(CeedBasisReferenceCopy(b, &(*op_field)->basis));
811 CeedCall(CeedBasisReferenceCopy(basis, &(*op_field)->basis));
812 if (op->num_qpts == 0 && !op->is_at_points) op->num_qpts = num_qpts; // no consistent number of qpts for OperatorAtPoints
813 op->num_fields += 1;
814 CeedCall(CeedStringAllocCopy(field_name, (char **)&(*op_field)->field_name));
815 return CEED_ERROR_SUCCESS;
816}
817
818/**
819 @brief Get the `CeedOperator` Field of a `CeedOperator`.
820
821 Note: Calling this function asserts that setup is complete and sets the `CeedOperator` as immutable.
822
812 if (op->num_qpts == 0 && !op->is_at_points) op->num_qpts = num_qpts; // no consistent number of qpts for OperatorAtPoints
813 op->num_fields += 1;
814 CeedCall(CeedStringAllocCopy(field_name, (char **)&(*op_field)->field_name));
815 return CEED_ERROR_SUCCESS;
816}
817
818/**
819 @brief Get the `CeedOperator` Field of a `CeedOperator`.
820
821 Note: Calling this function asserts that setup is complete and sets the `CeedOperator` as immutable.
822
823 @param[in] op `CeedOperator`
823 @param[in] op `CeedOperator`
824 @param[out] num_input_fields Variable to store number of input fields
825 @param[out] input_fields Variable to store input fields
826 @param[out] num_output_fields Variable to store number of output fields
827 @param[out] output_fields Variable to store output fields
828
829 @return An error code: 0 - success, otherwise - failure
830
831 @ref Advanced

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

896 return CEED_ERROR_SUCCESS;
897}
898
899/**
900 @brief Get a `CeedOperator` Field of a `CeedOperator` from its name
901
902 Note: Calling this function asserts that setup is complete and sets the `CeedOperator` as immutable.
903
824 @param[out] num_input_fields Variable to store number of input fields
825 @param[out] input_fields Variable to store input fields
826 @param[out] num_output_fields Variable to store number of output fields
827 @param[out] output_fields Variable to store output fields
828
829 @return An error code: 0 - success, otherwise - failure
830
831 @ref Advanced

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

896 return CEED_ERROR_SUCCESS;
897}
898
899/**
900 @brief Get a `CeedOperator` Field of a `CeedOperator` from its name
901
902 Note: Calling this function asserts that setup is complete and sets the `CeedOperator` as immutable.
903
904 @param[in] op `CeedOperator`
904 @param[in] op `CeedOperator`
905 @param[in] field_name Name of desired `CeedOperator` Field
906 @param[out] op_field `CeedOperator` Field corresponding to the name
907
908 @return An error code: 0 - success, otherwise - failure
909
910 @ref Advanced
911**/
912int CeedOperatorGetFieldByName(CeedOperator op, const char *field_name, CeedOperatorField *op_field) {

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

951 *field_name = (char *)op_field->field_name;
952 return CEED_ERROR_SUCCESS;
953}
954
955/**
956 @brief Get the `CeedElemRestriction` of a `CeedOperator` Field
957
958 @param[in] op_field `CeedOperator` Field
905 @param[in] field_name Name of desired `CeedOperator` Field
906 @param[out] op_field `CeedOperator` Field corresponding to the name
907
908 @return An error code: 0 - success, otherwise - failure
909
910 @ref Advanced
911**/
912int CeedOperatorGetFieldByName(CeedOperator op, const char *field_name, CeedOperatorField *op_field) {

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

951 *field_name = (char *)op_field->field_name;
952 return CEED_ERROR_SUCCESS;
953}
954
955/**
956 @brief Get the `CeedElemRestriction` of a `CeedOperator` Field
957
958 @param[in] op_field `CeedOperator` Field
959 @param[out] rstr Variable to store `CeedElemRestriction`
959 @param[out] rstr Variable to store `CeedElemRestriction`
960
961 @return An error code: 0 - success, otherwise - failure
962
963 @ref Advanced
964**/
965int CeedOperatorFieldGetElemRestriction(CeedOperatorField op_field, CeedElemRestriction *rstr) {
966 *rstr = op_field->elem_rstr;
967 return CEED_ERROR_SUCCESS;
968}
969
970/**
971 @brief Get the `CeedBasis` of a `CeedOperator` Field
972
973 @param[in] op_field `CeedOperator` Field
960
961 @return An error code: 0 - success, otherwise - failure
962
963 @ref Advanced
964**/
965int CeedOperatorFieldGetElemRestriction(CeedOperatorField op_field, CeedElemRestriction *rstr) {
966 *rstr = op_field->elem_rstr;
967 return CEED_ERROR_SUCCESS;
968}
969
970/**
971 @brief Get the `CeedBasis` of a `CeedOperator` Field
972
973 @param[in] op_field `CeedOperator` Field
974 @param[out] basis Variable to store `CeedBasis`
974 @param[out] basis Variable to store `CeedBasis`
975
976 @return An error code: 0 - success, otherwise - failure
977
978 @ref Advanced
979**/
980int CeedOperatorFieldGetBasis(CeedOperatorField op_field, CeedBasis *basis) {
981 *basis = op_field->basis;
982 return CEED_ERROR_SUCCESS;
983}
984
985/**
986 @brief Get the `CeedVector` of a `CeedOperator` Field
987
988 @param[in] op_field `CeedOperator` Field
975
976 @return An error code: 0 - success, otherwise - failure
977
978 @ref Advanced
979**/
980int CeedOperatorFieldGetBasis(CeedOperatorField op_field, CeedBasis *basis) {
981 *basis = op_field->basis;
982 return CEED_ERROR_SUCCESS;
983}
984
985/**
986 @brief Get the `CeedVector` of a `CeedOperator` Field
987
988 @param[in] op_field `CeedOperator` Field
989 @param[out] vec Variable to store `CeedVector`
989 @param[out] vec Variable to store `CeedVector`
990
991 @return An error code: 0 - success, otherwise - failure
992
993 @ref Advanced
994**/
995int CeedOperatorFieldGetVector(CeedOperatorField op_field, CeedVector *vec) {
996 *vec = op_field->vec;
997 return CEED_ERROR_SUCCESS;
998}
999
1000/**
990
991 @return An error code: 0 - success, otherwise - failure
992
993 @ref Advanced
994**/
995int CeedOperatorFieldGetVector(CeedOperatorField op_field, CeedVector *vec) {
996 *vec = op_field->vec;
997 return CEED_ERROR_SUCCESS;
998}
999
1000/**
1001 @brief Add a sub-operator to a composite `CeedOperator`
1001 @brief Add a sub-operator to a composite `CeedOperator`
1002
1002
1003 @param[in,out] composite_op Composite `CeedOperator`
1004 @param[in] sub_op Sub-operator `CeedOperator`
1003 @param[in,out] composite_op Composite `CeedOperator`
1004 @param[in] sub_op Sub-operator `CeedOperator`
1005
1006 @return An error code: 0 - success, otherwise - failure
1007
1008 @ref User
1009 */
1010int CeedCompositeOperatorAddSub(CeedOperator composite_op, CeedOperator sub_op) {
1011 CeedCheck(composite_op->is_composite, composite_op->ceed, CEED_ERROR_MINOR, "CeedOperator is not a composite operator");
1012 CeedCheck(composite_op->num_suboperators < CEED_COMPOSITE_MAX, composite_op->ceed, CEED_ERROR_UNSUPPORTED, "Cannot add additional sub-operators");

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

1028
1029 composite_op->sub_operators[composite_op->num_suboperators] = sub_op;
1030 CeedCall(CeedOperatorReference(sub_op));
1031 composite_op->num_suboperators++;
1032 return CEED_ERROR_SUCCESS;
1033}
1034
1035/**
1005
1006 @return An error code: 0 - success, otherwise - failure
1007
1008 @ref User
1009 */
1010int CeedCompositeOperatorAddSub(CeedOperator composite_op, CeedOperator sub_op) {
1011 CeedCheck(composite_op->is_composite, composite_op->ceed, CEED_ERROR_MINOR, "CeedOperator is not a composite operator");
1012 CeedCheck(composite_op->num_suboperators < CEED_COMPOSITE_MAX, composite_op->ceed, CEED_ERROR_UNSUPPORTED, "Cannot add additional sub-operators");

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

1028
1029 composite_op->sub_operators[composite_op->num_suboperators] = sub_op;
1030 CeedCall(CeedOperatorReference(sub_op));
1031 composite_op->num_suboperators++;
1032 return CEED_ERROR_SUCCESS;
1033}
1034
1035/**
1036 @brief Get the number of sub-operators associated with a `CeedOperator`
1036 @brief Get the number of sub-operators associated with a `CeedOperator`
1037
1037
1038 @param[in] op `CeedOperator`
1038 @param[in] op `CeedOperator`
1039 @param[out] num_suboperators Variable to store number of sub-operators
1040
1041 @return An error code: 0 - success, otherwise - failure
1042
1043 @ref Backend
1044**/
1045int CeedCompositeOperatorGetNumSub(CeedOperator op, CeedInt *num_suboperators) {
1046 CeedCheck(op->is_composite, op->ceed, CEED_ERROR_MINOR, "Only defined for a composite operator");
1047 *num_suboperators = op->num_suboperators;
1048 return CEED_ERROR_SUCCESS;
1049}
1050
1051/**
1039 @param[out] num_suboperators Variable to store number of sub-operators
1040
1041 @return An error code: 0 - success, otherwise - failure
1042
1043 @ref Backend
1044**/
1045int CeedCompositeOperatorGetNumSub(CeedOperator op, CeedInt *num_suboperators) {
1046 CeedCheck(op->is_composite, op->ceed, CEED_ERROR_MINOR, "Only defined for a composite operator");
1047 *num_suboperators = op->num_suboperators;
1048 return CEED_ERROR_SUCCESS;
1049}
1050
1051/**
1052 @brief Get the list of sub-operators associated with a `CeedOperator`
1052 @brief Get the list of sub-operators associated with a `CeedOperator`
1053
1053
1054 @param[in] op `CeedOperator`
1054 @param[in] op `CeedOperator`
1055 @param[out] sub_operators Variable to store list of sub-operators
1056
1057 @return An error code: 0 - success, otherwise - failure
1058
1059 @ref Backend
1060**/
1061int CeedCompositeOperatorGetSubList(CeedOperator op, CeedOperator **sub_operators) {
1062 CeedCheck(op->is_composite, op->ceed, CEED_ERROR_MINOR, "Only defined for a composite operator");

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

1111 return CEED_ERROR_SUCCESS;
1112}
1113
1114/**
1115 @brief Get vector lengths for the active input and/or output `CeedVector` of a `CeedOperator`.
1116
1117 Note: Lengths of `-1` indicate that the CeedOperator does not have an active input and/or output.
1118
1055 @param[out] sub_operators Variable to store list of sub-operators
1056
1057 @return An error code: 0 - success, otherwise - failure
1058
1059 @ref Backend
1060**/
1061int CeedCompositeOperatorGetSubList(CeedOperator op, CeedOperator **sub_operators) {
1062 CeedCheck(op->is_composite, op->ceed, CEED_ERROR_MINOR, "Only defined for a composite operator");

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

1111 return CEED_ERROR_SUCCESS;
1112}
1113
1114/**
1115 @brief Get vector lengths for the active input and/or output `CeedVector` of a `CeedOperator`.
1116
1117 Note: Lengths of `-1` indicate that the CeedOperator does not have an active input and/or output.
1118
1119 @param[in] op `CeedOperator`
1119 @param[in] op `CeedOperator`
1120 @param[out] input_size Variable to store active input vector length, or `NULL`
1121 @param[out] output_size Variable to store active output vector length, or `NULL`
1122
1123 @return An error code: 0 - success, otherwise - failure
1124
1125 @ref User
1126**/
1127int CeedOperatorGetActiveVectorLengths(CeedOperator op, CeedSize *input_size, CeedSize *output_size) {

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

1150}
1151
1152/**
1153 @brief Set reuse of `CeedQFunction` data in `CeedOperatorLinearAssemble*()` functions.
1154
1155 When `reuse_assembly_data = false` (default), the `CeedQFunction` associated with this `CeedOperator` is re-assembled every time a `CeedOperatorLinearAssemble*()` function is called.
1156 When `reuse_assembly_data = true`, the `CeedQFunction` associated with this `CeedOperator` is reused between calls to @ref CeedOperatorSetQFunctionAssemblyDataUpdateNeeded().
1157
1120 @param[out] input_size Variable to store active input vector length, or `NULL`
1121 @param[out] output_size Variable to store active output vector length, or `NULL`
1122
1123 @return An error code: 0 - success, otherwise - failure
1124
1125 @ref User
1126**/
1127int CeedOperatorGetActiveVectorLengths(CeedOperator op, CeedSize *input_size, CeedSize *output_size) {

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

1150}
1151
1152/**
1153 @brief Set reuse of `CeedQFunction` data in `CeedOperatorLinearAssemble*()` functions.
1154
1155 When `reuse_assembly_data = false` (default), the `CeedQFunction` associated with this `CeedOperator` is re-assembled every time a `CeedOperatorLinearAssemble*()` function is called.
1156 When `reuse_assembly_data = true`, the `CeedQFunction` associated with this `CeedOperator` is reused between calls to @ref CeedOperatorSetQFunctionAssemblyDataUpdateNeeded().
1157
1158 @param[in] op `CeedOperator`
1158 @param[in] op `CeedOperator`
1159 @param[in] reuse_assembly_data Boolean flag setting assembly data reuse
1160
1161 @return An error code: 0 - success, otherwise - failure
1162
1163 @ref Advanced
1164**/
1165int CeedOperatorSetQFunctionAssemblyReuse(CeedOperator op, bool reuse_assembly_data) {
1166 bool is_composite;

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

1174 CeedCall(CeedQFunctionAssemblyDataSetReuse(op->qf_assembled, reuse_assembly_data));
1175 }
1176 return CEED_ERROR_SUCCESS;
1177}
1178
1179/**
1180 @brief Mark `CeedQFunction` data as updated and the `CeedQFunction` as requiring re-assembly.
1181
1159 @param[in] reuse_assembly_data Boolean flag setting assembly data reuse
1160
1161 @return An error code: 0 - success, otherwise - failure
1162
1163 @ref Advanced
1164**/
1165int CeedOperatorSetQFunctionAssemblyReuse(CeedOperator op, bool reuse_assembly_data) {
1166 bool is_composite;

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

1174 CeedCall(CeedQFunctionAssemblyDataSetReuse(op->qf_assembled, reuse_assembly_data));
1175 }
1176 return CEED_ERROR_SUCCESS;
1177}
1178
1179/**
1180 @brief Mark `CeedQFunction` data as updated and the `CeedQFunction` as requiring re-assembly.
1181
1182 @param[in] op `CeedOperator`
1182 @param[in] op `CeedOperator`
1183 @param[in] needs_data_update Boolean flag setting assembly data reuse
1184
1185 @return An error code: 0 - success, otherwise - failure
1186
1187 @ref Advanced
1188**/
1189int CeedOperatorSetQFunctionAssemblyDataUpdateNeeded(CeedOperator op, bool needs_data_update) {
1190 bool is_composite;

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

1198 CeedCall(CeedQFunctionAssemblyDataSetUpdateNeeded(op->qf_assembled, needs_data_update));
1199 }
1200 return CEED_ERROR_SUCCESS;
1201}
1202
1203/**
1204 @brief Set name of `CeedOperator` for @ref CeedOperatorView() output
1205
1183 @param[in] needs_data_update Boolean flag setting assembly data reuse
1184
1185 @return An error code: 0 - success, otherwise - failure
1186
1187 @ref Advanced
1188**/
1189int CeedOperatorSetQFunctionAssemblyDataUpdateNeeded(CeedOperator op, bool needs_data_update) {
1190 bool is_composite;

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

1198 CeedCall(CeedQFunctionAssemblyDataSetUpdateNeeded(op->qf_assembled, needs_data_update));
1199 }
1200 return CEED_ERROR_SUCCESS;
1201}
1202
1203/**
1204 @brief Set name of `CeedOperator` for @ref CeedOperatorView() output
1205
1206 @param[in,out] op `CeedOperator`
1206 @param[in,out] op `CeedOperator`
1207 @param[in] name Name to set, or NULL to remove previously set name
1208
1209 @return An error code: 0 - success, otherwise - failure
1210
1211 @ref User
1212**/
1213int CeedOperatorSetName(CeedOperator op, const char *name) {
1214 char *name_copy;

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

1219 CeedCall(CeedCalloc(name_len + 1, &name_copy));
1220 memcpy(name_copy, name, name_len);
1221 op->name = name_copy;
1222 }
1223 return CEED_ERROR_SUCCESS;
1224}
1225
1226/**
1207 @param[in] name Name to set, or NULL to remove previously set name
1208
1209 @return An error code: 0 - success, otherwise - failure
1210
1211 @ref User
1212**/
1213int CeedOperatorSetName(CeedOperator op, const char *name) {
1214 char *name_copy;

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

1219 CeedCall(CeedCalloc(name_len + 1, &name_copy));
1220 memcpy(name_copy, name, name_len);
1221 op->name = name_copy;
1222 }
1223 return CEED_ERROR_SUCCESS;
1224}
1225
1226/**
1227 @brief View a `CeedOperator`
1227 @brief View a `CeedOperator`
1228
1229 @param[in] op `CeedOperator` to view
1230 @param[in] stream Stream to write; typically `stdout` or a file
1231
1232 @return Error code: 0 - success, otherwise - failure
1233
1234 @ref User
1235**/

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

1247 } else {
1248 fprintf(stream, "CeedOperator%s%s\n", has_name ? " - " : "", has_name ? op->name : "");
1249 CeedCall(CeedOperatorSingleView(op, 0, stream));
1250 }
1251 return CEED_ERROR_SUCCESS;
1252}
1253
1254/**
1228
1229 @param[in] op `CeedOperator` to view
1230 @param[in] stream Stream to write; typically `stdout` or a file
1231
1232 @return Error code: 0 - success, otherwise - failure
1233
1234 @ref User
1235**/

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

1247 } else {
1248 fprintf(stream, "CeedOperator%s%s\n", has_name ? " - " : "", has_name ? op->name : "");
1249 CeedCall(CeedOperatorSingleView(op, 0, stream));
1250 }
1251 return CEED_ERROR_SUCCESS;
1252}
1253
1254/**
1255 @brief Get the `Ceed` associated with a `CeedOperator`
1255 @brief Get the `Ceed` associated with a `CeedOperator`
1256
1256
1257 @param[in] op `CeedOperator`
1257 @param[in] op `CeedOperator`
1258 @param[out] ceed Variable to store `Ceed`
1259
1260 @return An error code: 0 - success, otherwise - failure
1261
1262 @ref Advanced
1263**/
1264int CeedOperatorGetCeed(CeedOperator op, Ceed *ceed) {
1265 *ceed = op->ceed;
1266 return CEED_ERROR_SUCCESS;
1267}
1268
1269/**
1258 @param[out] ceed Variable to store `Ceed`
1259
1260 @return An error code: 0 - success, otherwise - failure
1261
1262 @ref Advanced
1263**/
1264int CeedOperatorGetCeed(CeedOperator op, Ceed *ceed) {
1265 *ceed = op->ceed;
1266 return CEED_ERROR_SUCCESS;
1267}
1268
1269/**
1270 @brief Get the number of elements associated with a `CeedOperator`
1270 @brief Get the number of elements associated with a `CeedOperator`
1271
1271
1272 @param[in] op `CeedOperator`
1272 @param[in] op `CeedOperator`
1273 @param[out] num_elem Variable to store number of elements
1274
1275 @return An error code: 0 - success, otherwise - failure
1276
1277 @ref Advanced
1278**/
1279int CeedOperatorGetNumElements(CeedOperator op, CeedInt *num_elem) {
1280 CeedCheck(!op->is_composite, op->ceed, CEED_ERROR_MINOR, "Not defined for composite operator");
1281 *num_elem = op->num_elem;
1282 return CEED_ERROR_SUCCESS;
1283}
1284
1285/**
1273 @param[out] num_elem Variable to store number of elements
1274
1275 @return An error code: 0 - success, otherwise - failure
1276
1277 @ref Advanced
1278**/
1279int CeedOperatorGetNumElements(CeedOperator op, CeedInt *num_elem) {
1280 CeedCheck(!op->is_composite, op->ceed, CEED_ERROR_MINOR, "Not defined for composite operator");
1281 *num_elem = op->num_elem;
1282 return CEED_ERROR_SUCCESS;
1283}
1284
1285/**
1286 @brief Get the number of quadrature points associated with a `CeedOperator`
1286 @brief Get the number of quadrature points associated with a `CeedOperator`
1287
1287
1288 @param[in] op `CeedOperator`
1288 @param[in] op `CeedOperator`
1289 @param[out] num_qpts Variable to store vector number of quadrature points
1290
1291 @return An error code: 0 - success, otherwise - failure
1292
1293 @ref Advanced
1294**/
1295int CeedOperatorGetNumQuadraturePoints(CeedOperator op, CeedInt *num_qpts) {
1296 CeedCheck(!op->is_composite, op->ceed, CEED_ERROR_MINOR, "Not defined for composite operator");
1297 *num_qpts = op->num_qpts;
1298 return CEED_ERROR_SUCCESS;
1299}
1300
1301/**
1289 @param[out] num_qpts Variable to store vector number of quadrature points
1290
1291 @return An error code: 0 - success, otherwise - failure
1292
1293 @ref Advanced
1294**/
1295int CeedOperatorGetNumQuadraturePoints(CeedOperator op, CeedInt *num_qpts) {
1296 CeedCheck(!op->is_composite, op->ceed, CEED_ERROR_MINOR, "Not defined for composite operator");
1297 *num_qpts = op->num_qpts;
1298 return CEED_ERROR_SUCCESS;
1299}
1300
1301/**
1302 @brief Estimate number of FLOPs required to apply `CeedOperator` on the active `CeedVector`
1302 @brief Estimate number of FLOPs required to apply `CeedOperator` on the active `CeedVector`
1303
1304 @param[in] op `CeedOperator` to estimate FLOPs for
1305 @param[out] flops Address of variable to hold FLOPs estimate
1306
1307 @ref Backend
1308**/
1309int CeedOperatorGetFlopsEstimate(CeedOperator op, CeedSize *flops) {
1310 bool is_composite;

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

1373/**
1374 @brief Get `CeedQFunction` global context for a `CeedOperator`.
1375
1376 The caller is responsible for destroying `ctx` returned from this function via @ref CeedQFunctionContextDestroy().
1377
1378 Note: If the value of `ctx` passed into this function is non-`NULL`, then it is assumed that `ctx` is a pointer to a `CeedQFunctionContext`.
1379 This `CeedQFunctionContext` will be destroyed if `ctx` is the only reference to this `CeedQFunctionContext`.
1380
1303
1304 @param[in] op `CeedOperator` to estimate FLOPs for
1305 @param[out] flops Address of variable to hold FLOPs estimate
1306
1307 @ref Backend
1308**/
1309int CeedOperatorGetFlopsEstimate(CeedOperator op, CeedSize *flops) {
1310 bool is_composite;

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

1373/**
1374 @brief Get `CeedQFunction` global context for a `CeedOperator`.
1375
1376 The caller is responsible for destroying `ctx` returned from this function via @ref CeedQFunctionContextDestroy().
1377
1378 Note: If the value of `ctx` passed into this function is non-`NULL`, then it is assumed that `ctx` is a pointer to a `CeedQFunctionContext`.
1379 This `CeedQFunctionContext` will be destroyed if `ctx` is the only reference to this `CeedQFunctionContext`.
1380
1381 @param[in] op `CeedOperator`
1382 @param[out] ctx Variable to store `CeedQFunctionContext`
1381 @param[in] op `CeedOperator`
1382 @param[out] ctx Variable to store `CeedQFunctionContext`
1383
1384 @return An error code: 0 - success, otherwise - failure
1385
1386 @ref Advanced
1387**/
1388int CeedOperatorGetContext(CeedOperator op, CeedQFunctionContext *ctx) {
1389 CeedCheck(!op->is_composite, op->ceed, CEED_ERROR_INCOMPATIBLE, "Cannot retrieve CeedQFunctionContext for composite operator");
1390 if (op->qf->ctx) CeedCall(CeedQFunctionContextReferenceCopy(op->qf->ctx, ctx));
1391 else *ctx = NULL;
1392 return CEED_ERROR_SUCCESS;
1393}
1394
1395/**
1396 @brief Get label for a registered `CeedQFunctionContext` field, or `NULL` if no field has been registered with this `field_name`.
1397
1398 Fields are registered via `CeedQFunctionContextRegister*()` functions (eg. @ref CeedQFunctionContextRegisterDouble()).
1399
1383
1384 @return An error code: 0 - success, otherwise - failure
1385
1386 @ref Advanced
1387**/
1388int CeedOperatorGetContext(CeedOperator op, CeedQFunctionContext *ctx) {
1389 CeedCheck(!op->is_composite, op->ceed, CEED_ERROR_INCOMPATIBLE, "Cannot retrieve CeedQFunctionContext for composite operator");
1390 if (op->qf->ctx) CeedCall(CeedQFunctionContextReferenceCopy(op->qf->ctx, ctx));
1391 else *ctx = NULL;
1392 return CEED_ERROR_SUCCESS;
1393}
1394
1395/**
1396 @brief Get label for a registered `CeedQFunctionContext` field, or `NULL` if no field has been registered with this `field_name`.
1397
1398 Fields are registered via `CeedQFunctionContextRegister*()` functions (eg. @ref CeedQFunctionContextRegisterDouble()).
1399
1400 @param[in] op `CeedOperator`
1400 @param[in] op `CeedOperator`
1401 @param[in] field_name Name of field to retrieve label
1402 @param[out] field_label Variable to field label
1403
1404 @return An error code: 0 - success, otherwise - failure
1405
1406 @ref User
1407**/
1408int CeedOperatorGetContextFieldLabel(CeedOperator op, const char *field_name, CeedContextFieldLabel *field_label) {

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

1499 return CEED_ERROR_SUCCESS;
1500}
1501
1502/**
1503 @brief Set `CeedQFunctionContext` field holding double precision values.
1504
1505 For composite operators, the values are set in all sub-operator `CeedQFunctionContext` that have a matching `field_name`.
1506
1401 @param[in] field_name Name of field to retrieve label
1402 @param[out] field_label Variable to field label
1403
1404 @return An error code: 0 - success, otherwise - failure
1405
1406 @ref User
1407**/
1408int CeedOperatorGetContextFieldLabel(CeedOperator op, const char *field_name, CeedContextFieldLabel *field_label) {

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

1499 return CEED_ERROR_SUCCESS;
1500}
1501
1502/**
1503 @brief Set `CeedQFunctionContext` field holding double precision values.
1504
1505 For composite operators, the values are set in all sub-operator `CeedQFunctionContext` that have a matching `field_name`.
1506
1507 @param[in,out] op `CeedOperator`
1507 @param[in,out] op `CeedOperator`
1508 @param[in] field_label Label of field to set
1509 @param[in] values Values to set
1510
1511 @return An error code: 0 - success, otherwise - failure
1512
1513 @ref User
1514**/
1515int CeedOperatorSetContextDouble(CeedOperator op, CeedContextFieldLabel field_label, double *values) {
1516 return CeedOperatorContextSetGeneric(op, field_label, CEED_CONTEXT_FIELD_DOUBLE, values);
1517}
1518
1519/**
1520 @brief Get `CeedQFunctionContext` field holding double precision values, read-only.
1521
1522 For composite operators, the values correspond to the first sub-operator `CeedQFunctionContext` that has a matching `field_name`.
1523
1508 @param[in] field_label Label of field to set
1509 @param[in] values Values to set
1510
1511 @return An error code: 0 - success, otherwise - failure
1512
1513 @ref User
1514**/
1515int CeedOperatorSetContextDouble(CeedOperator op, CeedContextFieldLabel field_label, double *values) {
1516 return CeedOperatorContextSetGeneric(op, field_label, CEED_CONTEXT_FIELD_DOUBLE, values);
1517}
1518
1519/**
1520 @brief Get `CeedQFunctionContext` field holding double precision values, read-only.
1521
1522 For composite operators, the values correspond to the first sub-operator `CeedQFunctionContext` that has a matching `field_name`.
1523
1524 @param[in] op `CeedOperator`
1524 @param[in] op `CeedOperator`
1525 @param[in] field_label Label of field to get
1526 @param[out] num_values Number of values in the field label
1527 @param[out] values Pointer to context values
1528
1529 @return An error code: 0 - success, otherwise - failure
1530
1531 @ref User
1532**/
1533int CeedOperatorGetContextDoubleRead(CeedOperator op, CeedContextFieldLabel field_label, size_t *num_values, const double **values) {
1534 return CeedOperatorContextGetGenericRead(op, field_label, CEED_CONTEXT_FIELD_DOUBLE, num_values, values);
1535}
1536
1537/**
1538 @brief Restore `CeedQFunctionContext` field holding double precision values, read-only.
1539
1525 @param[in] field_label Label of field to get
1526 @param[out] num_values Number of values in the field label
1527 @param[out] values Pointer to context values
1528
1529 @return An error code: 0 - success, otherwise - failure
1530
1531 @ref User
1532**/
1533int CeedOperatorGetContextDoubleRead(CeedOperator op, CeedContextFieldLabel field_label, size_t *num_values, const double **values) {
1534 return CeedOperatorContextGetGenericRead(op, field_label, CEED_CONTEXT_FIELD_DOUBLE, num_values, values);
1535}
1536
1537/**
1538 @brief Restore `CeedQFunctionContext` field holding double precision values, read-only.
1539
1540 @param[in] op `CeedOperator`
1540 @param[in] op `CeedOperator`
1541 @param[in] field_label Label of field to restore
1542 @param[out] values Pointer to context values
1543
1544 @return An error code: 0 - success, otherwise - failure
1545
1546 @ref User
1547**/
1548int CeedOperatorRestoreContextDoubleRead(CeedOperator op, CeedContextFieldLabel field_label, const double **values) {
1549 return CeedOperatorContextRestoreGenericRead(op, field_label, CEED_CONTEXT_FIELD_DOUBLE, values);
1550}
1551
1552/**
1553 @brief Set `CeedQFunctionContext` field holding `int32` values.
1554
1555 For composite operators, the values are set in all sub-operator `CeedQFunctionContext` that have a matching `field_name`.
1556
1541 @param[in] field_label Label of field to restore
1542 @param[out] values Pointer to context values
1543
1544 @return An error code: 0 - success, otherwise - failure
1545
1546 @ref User
1547**/
1548int CeedOperatorRestoreContextDoubleRead(CeedOperator op, CeedContextFieldLabel field_label, const double **values) {
1549 return CeedOperatorContextRestoreGenericRead(op, field_label, CEED_CONTEXT_FIELD_DOUBLE, values);
1550}
1551
1552/**
1553 @brief Set `CeedQFunctionContext` field holding `int32` values.
1554
1555 For composite operators, the values are set in all sub-operator `CeedQFunctionContext` that have a matching `field_name`.
1556
1557 @param[in,out] op `CeedOperator`
1557 @param[in,out] op `CeedOperator`
1558 @param[in] field_label Label of field to set
1559 @param[in] values Values to set
1560
1561 @return An error code: 0 - success, otherwise - failure
1562
1563 @ref User
1564**/
1565int CeedOperatorSetContextInt32(CeedOperator op, CeedContextFieldLabel field_label, int32_t *values) {
1566 return CeedOperatorContextSetGeneric(op, field_label, CEED_CONTEXT_FIELD_INT32, values);
1567}
1568
1569/**
1570 @brief Get `CeedQFunctionContext` field holding `int32` values, read-only.
1571
1572 For composite operators, the values correspond to the first sub-operator `CeedQFunctionContext` that has a matching `field_name`.
1573
1558 @param[in] field_label Label of field to set
1559 @param[in] values Values to set
1560
1561 @return An error code: 0 - success, otherwise - failure
1562
1563 @ref User
1564**/
1565int CeedOperatorSetContextInt32(CeedOperator op, CeedContextFieldLabel field_label, int32_t *values) {
1566 return CeedOperatorContextSetGeneric(op, field_label, CEED_CONTEXT_FIELD_INT32, values);
1567}
1568
1569/**
1570 @brief Get `CeedQFunctionContext` field holding `int32` values, read-only.
1571
1572 For composite operators, the values correspond to the first sub-operator `CeedQFunctionContext` that has a matching `field_name`.
1573
1574 @param[in] op `CeedOperator`
1574 @param[in] op `CeedOperator`
1575 @param[in] field_label Label of field to get
1576 @param[out] num_values Number of `int32` values in `values`
1577 @param[out] values Pointer to context values
1578
1579 @return An error code: 0 - success, otherwise - failure
1580
1581 @ref User
1582**/
1583int CeedOperatorGetContextInt32Read(CeedOperator op, CeedContextFieldLabel field_label, size_t *num_values, const int32_t **values) {
1584 return CeedOperatorContextGetGenericRead(op, field_label, CEED_CONTEXT_FIELD_INT32, num_values, values);
1585}
1586
1587/**
1588 @brief Restore `CeedQFunctionContext` field holding `int32` values, read-only.
1589
1575 @param[in] field_label Label of field to get
1576 @param[out] num_values Number of `int32` values in `values`
1577 @param[out] values Pointer to context values
1578
1579 @return An error code: 0 - success, otherwise - failure
1580
1581 @ref User
1582**/
1583int CeedOperatorGetContextInt32Read(CeedOperator op, CeedContextFieldLabel field_label, size_t *num_values, const int32_t **values) {
1584 return CeedOperatorContextGetGenericRead(op, field_label, CEED_CONTEXT_FIELD_INT32, num_values, values);
1585}
1586
1587/**
1588 @brief Restore `CeedQFunctionContext` field holding `int32` values, read-only.
1589
1590 @param[in] op `CeedOperator`
1590 @param[in] op `CeedOperator`
1591 @param[in] field_label Label of field to get
1592 @param[out] values Pointer to context values
1593
1594 @return An error code: 0 - success, otherwise - failure
1595
1596 @ref User
1597**/
1598int CeedOperatorRestoreContextInt32Read(CeedOperator op, CeedContextFieldLabel field_label, const int32_t **values) {
1599 return CeedOperatorContextRestoreGenericRead(op, field_label, CEED_CONTEXT_FIELD_INT32, values);
1600}
1601
1602/**
1603 @brief Set `CeedQFunctionContext` field holding boolean values.
1604
1605 For composite operators, the values are set in all sub-operator `CeedQFunctionContext` that have a matching `field_name`.
1606
1591 @param[in] field_label Label of field to get
1592 @param[out] values Pointer to context values
1593
1594 @return An error code: 0 - success, otherwise - failure
1595
1596 @ref User
1597**/
1598int CeedOperatorRestoreContextInt32Read(CeedOperator op, CeedContextFieldLabel field_label, const int32_t **values) {
1599 return CeedOperatorContextRestoreGenericRead(op, field_label, CEED_CONTEXT_FIELD_INT32, values);
1600}
1601
1602/**
1603 @brief Set `CeedQFunctionContext` field holding boolean values.
1604
1605 For composite operators, the values are set in all sub-operator `CeedQFunctionContext` that have a matching `field_name`.
1606
1607 @param[in,out] op `CeedOperator`
1607 @param[in,out] op `CeedOperator`
1608 @param[in] field_label Label of field to set
1609 @param[in] values Values to set
1610
1611 @return An error code: 0 - success, otherwise - failure
1612
1613 @ref User
1614**/
1615int CeedOperatorSetContextBoolean(CeedOperator op, CeedContextFieldLabel field_label, bool *values) {
1616 return CeedOperatorContextSetGeneric(op, field_label, CEED_CONTEXT_FIELD_BOOL, values);
1617}
1618
1619/**
1620 @brief Get `CeedQFunctionContext` field holding boolean values, read-only.
1621
1622 For composite operators, the values correspond to the first sub-operator `CeedQFunctionContext` that has a matching `field_name`.
1623
1608 @param[in] field_label Label of field to set
1609 @param[in] values Values to set
1610
1611 @return An error code: 0 - success, otherwise - failure
1612
1613 @ref User
1614**/
1615int CeedOperatorSetContextBoolean(CeedOperator op, CeedContextFieldLabel field_label, bool *values) {
1616 return CeedOperatorContextSetGeneric(op, field_label, CEED_CONTEXT_FIELD_BOOL, values);
1617}
1618
1619/**
1620 @brief Get `CeedQFunctionContext` field holding boolean values, read-only.
1621
1622 For composite operators, the values correspond to the first sub-operator `CeedQFunctionContext` that has a matching `field_name`.
1623
1624 @param[in] op `CeedOperator`
1624 @param[in] op `CeedOperator`
1625 @param[in] field_label Label of field to get
1626 @param[out] num_values Number of boolean values in `values`
1627 @param[out] values Pointer to context values
1628
1629 @return An error code: 0 - success, otherwise - failure
1630
1631 @ref User
1632**/
1633int CeedOperatorGetContextBooleanRead(CeedOperator op, CeedContextFieldLabel field_label, size_t *num_values, const bool **values) {
1634 return CeedOperatorContextGetGenericRead(op, field_label, CEED_CONTEXT_FIELD_BOOL, num_values, values);
1635}
1636
1637/**
1638 @brief Restore `CeedQFunctionContext` field holding boolean values, read-only.
1639
1625 @param[in] field_label Label of field to get
1626 @param[out] num_values Number of boolean values in `values`
1627 @param[out] values Pointer to context values
1628
1629 @return An error code: 0 - success, otherwise - failure
1630
1631 @ref User
1632**/
1633int CeedOperatorGetContextBooleanRead(CeedOperator op, CeedContextFieldLabel field_label, size_t *num_values, const bool **values) {
1634 return CeedOperatorContextGetGenericRead(op, field_label, CEED_CONTEXT_FIELD_BOOL, num_values, values);
1635}
1636
1637/**
1638 @brief Restore `CeedQFunctionContext` field holding boolean values, read-only.
1639
1640 @param[in] op `CeedOperator`
1640 @param[in] op `CeedOperator`
1641 @param[in] field_label Label of field to get
1642 @param[out] values Pointer to context values
1643
1644 @return An error code: 0 - success, otherwise - failure
1645
1646 @ref User
1647**/
1648int CeedOperatorRestoreContextBooleanRead(CeedOperator op, CeedContextFieldLabel field_label, const bool **values) {

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

1752 } else if (op->num_elem) {
1753 // Standard Operator
1754 CeedCall(op->ApplyAdd(op, in, out, request));
1755 }
1756 return CEED_ERROR_SUCCESS;
1757}
1758
1759/**
1641 @param[in] field_label Label of field to get
1642 @param[out] values Pointer to context values
1643
1644 @return An error code: 0 - success, otherwise - failure
1645
1646 @ref User
1647**/
1648int CeedOperatorRestoreContextBooleanRead(CeedOperator op, CeedContextFieldLabel field_label, const bool **values) {

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

1752 } else if (op->num_elem) {
1753 // Standard Operator
1754 CeedCall(op->ApplyAdd(op, in, out, request));
1755 }
1756 return CEED_ERROR_SUCCESS;
1757}
1758
1759/**
1760 @brief Destroy a `CeedOperator`
1760 @brief Destroy a `CeedOperator`
1761
1762 @param[in,out] op `CeedOperator` to destroy
1763
1764 @return An error code: 0 - success, otherwise - failure
1765
1766 @ref User
1767**/
1768int CeedOperatorDestroy(CeedOperator *op) {

--- 73 unchanged lines hidden ---
1761
1762 @param[in,out] op `CeedOperator` to destroy
1763
1764 @return An error code: 0 - success, otherwise - failure
1765
1766 @ref User
1767**/
1768int CeedOperatorDestroy(CeedOperator *op) {

--- 73 unchanged lines hidden ---