xref: /libCEED/rust/libceed-sys/c-src/include/ceed/backend.h (revision 78b2e7521ef628dcf91586324cfb49fa136ab5b3)
13d8e8822SJeremy L Thompson // Copyright (c) 2017-2022, Lawrence Livermore National Security, LLC and other CEED contributors.
23d8e8822SJeremy L Thompson // All Rights Reserved. See the top-level LICENSE and NOTICE files for details.
3ec3da8bcSJed Brown //
43d8e8822SJeremy L Thompson // SPDX-License-Identifier: BSD-2-Clause
5ec3da8bcSJed Brown //
63d8e8822SJeremy L Thompson // This file is part of CEED:  http://github.com/ceed
7ec3da8bcSJed Brown 
8ec3da8bcSJed Brown /// @file
9ec3da8bcSJed Brown /// Public header for backend components of libCEED
10ec3da8bcSJed Brown #ifndef _ceed_backend_h
11ec3da8bcSJed Brown #define _ceed_backend_h
12ec3da8bcSJed Brown 
1349aac155SJeremy L Thompson #include <ceed.h>
14d0c91ce9Sjeremylt #include <limits.h>
15ec3da8bcSJed Brown #include <stdbool.h>
16ec3da8bcSJed Brown 
172b730f8bSJeremy L Thompson #if defined(__clang_analyzer__)
182b730f8bSJeremy L Thompson #define CEED_INTERN
192b730f8bSJeremy L Thompson #elif defined(__cplusplus)
203b271f31SJed Brown #define CEED_INTERN extern "C" CEED_VISIBILITY(hidden)
213b271f31SJed Brown #else
223b271f31SJed Brown #define CEED_INTERN extern CEED_VISIBILITY(hidden)
233b271f31SJed Brown #endif
243b271f31SJed Brown 
25ec3da8bcSJed Brown #define CEED_UNUSED __attribute__((unused))
26ec3da8bcSJed Brown 
27ec3da8bcSJed Brown #define CEED_MAX_RESOURCE_LEN 1024
28d0c91ce9Sjeremylt #define CEED_MAX_BACKEND_PRIORITY UINT_MAX
29ec3da8bcSJed Brown #define CEED_ALIGN 64
30ec3da8bcSJed Brown #define CEED_COMPOSITE_MAX 16
31bf4cb664SJeremy L Thompson #define CEED_FIELD_MAX 16
32ec3da8bcSJed Brown 
3303d18186Sjeremylt /**
3403d18186Sjeremylt   @ingroup Ceed
35ea61e9acSJeremy L Thompson   This macro provides the ability to disable optimization flags for functions that are sensitive to floating point optimizations.
3603d18186Sjeremylt **/
3703d18186Sjeremylt #ifndef CeedPragmaOptimizeOff
3803d18186Sjeremylt #if defined(__clang__)
3903d18186Sjeremylt #define CeedPragmaOptimizeOff _Pragma("clang optimize off")
4003d18186Sjeremylt #elif defined(__GNUC__)
4103d18186Sjeremylt #define CeedPragmaOptimizeOff _Pragma("GCC push_options") _Pragma("GCC optimize 0")
4203d18186Sjeremylt #elif defined(__INTEL_COMPILER) || defined(__INTEL_LLVM_COMPILER)
4303d18186Sjeremylt #define CeedPragmaOptimizeOff _Pragma("optimize('', off)")
4403d18186Sjeremylt #else
4503d18186Sjeremylt #define CeedPragmaOptimizeOff
4603d18186Sjeremylt #endif
4703d18186Sjeremylt #endif
4803d18186Sjeremylt 
4903d18186Sjeremylt /**
5003d18186Sjeremylt   @ingroup Ceed
5103d18186Sjeremylt   This macro restores previously set optimization flags after CeedPragmaOptimizeOff.
5203d18186Sjeremylt **/
5303d18186Sjeremylt #ifndef CeedPragmaOptimizeOn
5403d18186Sjeremylt #if defined(__clang__)
5503d18186Sjeremylt #define CeedPragmaOptimizeOn _Pragma("clang optimize on")
5603d18186Sjeremylt #elif defined(__GNUC__)
5703d18186Sjeremylt #define CeedPragmaOptimizeOn _Pragma("GCC pop_options")
5803d18186Sjeremylt #elif defined(__INTEL_COMPILER) || defined(__INTEL_LLVM_COMPILER)
5903d18186Sjeremylt #define CeedPragmaOptimizeOff _Pragma("optimize('', on)")
6003d18186Sjeremylt #else
6103d18186Sjeremylt #define CeedPragmaOptimizeOn
6203d18186Sjeremylt #endif
6303d18186Sjeremylt #endif
6403d18186Sjeremylt 
65ec3da8bcSJed Brown /// CEED_DEBUG_COLOR default value, forward CeedDebug* declarations & macros
663f21f6b1SJeremy L Thompson #define CEED_DEBUG_COLOR_NONE 255
673f21f6b1SJeremy L Thompson 
683f21f6b1SJeremy L Thompson CEED_EXTERN void CeedDebugImpl256(const unsigned char, const char *, ...);
693f21f6b1SJeremy L Thompson CEED_EXTERN bool CeedDebugFlag(const Ceed ceed);
703f21f6b1SJeremy L Thompson CEED_EXTERN bool CeedDebugFlagEnv(void);
713f21f6b1SJeremy L Thompson #define CeedDebug256(ceed, color, ...)                               \
722b730f8bSJeremy L Thompson   {                                                                  \
732b730f8bSJeremy L Thompson     if (CeedDebugFlag(ceed)) CeedDebugImpl256(color, ##__VA_ARGS__); \
742b730f8bSJeremy L Thompson   }
753f21f6b1SJeremy L Thompson #define CeedDebug(ceed, ...) CeedDebug256(ceed, (unsigned char)CEED_DEBUG_COLOR_NONE, ##__VA_ARGS__)
763f21f6b1SJeremy L Thompson #define CeedDebugEnv256(color, ...)                                 \
772b730f8bSJeremy L Thompson   {                                                                 \
782b730f8bSJeremy L Thompson     if (CeedDebugFlagEnv()) CeedDebugImpl256(color, ##__VA_ARGS__); \
792b730f8bSJeremy L Thompson   }
803f21f6b1SJeremy L Thompson #define CeedDebugEnv(...) CeedDebugEnv256((unsigned char)CEED_DEBUG_COLOR_NONE, ##__VA_ARGS__)
81ec3da8bcSJed Brown 
82ec3da8bcSJed Brown /// Handle for object handling TensorContraction
83ec3da8bcSJed Brown /// @ingroup CeedBasis
84ec3da8bcSJed Brown typedef struct CeedTensorContract_private *CeedTensorContract;
85ec3da8bcSJed Brown 
86480fae85SJeremy L Thompson /// Handle for object handling assembled QFunction data
87480fae85SJeremy L Thompson /// @ingroup CeedOperator
88480fae85SJeremy L Thompson typedef struct CeedQFunctionAssemblyData_private *CeedQFunctionAssemblyData;
89480fae85SJeremy L Thompson 
90ed9e99e6SJeremy L Thompson /// Handle for object handling assembled Operator data
91ed9e99e6SJeremy L Thompson /// @ingroup CeedOperator
92ed9e99e6SJeremy L Thompson typedef struct CeedOperatorAssemblyData_private *CeedOperatorAssemblyData;
93ed9e99e6SJeremy L Thompson 
94ea61e9acSJeremy L Thompson /* In the next 3 functions, p has to be the address of a pointer type, i.e. p has to be a pointer to a pointer. */
95ec3da8bcSJed Brown CEED_INTERN int CeedMallocArray(size_t n, size_t unit, void *p);
96ec3da8bcSJed Brown CEED_INTERN int CeedCallocArray(size_t n, size_t unit, void *p);
97ec3da8bcSJed Brown CEED_INTERN int CeedReallocArray(size_t n, size_t unit, void *p);
98f7e22acaSJeremy L Thompson CEED_INTERN int CeedStringAllocCopy(const char *source, char **copy);
99ec3da8bcSJed Brown CEED_INTERN int CeedFree(void *p);
100ec3da8bcSJed Brown 
1012b730f8bSJeremy L Thompson #define CeedChk(ierr)        \
1022b730f8bSJeremy L Thompson   do {                       \
1032b730f8bSJeremy L Thompson     int ierr_ = ierr;        \
1042b730f8bSJeremy L Thompson     if (ierr_) return ierr_; \
1052b730f8bSJeremy L Thompson   } while (0)
1062b730f8bSJeremy L Thompson #define CeedChkBackend(ierr)                                     \
1072b730f8bSJeremy L Thompson   do {                                                           \
1082b730f8bSJeremy L Thompson     int ierr_ = ierr;                                            \
1092b730f8bSJeremy L Thompson     if (ierr_) {                                                 \
1102b730f8bSJeremy L Thompson       if (ierr_ > CEED_ERROR_SUCCESS) return CEED_ERROR_BACKEND; \
1112b730f8bSJeremy L Thompson       else return ierr_;                                         \
1122b730f8bSJeremy L Thompson     }                                                            \
1132b730f8bSJeremy L Thompson   } while (0)
1142b730f8bSJeremy L Thompson 
1152b730f8bSJeremy L Thompson #define CeedCall(...)          \
1162b730f8bSJeremy L Thompson   do {                         \
1172b730f8bSJeremy L Thompson     int ierr_q_ = __VA_ARGS__; \
1182b730f8bSJeremy L Thompson     CeedChk(ierr_q_);          \
1190126412dSJeremy L Thompson   } while (0)
1202b730f8bSJeremy L Thompson #define CeedCallBackend(...)   \
1212b730f8bSJeremy L Thompson   do {                         \
1222b730f8bSJeremy L Thompson     int ierr_q_ = __VA_ARGS__; \
1232b730f8bSJeremy L Thompson     CeedChkBackend(ierr_q_);   \
1240126412dSJeremy L Thompson   } while (0)
1252b730f8bSJeremy L Thompson 
1266574a04fSJeremy L Thompson #define CeedCheck(cond, ceed, ecode, ...)         \
1276574a04fSJeremy L Thompson   do {                                            \
1286574a04fSJeremy L Thompson     if (!(cond)) {                                \
1296574a04fSJeremy L Thompson       return CeedError(ceed, ecode, __VA_ARGS__); \
1306574a04fSJeremy L Thompson     }                                             \
1316574a04fSJeremy L Thompson   } while (0)
1326574a04fSJeremy L Thompson 
133ea61e9acSJeremy L Thompson /* Note that CeedMalloc and CeedCalloc will, generally, return pointers with different memory alignments:
134ea61e9acSJeremy L Thompson    CeedMalloc returns pointers aligned at CEED_ALIGN bytes, while CeedCalloc uses the alignment of calloc. */
135ec3da8bcSJed Brown #define CeedMalloc(n, p) CeedMallocArray((n), sizeof(**(p)), p)
136ec3da8bcSJed Brown #define CeedCalloc(n, p) CeedCallocArray((n), sizeof(**(p)), p)
137ec3da8bcSJed Brown #define CeedRealloc(n, p) CeedReallocArray((n), sizeof(**(p)), p)
138ec3da8bcSJed Brown 
1392b730f8bSJeremy L Thompson CEED_EXTERN int CeedRegister(const char *prefix, int (*init)(const char *, Ceed), unsigned int priority);
1402b730f8bSJeremy L Thompson CEED_EXTERN int CeedRegisterImpl(const char *prefix, int (*init)(const char *, Ceed), unsigned int priority);
141ec3da8bcSJed Brown 
142d1d35e2fSjeremylt CEED_EXTERN int CeedIsDebug(Ceed ceed, bool *is_debug);
143ec3da8bcSJed Brown CEED_EXTERN int CeedGetParent(Ceed ceed, Ceed *parent);
144ec3da8bcSJed Brown CEED_EXTERN int CeedGetDelegate(Ceed ceed, Ceed *delegate);
145ec3da8bcSJed Brown CEED_EXTERN int CeedSetDelegate(Ceed ceed, Ceed delegate);
1462b730f8bSJeremy L Thompson CEED_EXTERN int CeedGetObjectDelegate(Ceed ceed, Ceed *delegate, const char *obj_name);
1472b730f8bSJeremy L Thompson CEED_EXTERN int CeedSetObjectDelegate(Ceed ceed, Ceed delegate, const char *obj_name);
1482b730f8bSJeremy L Thompson CEED_EXTERN int CeedGetOperatorFallbackResource(Ceed ceed, const char **resource);
1498687e1d4SJeremy L Thompson CEED_EXTERN int CeedGetOperatorFallbackCeed(Ceed ceed, Ceed *fallback_ceed);
1502b730f8bSJeremy L Thompson CEED_EXTERN int CeedSetOperatorFallbackResource(Ceed ceed, const char *resource);
151ec3da8bcSJed Brown CEED_EXTERN int CeedGetOperatorFallbackParentCeed(Ceed ceed, Ceed *parent);
152d1d35e2fSjeremylt CEED_EXTERN int CeedSetDeterministic(Ceed ceed, bool is_deterministic);
1532b730f8bSJeremy L Thompson CEED_EXTERN int CeedSetBackendFunction(Ceed ceed, const char *type, void *object, const char *func_name, int (*f)());
154ec3da8bcSJed Brown CEED_EXTERN int CeedGetData(Ceed ceed, void *data);
155ec3da8bcSJed Brown CEED_EXTERN int CeedSetData(Ceed ceed, void *data);
1569560d06aSjeremylt CEED_EXTERN int CeedReference(Ceed ceed);
157ec3da8bcSJed Brown 
1589c774eddSJeremy L Thompson CEED_EXTERN int CeedVectorHasValidArray(CeedVector vec, bool *has_valid_array);
1592b730f8bSJeremy L Thompson CEED_EXTERN int CeedVectorHasBorrowedArrayOfType(CeedVector vec, CeedMemType mem_type, bool *has_borrowed_array_of_type);
1609c774eddSJeremy L Thompson CEED_EXTERN int CeedVectorHasValidArray(CeedVector vec, bool *has_valid_array);
161ec3da8bcSJed Brown CEED_EXTERN int CeedVectorGetState(CeedVector vec, uint64_t *state);
162ec3da8bcSJed Brown CEED_EXTERN int CeedVectorAddReference(CeedVector vec);
163ec3da8bcSJed Brown CEED_EXTERN int CeedVectorGetData(CeedVector vec, void *data);
164ec3da8bcSJed Brown CEED_EXTERN int CeedVectorSetData(CeedVector vec, void *data);
1659560d06aSjeremylt CEED_EXTERN int CeedVectorReference(CeedVector vec);
166ec3da8bcSJed Brown 
167*78b2e752SJeremy L Thompson CEED_EXTERN int CeedElemRestrictionApplyUnsigned(CeedElemRestriction rstr, CeedTransposeMode t_mode, CeedVector u, CeedVector ru,
168*78b2e752SJeremy L Thompson                                                  CeedRequest *request);
1692b730f8bSJeremy L Thompson CEED_EXTERN int CeedElemRestrictionGetStrides(CeedElemRestriction rstr, CeedInt (*strides)[3]);
1702b730f8bSJeremy L Thompson CEED_EXTERN int CeedElemRestrictionGetOffsets(CeedElemRestriction rstr, CeedMemType mem_type, const CeedInt **offsets);
1712b730f8bSJeremy L Thompson CEED_EXTERN int CeedElemRestrictionRestoreOffsets(CeedElemRestriction rstr, const CeedInt **offsets);
1722b730f8bSJeremy L Thompson CEED_EXTERN int CeedElemRestrictionIsStrided(CeedElemRestriction rstr, bool *is_strided);
1732b730f8bSJeremy L Thompson CEED_EXTERN int CeedElemRestrictionIsOriented(CeedElemRestriction rstr, bool *is_oriented);
1742b730f8bSJeremy L Thompson CEED_EXTERN int CeedElemRestrictionHasBackendStrides(CeedElemRestriction rstr, bool *has_backend_strides);
1752b730f8bSJeremy L Thompson CEED_EXTERN int CeedElemRestrictionGetELayout(CeedElemRestriction rstr, CeedInt (*layout)[3]);
1762b730f8bSJeremy L Thompson CEED_EXTERN int CeedElemRestrictionSetELayout(CeedElemRestriction rstr, CeedInt layout[3]);
1772b730f8bSJeremy L Thompson CEED_EXTERN int CeedElemRestrictionGetData(CeedElemRestriction rstr, void *data);
1782b730f8bSJeremy L Thompson CEED_EXTERN int CeedElemRestrictionSetData(CeedElemRestriction rstr, void *data);
1799560d06aSjeremylt CEED_EXTERN int CeedElemRestrictionReference(CeedElemRestriction rstr);
1809d36ca50SJeremy L Thompson CEED_EXTERN int CeedElemRestrictionGetFlopsEstimate(CeedElemRestriction rstr, CeedTransposeMode t_mode, CeedSize *flops);
181ec3da8bcSJed Brown 
1826f117663SJeremy L Thompson /// Type of FE space;
1836f117663SJeremy L Thompson /// @ingroup CeedBasis
1846f117663SJeremy L Thompson typedef enum {
185c4e3f59bSSebastian Grimberg   /// H^1 FE space
1866f117663SJeremy L Thompson   CEED_FE_SPACE_H1 = 1,
1876f117663SJeremy L Thompson   /// H(div) FE space
1886f117663SJeremy L Thompson   CEED_FE_SPACE_HDIV = 2,
189c4e3f59bSSebastian Grimberg   /// H(curl) FE space
190c4e3f59bSSebastian Grimberg   CEED_FE_SPACE_HCURL = 3,
1916f117663SJeremy L Thompson } CeedFESpace;
1926f117663SJeremy L Thompson CEED_EXTERN const char *const CeedFESpaces[];
1936f117663SJeremy L Thompson 
1942b730f8bSJeremy L Thompson CEED_EXTERN int CeedBasisGetCollocatedGrad(CeedBasis basis, CeedScalar *colo_grad_1d);
195d1d35e2fSjeremylt CEED_EXTERN int CeedBasisIsTensor(CeedBasis basis, bool *is_tensor);
196ec3da8bcSJed Brown CEED_EXTERN int CeedBasisGetData(CeedBasis basis, void *data);
197ec3da8bcSJed Brown CEED_EXTERN int CeedBasisSetData(CeedBasis basis, void *data);
1989560d06aSjeremylt CEED_EXTERN int CeedBasisReference(CeedBasis basis);
199c4e3f59bSSebastian Grimberg CEED_EXTERN int CeedBasisGetNumQuadratureComponents(CeedBasis basis, CeedEvalMode eval_mode, CeedInt *q_comp);
2009d36ca50SJeremy L Thompson CEED_EXTERN int CeedBasisGetFlopsEstimate(CeedBasis basis, CeedTransposeMode t_mode, CeedEvalMode eval_mode, CeedSize *flops);
201c4e3f59bSSebastian Grimberg CEED_EXTERN int CeedBasisGetFESpace(CeedBasis basis, CeedFESpace *fe_space);
2022b730f8bSJeremy L Thompson CEED_EXTERN int CeedBasisGetTopologyDimension(CeedElemTopology topo, CeedInt *dim);
2032b730f8bSJeremy L Thompson CEED_EXTERN int CeedBasisGetTensorContract(CeedBasis basis, CeedTensorContract *contract);
2042b730f8bSJeremy L Thompson CEED_EXTERN int CeedBasisSetTensorContract(CeedBasis basis, CeedTensorContract contract);
205c4e3f59bSSebastian Grimberg 
2062b730f8bSJeremy L Thompson CEED_EXTERN int CeedTensorContractCreate(Ceed ceed, CeedBasis basis, CeedTensorContract *contract);
2072b730f8bSJeremy L Thompson CEED_EXTERN int CeedTensorContractApply(CeedTensorContract contract, CeedInt A, CeedInt B, CeedInt C, CeedInt J, const CeedScalar *__restrict__ t,
2082b730f8bSJeremy L Thompson                                         CeedTransposeMode t_mode, const CeedInt Add, const CeedScalar *__restrict__ u, CeedScalar *__restrict__ v);
209c4e3f59bSSebastian Grimberg CEED_EXTERN int CeedTensorContractStridedApply(CeedTensorContract contract, CeedInt A, CeedInt B, CeedInt C, CeedInt D, CeedInt J,
210c4e3f59bSSebastian Grimberg                                                const CeedScalar *__restrict__ t, CeedTransposeMode t_mode, const CeedInt add,
211c4e3f59bSSebastian Grimberg                                                const CeedScalar *__restrict__ u, CeedScalar *__restrict__ v);
2122b730f8bSJeremy L Thompson CEED_EXTERN int CeedTensorContractGetCeed(CeedTensorContract contract, Ceed *ceed);
2132b730f8bSJeremy L Thompson CEED_EXTERN int CeedTensorContractGetData(CeedTensorContract contract, void *data);
2142b730f8bSJeremy L Thompson CEED_EXTERN int CeedTensorContractSetData(CeedTensorContract contract, void *data);
2159560d06aSjeremylt CEED_EXTERN int CeedTensorContractReference(CeedTensorContract contract);
216ec3da8bcSJed Brown CEED_EXTERN int CeedTensorContractDestroy(CeedTensorContract *contract);
217ec3da8bcSJed Brown 
218509668d5SJeremy L Thompson CEED_EXTERN int CeedQFunctionRegister(const char *name, const char *source, CeedInt vec_length, CeedQFunctionUser f,
219509668d5SJeremy L Thompson                                       int (*init)(Ceed, const char *, CeedQFunction));
220ec3da8bcSJed Brown CEED_EXTERN int CeedQFunctionSetFortranStatus(CeedQFunction qf, bool status);
2212b730f8bSJeremy L Thompson CEED_EXTERN int CeedQFunctionGetVectorLength(CeedQFunction qf, CeedInt *vec_length);
2222b730f8bSJeremy L Thompson CEED_EXTERN int CeedQFunctionGetNumArgs(CeedQFunction qf, CeedInt *num_input_fields, CeedInt *num_output_fields);
22343e1b16fSJeremy L Thompson CEED_EXTERN int CeedQFunctionGetKernelName(CeedQFunction qf, char **kernel_name);
22443e1b16fSJeremy L Thompson CEED_EXTERN int CeedQFunctionGetSourcePath(CeedQFunction qf, char **source_path);
2253d3250a0SJeremy L Thompson CEED_EXTERN int CeedQFunctionLoadSourceToBuffer(CeedQFunction qf, char **source_buffer);
2262b730f8bSJeremy L Thompson CEED_EXTERN int CeedQFunctionGetUserFunction(CeedQFunction qf, CeedQFunctionUser *f);
2272b730f8bSJeremy L Thompson CEED_EXTERN int CeedQFunctionGetContext(CeedQFunction qf, CeedQFunctionContext *ctx);
228441428dfSJeremy L Thompson CEED_EXTERN int CeedQFunctionGetContextData(CeedQFunction qf, CeedMemType mem_type, void *data);
229441428dfSJeremy L Thompson CEED_EXTERN int CeedQFunctionRestoreContextData(CeedQFunction qf, void *data);
2302b730f8bSJeremy L Thompson CEED_EXTERN int CeedQFunctionGetInnerContext(CeedQFunction qf, CeedQFunctionContext *ctx);
231441428dfSJeremy L Thompson CEED_EXTERN int CeedQFunctionGetInnerContextData(CeedQFunction qf, CeedMemType mem_type, void *data);
232441428dfSJeremy L Thompson CEED_EXTERN int CeedQFunctionRestoreInnerContextData(CeedQFunction qf, void *data);
233d1d35e2fSjeremylt CEED_EXTERN int CeedQFunctionIsIdentity(CeedQFunction qf, bool *is_identity);
234441428dfSJeremy L Thompson CEED_EXTERN int CeedQFunctionIsContextWritable(CeedQFunction qf, bool *is_writable);
235ec3da8bcSJed Brown CEED_EXTERN int CeedQFunctionGetData(CeedQFunction qf, void *data);
236ec3da8bcSJed Brown CEED_EXTERN int CeedQFunctionSetData(CeedQFunction qf, void *data);
2379560d06aSjeremylt CEED_EXTERN int CeedQFunctionReference(CeedQFunction qf);
2389d36ca50SJeremy L Thompson CEED_EXTERN int CeedQFunctionGetFlopsEstimate(CeedQFunction qf, CeedSize *flops);
239ec3da8bcSJed Brown 
2402b730f8bSJeremy L Thompson CEED_EXTERN int CeedQFunctionContextGetCeed(CeedQFunctionContext ctx, Ceed *ceed);
2412b730f8bSJeremy L Thompson CEED_EXTERN int CeedQFunctionContextHasValidData(CeedQFunctionContext ctx, bool *has_valid_data);
2422b730f8bSJeremy L Thompson CEED_EXTERN int CeedQFunctionContextHasBorrowedDataOfType(CeedQFunctionContext ctx, CeedMemType mem_type, bool *has_borrowed_data_of_type);
2432b730f8bSJeremy L Thompson CEED_EXTERN int CeedQFunctionContextGetState(CeedQFunctionContext ctx, uint64_t *state);
2442b730f8bSJeremy L Thompson CEED_EXTERN int CeedQFunctionContextGetBackendData(CeedQFunctionContext ctx, void *data);
2452b730f8bSJeremy L Thompson CEED_EXTERN int CeedQFunctionContextSetBackendData(CeedQFunctionContext ctx, void *data);
2462b730f8bSJeremy L Thompson CEED_EXTERN int CeedQFunctionContextGetFieldLabel(CeedQFunctionContext ctx, const char *field_name, CeedContextFieldLabel *field_label);
2472b730f8bSJeremy L Thompson CEED_EXTERN int CeedQFunctionContextSetGeneric(CeedQFunctionContext ctx, CeedContextFieldLabel field_label, CeedContextFieldType field_type,
2482b730f8bSJeremy L Thompson                                                void *value);
2492788fa27SJeremy L Thompson CEED_EXTERN int CeedQFunctionContextGetGenericRead(CeedQFunctionContext ctx, CeedContextFieldLabel field_label, CeedContextFieldType field_type,
2502788fa27SJeremy L Thompson                                                    size_t *num_values, void *value);
2512788fa27SJeremy L Thompson CEED_EXTERN int CeedQFunctionContextRestoreGenericRead(CeedQFunctionContext ctx, CeedContextFieldLabel field_label, CeedContextFieldType field_type,
2522788fa27SJeremy L Thompson                                                        void *value);
2532b730f8bSJeremy L Thompson CEED_EXTERN int CeedQFunctionContextSetDouble(CeedQFunctionContext ctx, CeedContextFieldLabel field_label, double *values);
2542788fa27SJeremy L Thompson CEED_EXTERN int CeedQFunctionContextGetDoubleRead(CeedQFunctionContext ctx, CeedContextFieldLabel field_label, size_t *num_values,
2552788fa27SJeremy L Thompson                                                   const double **values);
2562788fa27SJeremy L Thompson CEED_EXTERN int CeedQFunctionContextRestoreDoubleRead(CeedQFunctionContext ctx, CeedContextFieldLabel field_label, const double **values);
2572b730f8bSJeremy L Thompson CEED_EXTERN int CeedQFunctionContextSetInt32(CeedQFunctionContext ctx, CeedContextFieldLabel field_label, int *values);
2582788fa27SJeremy L Thompson CEED_EXTERN int CeedQFunctionContextGetInt32Read(CeedQFunctionContext ctx, CeedContextFieldLabel field_label, size_t *num_values, const int **values);
2592788fa27SJeremy L Thompson CEED_EXTERN int CeedQFunctionContextRestoreInt32Read(CeedQFunctionContext ctx, CeedContextFieldLabel field_label, const int **values);
2602b730f8bSJeremy L Thompson CEED_EXTERN int CeedQFunctionContextGetDataDestroy(CeedQFunctionContext ctx, CeedMemType *f_mem_type, CeedQFunctionContextDataDestroyUser *f);
2619560d06aSjeremylt CEED_EXTERN int CeedQFunctionContextReference(CeedQFunctionContext ctx);
262ec3da8bcSJed Brown 
263480fae85SJeremy L Thompson CEED_EXTERN int CeedQFunctionAssemblyDataCreate(Ceed ceed, CeedQFunctionAssemblyData *data);
264480fae85SJeremy L Thompson CEED_EXTERN int CeedQFunctionAssemblyDataReference(CeedQFunctionAssemblyData data);
265beecbf24SJeremy L Thompson CEED_EXTERN int CeedQFunctionAssemblyDataSetReuse(CeedQFunctionAssemblyData data, bool reuse_assembly_data);
266beecbf24SJeremy L Thompson CEED_EXTERN int CeedQFunctionAssemblyDataSetUpdateNeeded(CeedQFunctionAssemblyData data, bool needs_data_update);
2678b919e6bSJeremy L Thompson CEED_EXTERN int CeedQFunctionAssemblyDataIsUpdateNeeded(CeedQFunctionAssemblyData data, bool *is_update_needed);
268480fae85SJeremy L Thompson CEED_EXTERN int CeedQFunctionAssemblyDataReferenceCopy(CeedQFunctionAssemblyData data, CeedQFunctionAssemblyData *data_copy);
269480fae85SJeremy L Thompson CEED_EXTERN int CeedQFunctionAssemblyDataIsSetup(CeedQFunctionAssemblyData data, bool *is_setup);
270480fae85SJeremy L Thompson CEED_EXTERN int CeedQFunctionAssemblyDataSetObjects(CeedQFunctionAssemblyData data, CeedVector vec, CeedElemRestriction rstr);
271480fae85SJeremy L Thompson CEED_EXTERN int CeedQFunctionAssemblyDataGetObjects(CeedQFunctionAssemblyData data, CeedVector *vec, CeedElemRestriction *rstr);
272480fae85SJeremy L Thompson CEED_EXTERN int CeedQFunctionAssemblyDataDestroy(CeedQFunctionAssemblyData *data);
273480fae85SJeremy L Thompson 
274ed9e99e6SJeremy L Thompson CEED_EXTERN int CeedOperatorAssemblyDataCreate(Ceed ceed, CeedOperator op, CeedOperatorAssemblyData *data);
275437c7c90SJeremy L Thompson CEED_EXTERN int CeedOperatorAssemblyDataGetEvalModes(CeedOperatorAssemblyData data, CeedInt *num_active_bases, CeedInt **num_eval_modes_in,
276437c7c90SJeremy L Thompson                                                      const CeedEvalMode ***eval_modes_in, CeedSize ***eval_mode_offsets_in,
277437c7c90SJeremy L Thompson                                                      CeedInt **num_eval_modes_out, const CeedEvalMode ***eval_modes_out,
278437c7c90SJeremy L Thompson                                                      CeedSize ***eval_mode_offsets_out, CeedSize *num_output_components);
279437c7c90SJeremy L Thompson CEED_EXTERN int CeedOperatorAssemblyDataGetBases(CeedOperatorAssemblyData data, CeedInt *num_active_bases, CeedBasis **active_bases,
280437c7c90SJeremy L Thompson                                                  const CeedScalar ***assembled_bases_in, const CeedScalar ***assembled_bases_out);
281437c7c90SJeremy L Thompson CEED_EXTERN int CeedOperatorAssemblyDataGetElemRestrictions(CeedOperatorAssemblyData data, CeedInt *num_active_elem_rstrs,
282437c7c90SJeremy L Thompson                                                             CeedElemRestriction **active_elem_rstrs);
283ed9e99e6SJeremy L Thompson CEED_EXTERN int CeedOperatorAssemblyDataDestroy(CeedOperatorAssemblyData *data);
284ed9e99e6SJeremy L Thompson 
285ed9e99e6SJeremy L Thompson CEED_EXTERN int CeedOperatorGetOperatorAssemblyData(CeedOperator op, CeedOperatorAssemblyData *data);
2862b730f8bSJeremy L Thompson CEED_EXTERN int CeedOperatorGetActiveBasis(CeedOperator op, CeedBasis *active_basis);
287ed9e99e6SJeremy L Thompson CEED_EXTERN int CeedOperatorGetActiveElemRestriction(CeedOperator op, CeedElemRestriction *active_rstr);
288d1d35e2fSjeremylt CEED_EXTERN int CeedOperatorGetNumArgs(CeedOperator op, CeedInt *num_args);
289d1d35e2fSjeremylt CEED_EXTERN int CeedOperatorIsSetupDone(CeedOperator op, bool *is_setup_done);
290ec3da8bcSJed Brown CEED_EXTERN int CeedOperatorGetQFunction(CeedOperator op, CeedQFunction *qf);
291d1d35e2fSjeremylt CEED_EXTERN int CeedOperatorIsComposite(CeedOperator op, bool *is_composite);
292ec3da8bcSJed Brown CEED_EXTERN int CeedOperatorGetData(CeedOperator op, void *data);
293ec3da8bcSJed Brown CEED_EXTERN int CeedOperatorSetData(CeedOperator op, void *data);
2949560d06aSjeremylt CEED_EXTERN int CeedOperatorReference(CeedOperator op);
295ec3da8bcSJed Brown CEED_EXTERN int CeedOperatorSetSetupDone(CeedOperator op);
296ec3da8bcSJed Brown 
2972b730f8bSJeremy L Thompson CEED_INTERN int CeedMatrixMatrixMultiply(Ceed ceed, const CeedScalar *mat_A, const CeedScalar *mat_B, CeedScalar *mat_C, CeedInt m, CeedInt n,
2982b730f8bSJeremy L Thompson                                          CeedInt kk);
299ba59ac12SSebastian Grimberg CEED_EXTERN int CeedQRFactorization(Ceed ceed, CeedScalar *mat, CeedScalar *tau, CeedInt m, CeedInt n);
300ba59ac12SSebastian Grimberg CEED_EXTERN int CeedHouseholderApplyQ(CeedScalar *mat_A, const CeedScalar *mat_Q, const CeedScalar *tau, CeedTransposeMode t_mode, CeedInt m,
301ba59ac12SSebastian Grimberg                                       CeedInt n, CeedInt k, CeedInt row, CeedInt col);
302ba59ac12SSebastian Grimberg CEED_EXTERN int CeedSymmetricSchurDecomposition(Ceed ceed, CeedScalar *mat, CeedScalar *lambda, CeedInt n);
303ba59ac12SSebastian Grimberg CEED_EXTERN int CeedSimultaneousDiagonalization(Ceed ceed, CeedScalar *mat_A, CeedScalar *mat_B, CeedScalar *x, CeedScalar *lambda, CeedInt n);
304ec3da8bcSJed Brown 
305ec3da8bcSJed Brown #endif
306