@@ -221,6 +221,36 @@ int CeedQFunctionContextSetBackendData(CeedQFunctionContext ctx, void *data) {
221221 return CEED_ERROR_SUCCESS ;
222222}
223223
224+ /**
225+ @brief Get label for a registered QFunctionContext field, or `NULL` if no
226+ field has been registered with this `field_name`
227+
228+ @param[in] ctx CeedQFunctionContext
229+ @param[in] field_name Name of field to retrieve label
230+ @param[out] field_label Variable to field label
231+
232+ @return An error code: 0 - success, otherwise - failure
233+
234+ @ref Backend
235+ **/
236+ int CeedQFunctionContextGetFieldLabel (CeedQFunctionContext ctx ,
237+ const char * field_name ,
238+ CeedContextFieldLabel * field_label ) {
239+ int ierr ;
240+
241+ CeedInt field_index ;
242+ ierr = CeedQFunctionContextGetFieldIndex (ctx , field_name , & field_index );
243+ CeedChk (ierr );
244+
245+ if (field_index != -1 ) {
246+ * field_label = ctx -> field_labels [field_index ];
247+ } else {
248+ * field_label = NULL ;
249+ }
250+
251+ return CEED_ERROR_SUCCESS ;
252+ }
253+
224254/**
225255 @brief Set QFunctionContext field
226256
@@ -231,7 +261,7 @@ int CeedQFunctionContextSetBackendData(CeedQFunctionContext ctx, void *data) {
231261
232262 @return An error code: 0 - success, otherwise - failure
233263
234- @ref User
264+ @ref Backend
235265**/
236266int CeedQFunctionContextSetGeneric (CeedQFunctionContext ctx ,
237267 CeedContextFieldLabel field_label ,
@@ -257,6 +287,62 @@ int CeedQFunctionContextSetGeneric(CeedQFunctionContext ctx,
257287 return CEED_ERROR_SUCCESS ;
258288}
259289
290+ /**
291+ @brief Set QFunctionContext field holding a double precision value
292+
293+ @param ctx CeedQFunctionContext
294+ @param field_label Label for field to register
295+ @param values Values to set
296+
297+ @return An error code: 0 - success, otherwise - failure
298+
299+ @ref Backend
300+ **/
301+ int CeedQFunctionContextSetDouble (CeedQFunctionContext ctx ,
302+ CeedContextFieldLabel field_label , double * values ) {
303+ int ierr ;
304+
305+ if (!field_label )
306+ // LCOV_EXCL_START
307+ return CeedError (ctx -> ceed , CEED_ERROR_UNSUPPORTED ,
308+ "Invalid field label" );
309+ // LCOV_EXCL_STOP
310+
311+ ierr = CeedQFunctionContextSetGeneric (ctx , field_label ,
312+ CEED_CONTEXT_FIELD_DOUBLE ,
313+ values ); CeedChk (ierr );
314+
315+ return CEED_ERROR_SUCCESS ;
316+ }
317+
318+ /**
319+ @brief Set QFunctionContext field holding an int32 value
320+
321+ @param ctx CeedQFunctionContext
322+ @param field_label Label for field to register
323+ @param values Values to set
324+
325+ @return An error code: 0 - success, otherwise - failure
326+
327+ @ref Backend
328+ **/
329+ int CeedQFunctionContextSetInt32 (CeedQFunctionContext ctx ,
330+ CeedContextFieldLabel field_label , int * values ) {
331+ int ierr ;
332+
333+ if (!field_label )
334+ // LCOV_EXCL_START
335+ return CeedError (ctx -> ceed , CEED_ERROR_UNSUPPORTED ,
336+ "Invalid field label" );
337+ // LCOV_EXCL_STOP
338+
339+ ierr = CeedQFunctionContextSetGeneric (ctx , field_label ,
340+ CEED_CONTEXT_FIELD_INT32 ,
341+ values ); CeedChk (ierr );
342+
343+ return CEED_ERROR_SUCCESS ;
344+ }
345+
260346/**
261347 @brief Increment the reference counter for a CeedQFunctionContext
262348
@@ -653,36 +739,6 @@ int CeedQFunctionContextGetAllFieldLabels(CeedQFunctionContext ctx,
653739 return CEED_ERROR_SUCCESS ;
654740}
655741
656- /**
657- @brief Get label for a registered QFunctionContext field, or `NULL` if no
658- field has been registered with this `field_name`
659-
660- @param[in] ctx CeedQFunctionContext
661- @param[in] field_name Name of field to retrieve label
662- @param[out] field_label Variable to field label
663-
664- @return An error code: 0 - success, otherwise - failure
665-
666- @ref User
667- **/
668- int CeedQFunctionContextGetFieldLabel (CeedQFunctionContext ctx ,
669- const char * field_name ,
670- CeedContextFieldLabel * field_label ) {
671- int ierr ;
672-
673- CeedInt field_index ;
674- ierr = CeedQFunctionContextGetFieldIndex (ctx , field_name , & field_index );
675- CeedChk (ierr );
676-
677- if (field_index != -1 ) {
678- * field_label = ctx -> field_labels [field_index ];
679- } else {
680- * field_label = NULL ;
681- }
682-
683- return CEED_ERROR_SUCCESS ;
684- }
685-
686742/**
687743 @brief Get the descriptive information about a CeedContextFieldLabel
688744
@@ -708,62 +764,6 @@ int CeedContextFieldLabelGetDescription(CeedContextFieldLabel label,
708764 return CEED_ERROR_SUCCESS ;
709765}
710766
711- /**
712- @brief Set QFunctionContext field holding a double precision value
713-
714- @param ctx CeedQFunctionContext
715- @param field_label Label for field to register
716- @param values Values to set
717-
718- @return An error code: 0 - success, otherwise - failure
719-
720- @ref User
721- **/
722- int CeedQFunctionContextSetDouble (CeedQFunctionContext ctx ,
723- CeedContextFieldLabel field_label , double * values ) {
724- int ierr ;
725-
726- if (!field_label )
727- // LCOV_EXCL_START
728- return CeedError (ctx -> ceed , CEED_ERROR_UNSUPPORTED ,
729- "Invalid field label" );
730- // LCOV_EXCL_STOP
731-
732- ierr = CeedQFunctionContextSetGeneric (ctx , field_label ,
733- CEED_CONTEXT_FIELD_DOUBLE ,
734- values ); CeedChk (ierr );
735-
736- return CEED_ERROR_SUCCESS ;
737- }
738-
739- /**
740- @brief Set QFunctionContext field holding an int32 value
741-
742- @param ctx CeedQFunctionContext
743- @param field_label Label for field to register
744- @param values Values to set
745-
746- @return An error code: 0 - success, otherwise - failure
747-
748- @ref User
749- **/
750- int CeedQFunctionContextSetInt32 (CeedQFunctionContext ctx ,
751- CeedContextFieldLabel field_label , int * values ) {
752- int ierr ;
753-
754- if (!field_label )
755- // LCOV_EXCL_START
756- return CeedError (ctx -> ceed , CEED_ERROR_UNSUPPORTED ,
757- "Invalid field label" );
758- // LCOV_EXCL_STOP
759-
760- ierr = CeedQFunctionContextSetGeneric (ctx , field_label ,
761- CEED_CONTEXT_FIELD_INT32 ,
762- values ); CeedChk (ierr );
763-
764- return CEED_ERROR_SUCCESS ;
765- }
766-
767767/**
768768 @brief Get data size for a Context
769769
0 commit comments