12 #ifndef MFEM_LIBCEED_UTIL
13 #define MFEM_LIBCEED_UTIL
15 #include "../../../config/config.hpp"
17 #include <unordered_map>
22 #include <ceed/hash.h>
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);
116 return CeedHashCombine(
118 CeedHashInt(reinterpret_cast<CeedHash64_t>(std::get<0>(k))),
119 CeedHashInt(reinterpret_cast<CeedHash64_t>(std::get<1>(k)))),
121 CeedHashCombine(CeedHashInt(std::get<2>(k)),
122 CeedHashInt(std::get<3>(k))),
123 CeedHashInt(std::get<4>(k))));
126 using BasisMap = std::unordered_map<const BasisKey, CeedBasis, BasisHash>;
132 std::tuple<const mfem::FiniteElementSpace*, int, int, int, int>;
137 return CeedHashCombine(
140 CeedHashInt(reinterpret_cast<CeedHash64_t>(std::get<0>(k))),
141 CeedHashInt(std::get<1>(k))),
142 CeedHashCombine(CeedHashInt(std::get<2>(k)),
143 CeedHashInt(std::get<3>(k)))),
144 CeedHashInt(std::get<4>(k)));
148 std::unordered_map<const RestrKey, CeedElemRestriction, RestrHash>;
168 #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::size_t operator()(const RestrKey &k) const
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::unordered_map< const BasisKey, CeedBasis, BasisHash > BasisMap
std::size_t operator()(const BasisKey &k) const
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...
const IntegrationRule & GetRule(const Integrator &integ, const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans)
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...