Support additional `CeedContextFieldType` values
- Dominant language
- C
- Stars
- 265
- Forks
- 78
- Avg merge
- 2d 8h
- Merged PRs (30d)
- 11
Description
## Summary
Add new enum values to `CeedContextFieldType` for single-precision floating point, 64-bit integer, byte, and `CeedInt` and `CeedScalar` types.
## Possible Implementation
- [ ] Expand the `CeedContextFieldType` interface to include:
```c
typedef enum {
/// Byte value, C type of char
CEED_CONTEXT_FIELD_BYTE = 1,
/// CeedScalar value
CEED_CONTEXT_FIELD_SCALAR = 2,
/// Single precision value
CEED_CONTEXT_FIELD_FLOAT = 3,
/// Double precision value
CEED_CONTEXT_FIELD_DOUBLE = 4,
/// CeedInt value
CEED_CONTEXT_FIELD_INT = 5,
/// 32 bit integer value
CEED_CONTEXT_FIELD_INT32 = 6,
/// 64 bit integer value
CEED_CONTEXT_FIELD_INT64 = 7,
/// Boolean value
CEED_CONTEXT_FIELD_BOOL = 8,
} CeedContextFieldType;
```
- [ ] Add strings/update indices in `CeedContextFieldTypes`.
- [ ] Add associated public registration functions:
```c
int CeedQFunctionContextRegisterByte(CeedQFunctionContext ctx, const char *field_name, size_t field_offset, size_t num_values, const char *field_description);
int CeedQFunctionContextRegisterScalar(CeedQFunctionContext ctx, const char *field_name, size_t field_offset, size_t num_values, const char *field_description);
int CeedQFunctionContextRegisterFloat(CeedQFunctionContext ctx, const char *field_name, size_t field_offset, size_t num_values, const char *field_description);
int CeedQFunctionContextRegisterInt(CeedQFunctionContext ctx, const char *field_name, size_t field_offset, size_t num_values, const char *field_description);
int CeedQFunctionContextRegisterInt64(CeedQFunctionContext ctx, const char *field_name, size_t field_offset, size_t num_values, const char *field_description);
```
- [ ] Add the associated public `Get[TYPE]Read`/`Restore[TYPE]Read`/`Set[TYPE]` functions (byte used as an example):
```c
int CeedOperatorGetContextByteRead(CeedOperator op, CeedContextFieldLabel field_label, size_t *num_values, const char **values);
int CeedOperatorRestoreContextByteRead(CeedOperator op, CeedContextFieldLabel field_label, size_t *num_values, const char **values);
int CeedOperatorSetContextByte(CeedOperator op, CeedContextFieldLabel field_label, char *values);
int CeedQFunctionContextGetByteRead(CeedQFunctionContext ctx, CeedContextFieldLabel field_label, size_t *num_values, const char **values);
int CeedQFunctionContextRestoreByteRead(CeedQFunctionContext ctx, CeedContextFieldLabel field_label, const char **values);
int CeedQFunctionContextSetByte(CeedQFunctionContext ctx, CeedContextFieldLabel field_label, char *values);
```
- [ ] Update `CeedQFunctionContextRegisterGeneric`, `CeedQFunctionContextGetGenericRead`.
- [ ] Regenerate Julia bindings.
- [ ] Add new values to `tests/t407-qfunction`.
Contributor guide
Research direction
Start by locating the CeedContextFieldType interface, CeedContextFieldTypes, the listed registration and Get/Restore/Set APIs, and the generic context functions. Review the existing patterns, regenerate the Julia bindings, and run the tests/t407-qfunction tests; done means the new enum values and all requested public APIs are covered and the tests pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, julia
- Domain
- api
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100