10 #ifdef MOOSE_MFEM_ENABLED 15 #include "libmesh/int_range.h" 22 storeGridFunction(std::ostream & stream, mfem::ParGridFunction & gridfunction,
void * context)
24 const auto size = gridfunction.Size();
27 const auto * values = gridfunction.HostRead();
30 auto value = values[i];
36 loadGridFunction(std::istream & stream, mfem::ParGridFunction & gridfunction,
void * context)
40 mooseAssert(size == gridfunction.Size(),
41 "MFEM restartable GridFunction size mismatch during restore.");
43 auto * values = gridfunction.HostWrite();
45 dataLoad(stream, values[i], context);
56 dataStore(stream, num_gridfunctions, context);
57 for (
const auto & [
name, gridfunction] : data->gridfunctions)
59 auto stored_name =
name;
61 storeGridFunction(stream, *gridfunction, context);
64 auto num_complex_gridfunctions = data->cmplx_gridfunctions.size();
65 dataStore(stream, num_complex_gridfunctions, context);
66 for (
const auto & [
name, gridfunction] : data->cmplx_gridfunctions)
68 auto stored_name =
name;
70 storeGridFunction(stream, gridfunction->real(), context);
71 storeGridFunction(stream, gridfunction->imag(), context);
81 int num_gridfunctions = 0;
82 dataLoad(stream, num_gridfunctions, context);
83 for (
int i = 0; i < num_gridfunctions; ++i)
87 auto & gf = data->gridfunctions.GetRef(
name);
88 loadGridFunction(stream, gf, context);
91 int num_complex_gridfunctions = 0;
92 dataLoad(stream, num_complex_gridfunctions, context);
93 for (
int i = 0; i < num_complex_gridfunctions; ++i)
97 auto & gf = data->cmplx_gridfunctions.GetRef(
name);
98 loadGridFunction(stream, gf.real(), context);
99 loadGridFunction(stream, gf.imag(), context);
std::string name(const ElemQuality q)
Base problem data struct.
void dataLoad(std::istream &stream, Moose::MFEM::SolutionState &, void *context)
Real value(unsigned n, unsigned alpha, unsigned beta, Real x)
void dataStore(std::ostream &stream, Moose::MFEM::SolutionState &, void *context)
IntRange< T > make_range(T beg, T end)
int size()
Returns the number of elements in the map.
Moose::MFEM::GridFunctions gridfunctions