www.mooseframework.org
Public Member Functions | Public Attributes | Protected Attributes | Private Member Functions | List of all members
SetupMeshAction Class Reference

#include <SetupMeshAction.h>

Inheritance diagram for SetupMeshAction:
[legend]

Public Member Functions

 SetupMeshAction (InputParameters params)
 
virtual void act () override
 
InputParametersgetObjectParams ()
 Retreive the parameters of the object to be created by this action. More...
 
const std::string & getMooseObjectType () const
 Return the object type to be created. More...
 
const std::string & name () const
 The name of the action. More...
 
const std::string & type () const
 
InputParametersparameters ()
 
const InputParametersparameters () const
 
const std::string & specificTaskName () const
 
const std::set< std::string > & getAllTasks () const
 
bool isParamValid (const std::string &name) const
 
void appendTask (const std::string &task)
 
std::string getBaseName () const
 Deprecated name methods, use name() More...
 
std::string getShortName () const
 DEPRECATED METHODS. More...
 
template<typename T >
const T & getParam (const std::string &name) const
 Retrieve a parameter for the object. More...
 

Public Attributes

const ConsoleStream _console
 An instance of helper class to write streams to the Console objects. More...
 

Protected Attributes

std::string _type
 The Object type that is being created. More...
 
InputParameters _moose_object_pars
 The parameters for the object to be created. More...
 
InputParameters _pars
 Input parameters for the action. More...
 
std::string _registered_identifier
 
std::string _name
 The name of the action. More...
 
std::string _action_type
 
MooseApp_app
 The MOOSE application this is associated with. More...
 
Factory_factory
 The Factory associated with the MooseApp. More...
 
ActionFactory_action_factory
 Builds Actions. More...
 
std::string _specific_task_name
 This member will only be populated if this Action instance is only designed to handle one task. More...
 
std::set< std::string > _all_tasks
 A list of all the tasks that this Action will satisfy. More...
 
ActionWarehouse_awh
 Reference to ActionWarehouse where we store object build by actions. More...
 
const std::string & _current_task
 The current action (even though we have seperate instances for each action) More...
 
std::shared_ptr< MooseMesh > & _mesh
 
std::shared_ptr< MooseMesh > & _displaced_mesh
 
std::shared_ptr< FEProblemBase > & _problem
 Convenience reference to a problem this action works on. More...
 
std::shared_ptr< Executioner > & _executioner
 Convenience reference to an executioner. More...
 

Private Member Functions

void setupMesh (MooseMesh *mesh)
 

Detailed Description

Definition at line 27 of file SetupMeshAction.h.

Constructor & Destructor Documentation

SetupMeshAction::SetupMeshAction ( InputParameters  params)

Definition at line 81 of file SetupMeshAction.C.

81 : MooseObjectAction(params) {}
MooseObjectAction(InputParameters params)

Member Function Documentation

void SetupMeshAction::act ( )
overridevirtual

Implements Action.

Definition at line 158 of file SetupMeshAction.C.

