CeedElemRestriction

A CeedElemRestriction decomposes elements and groups the degrees of freedom (dofs) according to the different elements they belong to.

Expressing element decomposition and degrees of freedom over a mesh

typedef struct CeedElemRestriction_private *CeedElemRestriction

Handle for object describing restriction to elements.

const CeedInt CEED_STRIDES_BACKEND[3] = {}

Indicate that the stride is determined by the backend.

const CeedElemRestriction CEED_ELEMRESTRICTION_NONE = &ceed_elemrestriction_none

Indicate that no CeedElemRestriction is provided by the user.

int CeedElemRestrictionCreate(Ceed ceed, CeedInt nelem, CeedInt elemsize, CeedInt ncomp, CeedInt compstride, CeedInt lsize, CeedMemType mtype, CeedCopyMode cmode, const CeedInt *offsets, CeedElemRestriction *rstr)

Create a CeedElemRestriction.

User Functions

Return

An error code: 0 - success, otherwise - failure

Parameters
  • ceed: A Ceed object where the CeedElemRestriction will be created

  • nelem: Number of elements described in the offsets array

  • elemsize: Size (number of “nodes”) per element

  • ncomp: Number of field components per interpolation node (1 for scalar fields)

  • compstride: Stride between components for the same L-vector “node”. Data for node i, component j, element k can be found in the L-vector at index offsets[i + k*elemsize] + j*compstride.

  • lsize: The size of the L-vector. This vector may be larger than the elements and fields given by this restriction.

  • mtype: Memory type of the offsets array, see CeedMemType

  • cmode: Copy mode for the offsets array, see CeedCopyMode

  • offsets: Array of shape [nelem, elemsize]. Row i holds the ordered list of the offsets (into the input CeedVector) for the unknowns corresponding to element i, where 0 <= i < nelem. All offsets must be in the range [0, lsize - 1].

  • [out] rstr: Address of the variable where the newly created CeedElemRestriction will be stored

int CeedElemRestrictionCreateStrided(Ceed ceed, CeedInt nelem, CeedInt elemsize, CeedInt ncomp, CeedInt lsize, const CeedInt strides[3], CeedElemRestriction *rstr)

Create a strided CeedElemRestriction.

User Functions

Return

An error code: 0 - success, otherwise - failure

Parameters
  • ceed: A Ceed object where the CeedElemRestriction will be created

  • nelem: Number of elements described by the restriction

  • elemsize: Size (number of “nodes”) per element

  • ncomp: Number of field components per interpolation “node” (1 for scalar fields)

  • lsize: The size of the L-vector. This vector may be larger than the elements and fields given by this restriction.

  • strides: Array for strides between [nodes, components, elements]. Data for node i, component j, element k can be found in the L-vector at index i*strides[0] + j*strides[1] + k*strides[2]. CEED_STRIDES_BACKEND may be used with vectors created by a Ceed backend.

  • rstr: Address of the variable where the newly created CeedElemRestriction will be stored

int CeedElemRestrictionCreateBlocked(Ceed ceed, CeedInt nelem, CeedInt elemsize, CeedInt blksize, CeedInt ncomp, CeedInt compstride, CeedInt lsize, CeedMemType mtype, CeedCopyMode cmode, const CeedInt *offsets, CeedElemRestriction *rstr)

Create a blocked CeedElemRestriction, typically only called by backends.

Backend Developer Functions

Return

An error code: 0 - success, otherwise - failure

Parameters
  • ceed: A Ceed object where the CeedElemRestriction will be created.

  • nelem: Number of elements described in the offsets array.

  • elemsize: Size (number of unknowns) per element

  • blksize: Number of elements in a block

  • ncomp: Number of field components per interpolation node (1 for scalar fields)

  • compstride: Stride between components for the same L-vector “node”. Data for node i, component j, element k can be found in the L-vector at index offsets[i + k*elemsize] + j*compstride.

  • lsize: The size of the L-vector. This vector may be larger than the elements and fields given by this restriction.

  • mtype: Memory type of the offsets array, see CeedMemType

  • cmode: Copy mode for the offsets array, see CeedCopyMode

  • offsets: Array of shape [nelem, elemsize]. Row i holds the ordered list of the offsets (into the input CeedVector) for the unknowns corresponding to element i, where 0 <= i < nelem. All offsets must be in the range [0, lsize - 1]. The backend will permute and pad this array to the desired ordering for the blocksize, which is typically given by the backend. The default reordering is to interlace elements.

  • rstr: Address of the variable where the newly created CeedElemRestriction will be stored

int CeedElemRestrictionCreateBlockedStrided(Ceed ceed, CeedInt nelem, CeedInt elemsize, CeedInt blksize, CeedInt ncomp, CeedInt lsize, const CeedInt strides[3], CeedElemRestriction *rstr)

Create a blocked strided CeedElemRestriction.

User Functions

Return

An error code: 0 - success, otherwise - failure

Parameters
  • ceed: A Ceed object where the CeedElemRestriction will be created

  • nelem: Number of elements described by the restriction

  • elemsize: Size (number of “nodes”) per element

  • blksize: Number of elements in a block

  • ncomp: Number of field components per interpolation node (1 for scalar fields)

  • lsize: The size of the L-vector. This vector may be larger than the elements and fields given by this restriction.

  • strides: Array for strides between [nodes, components, elements]. Data for node i, component j, element k can be found in the L-vector at index i*strides[0] + j*strides[1] + k*strides[2]. CEED_STRIDES_BACKEND may be used with vectors created by a Ceed backend.

  • rstr: Address of the variable where the newly created CeedElemRestriction will be stored

