www.mooseframework.org
SetupInterface.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* DO NOT MODIFY THIS HEADER */
3 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
4 /* */
5 /* (c) 2010 Battelle Energy Alliance, LLC */
6 /* ALL RIGHTS RESERVED */
7 /* */
8 /* Prepared by Battelle Energy Alliance, LLC */
9 /* Under Contract No. DE-AC07-05ID14517 */
10 /* With the U. S. Department of Energy */
11 /* */
12 /* See COPYRIGHT for full restrictions */
13 /****************************************************************/
14 
15 #include "SetupInterface.h"
16 #include "Conversion.h"
17 #include "FEProblem.h"
18 
19 template <>
22 {
24 
25  // Get an MooseEnum of the available 'execute_on' options
27 
28  // Add the 'execute_on' input parameter for users to set
29  params.addParam<MultiMooseEnum>("execute_on",
30  execute_options,
31  "Set to (nonlinear|linear|timestep_end|timestep_begin|custom) "
32  "to execute only at that moment");
33 
34  // The Output system uses different options for the 'execute_on' than other systems, therefore the
35  // check of the options
36  // cannot occur based on the 'execute_on' parameter, so this flag triggers the check
37  params.addPrivateParam<bool>("check_execute_on", true);
38 
39  return params;
40 }
41 
43  : _current_execute_flag(
44  (moose_object->parameters().getCheckedPointerParam<FEProblemBase *>("_fe_problem_base"))
45  ->getCurrentExecuteOnFlag())
46 {
47  const InputParameters & params = moose_object->parameters();
48 
56  if (params.have_parameter<bool>("check_execute_on") && params.get<bool>("check_execute_on"))
57  {
58  MultiMooseEnum flags = params.get<MultiMooseEnum>("execute_on");
60  }
61 
62  else
63  _exec_flags.push_back(EXEC_LINEAR);
64 }
65 
67 
68 void
70 {
71 }
72 
73 void
75 {
76 }
77 
78 void
80 {
81 }
82 
83 void
85 {
86 }
87 
88 void
90 {
91 }
92 
93 const std::vector<ExecFlagType> &
95 {
96  return _exec_flags;
97 }
98 
101 {
102  unsigned int exec_bit_field = EXEC_NONE;
103  for (unsigned int i = 0; i < _exec_flags.size(); ++i)
104  exec_bit_field |= _exec_flags[i];
105 
106  return static_cast<ExecFlagType>(exec_bit_field);
107 }
108 
111 {
112  return MultiMooseEnum("none=0x00 initial=0x01 linear=0x02 nonlinear=0x04 timestep_end=0x08 "
113  "timestep_begin=0x10 final=0x20 custom=0x100",
114  "linear");
115 }
Object is evaluated in every residual computation.
Definition: MooseTypes.h:96
virtual void subdomainSetup()
Gets called when the subdomain changes (i.e.
virtual const std::vector< ExecFlagType > & execFlags() const
Get the execution flag for the object.
void addPrivateParam(const std::string &name, const T &value)
These method add a parameter to the InputParameters object which can be retrieved like any other para...
InputParameters validParams< SetupInterface >()
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
virtual ~SetupInterface()
InputParameters emptyInputParameters()
ExecFlagType execBitFlags() const
Build and return the execution flags as a bitfield.
virtual void timestepSetup()
Gets called at the beginning of the timestep before this object is asked to do its job...
Every object that can be built by the factory should be derived from this class.
Definition: MooseObject.h:36
SetupInterface(const MooseObject *moose_object)
std::vector< ExecFlagType > _exec_flags
execution flag (when is the object executed/evaluated)
const InputParameters & parameters() const
Get the parameters of the object.
Definition: MooseObject.h:53
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...
ExecFlagType
Execution flags - when is the object executed/evaluated.
Definition: MooseTypes.h:90
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
static MultiMooseEnum getExecuteOptions()
Returns the available options for the &#39;execute_on&#39; input parameters.
virtual void initialSetup()
Gets called at the beginning of the simulation before this object is asked to do its job...
virtual void jacobianSetup()
Gets called just before the Jacobian is computed and before this object is asked to do its job...
virtual void residualSetup()
Gets called just before the residual is computed and before this object is asked to do its job...
std::vector< ExecFlagType > vectorStringsToEnum< ExecFlagType >(const MultiMooseEnum &v)
Definition: Conversion.C:356