Ceed

bool CeedDebugFlag(const Ceed ceed)

Return value of CEED_DEBUG environment variable.

Backend Developer Functions

Parameters
  • ceed[in] Ceed context

Returns

boolean value: true - debugging mode enabled false - debugging mode disabled

bool CeedDebugFlagEnv(void)

Return value of CEED_DEBUG environment variable.

Backend Developer Functions

Returns

boolean value: true - debugging mode enabled false - debugging mode disabled

void CeedDebugImpl256(const unsigned char color, const char *format, ...)

Print debugging information in color.

Backend Developer Functions

Parameters
  • color – Color to print

  • format – Printing format

int CeedMallocArray(size_t n, size_t unit, void *p)

Allocate an array on the host; use CeedMalloc()

Memory usage can be tracked by the library. This ensures sufficient alignment for vectorization and should be used for large allocations.

Backend Developer Functions

See also

CeedFree()

Parameters
  • n[in] Number of units to allocate

  • unit[in] Size of each unit

  • p[out] Address of pointer to hold the result.

Returns

An error code: 0 - success, otherwise - failure

int CeedCallocArray(size_t n, size_t unit, void *p)

Allocate a cleared (zeroed) array on the host; use CeedCalloc()

Memory usage can be tracked by the library.

Backend Developer Functions

See also

CeedFree()

Parameters
  • n[in] Number of units to allocate

  • unit[in] Size of each unit

  • p[out] Address of pointer to hold the result.

Returns

An error code: 0 - success, otherwise - failure

int CeedReallocArray(size_t n, size_t unit, void *p)

Reallocate an array on the host; use CeedRealloc()

Memory usage can be tracked by the library.

Backend Developer Functions

See also

CeedFree()

Parameters
  • n[in] Number of units to allocate

  • unit[in] Size of each unit

  • p[out] Address of pointer to hold the result.

Returns

An error code: 0 - success, otherwise - failure

int CeedStringAllocCopy(const char *source, char **copy)

Allocate a cleared string buffer on the host.

Memory usage can be tracked by the library.

Backend Developer Functions

See also

CeedFree()

Parameters
  • source[in] Pointer to string to be copied

  • copy[out] Pointer to variable to hold newly allocated string copy

Returns

An error code: 0 - success, otherwise - failure

int CeedFree(void *p)

Free memory allocated using CeedMalloc() or CeedCalloc()

Parameters
  • p[inout] address of pointer to memory. This argument is of type void* to avoid needing a cast, but is the address of the pointer (which is zeroed) rather than the pointer.

int CeedRegister(const char *prefix, int (*init)(const char*, Ceed), unsigned int priority)

Register a Ceed backend.

Backend Developer Functions

Parameters
  • prefix[in] Prefix of resources for this backend to respond to. For example, the reference backend responds to “/cpu/self”.

  • init[in] Initialization function called by CeedInit() when the backend is selected to drive the requested resource.

  • priority[in] Integer priority. Lower values are preferred in case the resource requested by CeedInit() has non-unique best prefix match.

Returns

An error code: 0 - success, otherwise - failure

int CeedIsDebug(Ceed ceed, bool *is_debug)

Return debugging status flag.

Backend Developer Functions

Parameters
  • ceed[in] Ceed context to get debugging flag

  • is_debug[out] Variable to store debugging flag

Returns

An error code: 0 - success, otherwise - failure

int CeedGetParent(Ceed ceed, Ceed *parent)

Retrieve a parent Ceed context.

Backend Developer Functions

Parameters
  • ceed[in] Ceed context to retrieve parent of

  • parent[out] Address to save the parent to

Returns

An error code: 0 - success, otherwise - failure

int CeedGetDelegate(Ceed ceed, Ceed *delegate)

Retrieve a delegate Ceed context.

Backend Developer Functions

Parameters
  • ceed[in] Ceed context to retrieve delegate of

  • delegate[out] Address to save the delegate to

Returns

An error code: 0 - success, otherwise - failure

int CeedSetDelegate(Ceed ceed, Ceed delegate)

Set a delegate Ceed context.

This function allows a Ceed context to set a delegate Ceed context. All backend implementations default to the delegate Ceed context, unless overridden.

Backend Developer Functions

Parameters
  • ceed[in] Ceed context to set delegate of

  • delegate[out] Address to set the delegate to

Returns

An error code: 0 - success, otherwise - failure