int CeedElemRestrictionCreateVector(CeedElemRestriction rstr, CeedVector *lvec, CeedVector *evec)

Create CeedVectors associated with a CeedElemRestriction.

User Functions

Return

An error code: 0 - success, otherwise - failure

Parameters
  • rstr: CeedElemRestriction

  • lvec: The address of the L-vector to be created, or NULL

  • evec: The address of the E-vector to be created, or NULL

int CeedElemRestrictionApply(CeedElemRestriction rstr, CeedTransposeMode tmode, CeedVector u, CeedVector ru, CeedRequest *request)

Restrict an L-vector to an E-vector or apply its transpose.

User Functions

Return

An error code: 0 - success, otherwise - failure

Parameters
  • rstr: CeedElemRestriction

  • tmode: Apply restriction or transpose

  • u: Input vector (of size lsize when tmode=CEED_NOTRANSPOSE)

  • ru: Output vector (of shape [nelem * elemsize] when tmode=CEED_NOTRANSPOSE). Ordering of the e-vector is decided by the backend.

  • request: Request or CEED_REQUEST_IMMEDIATE

int CeedElemRestrictionApplyBlock(CeedElemRestriction rstr, CeedInt block, CeedTransposeMode tmode, CeedVector u, CeedVector ru, CeedRequest *request)

Restrict an L-vector to a block of an E-vector or apply its transpose.

Backend Developer Functions

Return

An error code: 0 - success, otherwise - failure

Parameters
  • rstr: CeedElemRestriction

  • block: Block number to restrict to/from, i.e. block=0 will handle elements [0 : blksize] and block=3 will handle elements [3*blksize : 4*blksize]

  • tmode: Apply restriction or transpose

  • u: Input vector (of size lsize when tmode=CEED_NOTRANSPOSE)

  • ru: Output vector (of shape [blksize * elemsize] when tmode=CEED_NOTRANSPOSE). Ordering of the e-vector is decided by the backend.

  • request: Request or CEED_REQUEST_IMMEDIATE

int CeedElemRestrictionGetCompStride(CeedElemRestriction rstr, CeedInt *compstride)

Get the L-vector component stride.

Backend Developer Functions

Return

An error code: 0 - success, otherwise - failure

Parameters
  • rstr: CeedElemRestriction

  • [out] compstride: Variable to store component stride

int CeedElemRestrictionGetNumElements(CeedElemRestriction rstr, CeedInt *numelem)

Get the total number of elements in the range of a CeedElemRestriction.

Backend Developer Functions

Return

An error code: 0 - success, otherwise - failure

Parameters
  • rstr: CeedElemRestriction

  • [out] numelem: Variable to store number of elements

int CeedElemRestrictionGetElementSize(CeedElemRestriction rstr, CeedInt *elemsize)

Get the size of elements in the CeedElemRestriction.

Backend Developer Functions

Return

An error code: 0 - success, otherwise - failure

Parameters
  • rstr: CeedElemRestriction

  • [out] elemsize: Variable to store size of elements

int CeedElemRestrictionGetLVectorSize(CeedElemRestriction rstr, CeedInt *lsize)

Get the size of the l-vector for a CeedElemRestriction.

Backend Developer Functions

Return

An error code: 0 - success, otherwise - failure

Parameters
  • rstr: CeedElemRestriction

  • [out] numnodes: Variable to store number of nodes

int CeedElemRestrictionGetNumComponents(CeedElemRestriction rstr, CeedInt *numcomp)

Get the number of components in the elements of a CeedElemRestriction.

Backend Developer Functions

Return

An error code: 0 - success, otherwise - failure

Parameters
  • rstr: CeedElemRestriction

  • [out] numcomp: Variable to store number of components

int CeedElemRestrictionGetNumBlocks(CeedElemRestriction rstr, CeedInt *numblock)

Get the number of blocks in a CeedElemRestriction.

Backend Developer Functions

Return

An error code: 0 - success, otherwise - failure

Parameters
  • rstr: CeedElemRestriction

  • [out] numblock: Variable to store number of blocks

int CeedElemRestrictionGetBlockSize(CeedElemRestriction rstr, CeedInt *blksize)

Get the size of blocks in the CeedElemRestriction.

Backend Developer Functions

Return

An error code: 0 - success, otherwise - failure

Parameters
  • rstr: CeedElemRestriction

  • [out] blksize: Variable to store size of blocks

int CeedElemRestrictionGetMultiplicity(CeedElemRestriction rstr, CeedVector mult)

Get the multiplicity of nodes in a CeedElemRestriction.

User Functions

Return

An error code: 0 - success, otherwise - failure

Parameters
  • rstr: CeedElemRestriction

  • [out] mult: Vector to store multiplicity (of size lsize)

int CeedElemRestrictionView(CeedElemRestriction rstr, FILE *stream)

View a CeedElemRestriction.

User Functions

Return

Error code: 0 - success, otherwise - failure

Parameters
  • [in] rstr: CeedElemRestriction to view

  • [in] stream: Stream to write; typically stdout/stderr or a file

int CeedElemRestrictionDestroy(CeedElemRestriction *rstr)

Destroy a CeedElemRestriction.

User Functions

Return

An error code: 0 - success, otherwise - failure

Parameters
  • rstr: CeedElemRestriction to destroy