19 params.addClassDescription(
"Generates the element to batch index map for MOOSEToNEML2 gatherers, "
20 "NEML2ToMOOSE retrievers, and the NEML2 executor");
27 params.set<
ExecFlagEnum>(
"execute_on") = execute_options;
82 for (
const auto & [elem_id, batch_index] : m2n._elem_to_batch_index)
104 mooseError(
"No batch index found for element id ", elem_id);
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
const ExecFlagType EXEC_INITIAL
const ExecFlagType EXEC_LINEAR
const ExecFlagType EXEC_NONLINEAR
registerMooseObject("MooseApp", NEML2BatchIndexGenerator)
static InputParameters validParams()
const QBase *const & _qrule
const Elem *const & _current_elem
The current element pointer (available during execute())
A MultiMooseEnum object to hold "execute_on" flags.
NEML2BatchIndexGenerator iterates over the mesh and generates a map from element ID to batch index wh...
void finalize() override
Finalize.
std::size_t _batch_index
Highest current batch index.
std::map< dof_id_type, std::size_t > _elem_to_batch_index
Map from element IDs to batch indices.
void initialize() override
Called before execute() is ever called so that data can be cleared.
void execute() override
Execute method.
void threadJoin(const UserObject &) override
Must override.
static InputParameters validParams()
std::size_t getBatchIndex() const
Get the current batch index (in almost all cases this is the total batch size)
void meshChanged() override
Called on this object when the mesh changes.
NEML2BatchIndexGenerator(const InputParameters ¶ms)
bool _outdated
Whether the batch index map is outdated.
std::pair< dof_id_type, std::size_t > _elem_to_batch_index_cache
cache the index for the current element
FEProblemBase & _fe_problem
Reference to the FEProblemBase for this user object.
Base class for user-specific data.
ExecFlagEnum getDefaultExecFlagEnum()
bool shouldCompute(const SubProblem &)
Determine whether the NEML2 material model should be evaluated.
const unsigned int invalid_uint