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 initialize() override
Called before execute() is ever called so that data can be cleared.
A MultiMooseEnum object to hold "execute_on" flags.
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.
const unsigned int invalid_uint
static InputParameters validParams()
registerMooseObject("MooseApp", NEML2BatchIndexGenerator)
bool shouldCompute(const SubProblem &)
Determine whether the NEML2 material model should be evaluated.
void meshChanged() override
Called on this object when the mesh changes.
void execute() override
Execute method.
NEML2BatchIndexGenerator(const InputParameters ¶ms)
ExecFlagEnum getDefaultExecFlagEnum()
Return the default ExecFlagEnum for MOOSE.
void finalize() override
Finalize.
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
const ExecFlagType EXEC_LINEAR
const ExecFlagType EXEC_NONLINEAR
const QBase *const & _qrule
const Elem *const & _current_elem
The current element pointer (available during execute())
FEProblemBase & _fe_problem
Reference to the FEProblemBase for this user object.
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type.
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)
Base class for user-specific data.
NEML2BatchIndexGenerator iterates over the mesh and generates a map from element ID to batch index wh...
const ExecFlagType EXEC_INITIAL