21 "Action to create shortcut syntax-specified checkpoints and automatic checkpoints.");
23 params.
addParam<
bool>(
"checkpoint",
"Create checkpoint files using the default options.");
35 const auto num_checkpoints = checkpoints.size();
37 const bool user_specified_checkpoint_behavior =
isParamValid(
"checkpoint");
38 const bool user_requested_checkpoint =
39 user_specified_checkpoint_behavior && getParam<bool>(
"checkpoint");
40 const bool user_requested_no_checkpoint =
41 user_specified_checkpoint_behavior && (getParam<bool>(
"checkpoint") ==
false);
43 if (num_checkpoints > 1)
44 checkpoints[0]->mooseError(
"Multiple Checkpoint objects are not allowed and there is more than "
45 "one Checkpoint defined in the 'Outputs' block.");
46 if (num_checkpoints == 1 && user_requested_checkpoint)
48 "Shortcut checkpoint syntax cannot be used with another Checkpoint object in the "
51 if (num_checkpoints == 0 &&
57 cp_params.
set<
bool>(
"_built_by_moose") =
true;
58 if (!user_requested_checkpoint)
61 cp_params.set<
unsigned int>(
"time_step_interval",
true) =
62 std::numeric_limits<unsigned int>::max();
64 _problem->addOutput(
"Checkpoint",
"checkpoint", cp_params);
registerMooseAction("MooseApp", AutoCheckpointAction, "auto_checkpoint_action")
static InputParameters validParams()
MooseApp & _app
The MOOSE application this is associated with.
std::shared_ptr< FEProblemBase > & _problem
Convenience reference to a problem this action works on.
AutoCheckpointAction(const InputParameters ¶ms)
virtual void act() override
Method to add objects to the simulation or perform other setup tasks.
static InputParameters validParams()
InputParameters getValidParams(const std::string &name) const
Get valid parameters for the object.
OutputWarehouse & getOutputWarehouse()
Get the OutputWarehouse objects.
bool isUltimateMaster() const
Whether or not this app is the ultimate master app.
bool testCheckpointHalfTransient() const
Whether or not this simulation should only run half its transient (useful for testing recovery)
void paramError(const std::string ¶m, Args... args) const
Emits an error prefixed with the file and line number of the given param (from the input file) along ...
bool isParamValid(const std::string &name) const
Test if the supplied parameter is valid.
std::vector< T * > getOutputs(const std::vector< OutputName > &names)
Return a vector of objects by names.
unsigned int _time_step_interval
The output time step interval.
Factory & _factory
The Factory associated with the MooseApp.