CeedBasis
-
int CeedBasisCreateH1Fallback(Ceed ceed, CeedElemTopology topo, CeedInt num_comp, CeedInt num_nodes, CeedInt num_qpts, const CeedScalar *interp, const CeedScalar *grad, const CeedScalar *q_ref, const CeedScalar *q_weight, CeedBasis basis)
Fallback to a reference implementation for a non tensor-product basis for \(H^1\) discretizations.
This function may only be called inside of a backend
BasisCreateH1function. This is used by a backend when the specific parameters for aCeedBasisexceed the backend’s support, such as when ainterpandgradmatrices require too many bytes to fit into shared memory on a GPU.User Functions
- Parameters:
ceed – [in]
Ceedobject used to create theCeedBasistopo – [in] Topology of element, e.g. hypercube, simplex, etc
num_comp – [in] Number of field components (1 for scalar fields)
num_nodes – [in] Total number of nodes
num_qpts – [in] Total number of quadrature points
interp – [in] Row-major (
num_qpts * num_nodes) matrix expressing the values of nodal basis functions at quadrature pointsgrad – [in] Row-major (
dim * num_qpts * num_nodes) matrix expressing derivatives of nodal basis functions at quadrature pointsq_ref – [in] Array of length
num_qpts * dimholding the locations of quadrature points on the reference elementq_weight – [in] Array of length
num_qptsholding the quadrature weights on the reference elementbasis – [out] Newly created
CeedBasis
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedBasisGetCollocatedGrad(CeedBasis basis, CeedScalar *collo_grad_1d)
Return collocated gradient matrix.
Backend Developer Functions
- Parameters:
basis – [in]
CeedBasiscollo_grad_1d – [out] Row-major (
Q_1d * Q_1d) matrix expressing derivatives of basis functions at quadrature points
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedBasisGetChebyshevInterp1D(CeedBasis basis, CeedScalar *chebyshev_interp_1d)
Return 1D interpolation matrix to Chebyshev polynomial coefficients on quadrature space.
Backend Developer Functions
- Parameters:
basis – [in]
CeedBasischebyshev_interp_1d – [out] Row-major (
P_1d * Q_1d) matrix interpolating from basis nodes to Chebyshev polynomial coefficients
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedBasisIsTensor(CeedBasis basis, bool *is_tensor)
Get tensor status for given
CeedBasisBackend Developer Functions
- Parameters:
basis – [in]
CeedBasisis_tensor – [out] Variable to store tensor status
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedBasisIsCollocated(CeedBasis basis, bool *is_collocated)
Determine if given
CeedBasishas nodes collocated with quadrature points.Backend Developer Functions
- Parameters:
basis – [in]
CeedBasisis_collocated – [out] Variable to store collocated status
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedBasisGetData(CeedBasis basis, void *data)
Get backend data of a
CeedBasisBackend Developer Functions
- Parameters:
basis – [in]
CeedBasisdata – [out] Variable to store data
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedBasisSetData(CeedBasis basis, void *data)
Set backend data of a
CeedBasisBackend Developer Functions
- Parameters:
basis – [inout]
CeedBasisdata – [in] Data to set
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedBasisReference(CeedBasis basis)
Increment the reference counter for a
CeedBasisBackend Developer Functions
- Parameters:
basis – [inout]
CeedBasisto increment the reference counter
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedBasisGetNumQuadratureComponents(CeedBasis basis, CeedEvalMode eval_mode, CeedInt *q_comp)
Get number of Q-vector components for given
CeedBasisBackend Developer Functions
- Parameters:
basis – [in]
CeedBasiseval_mode – [in] CEED_EVAL_INTERP to use interpolated values, CEED_EVAL_GRAD to use gradients, CEED_EVAL_DIV to use divergence, CEED_EVAL_CURL to use curl
q_comp – [out] Variable to store number of Q-vector components of basis
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedBasisGetFlopsEstimate(CeedBasis basis, CeedTransposeMode t_mode, CeedEvalMode eval_mode, bool is_at_points, CeedInt num_points, CeedSize *flops)
Estimate number of FLOPs required to apply
CeedBasisint_modeandeval_modeBackend Developer Functions
- Parameters:
basis – [in]
CeedBasisto estimate FLOPs fort_mode – [in] Apply basis or transpose
eval_mode – [in] CeedEvalMode
is_at_points – [in] Evaluate the basis at points or quadrature points
num_points – [in] Number of points basis is evaluated at
flops – [out] Address of variable to hold FLOPs estimate
-
int CeedBasisGetFESpace(CeedBasis basis, CeedFESpace *fe_space)
Get
CeedFESpacefor aCeedBasisBackend Developer Functions
- Parameters:
basis – [in]
CeedBasisfe_space – [out] Variable to store
CeedFESpace
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedBasisGetTopologyDimension(CeedElemTopology topo, CeedInt *dim)
Get dimension for given
CeedElemTopologyBackend Developer Functions
- Parameters:
topo – [in]
CeedElemTopologydim – [out] Variable to store dimension of topology
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedBasisGetTensorContract(CeedBasis basis, CeedTensorContract *contract)
Get
CeedTensorContractof aCeedBasisBackend Developer Functions
- Parameters:
basis – [in]
CeedBasiscontract – [out] Variable to store
CeedTensorContract
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedBasisSetTensorContract(CeedBasis basis, CeedTensorContract contract)
Set
CeedTensorContractof aCeedBasisBackend Developer Functions
- Parameters:
basis – [inout]
CeedBasiscontract – [in]
CeedTensorContractto set
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedMatrixMatrixMultiply(Ceed ceed, const CeedScalar *mat_A, const CeedScalar *mat_B, CeedScalar *mat_C, CeedInt m, CeedInt n, CeedInt kk)
Return a reference implementation of matrix multiplication \(C = A B\).
Note: This is a reference implementation for CPU
CeedScalarpointers that is not intended for high performance.Utility Functions
- Parameters:
ceed – [in]
Ceedcontext for error handlingmat_A – [in] Row-major matrix
Amat_B – [in] Row-major matrix
Bmat_C – [out] Row-major output matrix
Cm – [in] Number of rows of
Cn – [in] Number of columns of
Ckk – [in] Number of columns of
A/rows ofB
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedQRFactorization(Ceed ceed, CeedScalar *mat, CeedScalar *tau, CeedInt m, CeedInt n)
Return QR Factorization of a matrix.
Utility Functions
- Parameters:
ceed – [in]
Ceedcontext for error handlingmat – [inout] Row-major matrix to be factorized in place
tau – [inout] Vector of length
mof scaling factorsm – [in] Number of rows
n – [in] Number of columns
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedHouseholderApplyQ(CeedScalar *mat_A, const CeedScalar *mat_Q, const CeedScalar *tau, CeedTransposeMode t_mode, CeedInt m, CeedInt n, CeedInt k, CeedInt row, CeedInt col)
Apply Householder Q matrix.
Compute
mat_A = mat_Q mat_A, wheremat_Qis \(m \times m\) andmat_Ais \(m \times n\).Utility Functions
- Parameters:
mat_A – [inout] Matrix to apply Householder Q to, in place
mat_Q – [in] Householder Q matrix
tau – [in] Householder scaling factors
t_mode – [in] Transpose mode for application
m – [in] Number of rows in
An – [in] Number of columns in
Ak – [in] Number of elementary reflectors in Q,
k < mrow – [in] Row stride in
Acol – [in] Col stride in
A
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedMatrixPseudoinverse(Ceed ceed, const CeedScalar *mat, CeedInt m, CeedInt n, CeedScalar *mat_pinv)
Return pseudoinverse of a matrix.
Utility Functions
- Parameters:
ceed – [in] Ceed context for error handling
mat – [in] Row-major matrix to compute pseudoinverse of
m – [in] Number of rows
n – [in] Number of columns
mat_pinv – [out] Row-major pseudoinverse matrix
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedSymmetricSchurDecomposition(Ceed ceed, CeedScalar *mat, CeedScalar *lambda, CeedInt n)
Return symmetric Schur decomposition of the symmetric matrix mat via symmetric QR factorization.
Utility Functions
- Parameters:
ceed – [in]
Ceedcontext for error handlingmat – [inout] Row-major matrix to be factorized in place
lambda – [out] Vector of length n of eigenvalues
n – [in] Number of rows/columns
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedSimultaneousDiagonalization(Ceed ceed, CeedScalar *mat_A, CeedScalar *mat_B, CeedScalar *mat_X, CeedScalar *lambda, CeedInt n)
Return Simultaneous Diagonalization of two matrices.
This solves the generalized eigenvalue problem
A x = lambda B x, whereAandBare symmetric andBis positive definite. We generate the matrixXand vectorLambdasuch thatX^T A X = LambdaandX^T B X = I. This is equivalent to the LAPACK routine ‘sygv’ withTYPE = 1.Utility Functions
- Parameters:
ceed – [in]
Ceedcontext for error handlingmat_A – [in] Row-major matrix to be factorized with eigenvalues
mat_B – [in] Row-major matrix to be factorized to identity
mat_X – [out] Row-major orthogonal matrix
lambda – [out] Vector of length
nof generalized eigenvaluesn – [in] Number of rows/columns
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedTensorContractCreate(Ceed ceed, CeedTensorContract *contract)
Create a
CeedTensorContractobject for aCeedBasisBackend Developer Functions
- Parameters:
ceed – [in]
Ceedobject used to create theCeedTensorContractcontract – [out] Address of the variable where the newly created
CeedTensorContractwill be stored.
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedTensorContractApply(CeedTensorContract contract, CeedInt A, CeedInt B, CeedInt C, CeedInt J, const CeedScalar *restrict t, CeedTransposeMode t_mode, const CeedInt add, const CeedScalar *restrict u, CeedScalar *restrict v)
Apply tensor contraction.
Contracts on the middle index NOTRANSPOSE:
v_ajc = t_jb u_abcTRANSPOSE:v_ajc = t_bj u_abcIfadd != 0,=is replaced by+=Backend Developer Functions
- Parameters:
contract – [in]
CeedTensorContractto useA – [in] First index of
u,vB – [in] Middle index of
u, one index oftC – [in] Last index of
u,vJ – [in] Middle index of
v, one index oftt – [in] Tensor array to contract against
t_mode – [in] Transpose mode for
t, CEED_NOTRANSPOSE fort_jbCEED_TRANSPOSE fort_bjadd – [in] Add mode
u – [in] Input array
v – [out] Output array
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedTensorContractStridedApply(CeedTensorContract contract, CeedInt A, CeedInt B, CeedInt C, CeedInt D, CeedInt J, const CeedScalar *restrict t, CeedTransposeMode t_mode, const CeedInt add, const CeedScalar *restrict u, CeedScalar *restrict v)
Apply tensor contraction.
Contracts on the middle index NOTRANSPOSE:
v_dajc = t_djb u_abcTRANSPOSE:v_ajc = t_dbj u_dabcIfadd != 0,=is replaced by+=Backend Developer Functions
- Parameters:
contract – [in]
CeedTensorContractto useA – [in] First index of
u, second index ofvB – [in] Middle index of
u, one of last two indices oftC – [in] Last index of
u,vD – [in] First index of
v, first index oftJ – [in] Third index of
v, one of last two indices oftt – [in] Tensor array to contract against
t_mode – [in] Transpose mode for
t, CEED_NOTRANSPOSE fort_djbCEED_TRANSPOSE fort_dbjadd – [in] Add mode
u – [in] Input array
v – [out] Output array
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedTensorContractGetCeed(CeedTensorContract contract, Ceed *ceed)
Get the
Ceedassociated with aCeedTensorContractBackend Developer Functions
- Parameters:
contract – [in]
CeedTensorContractceed – [out] Variable to store
Ceed
- Returns:
An error code: 0 - success, otherwise - failure
-
Ceed CeedTensorContractReturnCeed(CeedTensorContract contract)
Return the
Ceedassociated with aCeedTensorContractBackend Developer Functions
- Parameters:
contract – [in]
CeedTensorContract
- Returns:
Ceedassociated withcontract
-
int CeedTensorContractGetData(CeedTensorContract contract, void *data)
Get backend data of a
CeedTensorContractBackend Developer Functions
- Parameters:
contract – [in]
CeedTensorContractdata – [out] Variable to store data
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedTensorContractSetData(CeedTensorContract contract, void *data)
Set backend data of a
CeedTensorContractBackend Developer Functions
- Parameters:
contract – [inout]
CeedTensorContractdata – [in] Data to set
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedTensorContractReference(CeedTensorContract contract)
Increment the reference counter for a
CeedTensorContractBackend Developer Functions
- Parameters:
contract – [inout]
CeedTensorContractto increment the reference counter
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedTensorContractReferenceCopy(CeedTensorContract tensor, CeedTensorContract *tensor_copy)
Copy the pointer to a
CeedTensorContract.Both pointers should be destroyed with CeedTensorContractDestroy().
Note: If the value of
*tensor_copypassed to this function is non-NULL, then it is assumed that*tensor_copyis a pointer to aCeedTensorContract. ThisCeedTensorContractwill be destroyed if*tensor_copyis the only reference to thisCeedTensorContract.User Functions
- Parameters:
tensor – [in]
CeedTensorContractto copy reference totensor_copy – [inout] Variable to store copied reference
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedTensorContractDestroy(CeedTensorContract *contract)
Destroy a
CeedTensorContractBackend Developer Functions
- Parameters:
contract – [inout]
CeedTensorContractto destroy
- Returns:
An error code: 0 - success, otherwise - failure