www.mooseframework.org
SetupInterface.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #include "SetupInterface.h"
11 #include "Conversion.h"
12 #include "FEProblem.h"
13 
15 
18 {
19 
21 
22  // Add the 'execute_on' input parameter for users to set
24  execute_options = EXEC_LINEAR;
25  params.addParam<ExecFlagEnum>("execute_on", execute_options, execute_options.getDocString());
26  return params;
27 }
28 
30  : _execute_enum(moose_object->parameters().isParamValid("execute_on")
31  ? moose_object->parameters().get<ExecFlagEnum>("execute_on")
32  : _empty_execute_enum),
33  _exec_flags(_execute_enum.begin(), _execute_enum.end()), // deprecated TODO: ExecFlagType
34  _current_execute_flag(
35  (moose_object->parameters().getCheckedPointerParam<FEProblemBase *>("_fe_problem_base"))
36  ->getCurrentExecuteOnFlag())
37 {
38  _empty_execute_enum.clear(); // remove any flags for the case when "execute_on" is not used
39 }
40 
42 
43 void
45 {
46 }
47 
48 void
50 {
51 }
52 
53 void
55 {
56 }
57 
58 void
60 {
61 }
62 
63 void
65 {
66 }
67 
68 const ExecFlagEnum &
70 {
71  return _execute_enum;
72 }
73 
74 const std::vector<ExecFlagType> &
76 {
77  // TODO: ExecFlagType
78  mooseDeprecated("The execFlags() method is being removed because MOOSE has been updated to use a "
79  "ExecFlagEnum for execute flags. The current flags should be retrieved from "
80  "the \"exeucte_on\" parameters of your object or by using the \"_execute_enum\" "
81  "reference to the parameter or the getExecuteOnEnum() method.");
82 
83  return _exec_flags;
84 }
85 
88 {
89  // TODO: ExecFlagType
90  mooseDeprecated("The execBitFlags method is being removed because MOOSE was updated to use a "
91  "ExecFlagEnum for execute flags. This method maintains the behavior of the "
92  "original method but the use of this method should be removed from your "
93  "application. The ExecFlagEnum should be inspected directly via the "
94  "getExecuteOnEnum() method.");
95 
96  unsigned int exec_bit_field = EXEC_NONE;
97  for (const auto & flag : _exec_flags)
98  exec_bit_field |= flag.id();
99  return ExecFlagType("deprecated", exec_bit_field);
100 }
101 
104 {
105  // TODO: ExecFlagType
106  ::mooseDeprecated("The 'getExecuteOptions' was replaced by the ExecFlagEnum class because MOOSE "
107  "was updated to use this for the execute flags and the new function provides "
108  "additional arguments for modification of the enum.");
110 }
SetupInterface::subdomainSetup
virtual void subdomainSetup()
Gets called when the subdomain changes (i.e.
Definition: SetupInterface.C:64
defineLegacyParams
defineLegacyParams(SetupInterface)
SetupInterface
Definition: SetupInterface.h:28
FEProblem.h
SetupInterface::validParams
static InputParameters validParams()
Definition: SetupInterface.C:17
MooseEnumItem::id
const int & id() const
Return the numeric, name, or raw name.
Definition: MooseEnumItem.h:36
emptyInputParameters
InputParameters emptyInputParameters()
Definition: InputParameters.C:24
InputParameters::addParam
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an option parameter and a documentation string to the InputParameters object.
Definition: InputParameters.h:1198
SetupInterface.h
EXEC_LINEAR
const ExecFlagType EXEC_LINEAR
EXEC_NONE
const ExecFlagType EXEC_NONE
MooseObject
Every object that can be built by the factory should be derived from this class.
Definition: MooseObject.h:50
SetupInterface::execFlags
virtual const std::vector< ExecFlagType > & execFlags() const
(DEPRECATED) Get the execution flag for the object TODO: ExecFlagType
Definition: SetupInterface.C:75
InputParameters
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
Definition: InputParameters.h:53
SetupInterface::getExecuteOnEnum
const ExecFlagEnum & getExecuteOnEnum() const
Return the execute on MultiMooseEnum for this object.
Definition: SetupInterface.C:69
SetupInterface::timestepSetup
virtual void timestepSetup()
Gets called at the beginning of the timestep before this object is asked to do its job.
Definition: SetupInterface.C:49
SetupInterface::jacobianSetup
virtual void jacobianSetup()
Gets called just before the Jacobian is computed and before this object is asked to do its job.
Definition: SetupInterface.C:54
SetupInterface::~SetupInterface
virtual ~SetupInterface()
Definition: SetupInterface.C:41
SetupInterface::residualSetup
virtual void residualSetup()
Gets called just before the residual is computed and before this object is asked to do its job.
Definition: SetupInterface.C:59
mooseDeprecated
void mooseDeprecated(Args &&... args)
Emit a deprecated code/feature message with the given stringified, concatenated args.
Definition: MooseError.h:239
MooseEnumItem
Class for containing MooseEnum item information.
Definition: MooseEnumItem.h:21
SetupInterface::_exec_flags
const std::vector< ExecFlagType > _exec_flags
(DEPRECATED) execution flag (when is the object executed/evaluated) TODO: ExecFlagType
Definition: SetupInterface.h:96
SetupInterface::SetupInterface
SetupInterface(const MooseObject *moose_object)
Definition: SetupInterface.C:29
SetupInterface::getExecuteOptions
static ExecFlagEnum getExecuteOptions()
(DEPRECATED) Returns the available options for the 'execute_on' input parameters TODO: ExecFlagType
Definition: SetupInterface.C:103
Conversion.h
SetupInterface::execBitFlags
ExecFlagType execBitFlags() const
(DEPRECATED) Build and return the execution flags as a bitfield TODO: ExecFlagType
Definition: SetupInterface.C:87
SetupInterface::_empty_execute_enum
ExecFlagEnum _empty_execute_enum
Empty ExecFlagEnum for the case when the "execute_on" parameter is not included.
Definition: SetupInterface.h:89
FEProblemBase
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
Definition: FEProblemBase.h:139
ExecFlagEnum
A MultiMooseEnum object to hold "execute_on" flags.
Definition: ExecFlagEnum.h:24
SetupInterface::initialSetup
virtual void initialSetup()
Gets called at the beginning of the simulation before this object is asked to do its job.
Definition: SetupInterface.C:44
MultiMooseEnum::clear
void clear()
Clear the MultiMooseEnum.
Definition: MultiMooseEnum.C:227
ExecFlagType
MooseEnumItem ExecFlagType
Definition: Moose.h:99
MooseUtils::getDefaultExecFlagEnum
ExecFlagEnum getDefaultExecFlagEnum()
Return the default ExecFlagEnum for MOOSE.
Definition: MooseUtils.C:685
SetupInterface::_execute_enum
const ExecFlagEnum & _execute_enum
Execute settings for this oejct.
Definition: SetupInterface.h:93
ExecFlagEnum::getDocString
std::string getDocString() const
Generate a documentation string for the "execute_on" parameter.
Definition: ExecFlagEnum.C:39