xref: /libCEED/include/ceed/backend.h (revision f2989f2b3b8649d855bed22b6730ee0ecfa6b31b)
19ba83ac0SJeremy L Thompson // Copyright (c) 2017-2026, 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
10a844dea2SJeremy L Thompson #pragma once
11ec3da8bcSJed Brown 
1249aac155SJeremy L Thompson #include <ceed.h>
13d0c91ce9Sjeremylt #include <limits.h>
14ec3da8bcSJed Brown #include <stdbool.h>
15ec3da8bcSJed Brown 
162b730f8bSJeremy L Thompson #if defined(__clang_analyzer__)
172b730f8bSJeremy L Thompson #define CEED_INTERN
182b730f8bSJeremy L Thompson #elif defined(__cplusplus)
193b271f31SJed Brown #define CEED_INTERN extern "C" CEED_VISIBILITY(hidden)
203b271f31SJed Brown #else
213b271f31SJed Brown #define CEED_INTERN extern CEED_VISIBILITY(hidden)
223b271f31SJed Brown #endif
233b271f31SJed Brown 
24ec3da8bcSJed Brown #define CEED_UNUSED __attribute__((unused))
25ec3da8bcSJed Brown 
26ec3da8bcSJed Brown #define CEED_MAX_RESOURCE_LEN 1024
27d0c91ce9Sjeremylt #define CEED_MAX_BACKEND_PRIORITY UINT_MAX
28ec3da8bcSJed Brown #define CEED_ALIGN 64
29ec3da8bcSJed Brown #define CEED_COMPOSITE_MAX 16
30bf4cb664SJeremy L Thompson #define CEED_FIELD_MAX 16
31ec3da8bcSJed Brown 
3203d18186Sjeremylt #ifndef CeedPragmaOptimizeOff
3303d18186Sjeremylt #if defined(__clang__)
341f97d2f1SJeremy L Thompson /// This macro provides the ability to disable optimization flags for functions that are sensitive to floating point optimizations.
351f97d2f1SJeremy L Thompson /// @ingroup Ceed
3603d18186Sjeremylt #define CeedPragmaOptimizeOff _Pragma("clang optimize off")
3703d18186Sjeremylt #elif defined(__GNUC__)
3803d18186Sjeremylt #define CeedPragmaOptimizeOff _Pragma("GCC push_options") _Pragma("GCC optimize 0")
3903d18186Sjeremylt #elif defined(__INTEL_COMPILER) || defined(__INTEL_LLVM_COMPILER)
4003d18186Sjeremylt #define CeedPragmaOptimizeOff _Pragma("optimize('', off)")
4103d18186Sjeremylt #else
4203d18186Sjeremylt #define CeedPragmaOptimizeOff
4303d18186Sjeremylt #endif
4403d18186Sjeremylt #endif
4503d18186Sjeremylt 
4603d18186Sjeremylt #ifndef CeedPragmaOptimizeOn
4703d18186Sjeremylt #if defined(__clang__)
481f97d2f1SJeremy L Thompson /// This macro restores previously set optimization flags after CeedPragmaOptimizeOff.
491f97d2f1SJeremy L Thompson /// @ingroup Ceed
5003d18186Sjeremylt #define CeedPragmaOptimizeOn _Pragma("clang optimize on")
5103d18186Sjeremylt #elif defined(__GNUC__)
5203d18186Sjeremylt #define CeedPragmaOptimizeOn _Pragma("GCC pop_options")
5303d18186Sjeremylt #elif defined(__INTEL_COMPILER) || defined(__INTEL_LLVM_COMPILER)
5458c07c4fSSebastian Grimberg #define CeedPragmaOptimizeOn _Pragma("optimize('', on)")
5503d18186Sjeremylt #else
5603d18186Sjeremylt #define CeedPragmaOptimizeOn
5703d18186Sjeremylt #endif
5803d18186Sjeremylt #endif
5903d18186Sjeremylt 
6058c07c4fSSebastian Grimberg /// This macro provides the appropriate OpenMP Pragmas for the compilation environment.
6158c07c4fSSebastian Grimberg /// @ingroup Ceed
6258c07c4fSSebastian Grimberg #ifndef CeedPragmaOMP
6358c07c4fSSebastian Grimberg #ifdef _OPENMP
6458c07c4fSSebastian Grimberg #define CeedPragmaOMPHelper(x) _Pragma(#x)
6558c07c4fSSebastian Grimberg #define CeedPragmaOMP(x) CeedPragmaOMPHelper(omp x)
6658c07c4fSSebastian Grimberg #else
6758c07c4fSSebastian Grimberg #define CeedPragmaOMP(x)
6858c07c4fSSebastian Grimberg #endif
6958c07c4fSSebastian Grimberg #endif
7058c07c4fSSebastian Grimberg #ifndef CeedPragmaAtomic
7158c07c4fSSebastian Grimberg #define CeedPragmaAtomic CeedPragmaOMP(atomic update)
7258c07c4fSSebastian Grimberg #endif
7358c07c4fSSebastian Grimberg #ifndef CeedPragmaCritical
7458c07c4fSSebastian Grimberg #define CeedPragmaCritical(x) CeedPragmaOMP(critical(x))
7558c07c4fSSebastian Grimberg #endif
7658c07c4fSSebastian Grimberg 
774c789ea2SJeremy L Thompson /// This macro provides the tab width for viewing Ceed objects.
784c789ea2SJeremy L Thompson /// @ingroup Ceed
794c789ea2SJeremy L Thompson #define CEED_TAB_WIDTH 2
804c789ea2SJeremy L Thompson 
811f97d2f1SJeremy L Thompson /**
82ce2232d0SJeremy L Thompson   This enum supplies common colors for CeedDebug256 debugging output.
831f97d2f1SJeremy L Thompson   Set the environment variable `CEED_DEBUG = 1` to activate debugging output.
841f97d2f1SJeremy L Thompson 
851f97d2f1SJeremy L Thompson   @ingroup Ceed
861f97d2f1SJeremy L Thompson   @ref     Backend
871f97d2f1SJeremy L Thompson **/
8823d4529eSJeremy L Thompson typedef enum {
8923d4529eSJeremy L Thompson   /// Success color
9023d4529eSJeremy L Thompson   CEED_DEBUG_COLOR_SUCCESS = 108,
9123d4529eSJeremy L Thompson   /// Warning color
9223d4529eSJeremy L Thompson   CEED_DEBUG_COLOR_WARNING = 208,
9323d4529eSJeremy L Thompson   /// Error color
9423d4529eSJeremy L Thompson   CEED_DEBUG_COLOR_ERROR = 196,
9523d4529eSJeremy L Thompson   /// Use native terminal coloring
9623d4529eSJeremy L Thompson   CEED_DEBUG_COLOR_NONE = 255,
9723d4529eSJeremy L Thompson } CeedDebugColor;
983f21f6b1SJeremy L Thompson 
993f21f6b1SJeremy L Thompson CEED_EXTERN void CeedDebugImpl256(const unsigned char, const char *, ...);
1003f21f6b1SJeremy L Thompson CEED_EXTERN bool CeedDebugFlag(const Ceed ceed);
1013f21f6b1SJeremy L Thompson CEED_EXTERN bool CeedDebugFlagEnv(void);
1021f97d2f1SJeremy L Thompson /**
1031f97d2f1SJeremy L Thompson   Print debugging information in color
1041f97d2f1SJeremy L Thompson 
1051f97d2f1SJeremy L Thompson   @param[in] ceed  Ceed
1061f97d2f1SJeremy L Thompson   @param[in] color Color to print with
1071f97d2f1SJeremy L Thompson 
1081f97d2f1SJeremy L Thompson   @ingroup Ceed
1091f97d2f1SJeremy L Thompson   @ref     Backend
1101f97d2f1SJeremy L Thompson **/
1113f21f6b1SJeremy L Thompson #define CeedDebug256(ceed, color, ...)                               \
1122b730f8bSJeremy L Thompson   {                                                                  \
1132b730f8bSJeremy L Thompson     if (CeedDebugFlag(ceed)) CeedDebugImpl256(color, ##__VA_ARGS__); \
1142b730f8bSJeremy L Thompson   }
1151f97d2f1SJeremy L Thompson /**
1161f97d2f1SJeremy L Thompson   Print debugging information to terminal
1171f97d2f1SJeremy L Thompson 
1181f97d2f1SJeremy L Thompson   @param[in] ceed  Ceed
1191f97d2f1SJeremy L Thompson 
1201f97d2f1SJeremy L Thompson   @ingroup Ceed
1211f97d2f1SJeremy L Thompson   @ref     Backend
1221f97d2f1SJeremy L Thompson **/
1233f21f6b1SJeremy L Thompson #define CeedDebug(ceed, ...) CeedDebug256(ceed, (unsigned char)CEED_DEBUG_COLOR_NONE, ##__VA_ARGS__)
1241f97d2f1SJeremy L Thompson /**
1251f97d2f1SJeremy L Thompson   Print debugging information in color without Ceed to reference
1261f97d2f1SJeremy L Thompson 
1271f97d2f1SJeremy L Thompson   @param[in] color Color to print with
1281f97d2f1SJeremy L Thompson 
1291f97d2f1SJeremy L Thompson   @ingroup Ceed
1301f97d2f1SJeremy L Thompson   @ref     Backend
1311f97d2f1SJeremy L Thompson **/
1323f21f6b1SJeremy L Thompson #define CeedDebugEnv256(color, ...)                                 \
1332b730f8bSJeremy L Thompson   {                                                                 \
1342b730f8bSJeremy L Thompson     if (CeedDebugFlagEnv()) CeedDebugImpl256(color, ##__VA_ARGS__); \
1352b730f8bSJeremy L Thompson   }
1361f97d2f1SJeremy L Thompson /**
1371f97d2f1SJeremy L Thompson   Print debugging information to terminal without Ceed to reference
1381f97d2f1SJeremy L Thompson 
1391f97d2f1SJeremy L Thompson   @ingroup Ceed
1401f97d2f1SJeremy L Thompson   @ref     Backend
1411f97d2f1SJeremy L Thompson **/
1423f21f6b1SJeremy L Thompson #define CeedDebugEnv(...) CeedDebugEnv256((unsigned char)CEED_DEBUG_COLOR_NONE, ##__VA_ARGS__)
143aca496beSJeremy L Thompson /**
144aca496beSJeremy L Thompson   Print warning information in color
145aca496beSJeremy L Thompson 
146aca496beSJeremy L Thompson   @ingroup Ceed
147aca496beSJeremy L Thompson   @ref     Backend
148aca496beSJeremy L Thompson **/
149aca496beSJeremy L Thompson #define CeedWarn(...)                                          \
1506eb06d7cSJeremy L Thompson   {                                                            \
1516eb06d7cSJeremy L Thompson     CeedDebugImpl256(CEED_DEBUG_COLOR_WARNING, ##__VA_ARGS__); \
1526eb06d7cSJeremy L Thompson   }
153ec3da8bcSJed Brown 
1541c66c397SJeremy L Thompson /**
1551c66c397SJeremy L Thompson   Swap the values of two CeedScalars
1561c66c397SJeremy L Thompson 
1571c66c397SJeremy L Thompson   @param[in,out] a  First CeedScalar
1581c66c397SJeremy L Thompson   @param[in,out] b  Second CeedScalar
1591c66c397SJeremy L Thompson 
1601c66c397SJeremy L Thompson   @ingroup Ceed
1611c66c397SJeremy L Thompson   @ref     Backend
1621c66c397SJeremy L Thompson **/
1631c66c397SJeremy L Thompson #define CeedScalarSwap(a, b)        \
1641c66c397SJeremy L Thompson   {                                 \
1651c66c397SJeremy L Thompson     const CeedScalar temp_ = a;     \
1661c66c397SJeremy L Thompson     a                      = b;     \
1671c66c397SJeremy L Thompson     b                      = temp_; \
1681c66c397SJeremy L Thompson   }
1691c66c397SJeremy L Thompson 
170ec3da8bcSJed Brown /// Handle for object handling TensorContraction
171ec3da8bcSJed Brown /// @ingroup CeedBasis
172ec3da8bcSJed Brown typedef struct CeedTensorContract_private *CeedTensorContract;
173ec3da8bcSJed Brown 
174480fae85SJeremy L Thompson /// Handle for object handling assembled QFunction data
175480fae85SJeremy L Thompson /// @ingroup CeedOperator
176480fae85SJeremy L Thompson typedef struct CeedQFunctionAssemblyData_private *CeedQFunctionAssemblyData;
177480fae85SJeremy L Thompson 
178ed9e99e6SJeremy L Thompson /// Handle for object handling assembled Operator data
179ed9e99e6SJeremy L Thompson /// @ingroup CeedOperator
180ed9e99e6SJeremy L Thompson typedef struct CeedOperatorAssemblyData_private *CeedOperatorAssemblyData;
181ed9e99e6SJeremy L Thompson 
182ea61e9acSJeremy 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. */
183ec3da8bcSJed Brown CEED_INTERN int CeedMallocArray(size_t n, size_t unit, void *p);
184ec3da8bcSJed Brown CEED_INTERN int CeedCallocArray(size_t n, size_t unit, void *p);
185ec3da8bcSJed Brown CEED_INTERN int CeedReallocArray(size_t n, size_t unit, void *p);
186f7e22acaSJeremy L Thompson CEED_INTERN int CeedStringAllocCopy(const char *source, char **copy);
187ec3da8bcSJed Brown CEED_INTERN int CeedFree(void *p);
188ec3da8bcSJed Brown 
189*6c328a79SJeremy L Thompson CEED_INTERN int CeedObjectCreate(Ceed ceed, int (*view_function)(CeedObject, FILE *), int (*destroy_function)(CeedObject *), CeedObject obj);
190b0f67a9cSJeremy L Thompson CEED_INTERN int CeedObjectReference(CeedObject obj);
191b0f67a9cSJeremy L Thompson CEED_INTERN int CeedObjectDereference(CeedObject obj);
192*6c328a79SJeremy L Thompson CEED_INTERN int CeedObjectDestroy_Private(CeedObject obj);
193b0f67a9cSJeremy L Thompson 
194f5d1e504SJeremy L Thompson CEED_INTERN int CeedSetHostBoolArray(const bool *source_array, CeedCopyMode copy_mode, CeedSize num_values, const bool **target_array_owned,
195f5d1e504SJeremy L Thompson                                      const bool **target_array_borrowed, const bool **target_array);
196f5d1e504SJeremy L Thompson CEED_INTERN int CeedSetHostCeedInt8Array(const CeedInt8 *source_array, CeedCopyMode copy_mode, CeedSize num_values,
197f5d1e504SJeremy L Thompson                                          const CeedInt8 **target_array_owned, const CeedInt8 **target_array_borrowed, const CeedInt8 **target_array);
198f5d1e504SJeremy L Thompson CEED_INTERN int CeedSetHostCeedIntArray(const CeedInt *source_array, CeedCopyMode copy_mode, CeedSize num_values, const CeedInt **target_array_owned,
199f5d1e504SJeremy L Thompson                                         const CeedInt **target_array_borrowed, const CeedInt **target_array);
200f5d1e504SJeremy L Thompson CEED_INTERN int CeedSetHostCeedScalarArray(const CeedScalar *source_array, CeedCopyMode copy_mode, CeedSize num_values,
201f5d1e504SJeremy L Thompson                                            const CeedScalar **target_array_owned, const CeedScalar **target_array_borrowed,
202f5d1e504SJeremy L Thompson                                            const CeedScalar **target_array);
203f5d1e504SJeremy L Thompson 
204d109957bSJeremy L Thompson /**
205d109957bSJeremy L Thompson   @brief Calls a libCEED function and then checks the resulting error code.
206d109957bSJeremy L Thompson   If the error code is non-zero, then the error handler is called and the call from the current function with the error code.
2072b730f8bSJeremy L Thompson 
208d109957bSJeremy L Thompson   @ref Developer
209d109957bSJeremy L Thompson **/
2102b730f8bSJeremy L Thompson #define CeedCall(...)        \
2112b730f8bSJeremy L Thompson   do {                       \
212d109957bSJeremy L Thompson     int ierr_ = __VA_ARGS__; \
213d109957bSJeremy L Thompson     if (ierr_) return ierr_; \
2140126412dSJeremy L Thompson   } while (0)
2152b730f8bSJeremy L Thompson 
216d109957bSJeremy L Thompson /**
217d109957bSJeremy L Thompson   @brief Calls a libCEED function and then checks the resulting error code.
218d109957bSJeremy L Thompson   If the error code is non-zero, then the error handler is called and the call from the current function with the error code.
219d109957bSJeremy L Thompson   All interface level error codes are upgraded to `CEED_ERROR_BACKEND`.
220d109957bSJeremy L Thompson 
221d109957bSJeremy L Thompson   @ref Developer
222d109957bSJeremy L Thompson **/
223d109957bSJeremy L Thompson #define CeedCallBackend(...)                                                     \
224d109957bSJeremy L Thompson   do {                                                                           \
225d109957bSJeremy L Thompson     int ierr_ = __VA_ARGS__;                                                     \
226d109957bSJeremy L Thompson     if (ierr_) return (ierr_ > CEED_ERROR_SUCCESS) ? CEED_ERROR_BACKEND : ierr_; \
227d109957bSJeremy L Thompson   } while (0)
228d109957bSJeremy L Thompson 
229d109957bSJeremy L Thompson /**
230d109957bSJeremy L Thompson   @brief Check that a particular condition is true and returns a `CeedError` if not.
231d109957bSJeremy L Thompson 
232d109957bSJeremy L Thompson   @ref Developer
233d109957bSJeremy L Thompson **/
2346574a04fSJeremy L Thompson #define CeedCheck(cond, ceed, ecode, ...)                    \
2356574a04fSJeremy L Thompson   do {                                                       \
236d109957bSJeremy L Thompson     if (!(cond)) return CeedError(ceed, ecode, __VA_ARGS__); \
2376574a04fSJeremy L Thompson   } while (0)
2386574a04fSJeremy L Thompson 
239ea61e9acSJeremy L Thompson /* Note that CeedMalloc and CeedCalloc will, generally, return pointers with different memory alignments:
240ea61e9acSJeremy L Thompson    CeedMalloc returns pointers aligned at CEED_ALIGN bytes, while CeedCalloc uses the alignment of calloc. */
241ec3da8bcSJed Brown #define CeedMalloc(n, p) CeedMallocArray((n), sizeof(**(p)), p)
242ec3da8bcSJed Brown #define CeedCalloc(n, p) CeedCallocArray((n), sizeof(**(p)), p)
243ec3da8bcSJed Brown #define CeedRealloc(n, p) CeedReallocArray((n), sizeof(**(p)), p)
244ec3da8bcSJed Brown 
2456a8ec7bdSSebastian Grimberg /* Allows calling CeedSetBackendFunctionImpl using incompatible pointer types */
246897d4737SSebastian Grimberg #define CeedSetBackendFunction(ceed, type, object, func_name, f) CeedSetBackendFunctionImpl(ceed, type, object, func_name, (void (*)(void))f)
247360501f4SSebastian Grimberg 
2482b730f8bSJeremy L Thompson CEED_EXTERN int CeedRegister(const char *prefix, int (*init)(const char *, Ceed), unsigned int priority);
2492b730f8bSJeremy L Thompson CEED_EXTERN int CeedRegisterImpl(const char *prefix, int (*init)(const char *, Ceed), unsigned int priority);
250ec3da8bcSJed Brown 
251d1d35e2fSjeremylt CEED_EXTERN int CeedIsDebug(Ceed ceed, bool *is_debug);
252bc246734SJeremy L Thompson CEED_EXTERN int CeedGetResourceRoot(Ceed ceed, const char *resource, const char *delineator, char **resource_root);
253ec3da8bcSJed Brown CEED_EXTERN int CeedGetParent(Ceed ceed, Ceed *parent);
254ec3da8bcSJed Brown CEED_EXTERN int CeedGetDelegate(Ceed ceed, Ceed *delegate);
255ec3da8bcSJed Brown CEED_EXTERN int CeedSetDelegate(Ceed ceed, Ceed delegate);
2562b730f8bSJeremy L Thompson CEED_EXTERN int CeedGetObjectDelegate(Ceed ceed, Ceed *delegate, const char *obj_name);
2572b730f8bSJeremy L Thompson CEED_EXTERN int CeedSetObjectDelegate(Ceed ceed, Ceed delegate, const char *obj_name);
2588687e1d4SJeremy L Thompson CEED_EXTERN int CeedGetOperatorFallbackCeed(Ceed ceed, Ceed *fallback_ceed);
25946b50f9eSZach Atkins CEED_EXTERN int CeedSetOperatorFallbackCeed(Ceed ceed, Ceed fallback_ceed);
260d1d35e2fSjeremylt CEED_EXTERN int CeedSetDeterministic(Ceed ceed, bool is_deterministic);
261897d4737SSebastian Grimberg CEED_EXTERN int CeedSetBackendFunctionImpl(Ceed ceed, const char *type, void *object, const char *func_name, void (*f)(void));
262ec3da8bcSJed Brown CEED_EXTERN int CeedGetData(Ceed ceed, void *data);
263ec3da8bcSJed Brown CEED_EXTERN int CeedSetData(Ceed ceed, void *data);
2649560d06aSjeremylt CEED_EXTERN int CeedReference(Ceed ceed);
26573501bfeSJeremy L Thompson CEED_EXTERN int CeedGetWorkVector(Ceed ceed, CeedSize len, CeedVector *vec);
26673501bfeSJeremy L Thompson CEED_EXTERN int CeedRestoreWorkVector(Ceed ceed, CeedVector *vec);
2670b37c066SZach Atkins CEED_EXTERN int CeedClearWorkVectors(Ceed ceed, CeedSize min_len);
26855326fe7SZach Atkins CEED_EXTERN int CeedGetWorkVectorMemoryUsage(Ceed ceed, CeedScalar *usage_mb);
269b13efd58SJeremy L Thompson CEED_EXTERN int CeedGetJitSourceRoots(Ceed ceed, CeedInt *num_source_roots, const char ***jit_source_roots);
2702027fb9dSSirAlienTheGreat CEED_EXTERN int CeedGetRustSourceRoots(Ceed ceed, CeedInt *num_source_roots, const char ***rust_source_roots);
271b13efd58SJeremy L Thompson CEED_EXTERN int CeedRestoreJitSourceRoots(Ceed ceed, const char ***jit_source_roots);
2722027fb9dSSirAlienTheGreat CEED_EXTERN int CeedRestoreRustSourceRoots(Ceed ceed, const char ***rust_source_roots);
2734753b775SJeremy L Thompson CEED_EXTERN int CeedGetJitDefines(Ceed ceed, CeedInt *num_defines, const char ***jit_defines);
2744753b775SJeremy L Thompson CEED_EXTERN int CeedRestoreJitDefines(Ceed ceed, const char ***jit_defines);
275ec3da8bcSJed Brown 
2769c774eddSJeremy L Thompson CEED_EXTERN int CeedVectorHasValidArray(CeedVector vec, bool *has_valid_array);
2772b730f8bSJeremy L Thompson CEED_EXTERN int CeedVectorHasBorrowedArrayOfType(CeedVector vec, CeedMemType mem_type, bool *has_borrowed_array_of_type);
2789c774eddSJeremy L Thompson CEED_EXTERN int CeedVectorHasValidArray(CeedVector vec, bool *has_valid_array);
279ec3da8bcSJed Brown CEED_EXTERN int CeedVectorGetState(CeedVector vec, uint64_t *state);
280ec3da8bcSJed Brown CEED_EXTERN int CeedVectorGetData(CeedVector vec, void *data);
281ec3da8bcSJed Brown CEED_EXTERN int CeedVectorSetData(CeedVector vec, void *data);
2829560d06aSjeremylt CEED_EXTERN int CeedVectorReference(CeedVector vec);
283ec3da8bcSJed Brown 
284ce2232d0SJeremy L Thompson /**
285ce2232d0SJeremy L Thompson   Specify type of restriction operation.
286ce2232d0SJeremy L Thompson 
287ce2232d0SJeremy L Thompson   @ingroup CeedElemRestriction
288ce2232d0SJeremy L Thompson   @ref     Backend
289ce2232d0SJeremy L Thompson **/
290fcbe8c06SSebastian Grimberg typedef enum {
29161a27d74SSebastian Grimberg   /// Standard element restriction with offsets
29261a27d74SSebastian Grimberg   CEED_RESTRICTION_STANDARD = 1,
293fcbe8c06SSebastian Grimberg   /// Oriented element restriction
294fcbe8c06SSebastian Grimberg   CEED_RESTRICTION_ORIENTED = 2,
295fcbe8c06SSebastian Grimberg   /// Curl-oriented element restriction
296fcbe8c06SSebastian Grimberg   CEED_RESTRICTION_CURL_ORIENTED = 3,
297fcbe8c06SSebastian Grimberg   /// Strided element restriction
298fcbe8c06SSebastian Grimberg   CEED_RESTRICTION_STRIDED = 4,
2993ac8f562SJeremy L Thompson   /// Point-in-cell element restriction
3003ac8f562SJeremy L Thompson   CEED_RESTRICTION_POINTS = 5,
301fcbe8c06SSebastian Grimberg } CeedRestrictionType;
302fcbe8c06SSebastian Grimberg 
303fcbe8c06SSebastian Grimberg CEED_EXTERN int CeedElemRestrictionGetType(CeedElemRestriction rstr, CeedRestrictionType *rstr_type);
30477d1c127SSebastian Grimberg CEED_EXTERN int CeedElemRestrictionIsStrided(CeedElemRestriction rstr, bool *is_strided);
305637baffdSJeremy L Thompson CEED_EXTERN int CeedElemRestrictionIsAtPoints(CeedElemRestriction rstr, bool *is_points);
30648acf710SJeremy L Thompson CEED_EXTERN int CeedElemRestrictionAtPointsAreCompatible(CeedElemRestriction rstr_a, CeedElemRestriction rstr_b, bool *are_compatible);
30756c48462SJeremy L Thompson CEED_EXTERN int CeedElemRestrictionGetStrides(CeedElemRestriction rstr, CeedInt strides[3]);
30877d1c127SSebastian Grimberg CEED_EXTERN int CeedElemRestrictionHasBackendStrides(CeedElemRestriction rstr, bool *has_backend_strides);
3092b730f8bSJeremy L Thompson CEED_EXTERN int CeedElemRestrictionGetOffsets(CeedElemRestriction rstr, CeedMemType mem_type, const CeedInt **offsets);
3102b730f8bSJeremy L Thompson CEED_EXTERN int CeedElemRestrictionRestoreOffsets(CeedElemRestriction rstr, const CeedInt **offsets);
31177d1c127SSebastian Grimberg CEED_EXTERN int CeedElemRestrictionGetOrientations(CeedElemRestriction rstr, CeedMemType mem_type, const bool **orients);
31277d1c127SSebastian Grimberg CEED_EXTERN int CeedElemRestrictionRestoreOrientations(CeedElemRestriction rstr, const bool **orients);
3130c73c039SSebastian Grimberg CEED_EXTERN int CeedElemRestrictionGetCurlOrientations(CeedElemRestriction rstr, CeedMemType mem_type, const CeedInt8 **curl_orients);
3140c73c039SSebastian Grimberg CEED_EXTERN int CeedElemRestrictionRestoreCurlOrientations(CeedElemRestriction rstr, const CeedInt8 **curl_orients);
31556c48462SJeremy L Thompson CEED_EXTERN int CeedElemRestrictionGetLLayout(CeedElemRestriction rstr, CeedInt layout[3]);
31622eb1385SJeremy L Thompson CEED_EXTERN int CeedElemRestrictionSetLLayout(CeedElemRestriction rstr, CeedInt layout[3]);
31756c48462SJeremy L Thompson CEED_EXTERN int CeedElemRestrictionGetELayout(CeedElemRestriction rstr, CeedInt layout[3]);
3182b730f8bSJeremy L Thompson CEED_EXTERN int CeedElemRestrictionSetELayout(CeedElemRestriction rstr, CeedInt layout[3]);
31919605835SJeremy L Thompson CEED_EXTERN int CeedElemRestrictionGetAtPointsElementOffset(CeedElemRestriction rstr, CeedInt elem, CeedSize *elem_offset);
320ff1bc20eSJeremy L Thompson CEED_EXTERN int CeedElemRestrictionSetAtPointsEVectorSize(CeedElemRestriction rstr, CeedSize e_size);
3212b730f8bSJeremy L Thompson CEED_EXTERN int CeedElemRestrictionGetData(CeedElemRestriction rstr, void *data);
3222b730f8bSJeremy L Thompson CEED_EXTERN int CeedElemRestrictionSetData(CeedElemRestriction rstr, void *data);
3239560d06aSjeremylt CEED_EXTERN int CeedElemRestrictionReference(CeedElemRestriction rstr);
3249d36ca50SJeremy L Thompson CEED_EXTERN int CeedElemRestrictionGetFlopsEstimate(CeedElemRestriction rstr, CeedTransposeMode t_mode, CeedSize *flops);
325ec3da8bcSJed Brown 
326ce2232d0SJeremy L Thompson /**
327ce2232d0SJeremy L Thompson   Specify type of FE space.
328ce2232d0SJeremy L Thompson 
329ce2232d0SJeremy L Thompson   @ingroup CeedBasis
330ce2232d0SJeremy L Thompson   @ref     Backend
331ce2232d0SJeremy L Thompson **/
3326f117663SJeremy L Thompson typedef enum {
333c4e3f59bSSebastian Grimberg   /// H^1 FE space
3346f117663SJeremy L Thompson   CEED_FE_SPACE_H1 = 1,
3356f117663SJeremy L Thompson   /// H(div) FE space
3366f117663SJeremy L Thompson   CEED_FE_SPACE_HDIV = 2,
337c4e3f59bSSebastian Grimberg   /// H(curl) FE space
338c4e3f59bSSebastian Grimberg   CEED_FE_SPACE_HCURL = 3,
3396f117663SJeremy L Thompson } CeedFESpace;
3406f117663SJeremy L Thompson CEED_EXTERN const char *const CeedFESpaces[];
3416f117663SJeremy L Thompson 
3422b730f8bSJeremy L Thompson CEED_EXTERN int CeedBasisGetCollocatedGrad(CeedBasis basis, CeedScalar *colo_grad_1d);
343b0cc4569SJeremy L Thompson CEED_EXTERN int CeedBasisGetChebyshevInterp1D(CeedBasis basis, CeedScalar *chebyshev_interp_1d);
344d1d35e2fSjeremylt CEED_EXTERN int CeedBasisIsTensor(CeedBasis basis, bool *is_tensor);
345ca62d558SJeremy L Thompson CEED_EXTERN int CeedBasisIsCollocated(CeedBasis basis, bool *is_collocated);
346ec3da8bcSJed Brown CEED_EXTERN int CeedBasisGetData(CeedBasis basis, void *data);
347ec3da8bcSJed Brown CEED_EXTERN int CeedBasisSetData(CeedBasis basis, void *data);
3489560d06aSjeremylt CEED_EXTERN int CeedBasisReference(CeedBasis basis);
349c4e3f59bSSebastian Grimberg CEED_EXTERN int CeedBasisGetNumQuadratureComponents(CeedBasis basis, CeedEvalMode eval_mode, CeedInt *q_comp);
3503f919cbcSJeremy L Thompson CEED_EXTERN int CeedBasisGetFlopsEstimate(CeedBasis basis, CeedTransposeMode t_mode, CeedEvalMode eval_mode, bool is_at_points, CeedInt num_points,
3513f919cbcSJeremy L Thompson                                           CeedSize *flops);
352c4e3f59bSSebastian Grimberg CEED_EXTERN int CeedBasisGetFESpace(CeedBasis basis, CeedFESpace *fe_space);
3532b730f8bSJeremy L Thompson CEED_EXTERN int CeedBasisGetTopologyDimension(CeedElemTopology topo, CeedInt *dim);
3542b730f8bSJeremy L Thompson CEED_EXTERN int CeedBasisGetTensorContract(CeedBasis basis, CeedTensorContract *contract);
3552b730f8bSJeremy L Thompson CEED_EXTERN int CeedBasisSetTensorContract(CeedBasis basis, CeedTensorContract contract);
356fda26546SJeremy L Thompson CEED_EXTERN int CeedBasisCreateH1Fallback(Ceed ceed, CeedElemTopology topo, CeedInt num_comp, CeedInt num_nodes, CeedInt nqpts,
357fda26546SJeremy L Thompson                                           const CeedScalar *interp, const CeedScalar *grad, const CeedScalar *q_ref, const CeedScalar *q_weights,
358fda26546SJeremy L Thompson                                           CeedBasis basis);
359c4e3f59bSSebastian Grimberg 
360a71faab1SSebastian Grimberg CEED_EXTERN int  CeedTensorContractCreate(Ceed ceed, CeedTensorContract *contract);
3612b730f8bSJeremy L Thompson CEED_EXTERN int  CeedTensorContractApply(CeedTensorContract contract, CeedInt A, CeedInt B, CeedInt C, CeedInt J, const CeedScalar *__restrict__ t,
3622b730f8bSJeremy L Thompson                                          CeedTransposeMode t_mode, const CeedInt Add, const CeedScalar *__restrict__ u, CeedScalar *__restrict__ v);
363c4e3f59bSSebastian Grimberg CEED_EXTERN int  CeedTensorContractStridedApply(CeedTensorContract contract, CeedInt A, CeedInt B, CeedInt C, CeedInt D, CeedInt J,
364c4e3f59bSSebastian Grimberg                                                 const CeedScalar *__restrict__ t, CeedTransposeMode t_mode, const CeedInt add,
365c4e3f59bSSebastian Grimberg                                                 const CeedScalar *__restrict__ u, CeedScalar *__restrict__ v);
3662b730f8bSJeremy L Thompson CEED_EXTERN int  CeedTensorContractGetCeed(CeedTensorContract contract, Ceed *ceed);
3676e536b99SJeremy L Thompson CEED_EXTERN Ceed CeedTensorContractReturnCeed(CeedTensorContract contract);
3682b730f8bSJeremy L Thompson CEED_EXTERN int  CeedTensorContractGetData(CeedTensorContract contract, void *data);
3692b730f8bSJeremy L Thompson CEED_EXTERN int  CeedTensorContractSetData(CeedTensorContract contract, void *data);
3709560d06aSjeremylt CEED_EXTERN int  CeedTensorContractReference(CeedTensorContract contract);
371585a562dSJeremy L Thompson CEED_EXTERN int  CeedTensorContractReferenceCopy(CeedTensorContract tensor, CeedTensorContract *tensor_copy);
372ec3da8bcSJed Brown CEED_EXTERN int  CeedTensorContractDestroy(CeedTensorContract *contract);
373ec3da8bcSJed Brown 
374509668d5SJeremy L Thompson CEED_EXTERN int CeedQFunctionRegister(const char *name, const char *source, CeedInt vec_length, CeedQFunctionUser f,
375509668d5SJeremy L Thompson                                       int (*init)(Ceed, const char *, CeedQFunction));
376ec3da8bcSJed Brown CEED_EXTERN int CeedQFunctionSetFortranStatus(CeedQFunction qf, bool status);
3772b730f8bSJeremy L Thompson CEED_EXTERN int CeedQFunctionGetVectorLength(CeedQFunction qf, CeedInt *vec_length);
3782b730f8bSJeremy L Thompson CEED_EXTERN int CeedQFunctionGetNumArgs(CeedQFunction qf, CeedInt *num_input_fields, CeedInt *num_output_fields);
3797d023984SJeremy L Thompson CEED_EXTERN int CeedQFunctionGetKernelName(CeedQFunction qf, const char **kernel_name);
380d3d5610dSJeremy L Thompson CEED_EXTERN int CeedQFunctionGetName(CeedQFunction qf, const char **name);
38134ffed21SJeremy L Thompson CEED_EXTERN int CeedQFunctionGetSourcePath(CeedQFunction qf, const char **source_path);
382f8d308faSJed Brown CEED_EXTERN int CeedQFunctionLoadSourceToBuffer(CeedQFunction qf, const char **source_buffer);
3832b730f8bSJeremy L Thompson CEED_EXTERN int CeedQFunctionGetUserFunction(CeedQFunction qf, CeedQFunctionUser *f);
3842b730f8bSJeremy L Thompson CEED_EXTERN int CeedQFunctionGetContext(CeedQFunction qf, CeedQFunctionContext *ctx);
385441428dfSJeremy L Thompson CEED_EXTERN int CeedQFunctionGetContextData(CeedQFunction qf, CeedMemType mem_type, void *data);
386441428dfSJeremy L Thompson CEED_EXTERN int CeedQFunctionRestoreContextData(CeedQFunction qf, void *data);
3872b730f8bSJeremy L Thompson CEED_EXTERN int CeedQFunctionGetInnerContext(CeedQFunction qf, CeedQFunctionContext *ctx);
388441428dfSJeremy L Thompson CEED_EXTERN int CeedQFunctionGetInnerContextData(CeedQFunction qf, CeedMemType mem_type, void *data);
389441428dfSJeremy L Thompson CEED_EXTERN int CeedQFunctionRestoreInnerContextData(CeedQFunction qf, void *data);
390d1d35e2fSjeremylt CEED_EXTERN int CeedQFunctionIsIdentity(CeedQFunction qf, bool *is_identity);
391441428dfSJeremy L Thompson CEED_EXTERN int CeedQFunctionIsContextWritable(CeedQFunction qf, bool *is_writable);
392ec3da8bcSJed Brown CEED_EXTERN int CeedQFunctionGetData(CeedQFunction qf, void *data);
393ec3da8bcSJed Brown CEED_EXTERN int CeedQFunctionSetData(CeedQFunction qf, void *data);
3941203703bSJeremy L Thompson CEED_EXTERN int CeedQFunctionIsImmutable(CeedQFunction qf, bool *is_immutable);
3951203703bSJeremy L Thompson CEED_EXTERN int CeedQFunctionSetImmutable(CeedQFunction qf);
3969560d06aSjeremylt CEED_EXTERN int CeedQFunctionReference(CeedQFunction qf);
3979d36ca50SJeremy L Thompson CEED_EXTERN int CeedQFunctionGetFlopsEstimate(CeedQFunction qf, CeedSize *flops);
398ec3da8bcSJed Brown 
3992b730f8bSJeremy L Thompson CEED_EXTERN int  CeedQFunctionContextGetCeed(CeedQFunctionContext ctx, Ceed *ceed);
4006e536b99SJeremy L Thompson CEED_EXTERN Ceed CeedQFunctionContextReturnCeed(CeedQFunctionContext ctx);
4012b730f8bSJeremy L Thompson CEED_EXTERN int  CeedQFunctionContextHasValidData(CeedQFunctionContext ctx, bool *has_valid_data);
4022b730f8bSJeremy L Thompson CEED_EXTERN int  CeedQFunctionContextHasBorrowedDataOfType(CeedQFunctionContext ctx, CeedMemType mem_type, bool *has_borrowed_data_of_type);
4032b730f8bSJeremy L Thompson CEED_EXTERN int  CeedQFunctionContextGetState(CeedQFunctionContext ctx, uint64_t *state);
4042b730f8bSJeremy L Thompson CEED_EXTERN int  CeedQFunctionContextGetBackendData(CeedQFunctionContext ctx, void *data);
4052b730f8bSJeremy L Thompson CEED_EXTERN int  CeedQFunctionContextSetBackendData(CeedQFunctionContext ctx, void *data);
4062b730f8bSJeremy L Thompson CEED_EXTERN int  CeedQFunctionContextGetFieldLabel(CeedQFunctionContext ctx, const char *field_name, CeedContextFieldLabel *field_label);
4072b730f8bSJeremy L Thompson CEED_EXTERN int  CeedQFunctionContextSetGeneric(CeedQFunctionContext ctx, CeedContextFieldLabel field_label, CeedContextFieldType field_type,
4082b730f8bSJeremy L Thompson                                                 void *value);
4092788fa27SJeremy L Thompson CEED_EXTERN int  CeedQFunctionContextGetGenericRead(CeedQFunctionContext ctx, CeedContextFieldLabel field_label, CeedContextFieldType field_type,
4102788fa27SJeremy L Thompson                                                     size_t *num_values, void *value);
4112788fa27SJeremy L Thompson CEED_EXTERN int  CeedQFunctionContextRestoreGenericRead(CeedQFunctionContext ctx, CeedContextFieldLabel field_label, CeedContextFieldType field_type,
4122788fa27SJeremy L Thompson                                                         void *value);
4132b730f8bSJeremy L Thompson CEED_EXTERN int  CeedQFunctionContextSetDouble(CeedQFunctionContext ctx, CeedContextFieldLabel field_label, double *values);
4142788fa27SJeremy L Thompson CEED_EXTERN int  CeedQFunctionContextGetDoubleRead(CeedQFunctionContext ctx, CeedContextFieldLabel field_label, size_t *num_values,
4152788fa27SJeremy L Thompson                                                    const double **values);
4162788fa27SJeremy L Thompson CEED_EXTERN int  CeedQFunctionContextRestoreDoubleRead(CeedQFunctionContext ctx, CeedContextFieldLabel field_label, const double **values);
41723dbfd29SJeremy L Thompson CEED_EXTERN int  CeedQFunctionContextSetInt32(CeedQFunctionContext ctx, CeedContextFieldLabel field_label, int32_t *values);
41823dbfd29SJeremy L Thompson CEED_EXTERN int  CeedQFunctionContextGetInt32Read(CeedQFunctionContext ctx, CeedContextFieldLabel field_label, size_t *num_values,
41923dbfd29SJeremy L Thompson                                                   const int32_t **values);
42023dbfd29SJeremy L Thompson CEED_EXTERN int  CeedQFunctionContextRestoreInt32Read(CeedQFunctionContext ctx, CeedContextFieldLabel field_label, const int32_t **values);
4215b6ec284SJeremy L Thompson CEED_EXTERN int  CeedQFunctionContextSetBoolean(CeedQFunctionContext ctx, CeedContextFieldLabel field_label, bool *values);
4225b6ec284SJeremy L Thompson CEED_EXTERN int  CeedQFunctionContextGetBooleanRead(CeedQFunctionContext ctx, CeedContextFieldLabel field_label, size_t *num_values,
4235b6ec284SJeremy L Thompson                                                     const bool **values);
4245b6ec284SJeremy L Thompson CEED_EXTERN int  CeedQFunctionContextRestoreBooleanRead(CeedQFunctionContext ctx, CeedContextFieldLabel field_label, const bool **values);
4252b730f8bSJeremy L Thompson CEED_EXTERN int  CeedQFunctionContextGetDataDestroy(CeedQFunctionContext ctx, CeedMemType *f_mem_type, CeedQFunctionContextDataDestroyUser *f);
4269560d06aSjeremylt CEED_EXTERN int  CeedQFunctionContextReference(CeedQFunctionContext ctx);
427ec3da8bcSJed Brown 
428004e4986SSebastian Grimberg CEED_EXTERN int CeedOperatorGetBasisPointer(CeedBasis basis, CeedEvalMode eval_mode, const CeedScalar *identity, const CeedScalar **basis_ptr);
429506b1a0cSSebastian Grimberg CEED_EXTERN int CeedOperatorCreateActivePointBlockRestriction(CeedElemRestriction rstr, CeedElemRestriction *pointblock_rstr);
4307d5185d7SSebastian Grimberg 
4317d5185d7SSebastian Grimberg CEED_EXTERN int CeedOperatorGetQFunctionAssemblyData(CeedOperator op, CeedQFunctionAssemblyData *data);
432480fae85SJeremy L Thompson CEED_EXTERN int CeedQFunctionAssemblyDataCreate(Ceed ceed, CeedQFunctionAssemblyData *data);
433480fae85SJeremy L Thompson CEED_EXTERN int CeedQFunctionAssemblyDataReference(CeedQFunctionAssemblyData data);
434beecbf24SJeremy L Thompson CEED_EXTERN int CeedQFunctionAssemblyDataSetReuse(CeedQFunctionAssemblyData data, bool reuse_assembly_data);
435beecbf24SJeremy L Thompson CEED_EXTERN int CeedQFunctionAssemblyDataSetUpdateNeeded(CeedQFunctionAssemblyData data, bool needs_data_update);
4368b919e6bSJeremy L Thompson CEED_EXTERN int CeedQFunctionAssemblyDataIsUpdateNeeded(CeedQFunctionAssemblyData data, bool *is_update_needed);
437480fae85SJeremy L Thompson CEED_EXTERN int CeedQFunctionAssemblyDataReferenceCopy(CeedQFunctionAssemblyData data, CeedQFunctionAssemblyData *data_copy);
438480fae85SJeremy L Thompson CEED_EXTERN int CeedQFunctionAssemblyDataIsSetup(CeedQFunctionAssemblyData data, bool *is_setup);
439480fae85SJeremy L Thompson CEED_EXTERN int CeedQFunctionAssemblyDataSetObjects(CeedQFunctionAssemblyData data, CeedVector vec, CeedElemRestriction rstr);
440480fae85SJeremy L Thompson CEED_EXTERN int CeedQFunctionAssemblyDataGetObjects(CeedQFunctionAssemblyData data, CeedVector *vec, CeedElemRestriction *rstr);
441480fae85SJeremy L Thompson CEED_EXTERN int CeedQFunctionAssemblyDataDestroy(CeedQFunctionAssemblyData *data);
442480fae85SJeremy L Thompson 
4437d5185d7SSebastian Grimberg CEED_EXTERN int CeedOperatorGetOperatorAssemblyData(CeedOperator op, CeedOperatorAssemblyData *data);
444ed9e99e6SJeremy L Thompson CEED_EXTERN int CeedOperatorAssemblyDataCreate(Ceed ceed, CeedOperator op, CeedOperatorAssemblyData *data);
445506b1a0cSSebastian Grimberg CEED_EXTERN int CeedOperatorAssemblyDataGetEvalModes(CeedOperatorAssemblyData data, CeedInt *num_active_bases_in, CeedInt **num_eval_modes_in,
446437c7c90SJeremy L Thompson                                                      const CeedEvalMode ***eval_modes_in, CeedSize ***eval_mode_offsets_in,
447506b1a0cSSebastian Grimberg                                                      CeedInt *num_active_bases_out, CeedInt **num_eval_modes_out,
448506b1a0cSSebastian Grimberg                                                      const CeedEvalMode ***eval_modes_out, CeedSize ***eval_mode_offsets_out,
449506b1a0cSSebastian Grimberg                                                      CeedSize *num_output_components);
450506b1a0cSSebastian Grimberg CEED_EXTERN int CeedOperatorAssemblyDataGetBases(CeedOperatorAssemblyData data, CeedInt *num_active_bases_in, CeedBasis **active_bases_in,
451506b1a0cSSebastian Grimberg                                                  const CeedScalar ***assembled_bases_in, CeedInt *num_active_bases_out, CeedBasis **active_bases_out,
452506b1a0cSSebastian Grimberg                                                  const CeedScalar ***assembled_bases_out);
453506b1a0cSSebastian Grimberg CEED_EXTERN int CeedOperatorAssemblyDataGetElemRestrictions(CeedOperatorAssemblyData data, CeedInt *num_active_elem_rstrs_in,
454506b1a0cSSebastian Grimberg                                                             CeedElemRestriction **active_elem_rstrs_in, CeedInt *num_active_elem_rstrs_out,
455506b1a0cSSebastian Grimberg                                                             CeedElemRestriction **active_elem_rstrs_out);
456ed9e99e6SJeremy L Thompson CEED_EXTERN int CeedOperatorAssemblyDataDestroy(CeedOperatorAssemblyData *data);
457ed9e99e6SJeremy L Thompson 
4582b730f8bSJeremy L Thompson CEED_EXTERN int CeedOperatorGetActiveBasis(CeedOperator op, CeedBasis *active_basis);
459506b1a0cSSebastian Grimberg CEED_EXTERN int CeedOperatorGetActiveBases(CeedOperator op, CeedBasis *active_input_basis, CeedBasis *active_output_basis);
460ed9e99e6SJeremy L Thompson CEED_EXTERN int CeedOperatorGetActiveElemRestriction(CeedOperator op, CeedElemRestriction *active_rstr);
461506b1a0cSSebastian Grimberg CEED_EXTERN int CeedOperatorGetActiveElemRestrictions(CeedOperator op, CeedElemRestriction *active_input_rstr,
462506b1a0cSSebastian Grimberg                                                       CeedElemRestriction *active_output_rstr);
463d1d35e2fSjeremylt CEED_EXTERN int CeedOperatorGetNumArgs(CeedOperator op, CeedInt *num_args);
4649463e855SJeremy L Thompson CEED_EXTERN int CeedOperatorHasTensorBases(CeedOperator op, bool *has_tensor_bases);
4651203703bSJeremy L Thompson CEED_EXTERN int CeedOperatorIsImmutable(CeedOperator op, bool *is_immutable);
466d1d35e2fSjeremylt CEED_EXTERN int CeedOperatorIsSetupDone(CeedOperator op, bool *is_setup_done);
467ec3da8bcSJed Brown CEED_EXTERN int CeedOperatorGetQFunction(CeedOperator op, CeedQFunction *qf);
468d1d35e2fSjeremylt CEED_EXTERN int CeedOperatorIsComposite(CeedOperator op, bool *is_composite);
469ec3da8bcSJed Brown CEED_EXTERN int CeedOperatorGetData(CeedOperator op, void *data);
470ec3da8bcSJed Brown CEED_EXTERN int CeedOperatorSetData(CeedOperator op, void *data);
4719560d06aSjeremylt CEED_EXTERN int CeedOperatorReference(CeedOperator op);
472bb229da9SJeremy L Thompson CEED_EXTERN int CeedOperatorGetFallback(CeedOperator op, CeedOperator *op_fallback);
473bb229da9SJeremy L Thompson CEED_EXTERN int CeedOperatorGetFallbackParent(CeedOperator op, CeedOperator *parent);
474bb229da9SJeremy L Thompson CEED_EXTERN int CeedOperatorGetFallbackParentCeed(CeedOperator op, Ceed *parent);
475ed094490SJeremy L Thompson CEED_EXTERN int CeedOperatorLinearAssembleQFunctionBuildOrUpdateFallback(CeedOperator op, CeedVector *assembled, CeedElemRestriction *rstr,
4760816752eSJeremy L Thompson                                                                          CeedRequest *request);
477ed094490SJeremy L Thompson CEED_INTERN int CeedOperatorAssembleSingle(CeedOperator op, CeedInt offset, CeedVector values);
478ec3da8bcSJed Brown CEED_EXTERN int CeedOperatorSetSetupDone(CeedOperator op);
479ec3da8bcSJed Brown 
4802b730f8bSJeremy L Thompson CEED_INTERN int CeedMatrixMatrixMultiply(Ceed ceed, const CeedScalar *mat_A, const CeedScalar *mat_B, CeedScalar *mat_C, CeedInt m, CeedInt n,
4812b730f8bSJeremy L Thompson                                          CeedInt kk);
482ba59ac12SSebastian Grimberg CEED_EXTERN int CeedQRFactorization(Ceed ceed, CeedScalar *mat, CeedScalar *tau, CeedInt m, CeedInt n);
483ba59ac12SSebastian Grimberg CEED_EXTERN int CeedHouseholderApplyQ(CeedScalar *mat_A, const CeedScalar *mat_Q, const CeedScalar *tau, CeedTransposeMode t_mode, CeedInt m,
484ba59ac12SSebastian Grimberg                                       CeedInt n, CeedInt k, CeedInt row, CeedInt col);
4851203703bSJeremy L Thompson CEED_EXTERN int CeedMatrixPseudoinverse(Ceed ceed, const CeedScalar *mat, CeedInt m, CeedInt n, CeedScalar *mat_pinv);
486ba59ac12SSebastian Grimberg CEED_EXTERN int CeedSymmetricSchurDecomposition(Ceed ceed, CeedScalar *mat, CeedScalar *lambda, CeedInt n);
487ba59ac12SSebastian Grimberg CEED_EXTERN int CeedSimultaneousDiagonalization(Ceed ceed, CeedScalar *mat_A, CeedScalar *mat_B, CeedScalar *x, CeedScalar *lambda, CeedInt n);
488