1ea61e9acSJeremy L Thompson /// Copyright (c) 2017-2022, Lawrence Livermore National Security, LLC and other CEED contributors. 2ea61e9acSJeremy L Thompson /// All Rights Reserved. See the top-level LICENSE and NOTICE files for details. 3ec3da8bcSJed Brown /// 4ea61e9acSJeremy L Thompson /// SPDX-License-Identifier: BSD-2-Clause 5ec3da8bcSJed Brown /// 6ea61e9acSJeremy L Thompson /// This file is part of CEED: http://github.com/ceed 7ec3da8bcSJed Brown 8ec3da8bcSJed Brown /// @file 9ec3da8bcSJed Brown /// Public header for user and utility components of libCEED 1094b7b29bSJeremy L Thompson #ifndef CEED_H 1194b7b29bSJeremy L Thompson #define CEED_H 12ec3da8bcSJed Brown 13ec3da8bcSJed Brown /// @defgroup Ceed Ceed: core components 14ec3da8bcSJed Brown /// @defgroup CeedVector CeedVector: storing and manipulating vectors 15ec3da8bcSJed Brown /// @defgroup CeedElemRestriction CeedElemRestriction: restriction from local vectors to elements 16ec3da8bcSJed Brown /// @defgroup CeedBasis CeedBasis: fully discrete finite element-like objects 17ec3da8bcSJed Brown /// @defgroup CeedQFunction CeedQFunction: independent operations at quadrature points 18ec3da8bcSJed Brown /// @defgroup CeedOperator CeedOperator: composed FE-type operations on vectors 19ec3da8bcSJed Brown /// 20ea61e9acSJeremy L Thompson /// @page FunctionCategories libCEED: Types of Functions libCEED provides three different header files depending upon the type of functions a user 21ea61e9acSJeremy L Thompson /// requires. 22ec3da8bcSJed Brown /// @section Utility Utility Functions 23ea61e9acSJeremy L Thompson /// These functions are intended general utilities that may be useful to libCEED developers and users. 24ea61e9acSJeremy L Thompson /// These functions can generally be found in "ceed.h". 25ec3da8bcSJed Brown /// @section User User Functions 26ea61e9acSJeremy L Thompson /// These functions are intended to be used by general users of libCEED and can generally be found in "ceed.h". 27e9b533fbSJeremy L Thompson /// @section Advanced Advanced Functions 28ea61e9acSJeremy L Thompson /// These functions are intended to be used by advanced users of libCEED and can generally be found in "ceed.h". 29ec3da8bcSJed Brown /// @section Backend Backend Developer Functions 30ea61e9acSJeremy L Thompson /// These functions are intended to be used by backend developers of libCEED and can generally be found in "ceed-backend.h". 31ec3da8bcSJed Brown /// @section Developer Library Developer Functions 32ea61e9acSJeremy L Thompson /// These functions are intended to be used by library developers of libCEED and can generally be found in "ceed-impl.h". 33ec3da8bcSJed Brown 343b271f31SJed Brown #if !defined(CEED_SKIP_VISIBILITY) 353b271f31SJed Brown #define CEED_VISIBILITY(mode) __attribute__((visibility(#mode))) 363b271f31SJed Brown #else 373b271f31SJed Brown #define CEED_VISIBILITY(mode) 383b271f31SJed Brown #endif 393b271f31SJed Brown 40ec3da8bcSJed Brown /** 41ec3da8bcSJed Brown CEED_EXTERN is used in this header to denote all publicly visible symbols. 42ec3da8bcSJed Brown 43ea61e9acSJeremy L Thompson No other file should declare publicly visible symbols, thus it should never be used outside ceed.h. 44ec3da8bcSJed Brown */ 452b730f8bSJeremy L Thompson #if defined(__clang_analyzer__) 462b730f8bSJeremy L Thompson #define CEED_EXTERN extern 472b730f8bSJeremy L Thompson #elif defined(__cplusplus) 483b271f31SJed Brown #define CEED_EXTERN extern "C" CEED_VISIBILITY(default) 49ec3da8bcSJed Brown #else 503b271f31SJed Brown #define CEED_EXTERN extern CEED_VISIBILITY(default) 51ec3da8bcSJed Brown #endif 52ec3da8bcSJed Brown 53ec3da8bcSJed Brown #include <stdarg.h> 54ec3da8bcSJed Brown #include <stdbool.h> 553047f789SJeremy L Thompson #include <stdio.h> 56ec3da8bcSJed Brown 57c9c2c079SJeremy L Thompson /// Typedefs and macros used in public interfaces and user QFunction source 5849aac155SJeremy L Thompson #include "types.h" // IWYU pragma: export 5949aac155SJeremy L Thompson /// This line prevents IWYU from suggesting "ceed.h" 6049aac155SJeremy L Thompson // IWYU pragma: private, include <ceed.h> 61ec3da8bcSJed Brown 62ec3da8bcSJed Brown /// Library context created by CeedInit() 63ec3da8bcSJed Brown /// @ingroup CeedUser 64ec3da8bcSJed Brown typedef struct Ceed_private *Ceed; 65ec3da8bcSJed Brown /// Non-blocking Ceed interfaces return a CeedRequest. 66ec3da8bcSJed Brown /// To perform an operation immediately, pass \ref CEED_REQUEST_IMMEDIATE instead. 67ec3da8bcSJed Brown /// @ingroup CeedUser 68ec3da8bcSJed Brown typedef struct CeedRequest_private *CeedRequest; 69ec3da8bcSJed Brown /// Handle for vectors over the field \ref CeedScalar 70ec3da8bcSJed Brown /// @ingroup CeedVectorUser 71ec3da8bcSJed Brown typedef struct CeedVector_private *CeedVector; 72ec3da8bcSJed Brown /// Handle for object describing restriction to elements 73ec3da8bcSJed Brown /// @ingroup CeedElemRestrictionUser 74ec3da8bcSJed Brown typedef struct CeedElemRestriction_private *CeedElemRestriction; 75ec3da8bcSJed Brown /// Handle for object describing discrete finite element evaluations 76ec3da8bcSJed Brown /// @ingroup CeedBasisUser 77ec3da8bcSJed Brown typedef struct CeedBasis_private *CeedBasis; 7843bbe138SJeremy L Thompson /// Handle for object describing CeedQFunction fields 7943bbe138SJeremy L Thompson /// @ingroup CeedQFunctionBackend 8043bbe138SJeremy L Thompson typedef struct CeedQFunctionField_private *CeedQFunctionField; 81ec3da8bcSJed Brown /// Handle for object describing functions evaluated independently at quadrature points 82ec3da8bcSJed Brown /// @ingroup CeedQFunctionUser 83ec3da8bcSJed Brown typedef struct CeedQFunction_private *CeedQFunction; 8443bbe138SJeremy L Thompson /// Handle for object describing CeedOperator fields 8543bbe138SJeremy L Thompson /// @ingroup CeedOperatorBackend 8643bbe138SJeremy L Thompson typedef struct CeedOperatorField_private *CeedOperatorField; 87ec3da8bcSJed Brown /// Handle for object describing context data for CeedQFunctions 88ec3da8bcSJed Brown /// @ingroup CeedQFunctionUser 89ec3da8bcSJed Brown typedef struct CeedQFunctionContext_private *CeedQFunctionContext; 903668ca4bSJeremy L Thompson /// Handle for object describing registered fields for CeedQFunctionContext 913668ca4bSJeremy L Thompson /// @ingroup CeedQFunctionUser 923668ca4bSJeremy L Thompson typedef struct CeedContextFieldLabel_private *CeedContextFieldLabel; 93ec3da8bcSJed Brown /// Handle for object describing FE-type operators acting on vectors 94ec3da8bcSJed Brown /// 95859c15bbSJames Wright /// Given an element restriction \f$E\f$, basis evaluator \f$B\f$, and quadrature function\f$f\f$, a CeedOperator expresses operations of the form 96859c15bbSJames Wright /// \f$E^T B^T f(B E u)\f$ acting on the vector \f$u\f$. 97ec3da8bcSJed Brown /// @ingroup CeedOperatorUser 98ec3da8bcSJed Brown typedef struct CeedOperator_private *CeedOperator; 99ec3da8bcSJed Brown 10022e44211Sjeremylt CEED_EXTERN int CeedRegistryGetList(size_t *n, char ***const resources, CeedInt **array); 101ec3da8bcSJed Brown CEED_EXTERN int CeedInit(const char *resource, Ceed *ceed); 1025ae360d4SJeremy L Thompson CEED_EXTERN int CeedSetStream(Ceed ceed, void *handle); 1039560d06aSjeremylt CEED_EXTERN int CeedReferenceCopy(Ceed ceed, Ceed *ceed_copy); 104ec3da8bcSJed Brown CEED_EXTERN int CeedGetResource(Ceed ceed, const char **resource); 105d1d35e2fSjeremylt CEED_EXTERN int CeedIsDeterministic(Ceed ceed, bool *is_deterministic); 106ee5a26f2SJeremy L Thompson CEED_EXTERN int CeedAddJitSourceRoot(Ceed ceed, const char *jit_source_root); 107ec3da8bcSJed Brown CEED_EXTERN int CeedView(Ceed ceed, FILE *stream); 108ec3da8bcSJed Brown CEED_EXTERN int CeedDestroy(Ceed *ceed); 109ec3da8bcSJed Brown 1102b730f8bSJeremy L Thompson CEED_EXTERN int CeedErrorImpl(Ceed, const char *, int, const char *, int, const char *, ...); 111ec3da8bcSJed Brown /// Raise an error on ceed object 112ec3da8bcSJed Brown /// 113ec3da8bcSJed Brown /// @param ceed Ceed library context or NULL 114ec3da8bcSJed Brown /// @param ecode Error code (int) 115ec3da8bcSJed Brown /// @param ... printf-style format string followed by arguments as needed 116ec3da8bcSJed Brown /// 117ec3da8bcSJed Brown /// @ingroup Ceed 118ec3da8bcSJed Brown /// @sa CeedSetErrorHandler() 1192b730f8bSJeremy L Thompson #define CeedError(ceed, ecode, ...) (CeedErrorImpl((ceed), __FILE__, __LINE__, __func__, (ecode), __VA_ARGS__), (ecode)) 120ec3da8bcSJed Brown 121ec3da8bcSJed Brown /// Ceed error handlers 1222b730f8bSJeremy L Thompson CEED_EXTERN int CeedErrorReturn(Ceed, const char *, int, const char *, int, const char *, va_list *); 1232b730f8bSJeremy L Thompson CEED_EXTERN int CeedErrorStore(Ceed, const char *, int, const char *, int, const char *, va_list *); 1242b730f8bSJeremy L Thompson CEED_EXTERN int CeedErrorAbort(Ceed, const char *, int, const char *, int, const char *, va_list *); 1252b730f8bSJeremy L Thompson CEED_EXTERN int CeedErrorExit(Ceed, const char *, int, const char *, int, const char *, va_list *); 1262b730f8bSJeremy L Thompson typedef int (*CeedErrorHandler)(Ceed, const char *, int, const char *, int, const char *, va_list *); 127ec3da8bcSJed Brown CEED_EXTERN int CeedSetErrorHandler(Ceed ceed, CeedErrorHandler eh); 128d1d35e2fSjeremylt CEED_EXTERN int CeedGetErrorMessage(Ceed, const char **err_msg); 129d1d35e2fSjeremylt CEED_EXTERN int CeedResetErrorMessage(Ceed, const char **err_msg); 130ec3da8bcSJed Brown 131ec3da8bcSJed Brown /// libCEED library version numbering 132ec3da8bcSJed Brown /// @ingroup Ceed 133ec3da8bcSJed Brown #define CEED_VERSION_MAJOR 0 1348ec64e9aSJed Brown #define CEED_VERSION_MINOR 11 1358ec64e9aSJed Brown #define CEED_VERSION_PATCH 0 136d5780308SJeremy L Thompson #define CEED_VERSION_RELEASE false 137ec3da8bcSJed Brown 138ea61e9acSJeremy L Thompson /// Compile-time check that the the current library version is at least as recent as the specified version. 139ea61e9acSJeremy L Thompson /// This macro is typically used in 140ec3da8bcSJed Brown /// @code 141ec3da8bcSJed Brown /// #if CEED_VERSION_GE(0, 8, 0) 142ec3da8bcSJed Brown /// code path that needs at least 0.8.0 143ec3da8bcSJed Brown /// #else 144ec3da8bcSJed Brown /// fallback code for older versions 145ec3da8bcSJed Brown /// #endif 146ec3da8bcSJed Brown /// @endcode 147ec3da8bcSJed Brown /// 148ec3da8bcSJed Brown /// A non-release version always compares as positive infinity. 149ec3da8bcSJed Brown /// 150ec3da8bcSJed Brown /// @param major Major version 151ec3da8bcSJed Brown /// @param minor Minor version 152ec3da8bcSJed Brown /// @param patch Patch (subminor) version 153ec3da8bcSJed Brown /// 154ec3da8bcSJed Brown /// @ingroup Ceed 155ec3da8bcSJed Brown /// @sa CeedGetVersion() 156ec3da8bcSJed Brown #define CEED_VERSION_GE(major, minor, patch) \ 157ec3da8bcSJed Brown (!CEED_VERSION_RELEASE || \ 158ec3da8bcSJed Brown (CEED_VERSION_MAJOR > major || \ 1592b730f8bSJeremy L Thompson (CEED_VERSION_MAJOR == major && (CEED_VERSION_MINOR > minor || (CEED_VERSION_MINOR == minor && CEED_VERSION_PATCH >= patch))))) 160ec3da8bcSJed Brown 1612b730f8bSJeremy L Thompson CEED_EXTERN int CeedGetVersion(int *major, int *minor, int *patch, bool *release); 162ec3da8bcSJed Brown 16380a9ef05SNatalie Beams CEED_EXTERN int CeedGetScalarType(CeedScalarType *scalar_type); 16480a9ef05SNatalie Beams 1659bd0a4deSJeremy L Thompson /// String names for enum pretty printing 166ec3da8bcSJed Brown CEED_EXTERN const char *const *CeedErrorTypes; 167ec3da8bcSJed Brown CEED_EXTERN const char *const CeedMemTypes[]; 1689bd0a4deSJeremy L Thompson CEED_EXTERN const char *const CeedCopyModes[]; 1699bd0a4deSJeremy L Thompson CEED_EXTERN const char *const CeedTransposeModes[]; 1709bd0a4deSJeremy L Thompson CEED_EXTERN const char *const CeedEvalModes[]; 1719bd0a4deSJeremy L Thompson CEED_EXTERN const char *const CeedQuadModes[]; 1729bd0a4deSJeremy L Thompson CEED_EXTERN const char *const CeedElemTopologies[]; 1739bd0a4deSJeremy L Thompson CEED_EXTERN const char *const CeedContextFieldTypes[]; 174ec3da8bcSJed Brown 175ec3da8bcSJed Brown CEED_EXTERN int CeedGetPreferredMemType(Ceed ceed, CeedMemType *type); 176ec3da8bcSJed Brown 1771f9221feSJeremy L Thompson CEED_EXTERN int CeedVectorCreate(Ceed ceed, CeedSize len, CeedVector *vec); 1789560d06aSjeremylt CEED_EXTERN int CeedVectorReferenceCopy(CeedVector vec, CeedVector *vec_copy); 1795fb68f37SKaren (Ren) Stengel CEED_EXTERN int CeedVectorCopy(CeedVector vec, CeedVector vec_copy); 1802b730f8bSJeremy L Thompson CEED_EXTERN int CeedVectorSetArray(CeedVector vec, CeedMemType mem_type, CeedCopyMode copy_mode, CeedScalar *array); 181ec3da8bcSJed Brown CEED_EXTERN int CeedVectorSetValue(CeedVector vec, CeedScalar value); 182d1d35e2fSjeremylt CEED_EXTERN int CeedVectorSyncArray(CeedVector vec, CeedMemType mem_type); 1832b730f8bSJeremy L Thompson CEED_EXTERN int CeedVectorTakeArray(CeedVector vec, CeedMemType mem_type, CeedScalar **array); 1842b730f8bSJeremy L Thompson CEED_EXTERN int CeedVectorGetArray(CeedVector vec, CeedMemType mem_type, CeedScalar **array); 1852b730f8bSJeremy L Thompson CEED_EXTERN int CeedVectorGetArrayRead(CeedVector vec, CeedMemType mem_type, const CeedScalar **array); 1862b730f8bSJeremy L Thompson CEED_EXTERN int CeedVectorGetArrayWrite(CeedVector vec, CeedMemType mem_type, CeedScalar **array); 187ec3da8bcSJed Brown CEED_EXTERN int CeedVectorRestoreArray(CeedVector vec, CeedScalar **array); 1882b730f8bSJeremy L Thompson CEED_EXTERN int CeedVectorRestoreArrayRead(CeedVector vec, const CeedScalar **array); 1892b730f8bSJeremy L Thompson CEED_EXTERN int CeedVectorNorm(CeedVector vec, CeedNormType type, CeedScalar *norm); 190e0dd3b27Sjeremylt CEED_EXTERN int CeedVectorScale(CeedVector x, CeedScalar alpha); 1910f7fd0f8Sjeremylt CEED_EXTERN int CeedVectorAXPY(CeedVector y, CeedScalar alpha, CeedVector x); 1925fb68f37SKaren (Ren) Stengel CEED_EXTERN int CeedVectorAXPBY(CeedVector y, CeedScalar alpha, CeedScalar beta, CeedVector x); 1930f7fd0f8Sjeremylt CEED_EXTERN int CeedVectorPointwiseMult(CeedVector w, CeedVector x, CeedVector y); 194ec3da8bcSJed Brown CEED_EXTERN int CeedVectorReciprocal(CeedVector vec); 195acb2c48cSJeremy L Thompson CEED_EXTERN int CeedVectorViewRange(CeedVector vec, CeedSize start, CeedSize stop, CeedInt step, const char *fp_fmt, FILE *stream); 196d1d35e2fSjeremylt CEED_EXTERN int CeedVectorView(CeedVector vec, const char *fp_fmt, FILE *stream); 197b7c9bbdaSJeremy L Thompson CEED_EXTERN int CeedVectorGetCeed(CeedVector vec, Ceed *ceed); 1981f9221feSJeremy L Thompson CEED_EXTERN int CeedVectorGetLength(CeedVector vec, CeedSize *length); 199ec3da8bcSJed Brown CEED_EXTERN int CeedVectorDestroy(CeedVector *vec); 200ec3da8bcSJed Brown 201ec3da8bcSJed Brown CEED_EXTERN CeedRequest *const CEED_REQUEST_IMMEDIATE; 202ec3da8bcSJed Brown CEED_EXTERN CeedRequest *const CEED_REQUEST_ORDERED; 203ec3da8bcSJed Brown CEED_EXTERN int CeedRequestWait(CeedRequest *req); 204ec3da8bcSJed Brown 205356036faSJeremy L Thompson /// Argument for CeedOperatorSetField to use active input or output. 206ec3da8bcSJed Brown /// @ingroup CeedVector 207ec3da8bcSJed Brown CEED_EXTERN const CeedVector CEED_VECTOR_ACTIVE; 208ec3da8bcSJed Brown 209356036faSJeremy L Thompson /// Argument for CeedOperatorSetField to use no vector. 210356036faSJeremy L Thompson /// Only use this option with CeedEvalMode CEED_EVAL_WEIGHT. 211ec3da8bcSJed Brown /// @ingroup CeedVector 212ec3da8bcSJed Brown CEED_EXTERN const CeedVector CEED_VECTOR_NONE; 213ec3da8bcSJed Brown 214356036faSJeremy L Thompson /// Argument for CeedOperatorSetField that no basis operation is needed to translate between the E-vector and the Q-vector. 215356036faSJeremy L Thompson /// Only use this option with CeedEvalMode CEED_EVAL_NONE. 216356036faSJeremy L Thompson /// @ingroup CeedBasis 217356036faSJeremy L Thompson CEED_EXTERN const CeedBasis CEED_BASIS_NONE; 218356036faSJeremy L Thompson 219056ec191SJames Wright CEED_EXTERN const CeedBasis CEED_BASIS_COLLOCATED; 220056ec191SJames Wright 221356036faSJeremy L Thompson /// Argument for CeedOperatorSetField to use no ElemRestriction. 222356036faSJeremy L Thompson /// Only use this option with CeedEvalMode CEED_EVAL_WEIGHT. 223ec3da8bcSJed Brown /// @ingroup CeedElemRestriction 224ec3da8bcSJed Brown CEED_EXTERN const CeedElemRestriction CEED_ELEMRESTRICTION_NONE; 225ec3da8bcSJed Brown 226ec3da8bcSJed Brown /// Argument for CeedOperatorCreate that QFunction is not created by user. 227ea61e9acSJeremy L Thompson /// Only used for QFunctions dqf and dqfT. 228ea61e9acSJeremy L Thompson /// If implemented, a backend may attempt to provide the action of these QFunctions. 229ec3da8bcSJed Brown /// @ingroup CeedQFunction 230ec3da8bcSJed Brown CEED_EXTERN const CeedQFunction CEED_QFUNCTION_NONE; 231ec3da8bcSJed Brown 232ea61e9acSJeremy L Thompson /// Argument for CeedElemRestrictionCreateStrided that L-vector is in the Ceed backend's preferred layout. 233ea61e9acSJeremy L Thompson /// This argument should only be used with vectors created by a Ceed backend. 234ec3da8bcSJed Brown /// @ingroup CeedElemRestriction 235ec3da8bcSJed Brown CEED_EXTERN const CeedInt CEED_STRIDES_BACKEND[3]; 236ec3da8bcSJed Brown 2372b730f8bSJeremy L Thompson CEED_EXTERN int CeedElemRestrictionCreate(Ceed ceed, CeedInt num_elem, CeedInt elem_size, CeedInt num_comp, CeedInt comp_stride, CeedSize l_size, 2382b730f8bSJeremy L Thompson CeedMemType mem_type, CeedCopyMode copy_mode, const CeedInt *offsets, CeedElemRestriction *rstr); 2392b730f8bSJeremy L Thompson CEED_EXTERN int CeedElemRestrictionCreateOriented(Ceed ceed, CeedInt num_elem, CeedInt elem_size, CeedInt num_comp, CeedInt comp_stride, 2402b730f8bSJeremy L Thompson CeedSize l_size, CeedMemType mem_type, CeedCopyMode copy_mode, const CeedInt *offsets, 24177d1c127SSebastian Grimberg const bool *orients, CeedElemRestriction *rstr); 24277d1c127SSebastian Grimberg CEED_EXTERN int CeedElemRestrictionCreateCurlOriented(Ceed ceed, CeedInt num_elem, CeedInt elem_size, CeedInt num_comp, CeedInt comp_stride, 24377d1c127SSebastian Grimberg CeedSize l_size, CeedMemType mem_type, CeedCopyMode copy_mode, const CeedInt *offsets, 2440c73c039SSebastian Grimberg const CeedInt8 *curl_orients, CeedElemRestriction *rstr); 2452b730f8bSJeremy L Thompson CEED_EXTERN int CeedElemRestrictionCreateStrided(Ceed ceed, CeedInt num_elem, CeedInt elem_size, CeedInt num_comp, CeedSize l_size, 246ec3da8bcSJed Brown const CeedInt strides[3], CeedElemRestriction *rstr); 247e7f679fcSJeremy L Thompson CEED_EXTERN int CeedElemRestrictionCreateBlocked(Ceed ceed, CeedInt num_elem, CeedInt elem_size, CeedInt block_size, CeedInt num_comp, 2482b730f8bSJeremy L Thompson CeedInt comp_stride, CeedSize l_size, CeedMemType mem_type, CeedCopyMode copy_mode, 249ec3da8bcSJed Brown const CeedInt *offsets, CeedElemRestriction *rstr); 250e7f679fcSJeremy L Thompson CEED_EXTERN int CeedElemRestrictionCreateBlockedOriented(Ceed ceed, CeedInt num_elem, CeedInt elem_size, CeedInt block_size, CeedInt num_comp, 25177d1c127SSebastian Grimberg CeedInt comp_stride, CeedSize l_size, CeedMemType mem_type, CeedCopyMode copy_mode, 25277d1c127SSebastian Grimberg const CeedInt *offsets, const bool *orients, CeedElemRestriction *rstr); 253e7f679fcSJeremy L Thompson CEED_EXTERN int CeedElemRestrictionCreateBlockedCurlOriented(Ceed ceed, CeedInt num_elem, CeedInt elem_size, CeedInt block_size, CeedInt num_comp, 25477d1c127SSebastian Grimberg CeedInt comp_stride, CeedSize l_size, CeedMemType mem_type, CeedCopyMode copy_mode, 2550c73c039SSebastian Grimberg const CeedInt *offsets, const CeedInt8 *curl_orients, CeedElemRestriction *rstr); 256e7f679fcSJeremy L Thompson CEED_EXTERN int CeedElemRestrictionCreateBlockedStrided(Ceed ceed, CeedInt num_elem, CeedInt elem_size, CeedInt block_size, CeedInt num_comp, 257e79b91d9SJeremy L Thompson CeedSize l_size, const CeedInt strides[3], CeedElemRestriction *rstr); 258c17ec2beSJeremy L Thompson CEED_EXTERN int CeedElemRestrictionCreateUnsignedCopy(CeedElemRestriction rstr, CeedElemRestriction *rstr_unsigned); 2597c1dbaffSSebastian Grimberg CEED_EXTERN int CeedElemRestrictionCreateUnorientedCopy(CeedElemRestriction rstr, CeedElemRestriction *rstr_unoriented); 2602b730f8bSJeremy L Thompson CEED_EXTERN int CeedElemRestrictionReferenceCopy(CeedElemRestriction rstr, CeedElemRestriction *rstr_copy); 2612b730f8bSJeremy L Thompson CEED_EXTERN int CeedElemRestrictionCreateVector(CeedElemRestriction rstr, CeedVector *lvec, CeedVector *evec); 2622b730f8bSJeremy L Thompson CEED_EXTERN int CeedElemRestrictionApply(CeedElemRestriction rstr, CeedTransposeMode t_mode, CeedVector u, CeedVector ru, CeedRequest *request); 2632b730f8bSJeremy L Thompson CEED_EXTERN int CeedElemRestrictionApplyBlock(CeedElemRestriction rstr, CeedInt block, CeedTransposeMode t_mode, CeedVector u, CeedVector ru, 264ec3da8bcSJed Brown CeedRequest *request); 2652b730f8bSJeremy L Thompson CEED_EXTERN int CeedElemRestrictionGetCeed(CeedElemRestriction rstr, Ceed *ceed); 2662b730f8bSJeremy L Thompson CEED_EXTERN int CeedElemRestrictionGetCompStride(CeedElemRestriction rstr, CeedInt *comp_stride); 2672b730f8bSJeremy L Thompson CEED_EXTERN int CeedElemRestrictionGetNumElements(CeedElemRestriction rstr, CeedInt *num_elem); 2682b730f8bSJeremy L Thompson CEED_EXTERN int CeedElemRestrictionGetElementSize(CeedElemRestriction rstr, CeedInt *elem_size); 2692b730f8bSJeremy L Thompson CEED_EXTERN int CeedElemRestrictionGetLVectorSize(CeedElemRestriction rstr, CeedSize *l_size); 2702b730f8bSJeremy L Thompson CEED_EXTERN int CeedElemRestrictionGetNumComponents(CeedElemRestriction rstr, CeedInt *num_comp); 271e7f679fcSJeremy L Thompson CEED_EXTERN int CeedElemRestrictionGetNumBlocks(CeedElemRestriction rstr, CeedInt *num_block); 272e7f679fcSJeremy L Thompson CEED_EXTERN int CeedElemRestrictionGetBlockSize(CeedElemRestriction rstr, CeedInt *block_size); 2732b730f8bSJeremy L Thompson CEED_EXTERN int CeedElemRestrictionGetMultiplicity(CeedElemRestriction rstr, CeedVector mult); 274ec3da8bcSJed Brown CEED_EXTERN int CeedElemRestrictionView(CeedElemRestriction rstr, FILE *stream); 275ec3da8bcSJed Brown CEED_EXTERN int CeedElemRestrictionDestroy(CeedElemRestriction *rstr); 276ec3da8bcSJed Brown 277ec3da8bcSJed Brown // The formalism here is that we have the structure 278ec3da8bcSJed Brown // \int_\Omega v^T f_0(u, \nabla u, qdata) + (\nabla v)^T f_1(u, \nabla u, qdata) 279ec3da8bcSJed Brown // where gradients are with respect to the reference element. 280ec3da8bcSJed Brown 2812b730f8bSJeremy L Thompson CEED_EXTERN int CeedBasisCreateTensorH1Lagrange(Ceed ceed, CeedInt dim, CeedInt num_comp, CeedInt P, CeedInt Q, CeedQuadMode quad_mode, 282ec3da8bcSJed Brown CeedBasis *basis); 2832b730f8bSJeremy L Thompson CEED_EXTERN int CeedBasisCreateTensorH1(Ceed ceed, CeedInt dim, CeedInt num_comp, CeedInt P_1d, CeedInt Q_1d, const CeedScalar *interp_1d, 2842b730f8bSJeremy L Thompson const CeedScalar *grad_1d, const CeedScalar *q_ref_1d, const CeedScalar *q_weight_1d, CeedBasis *basis); 2852b730f8bSJeremy L Thompson CEED_EXTERN int CeedBasisCreateH1(Ceed ceed, CeedElemTopology topo, CeedInt num_comp, CeedInt num_nodes, CeedInt nqpts, const CeedScalar *interp, 2862b730f8bSJeremy L Thompson const CeedScalar *grad, const CeedScalar *q_ref, const CeedScalar *q_weights, CeedBasis *basis); 2872b730f8bSJeremy L Thompson CEED_EXTERN int CeedBasisCreateHdiv(Ceed ceed, CeedElemTopology topo, CeedInt num_comp, CeedInt num_nodes, CeedInt nqpts, const CeedScalar *interp, 2882b730f8bSJeremy L Thompson const CeedScalar *div, const CeedScalar *q_ref, const CeedScalar *q_weights, CeedBasis *basis); 289c4e3f59bSSebastian Grimberg CEED_EXTERN int CeedBasisCreateHcurl(Ceed ceed, CeedElemTopology topo, CeedInt num_comp, CeedInt num_nodes, CeedInt nqpts, const CeedScalar *interp, 290c4e3f59bSSebastian Grimberg const CeedScalar *curl, const CeedScalar *q_ref, const CeedScalar *q_weights, CeedBasis *basis); 291446e7af4SJeremy L Thompson CEED_EXTERN int CeedBasisCreateProjection(CeedBasis basis_from, CeedBasis basis_to, CeedBasis *basis_project); 2929560d06aSjeremylt CEED_EXTERN int CeedBasisReferenceCopy(CeedBasis basis, CeedBasis *basis_copy); 293ec3da8bcSJed Brown CEED_EXTERN int CeedBasisView(CeedBasis basis, FILE *stream); 2942b730f8bSJeremy L Thompson CEED_EXTERN int CeedBasisApply(CeedBasis basis, CeedInt num_elem, CeedTransposeMode t_mode, CeedEvalMode eval_mode, CeedVector u, CeedVector v); 295c8c3fa7dSJeremy L Thompson CEED_EXTERN int CeedBasisApplyAtPoints(CeedBasis basis, CeedInt num_points, CeedTransposeMode t_mode, CeedEvalMode eval_mode, CeedVector x_ref, 296c8c3fa7dSJeremy L Thompson CeedVector u, CeedVector v); 297b7c9bbdaSJeremy L Thompson CEED_EXTERN int CeedBasisGetCeed(CeedBasis basis, Ceed *ceed); 298ec3da8bcSJed Brown CEED_EXTERN int CeedBasisGetDimension(CeedBasis basis, CeedInt *dim); 299ec3da8bcSJed Brown CEED_EXTERN int CeedBasisGetTopology(CeedBasis basis, CeedElemTopology *topo); 300d1d35e2fSjeremylt CEED_EXTERN int CeedBasisGetNumComponents(CeedBasis basis, CeedInt *num_comp); 301ec3da8bcSJed Brown CEED_EXTERN int CeedBasisGetNumNodes(CeedBasis basis, CeedInt *P); 302d1d35e2fSjeremylt CEED_EXTERN int CeedBasisGetNumNodes1D(CeedBasis basis, CeedInt *P_1d); 303ec3da8bcSJed Brown CEED_EXTERN int CeedBasisGetNumQuadraturePoints(CeedBasis basis, CeedInt *Q); 3042b730f8bSJeremy L Thompson CEED_EXTERN int CeedBasisGetNumQuadraturePoints1D(CeedBasis basis, CeedInt *Q_1d); 305d1d35e2fSjeremylt CEED_EXTERN int CeedBasisGetQRef(CeedBasis basis, const CeedScalar **q_ref); 3062b730f8bSJeremy L Thompson CEED_EXTERN int CeedBasisGetQWeights(CeedBasis basis, const CeedScalar **q_weights); 307ec3da8bcSJed Brown CEED_EXTERN int CeedBasisGetInterp(CeedBasis basis, const CeedScalar **interp); 3082b730f8bSJeremy L Thompson CEED_EXTERN int CeedBasisGetInterp1D(CeedBasis basis, const CeedScalar **interp_1d); 309ec3da8bcSJed Brown CEED_EXTERN int CeedBasisGetGrad(CeedBasis basis, const CeedScalar **grad); 310d1d35e2fSjeremylt CEED_EXTERN int CeedBasisGetGrad1D(CeedBasis basis, const CeedScalar **grad_1d); 31150c301a5SRezgar Shakeri CEED_EXTERN int CeedBasisGetDiv(CeedBasis basis, const CeedScalar **div); 312c4e3f59bSSebastian Grimberg CEED_EXTERN int CeedBasisGetCurl(CeedBasis basis, const CeedScalar **curl); 313ec3da8bcSJed Brown CEED_EXTERN int CeedBasisDestroy(CeedBasis *basis); 314ec3da8bcSJed Brown 3152b730f8bSJeremy L Thompson CEED_EXTERN int CeedGaussQuadrature(CeedInt Q, CeedScalar *q_ref_1d, CeedScalar *q_weight_1d); 3162b730f8bSJeremy L Thompson CEED_EXTERN int CeedLobattoQuadrature(CeedInt Q, CeedScalar *q_ref_1d, CeedScalar *q_weight_1d); 317ec3da8bcSJed Brown 318cdf32b93SJeremy L Thompson /** Handle for the user provided CeedQFunction callback function 319ec3da8bcSJed Brown 320cdf32b93SJeremy L Thompson @param[in,out] ctx User-defined context set using CeedQFunctionSetContext() or NULL 321cdf32b93SJeremy L Thompson @param[in] Q Number of quadrature points at which to evaluate 322ea61e9acSJeremy L Thompson @param[in] in Array of pointers to each input argument in the order provided by the user in CeedQFunctionAddInput(). 323ea61e9acSJeremy L Thompson Each array has shape `[dim, num_comp, Q]` where `dim` is the geometric dimension for \ref CEED_EVAL_GRAD (`dim=1` for \ref 324ea61e9acSJeremy L Thompson CEED_EVAL_INTERP) and `num_comp` is the number of field components (`num_comp=1` for scalar fields). This results in indexing the `i`th input at 325d1d35e2fSjeremylt quadrature point `j` as `in[i][(d*num_comp + c)*Q + j]`. 326ea61e9acSJeremy L Thompson @param[out] out Array of pointers to each output array in the order provided using CeedQFunctionAddOutput(). 327ea61e9acSJeremy L Thompson The shapes are as above for \a in. 328ec3da8bcSJed Brown 329ec3da8bcSJed Brown @return An error code: 0 - success, otherwise - failure 330ec3da8bcSJed Brown 331ec3da8bcSJed Brown @ingroup CeedQFunction 332ec3da8bcSJed Brown **/ 3332b730f8bSJeremy L Thompson typedef int (*CeedQFunctionUser)(void *ctx, const CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out); 334ec3da8bcSJed Brown 3352b730f8bSJeremy L Thompson CEED_EXTERN int CeedQFunctionCreateInterior(Ceed ceed, CeedInt vec_length, CeedQFunctionUser f, const char *source, CeedQFunction *qf); 3362b730f8bSJeremy L Thompson CEED_EXTERN int CeedQFunctionCreateInteriorByName(Ceed ceed, const char *name, CeedQFunction *qf); 3372b730f8bSJeremy L Thompson CEED_EXTERN int CeedQFunctionCreateIdentity(Ceed ceed, CeedInt size, CeedEvalMode in_mode, CeedEvalMode out_mode, CeedQFunction *qf); 3389560d06aSjeremylt CEED_EXTERN int CeedQFunctionReferenceCopy(CeedQFunction qf, CeedQFunction *qf_copy); 3392b730f8bSJeremy L Thompson CEED_EXTERN int CeedQFunctionAddInput(CeedQFunction qf, const char *field_name, CeedInt size, CeedEvalMode eval_mode); 3402b730f8bSJeremy L Thompson CEED_EXTERN int CeedQFunctionAddOutput(CeedQFunction qf, const char *field_name, CeedInt size, CeedEvalMode eval_mode); 3412b730f8bSJeremy L Thompson CEED_EXTERN int CeedQFunctionGetFields(CeedQFunction qf, CeedInt *num_input_fields, CeedQFunctionField **input_fields, CeedInt *num_output_fields, 34243bbe138SJeremy L Thompson CeedQFunctionField **output_fields); 3432b730f8bSJeremy L Thompson CEED_EXTERN int CeedQFunctionSetContext(CeedQFunction qf, CeedQFunctionContext ctx); 344441428dfSJeremy L Thompson CEED_EXTERN int CeedQFunctionSetContextWritable(CeedQFunction qf, bool is_writable); 3459d36ca50SJeremy L Thompson CEED_EXTERN int CeedQFunctionSetUserFlopsEstimate(CeedQFunction qf, CeedSize flops); 346ec3da8bcSJed Brown CEED_EXTERN int CeedQFunctionView(CeedQFunction qf, FILE *stream); 347b7c9bbdaSJeremy L Thompson CEED_EXTERN int CeedQFunctionGetCeed(CeedQFunction qf, Ceed *ceed); 3482b730f8bSJeremy L Thompson CEED_EXTERN int CeedQFunctionApply(CeedQFunction qf, CeedInt Q, CeedVector *u, CeedVector *v); 349ec3da8bcSJed Brown CEED_EXTERN int CeedQFunctionDestroy(CeedQFunction *qf); 350ec3da8bcSJed Brown 3512b730f8bSJeremy L Thompson CEED_EXTERN int CeedQFunctionFieldGetName(CeedQFunctionField qf_field, char **field_name); 3522b730f8bSJeremy L Thompson CEED_EXTERN int CeedQFunctionFieldGetSize(CeedQFunctionField qf_field, CeedInt *size); 3532b730f8bSJeremy L Thompson CEED_EXTERN int CeedQFunctionFieldGetEvalMode(CeedQFunctionField qf_field, CeedEvalMode *eval_mode); 35443bbe138SJeremy L Thompson 3552790b72bSJeremy L Thompson /** Handle for the user provided CeedQFunctionContextDataDestroy callback function 3562790b72bSJeremy L Thompson 3572790b72bSJeremy L Thompson @param[in,out] data User-CeedQFunctionContext data 3582790b72bSJeremy L Thompson 3592790b72bSJeremy L Thompson @return An error code: 0 - success, otherwise - failure 3602790b72bSJeremy L Thompson 3612790b72bSJeremy L Thompson @ingroup CeedQFunction 3622790b72bSJeremy L Thompson **/ 3632790b72bSJeremy L Thompson typedef int (*CeedQFunctionContextDataDestroyUser)(void *data); 3642790b72bSJeremy L Thompson 3652b730f8bSJeremy L Thompson CEED_EXTERN int CeedQFunctionContextCreate(Ceed ceed, CeedQFunctionContext *ctx); 3662b730f8bSJeremy L Thompson CEED_EXTERN int CeedQFunctionContextReferenceCopy(CeedQFunctionContext ctx, CeedQFunctionContext *ctx_copy); 3672b730f8bSJeremy L Thompson CEED_EXTERN int CeedQFunctionContextSetData(CeedQFunctionContext ctx, CeedMemType mem_type, CeedCopyMode copy_mode, size_t size, void *data); 3682b730f8bSJeremy L Thompson CEED_EXTERN int CeedQFunctionContextTakeData(CeedQFunctionContext ctx, CeedMemType mem_type, void *data); 3692b730f8bSJeremy L Thompson CEED_EXTERN int CeedQFunctionContextGetData(CeedQFunctionContext ctx, CeedMemType mem_type, void *data); 3702b730f8bSJeremy L Thompson CEED_EXTERN int CeedQFunctionContextGetDataRead(CeedQFunctionContext ctx, CeedMemType mem_type, void *data); 3712b730f8bSJeremy L Thompson CEED_EXTERN int CeedQFunctionContextRestoreData(CeedQFunctionContext ctx, void *data); 3722b730f8bSJeremy L Thompson CEED_EXTERN int CeedQFunctionContextRestoreDataRead(CeedQFunctionContext ctx, void *data); 3732b730f8bSJeremy L Thompson CEED_EXTERN int CeedQFunctionContextRegisterDouble(CeedQFunctionContext ctx, const char *field_name, size_t field_offset, size_t num_values, 3747bfe0f0eSJeremy L Thompson const char *field_description); 3752b730f8bSJeremy L Thompson CEED_EXTERN int CeedQFunctionContextRegisterInt32(CeedQFunctionContext ctx, const char *field_name, size_t field_offset, size_t num_values, 3767bfe0f0eSJeremy L Thompson const char *field_description); 3772b730f8bSJeremy L Thompson CEED_EXTERN int CeedQFunctionContextGetAllFieldLabels(CeedQFunctionContext ctx, const CeedContextFieldLabel **field_labels, CeedInt *num_fields); 3782b730f8bSJeremy L Thompson CEED_EXTERN int CeedContextFieldLabelGetDescription(CeedContextFieldLabel label, const char **field_name, const char **field_description, 3792b730f8bSJeremy L Thompson size_t *num_values, CeedContextFieldType *field_type); 3802b730f8bSJeremy L Thompson CEED_EXTERN int CeedQFunctionContextGetContextSize(CeedQFunctionContext ctx, size_t *ctx_size); 3812b730f8bSJeremy L Thompson CEED_EXTERN int CeedQFunctionContextView(CeedQFunctionContext ctx, FILE *stream); 3822b730f8bSJeremy L Thompson CEED_EXTERN int CeedQFunctionContextSetDataDestroy(CeedQFunctionContext ctx, CeedMemType f_mem_type, CeedQFunctionContextDataDestroyUser f); 383ec3da8bcSJed Brown CEED_EXTERN int CeedQFunctionContextDestroy(CeedQFunctionContext *ctx); 384ec3da8bcSJed Brown 3852b730f8bSJeremy L Thompson CEED_EXTERN int CeedOperatorCreate(Ceed ceed, CeedQFunction qf, CeedQFunction dqf, CeedQFunction dqfT, CeedOperator *op); 386ec3da8bcSJed Brown CEED_EXTERN int CeedCompositeOperatorCreate(Ceed ceed, CeedOperator *op); 3879560d06aSjeremylt CEED_EXTERN int CeedOperatorReferenceCopy(CeedOperator op, CeedOperator *op_copy); 3882b730f8bSJeremy L Thompson CEED_EXTERN int CeedOperatorSetField(CeedOperator op, const char *field_name, CeedElemRestriction r, CeedBasis b, CeedVector v); 3892b730f8bSJeremy L Thompson CEED_EXTERN int CeedOperatorGetFields(CeedOperator op, CeedInt *num_input_fields, CeedOperatorField **input_fields, CeedInt *num_output_fields, 39043bbe138SJeremy L Thompson CeedOperatorField **output_fields); 3912b730f8bSJeremy L Thompson CEED_EXTERN int CeedCompositeOperatorAddSub(CeedOperator composite_op, CeedOperator sub_op); 392c6ebc35dSJeremy L Thompson CEED_EXTERN int CeedCompositeOperatorGetNumSub(CeedOperator op, CeedInt *num_suboperators); 393c6ebc35dSJeremy L Thompson CEED_EXTERN int CeedCompositeOperatorGetSubList(CeedOperator op, CeedOperator **sub_operators); 3944db537f9SJeremy L Thompson CEED_EXTERN int CeedOperatorCheckReady(CeedOperator op); 395c9366a6bSJeremy L Thompson CEED_EXTERN int CeedOperatorGetActiveVectorLengths(CeedOperator op, CeedSize *input_size, CeedSize *output_size); 396beecbf24SJeremy L Thompson CEED_EXTERN int CeedOperatorSetQFunctionAssemblyReuse(CeedOperator op, bool reuse_assembly_data); 397beecbf24SJeremy L Thompson CEED_EXTERN int CeedOperatorSetQFunctionAssemblyDataUpdateNeeded(CeedOperator op, bool needs_data_update); 3982b730f8bSJeremy L Thompson CEED_EXTERN int CeedOperatorLinearAssembleQFunction(CeedOperator op, CeedVector *assembled, CeedElemRestriction *rstr, CeedRequest *request); 3992b730f8bSJeremy L Thompson CEED_EXTERN int CeedOperatorLinearAssembleQFunctionBuildOrUpdate(CeedOperator op, CeedVector *assembled, CeedElemRestriction *rstr, 4002b730f8bSJeremy L Thompson CeedRequest *request); 4012b730f8bSJeremy L Thompson CEED_EXTERN int CeedOperatorLinearAssembleDiagonal(CeedOperator op, CeedVector assembled, CeedRequest *request); 4022b730f8bSJeremy L Thompson CEED_EXTERN int CeedOperatorLinearAssembleAddDiagonal(CeedOperator op, CeedVector assembled, CeedRequest *request); 4032b730f8bSJeremy L Thompson CEED_EXTERN int CeedOperatorLinearAssemblePointBlockDiagonal(CeedOperator op, CeedVector assembled, CeedRequest *request); 4042b730f8bSJeremy L Thompson CEED_EXTERN int CeedOperatorLinearAssembleAddPointBlockDiagonal(CeedOperator op, CeedVector assembled, CeedRequest *request); 405*01f0e615SJames Wright CEED_EXTERN int CeedOperatorLinearAssemblePointBlockDiagonalSymbolic(CeedOperator op, CeedSize *num_entries, CeedInt **rows, CeedInt **cols); 4062b730f8bSJeremy L Thompson CEED_EXTERN int CeedOperatorLinearAssembleSymbolic(CeedOperator op, CeedSize *num_entries, CeedInt **rows, CeedInt **cols); 407ec3da8bcSJed Brown CEED_EXTERN int CeedOperatorLinearAssemble(CeedOperator op, CeedVector values); 40875f0d5a4SJeremy L Thompson CEED_EXTERN int CeedCompositeOperatorGetMultiplicity(CeedOperator op, CeedInt num_skip_indices, CeedInt *skip_indices, CeedVector mult); 4092b730f8bSJeremy L Thompson CEED_EXTERN int CeedOperatorMultigridLevelCreate(CeedOperator op_fine, CeedVector p_mult_fine, CeedElemRestriction rstr_coarse, 4102b730f8bSJeremy L Thompson CeedBasis basis_coarse, CeedOperator *op_coarse, CeedOperator *op_prolong, 4112b730f8bSJeremy L Thompson CeedOperator *op_restrict); 4122b730f8bSJeremy L Thompson CEED_EXTERN int CeedOperatorMultigridLevelCreateTensorH1(CeedOperator op_fine, CeedVector p_mult_fine, CeedElemRestriction rstr_coarse, 413d1d35e2fSjeremylt CeedBasis basis_coarse, const CeedScalar *interp_c_to_f, CeedOperator *op_coarse, 414d1d35e2fSjeremylt CeedOperator *op_prolong, CeedOperator *op_restrict); 4152b730f8bSJeremy L Thompson CEED_EXTERN int CeedOperatorMultigridLevelCreateH1(CeedOperator op_fine, CeedVector p_mult_fine, CeedElemRestriction rstr_coarse, 4162b730f8bSJeremy L Thompson CeedBasis basis_coarse, const CeedScalar *interp_c_to_f, CeedOperator *op_coarse, 417d1d35e2fSjeremylt CeedOperator *op_prolong, CeedOperator *op_restrict); 4182b730f8bSJeremy L Thompson CEED_EXTERN int CeedOperatorCreateFDMElementInverse(CeedOperator op, CeedOperator *fdm_inv, CeedRequest *request); 419cd4dfc48Sjeremylt CEED_EXTERN int CeedOperatorSetNumQuadraturePoints(CeedOperator op, CeedInt num_qpts); 420ea6b5821SJeremy L Thompson CEED_EXTERN int CeedOperatorSetName(CeedOperator op, const char *name); 421ec3da8bcSJed Brown CEED_EXTERN int CeedOperatorView(CeedOperator op, FILE *stream); 422b7c9bbdaSJeremy L Thompson CEED_EXTERN int CeedOperatorGetCeed(CeedOperator op, Ceed *ceed); 423b7c9bbdaSJeremy L Thompson CEED_EXTERN int CeedOperatorGetNumElements(CeedOperator op, CeedInt *num_elem); 4242b730f8bSJeremy L Thompson CEED_EXTERN int CeedOperatorGetNumQuadraturePoints(CeedOperator op, CeedInt *num_qpts); 4259d36ca50SJeremy L Thompson CEED_EXTERN int CeedOperatorGetFlopsEstimate(CeedOperator op, CeedSize *flops); 4260126412dSJeremy L Thompson CEED_EXTERN int CeedOperatorGetContext(CeedOperator op, CeedQFunctionContext *ctx); 42717b0d5c6SJeremy L Thompson CEED_EXTERN int CeedOperatorGetContextFieldLabel(CeedOperator op, const char *field_name, CeedContextFieldLabel *field_label); 42817b0d5c6SJeremy L Thompson CEED_EXTERN int CeedOperatorSetContextDouble(CeedOperator op, CeedContextFieldLabel field_label, double *values); 42917b0d5c6SJeremy L Thompson CEED_EXTERN int CeedOperatorGetContextDoubleRead(CeedOperator op, CeedContextFieldLabel field_label, size_t *num_values, const double **values); 43017b0d5c6SJeremy L Thompson CEED_EXTERN int CeedOperatorRestoreContextDoubleRead(CeedOperator op, CeedContextFieldLabel field_label, const double **values); 43117b0d5c6SJeremy L Thompson CEED_EXTERN int CeedOperatorSetContextInt32(CeedOperator op, CeedContextFieldLabel field_label, int *values); 43217b0d5c6SJeremy L Thompson CEED_EXTERN int CeedOperatorGetContextInt32Read(CeedOperator op, CeedContextFieldLabel field_label, size_t *num_values, const int **values); 43317b0d5c6SJeremy L Thompson CEED_EXTERN int CeedOperatorRestoreContextInt32Read(CeedOperator op, CeedContextFieldLabel field_label, const int **values); 4342b730f8bSJeremy L Thompson CEED_EXTERN int CeedOperatorApply(CeedOperator op, CeedVector in, CeedVector out, CeedRequest *request); 4352b730f8bSJeremy L Thompson CEED_EXTERN int CeedOperatorApplyAdd(CeedOperator op, CeedVector in, CeedVector out, CeedRequest *request); 436ec3da8bcSJed Brown CEED_EXTERN int CeedOperatorDestroy(CeedOperator *op); 437ec3da8bcSJed Brown 438de5900adSJames Wright CEED_EXTERN int CeedOperatorGetFieldByName(CeedOperator op, const char *field_name, CeedOperatorField *op_field); 4392b730f8bSJeremy L Thompson CEED_EXTERN int CeedOperatorFieldGetName(CeedOperatorField op_field, char **field_name); 4402b730f8bSJeremy L Thompson CEED_EXTERN int CeedOperatorFieldGetElemRestriction(CeedOperatorField op_field, CeedElemRestriction *rstr); 4412b730f8bSJeremy L Thompson CEED_EXTERN int CeedOperatorFieldGetBasis(CeedOperatorField op_field, CeedBasis *basis); 4422b730f8bSJeremy L Thompson CEED_EXTERN int CeedOperatorFieldGetVector(CeedOperatorField op_field, CeedVector *vec); 44343bbe138SJeremy L Thompson 444ec3da8bcSJed Brown /** 445ec3da8bcSJed Brown @brief Return integer power 446ec3da8bcSJed Brown 447ec3da8bcSJed Brown @param[in] base The base to exponentiate 448ec3da8bcSJed Brown @param[in] power The power to raise the base to 449ec3da8bcSJed Brown 450ec3da8bcSJed Brown @return base^power 451ec3da8bcSJed Brown 452ec3da8bcSJed Brown @ref Utility 453ec3da8bcSJed Brown **/ 454ec3da8bcSJed Brown static inline CeedInt CeedIntPow(CeedInt base, CeedInt power) { 455ec3da8bcSJed Brown CeedInt result = 1; 456ec3da8bcSJed Brown while (power) { 457ec3da8bcSJed Brown if (power & 1) result *= base; 458ec3da8bcSJed Brown power >>= 1; 459ec3da8bcSJed Brown base *= base; 460ec3da8bcSJed Brown } 461ec3da8bcSJed Brown return result; 462ec3da8bcSJed Brown } 463ec3da8bcSJed Brown 464ec3da8bcSJed Brown /** 465ec3da8bcSJed Brown @brief Return minimum of two integers 466ec3da8bcSJed Brown 467ec3da8bcSJed Brown @param[in] a The first integer to compare 468ec3da8bcSJed Brown @param[in] b The second integer to compare 469ec3da8bcSJed Brown 470ec3da8bcSJed Brown @return The minimum of the two integers 471ec3da8bcSJed Brown 472ec3da8bcSJed Brown @ref Utility 473ec3da8bcSJed Brown **/ 474ec3da8bcSJed Brown static inline CeedInt CeedIntMin(CeedInt a, CeedInt b) { return a < b ? a : b; } 475ec3da8bcSJed Brown 476ec3da8bcSJed Brown /** 477ec3da8bcSJed Brown @brief Return maximum of two integers 478ec3da8bcSJed Brown 479ec3da8bcSJed Brown @param[in] a The first integer to compare 480ec3da8bcSJed Brown @param[in] b The second integer to compare 481ec3da8bcSJed Brown 482ec3da8bcSJed Brown @return The maximum of the two integers 483ec3da8bcSJed Brown 484ec3da8bcSJed Brown @ref Utility 485ec3da8bcSJed Brown **/ 486ec3da8bcSJed Brown static inline CeedInt CeedIntMax(CeedInt a, CeedInt b) { return a > b ? a : b; } 487ec3da8bcSJed Brown 488ec3da8bcSJed Brown // Used to ensure initialization before CeedInit() 489ec3da8bcSJed Brown CEED_EXTERN int CeedRegisterAll(void); 490ec3da8bcSJed Brown // Used to ensure initialization before CeedQFunctionCreate*() 491ec3da8bcSJed Brown CEED_EXTERN int CeedQFunctionRegisterAll(void); 492ec3da8bcSJed Brown 49394b7b29bSJeremy L Thompson #endif // CEED_H 494