159 {
160  // Create the mesh object and tell it to build itself
161  if (_current_task == "setup_mesh")
162  {
164  if (isParamValid("displacements"))
165  _displaced_mesh = _factory.create<MooseMesh>(_type, "displaced_mesh", _moose_object_pars);
166  }
167  else if (_current_task == "init_mesh")
168  {
169  _mesh->init();
170 
171  if (isParamValid("displacements"))
172  {
173  // Initialize the displaced mesh
174  _displaced_mesh->init();
175 
176  std::vector<std::string> displacements = getParam<std::vector<std::string>>("displacements");
177  if (displacements.size() < _displaced_mesh->dimension())
178  mooseError(
179  "Number of displacements must be greater than or equal to the dimension of the mesh!");
180  }
181 
182  setupMesh(_mesh.get());
183 
184  if (_displaced_mesh)
185  setupMesh(_displaced_mesh.get());
186  }
187 }
std::shared_ptr< MooseObject > create(const std::string &obj_name, const std::string &name, InputParameters parameters, THREAD_ID tid=0, bool print_deprecated=true)
Build an object (must be registered) - THIS METHOD IS DEPRECATED (Use create<T>()) ...
Definition: Factory.C:46
void mooseError(Args &&...args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:182
Factory & _factory
The Factory associated with the MooseApp.
Definition: Action.h:101
std::shared_ptr< MooseMesh > & _displaced_mesh
Definition: Action.h:128
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
Definition: MooseMesh.h:74
const std::string & _current_task
The current action (even though we have seperate instances for each action)
Definition: Action.h:125
void setupMesh(MooseMesh *mesh)
bool isParamValid(const std::string &name) const
Definition: Action.h:80
std::shared_ptr< MooseMesh > & _mesh
Definition: Action.h:127
std::string _type
The Object type that is being created.
InputParameters _moose_object_pars
The parameters for the object to be created.
void Action::appendTask ( const std::string &  task)
inlineinherited

Definition at line 82 of file Action.h.

82 { _all_tasks.insert(task); }
std::set< std::string > _all_tasks
A list of all the tasks that this Action will satisfy.
Definition: Action.h:119
const std::set<std::string>& Action::getAllTasks ( ) const
inlineinherited

Definition at line 68 of file Action.h.

Referenced by AddKernelAction::act().

68 { return _all_tasks; }
std::set< std::string > _all_tasks
A list of all the tasks that this Action will satisfy.
Definition: Action.h:119
std::string Action::getBaseName ( ) const
inherited

Deprecated name methods, use name()

Definition at line 82 of file Action.C.

Referenced by Action::name().

83 {
84  mooseDeprecated("getBaseName() is deprecated.");
86 }
void mooseDeprecated(Args &&...args)
Emit a deprecated code/feature message with the given stringified, concatenated args.
Definition: MooseError.h:202
std::string _name
The name of the action.
Definition: Action.h:92
std::string baseName(const std::string &name)
Function for string the information before the final / in a parser block.
Definition: MooseUtils.C:331
const std::string& MooseObjectAction::getMooseObjectType ( ) const
inlineinherited

Return the object type to be created.

Definition at line 40 of file MooseObjectAction.h.

Referenced by CommonOutputAction::hasConsole().

40 { return _type; }
std::string _type
The Object type that is being created.
InputParameters& MooseObjectAction::getObjectParams ( )
inlineinherited

Retreive the parameters of the object to be created by this action.

Definition at line 35 of file MooseObjectAction.h.

Referenced by SetupDebugAction::act(), MaterialOutputAction::buildMaterialOutputObjects(), CommonOutputAction::create(), AddVariableAction::createInitialConditionAction(), MooseApp::getCheckpointFiles(), CommonOutputAction::hasConsole(), and ActionWarehouse::printInputFile().

35 { return _moose_object_pars; }
InputParameters _moose_object_pars
The parameters for the object to be created.
template<typename T >
const T & Action::getParam ( const std::string &  name) const
inherited

Retrieve a parameter for the object.

Parameters
nameThe name of the parameter
Returns
The value of the parameter

Definition at line 139 of file Action.h.

Referenced by CreateDisplacedProblemAction::act(), AddPeriodicBCAction::act(), AddPeriodicBCAction::autoTranslationBoundaries(), DynamicObjectRegistrationAction::DynamicObjectRegistrationAction(), Action::getAllTasks(), and MooseApp::getCheckpointFiles().

140 {
141  return InputParameters::getParamHelper(name, _pars, static_cast<T *>(0));
142 }
static const T & getParamHelper(const std::string &name, const InputParameters &pars, const T *the_type)
InputParameters _pars
Input parameters for the action.
Definition: Action.h:86
const std::string & name() const
The name of the action.
Definition: Action.h:51
std::string Action::getShortName ( ) const
inherited

DEPRECATED METHODS.

Definition at line 75 of file Action.C.

Referenced by Action::name().

76 {
77  mooseDeprecated("getShortName() is deprecated.");
79 }
void mooseDeprecated(Args &&...args)
Emit a deprecated code/feature message with the given stringified, concatenated args.
Definition: MooseError.h:202
std::string shortName(const std::string &name)
Function for stripping name after the file / in parser block.
Definition: MooseUtils.C:325
std::string _name
The name of the action.
Definition: Action.h:92
bool Action::isParamValid ( const std::string &  name) const
inlineinherited

Definition at line 80 of file Action.h.

Referenced by CopyNodalVarsAction::act(), SetAdaptivityOptionsAction::act(), CreateProblemAction::act(), act(), CreateDisplacedProblemAction::act(), AddAuxVariableAction::act(), AddVariableAction::act(), AddVariableAction::addVariable(), AddPeriodicBCAction::autoTranslationBoundaries(), DynamicObjectRegistrationAction::DynamicObjectRegistrationAction(), and setupMesh().

80 { return _pars.isParamValid(name); }
bool isParamValid(const std::string &name) const
This method returns parameters that have been initialized in one fashion or another, i.e.
InputParameters _pars
Input parameters for the action.
Definition: Action.h:86
const std::string & name() const
The name of the action.
Definition: Action.h:51
const std::string& Action::name ( ) const
inlineinherited
InputParameters& Action::parameters ( )
inlineinherited

Definition at line 63 of file Action.h.

Referenced by GlobalParamsAction::remove(), GlobalParamsAction::setDoubleIndexParam(), GlobalParamsAction::setScalarParam(), and GlobalParamsAction::setVectorParam().

63 { return _pars; }
InputParameters _pars
Input parameters for the action.
Definition: Action.h:86
const InputParameters& Action::parameters ( ) const
inlineinherited

Definition at line 64 of file Action.h.

64 { return _pars; }
InputParameters _pars
Input parameters for the action.
Definition: Action.h:86
void SetupMeshAction::setupMesh ( MooseMesh mesh)
private

Definition at line 84 of file SetupMeshAction.C.

Referenced by act().

85 {
86  std::vector<BoundaryName> ghosted_boundaries =
87  getParam<std::vector<BoundaryName>>("ghosted_boundaries");
88 
89  for (const auto & bnd_name : ghosted_boundaries)
90  mesh->addGhostedBoundary(mesh->getBoundaryID(bnd_name));
91 
92  if (isParamValid("ghosted_boundaries_inflation"))
93  {
94  std::vector<Real> ghosted_boundaries_inflation =
95  getParam<std::vector<Real>>("ghosted_boundaries_inflation");
96  mesh->setGhostedBoundaryInflation(ghosted_boundaries_inflation);
97  }
98 
99  mesh->ghostGhostedBoundaries();
100 
101  if (getParam<bool>("second_order"))
102  mesh->getMesh().all_second_order(true);
103 
104 #ifdef LIBMESH_ENABLE_AMR
105  unsigned int level = getParam<unsigned int>("uniform_refine");
106 
107  // Did they specify extra refinement levels on the command-line?
108  level += _app.getParam<unsigned int>("refinements");
109 
110  mesh->setUniformRefineLevel(level);
111 #endif // LIBMESH_ENABLE_AMR
112 
113  // Add entity names to the mesh
114  if (_pars.isParamValid("block_id") && _pars.isParamValid("block_name"))
115  {
116  std::vector<SubdomainID> ids = getParam<std::vector<SubdomainID>>("block_id");
117  std::vector<SubdomainName> names = getParam<std::vector<SubdomainName>>("block_name");
118  std::set<SubdomainName> seen_it;
119 
120  if (ids.size() != names.size())
121  mooseError("You must supply the same number of block ids and names parameters");
122 
123  for (unsigned int i = 0; i < ids.size(); ++i)
124  {
125  if (seen_it.find(names[i]) != seen_it.end())
126  mooseError("The following dynamic block name is not unique: " + names[i]);
127  seen_it.insert(names[i]);
128  mesh->setSubdomainName(ids[i], names[i]);
129  }
130  }
131  if (_pars.isParamValid("boundary_id") && _pars.isParamValid("boundary_name"))
132  {
133  std::vector<BoundaryID> ids = getParam<std::vector<BoundaryID>>("boundary_id");
134  std::vector<BoundaryName> names = getParam<std::vector<BoundaryName>>("boundary_name");
135  std::set<SubdomainName> seen_it;
136 
137  if (ids.size() != names.size())
138  mooseError("You must supply the same number of boundary ids and names parameters");
139 
140  for (unsigned int i = 0; i < ids.size(); ++i)
141  {
142  if (seen_it.find(names[i]) != seen_it.end())
143  mooseError("The following dynamic boundary name is not unique: " + names[i]);
144  mesh->setBoundaryName(ids[i], names[i]);
145  seen_it.insert(names[i]);
146  }
147  }
148 
149  if (getParam<bool>("construct_side_list_from_node_list"))
150  mesh->getMesh().get_boundary_info().build_side_list_from_node_list();
151 
152  // Here we can override the partitioning for special cases
153  if (getParam<bool>("skip_partitioning"))
154  mesh->getMesh().skip_partitioning(getParam<bool>("skip_partitioning"));
155 }
void mooseError(Args &&...args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:182
BoundaryID getBoundaryID(const BoundaryName &boundary_name) const
Get the associated BoundaryID for the boundary name.
Definition: MooseMesh.C:929
bool isParamValid(const std::string &name) const
This method returns parameters that have been initialized in one fashion or another, i.e.
InputParameters _pars
Input parameters for the action.
Definition: Action.h:86
MeshBase & getMesh()
Accessor for the underlying libMesh Mesh object.
Definition: MooseMesh.C:2355
void setSubdomainName(SubdomainID subdomain_id, SubdomainName name)
This method returns a writable reference to a subdomain name based on the id parameter.
Definition: MooseMesh.C:1040
bool isParamValid(const std::string &name) const
Definition: Action.h:80
void setBoundaryName(BoundaryID boundary_id, BoundaryName name)
This method returns a writable reference to a boundary name based on the id parameter.
Definition: MooseMesh.C:1052
const T & getParam(const std::string &name)
Retrieve a parameter for the object.
Definition: MooseApp.h:738
void setGhostedBoundaryInflation(const std::vector< Real > &inflation)
This sets the inflation amount for the bounding box for each partition for use in ghosting boundaries...
Definition: MooseMesh.C:2167
void addGhostedBoundary(BoundaryID boundary_id)
This will add the boundary ids to be ghosted to this processor.
Definition: MooseMesh.C:2161
void ghostGhostedBoundaries()
Actually do the ghosting of boundaries that need to be ghosted to this processor. ...
Definition: MooseMesh.C:2243
MooseApp & _app
The MOOSE application this is associated with.
Definition: Action.h:98
void setUniformRefineLevel(unsigned int)
Set uniform refinement level.
Definition: MooseMesh.C:2155
const std::string& Action::specificTaskName ( ) const
inlineinherited

Definition at line 66 of file Action.h.

66 { return _specific_task_name; }
std::string _specific_task_name
This member will only be populated if this Action instance is only designed to handle one task...
Definition: Action.h:112
const std::string& Action::type ( ) const
inlineinherited

Definition at line 61 of file Action.h.

Referenced by CommonOutputAction::hasConsole().

61 { return _action_type; }
std::string _action_type
Definition: Action.h:95

Member Data Documentation

ActionFactory& Action::_action_factory
protectedinherited
std::string Action::_action_type
protectedinherited

Definition at line 95 of file Action.h.

Referenced by Action::type().

std::set<std::string> Action::_all_tasks
protectedinherited

A list of all the tasks that this Action will satisfy.

Note: That this is not populated at construction time. However, all tasks will be added prior to act().

Definition at line 119 of file Action.h.

Referenced by Action::appendTask(), and Action::getAllTasks().

MooseApp& Action::_app
protectedinherited
ActionWarehouse& Action::_awh
protectedinherited
const ConsoleStream ConsoleStreamInterface::_console
inherited

An instance of helper class to write streams to the Console objects.

Definition at line 37 of file ConsoleStreamInterface.h.

Referenced by IterationAdaptiveDT::acceptStep(), CreateProblemAction::act(), SetupRecoverFileBaseAction::act(), Adaptivity::adaptMesh(), FEProblemBase::adaptMesh(), FEProblemBase::advanceMultiApps(), SimplePredictor::apply(), FEProblemBase::backupMultiApps(), FEProblemBase::checkProblemIntegrity(), IterationAdaptiveDT::computeAdaptiveDT(), Transient::computeConstrainedDT(), NonlinearSystemBase::computeDamping(), IterationAdaptiveDT::computeDT(), IterationAdaptiveDT::computeFailedDT(), IterationAdaptiveDT::computeInterpolationDT(), FEProblemBase::computeResidualType(), IterationAdaptiveDT::constrainStep(), TimeStepper::constrainStep(), AB2PredictorCorrector::converged(), FEProblemBase::execMultiApps(), FEProblemBase::execMultiAppTransfers(), MultiAppPostprocessorTransfer::execute(), MultiAppPostprocessorInterpolationTransfer::execute(), MultiAppVariableValueSamplePostprocessorTransfer::execute(), MultiAppNearestNodeTransfer::execute(), MultiAppPostprocessorToAuxScalarTransfer::execute(), MultiAppScalarToAuxScalarTransfer::execute(), MultiAppVariableValueSampleTransfer::execute(), MultiAppUserObjectTransfer::execute(), MultiAppInterpolationTransfer::execute(), MultiAppMeshFunctionTransfer::execute(), MultiAppProjectionTransfer::execute(), MultiAppCopyTransfer::execute(), Steady::execute(), MultiAppDTKUserObjectTransfer::execute(), ActionWarehouse::executeActionsWithAction(), ActionWarehouse::executeAllActions(), MultiApp::globalAppToLocal(), InversePowerMethod::init(), NonlinearEigen::init(), Steady::init(), FEProblemBase::initialAdaptMesh(), FEProblemBase::initialSetup(), EigenExecutionerBase::inversePowerIteration(), Transient::keepGoing(), IterationAdaptiveDT::limitDTByFunction(), IterationAdaptiveDT::limitDTToPostprocessorValue(), EigenExecutionerBase::makeBXConsistent(), Console::meshChanged(), MooseObject::mooseDeprecated(), MooseObject::mooseInfo(), MooseObject::mooseWarning(), DOFMapOutput::output(), VariableResidualNormsDebugOutput::output(), Console::output(), ControlOutput::outputActiveObjects(), ControlOutput::outputChangedControls(), ControlOutput::outputControls(), Console::outputInput(), Console::outputPostprocessors(), Console::outputScalarVariables(), Console::outputSystemInformation(), FEProblemBase::possiblyRebuildGeomSearchPatches(), EigenExecutionerBase::postExecute(), ActionWarehouse::printActionDependencySets(), EigenExecutionerBase::printEigenvalue(), MaterialPropertyDebugOutput::printMaterialMap(), SolutionTimeAdaptiveDT::rejectStep(), DT2::rejectStep(), FEProblemBase::restoreMultiApps(), SimplePredictor::shouldApply(), NonlinearSystem::solve(), LStableDirk2::solve(), LStableDirk3::solve(), ImplicitMidpoint::solve(), ExplicitTVDRK2::solve(), AStableDirk4::solve(), LStableDirk4::solve(), ExplicitRK2::solve(), TransientMultiApp::solveStep(), Transient::solveStep(), DT2::step(), AB2PredictorCorrector::step(), NonlinearEigen::takeStep(), FEProblemBase::useFECache(), Console::writeTimestepInformation(), Console::writeVariableNorms(), and FEProblemBase::~FEProblemBase().

const std::string& Action::_current_task
protectedinherited

The current action (even though we have seperate instances for each action)

Definition at line 125 of file Action.h.

Referenced by AddKernelAction::act(), CopyNodalVarsAction::act(), AddScalarKernelAction::act(), act(), SetupMeshCompleteAction::act(), MaterialDerivativeTestAction::act(), and AddNodalNormalsAction::act().

std::shared_ptr<MooseMesh>& Action::_displaced_mesh
protectedinherited
std::shared_ptr<Executioner>& Action::_executioner
protectedinherited

Convenience reference to an executioner.

Definition at line 134 of file Action.h.

Referenced by SetupPredictorAction::act(), and SetupTimeStepperAction::act().

Factory& Action::_factory
protectedinherited
std::shared_ptr<MooseMesh>& Action::_mesh
protectedinherited
InputParameters MooseObjectAction::_moose_object_pars
protectedinherited
std::string Action::_name
protectedinherited
InputParameters Action::_pars
protectedinherited
std::shared_ptr<FEProblemBase>& Action::_problem
protectedinherited

Convenience reference to a problem this action works on.

Definition at line 131 of file Action.h.

Referenced by AddBCAction::act(), AddBoundsVectorsAction::act(), AddInitialConditionAction::act(), AddDiracKernelAction::act(), SetAdaptivityOptionsAction::act(), CreateExecutionerAction::act(), AddConstraintAction::act(), AddMultiAppAction::act(), AddDamperAction::act(), CheckIntegrityAction::act(), CopyNodalVarsAction::act(), SetupDampersAction::act(), AddNodalKernelAction::act(), AddIndicatorAction::act(), AddElementalFieldAction::act(), AddUserObjectAction::act(), AddDGKernelAction::act(), AddInterfaceKernelAction::act(), InitProblemAction::act(), AddPostprocessorAction::act(), AddTransferAction::act(), AddMarkerAction::act(), AddMaterialAction::act(), AddVectorPostprocessorAction::act(), AddScalarKernelAction::act(), AddICAction::act(), AddKernelAction::act(), AddFieldSplitAction::act(), CreateProblemAction::act(), AdaptivityAction::act(), AddFunctionAction::act(), SetupTimeIntegratorAction::act(), SetupTimeStepperAction::act(), CreateDisplacedProblemAction::act(), AddDistributionAction::act(), SetupPreconditionerAction::act(), SetupPredictorAction::act(), SetupResidualDebugAction::act(), MaterialDerivativeTestAction::act(), SetupQuadratureAction::act(), AddSamplerAction::act(), AddAuxVariableAction::act(), AddOutputAction::act(), AddPeriodicBCAction::act(), AddControlAction::act(), MaterialOutputAction::act(), SetupPostprocessorDataAction::act(), AddNodalNormalsAction::act(), AddVariableAction::addVariable(), AddPeriodicBCAction::autoTranslationBoundaries(), CheckOutputAction::checkMaterialOutput(), AddVariableAction::getSubdomainIDs(), and AddPeriodicBCAction::setPeriodicVars().

std::string Action::_registered_identifier
protectedinherited

Definition at line 89 of file Action.h.

std::string Action::_specific_task_name
protectedinherited

This member will only be populated if this Action instance is only designed to handle one task.

This happens when an Action is registered with several pieces of syntax in which case separate instances are built to handle the different incoming parameter values.

Definition at line 112 of file Action.h.

Referenced by Action::specificTaskName().

std::string MooseObjectAction::_type
protectedinherited

The documentation for this class was generated from the following files: