12 #ifndef MFEM_LIBCEED_UTIL 13 #define MFEM_LIBCEED_UTIL 15 #include "../../../config/config.hpp" 19 #include <unordered_map> 23 #include <ceed/backend.h> 30 class FiniteElementSpace;
31 class ElementTransformation;
32 class IntegrationRule;
48 #define PCeedChk(err) do { \ 51 const char * errmsg; \ 52 CeedGetErrorMessage(internal::ceed, &errmsg); \ 72 Ceed ceed, CeedBasis *basis,
73 CeedElemRestriction *restr);
89 const IntegrationRule &ir,
92 Ceed ceed, CeedBasis *basis,
93 CeedElemRestriction *restr);
98 template <
typename Integrator>
99 const IntegrationRule &
GetRule(
100 const Integrator &integ,
101 const FiniteElement &trial_fe,
102 const FiniteElement &test_fe,
103 ElementTransformation &Trans);
109 template <
typename T>
112 return std::hash<T> {}(key);
120 return seed ^ (hash + (seed << 6) + (seed >> 2));
141 using BasisMap = std::unordered_map<const BasisKey, CeedBasis, BasisHash>;
147 std::tuple<const mfem::FiniteElementSpace*, int, int, int, int>;
163 std::unordered_map<const RestrKey, CeedElemRestriction, RestrHash>;
183 #endif // MFEM_LIBCEED_UTIL std::unordered_map< const RestrKey, CeedElemRestriction, RestrHash > RestrMap
Class for an integration rule - an Array of IntegrationPoint.
void InitVector(const mfem::Vector &v, CeedVector &cv)
Initialize a CeedVector from an mfem::Vector.
std::tuple< const mfem::FiniteElementSpace *, int, int, int, int > RestrKey
int CeedOperatorGetActiveField(CeedOperator oper, CeedOperatorField *field)
std::tuple< const mfem::FiniteElementSpace *, const mfem::IntegrationRule *, int, int, int > BasisKey
std::size_t CeedHashCombine(std::size_t seed, std::size_t hash)
Effective way to combine hashes (from libCEED).
std::unordered_map< const BasisKey, CeedBasis, BasisHash > BasisMap
Class FiniteElementSpace - responsible for providing FEM view of the mesh, mainly managing the set of...
const std::string & GetCeedPath()
Return the path to the libCEED q-function headers.
void RemoveBasisAndRestriction(const mfem::FiniteElementSpace *fes)
Remove from ceed_basis_map and ceed_restr_map the entries associated with the given fes...
bool DeviceCanUseCeed()
Function that determines if a CEED kernel should be used, based on the current mfem::Device configura...
std::size_t CeedHash(const T key)
Wrapper for std::hash.
const IntegrationRule & GetRule(const Integrator &integ, const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans)
std::size_t operator()(const RestrKey &k) const
std::size_t operator()(const BasisKey &k) const
void InitBasisAndRestriction(const FiniteElementSpace &fes, const IntegrationRule &irm, Ceed ceed, CeedBasis *basis, CeedElemRestriction *restr)
Initialize a CeedBasis and a CeedElemRestriction based on an mfem::FiniteElementSpace fes...