int CeedGetObjectDelegate(Ceed ceed, Ceed *delegate, const char *obj_name)

Retrieve a delegate Ceed context for a specific object type.

Backend Developer Functions

Parameters
  • ceed[in] Ceed context to retrieve delegate of

  • delegate[out] Address to save the delegate to

  • obj_name[in] Name of the object type to retrieve delegate for

Returns

An error code: 0 - success, otherwise - failure

int CeedSetObjectDelegate(Ceed ceed, Ceed delegate, const char *obj_name)

Set a delegate Ceed context for a specific object type.

This function allows a Ceed context to set a delegate Ceed context for a given type of Ceed object. All backend implementations default to the delegate Ceed context for this object. For example, CeedSetObjectDelegate(ceed, refceed, “Basis”) uses refceed implementations for all CeedBasis backend functions.

Backend Developer Functions

Parameters
  • ceed[inout] Ceed context to set delegate of

  • delegate[out] Address to set the delegate to

  • obj_name[in] Name of the object type to set delegate for

Returns

An error code: 0 - success, otherwise - failure

int CeedGetOperatorFallbackResource(Ceed ceed, const char **resource)

Get the fallback resource for CeedOperators.

Backend Developer Functions

Parameters
  • ceed[in] Ceed context

  • resource[out] Variable to store fallback resource

Returns

An error code: 0 - success, otherwise - failure

int CeedGetOperatorFallbackCeed(Ceed ceed, Ceed *fallback_ceed)

Get the fallback Ceed for CeedOperators.

Backend Developer Functions

Parameters
  • ceed[in] Ceed context

  • fallback_ceed[out] Variable to store fallback Ceed

Returns

An error code: 0 - success, otherwise - failure

int CeedSetOperatorFallbackResource(Ceed ceed, const char *resource)

Set the fallback resource for CeedOperators.

The current resource, if any, is freed by calling this function. This string is freed upon the destruction of the Ceed context.

Backend Developer Functions

Parameters
  • ceed[inout] Ceed context

  • resource[in] Fallback resource to set

Returns

An error code: 0 - success, otherwise - failure

int CeedGetOperatorFallbackParentCeed(Ceed ceed, Ceed *parent)

Get the parent Ceed context associated with a fallback Ceed context for a CeedOperator.

Backend Developer Functions

Parameters
  • ceed[in] Ceed context

  • parent[out] Variable to store parent Ceed context

Returns

An error code: 0 - success, otherwise - failure

int CeedSetDeterministic(Ceed ceed, bool is_deterministic)

Flag Ceed context as deterministic.

Backend Developer Functions

Parameters
  • ceed[in] Ceed to flag as deterministic

  • is_deterministic[out] Deterministic status to set

Returns

An error code: 0 - success, otherwise - failure

int CeedSetBackendFunction(Ceed ceed, const char *type, void *object, const char *func_name, int (*f)())

Set a backend function.

This function is used for a backend to set the function associated with the Ceed objects. For example, CeedSetBackendFunction(ceed, “Ceed”, ceed, “VectorCreate”, BackendVectorCreate) sets the backend implementation of ‘CeedVectorCreate’ and CeedSetBackendFunction(ceed, “Basis”, basis, “Apply”, BackendBasisApply) sets the backend implementation of ‘CeedBasisApply’. Note, the prefix ‘Ceed’ is not required for the object type (“Basis” vs “CeedBasis”).

Backend Developer Functions

Parameters
  • ceed[in] Ceed context for error handling

  • type[in] Type of Ceed object to set function for

  • object[out] Ceed object to set function for

  • func_name[in] Name of function to set

  • f[in] Function to set

Returns

An error code: 0 - success, otherwise - failure

int CeedGetData(Ceed ceed, void *data)

Retrieve backend data for a Ceed context.

Backend Developer Functions

Parameters
  • ceed[in] Ceed context to retrieve data of

  • data[out] Address to save data to

Returns

An error code: 0 - success, otherwise - failure

int CeedSetData(Ceed ceed, void *data)

Set backend data for a Ceed context.

Backend Developer Functions

Parameters
  • ceed[inout] Ceed context to set data of

  • data[in] Address of data to set

Returns

An error code: 0 - success, otherwise - failure

int CeedReference(Ceed ceed)

Increment the reference counter for a Ceed context.

Backend Developer Functions

Parameters
  • ceed[inout] Ceed context to increment the reference counter

Returns

An error code: 0 - success, otherwise - failure