Line data Source code
1 : //* This file is part of the MOOSE framework 2 : //* https://mooseframework.inl.gov 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 "CreateMeshSetupActionsForComponents.h" 11 : #include "ActionWarehouse.h" 12 : #include "ActionFactory.h" 13 : #include "MooseObjectAction.h" 14 : 15 : registerMooseAction("MooseApp", CreateMeshSetupActionsForComponents, "meta_action_component"); 16 : 17 : InputParameters 18 312 : CreateMeshSetupActionsForComponents::validParams() 19 : { 20 312 : InputParameters params = Action::validParams(); 21 312 : params.addClassDescription( 22 : "Adds the SetupMesh-Actions to the simulation, if they are not created by the [Mesh] block."); 23 : 24 312 : return params; 25 0 : } 26 : 27 108 : CreateMeshSetupActionsForComponents::CreateMeshSetupActionsForComponents( 28 108 : const InputParameters & params) 29 108 : : Action(params) 30 : { 31 108 : } 32 : 33 : void 34 100 : CreateMeshSetupActionsForComponents::act() 35 : { 36 100 : if (_current_task == "meta_action_component") 37 : { 38 : // Create a default SetupMeshAction. If the user wants to use Mesh parameters, then 39 : // they must create a Mesh block in their input 40 : 41 : // Simulation already has a Mesh block, no need 42 100 : if (_awh.hasActions("setup_mesh") && _awh.hasActions("init_mesh")) 43 80 : return; 44 : 45 : // Build action parameters 46 20 : InputParameters action_params = _action_factory.getValidParams("SetupMeshAction"); 47 : 48 : // Build action and add it to the warehouse 49 : std::shared_ptr<MooseObjectAction> action = std::static_pointer_cast<MooseObjectAction>( 50 20 : _action_factory.create("SetupMeshAction", "Mesh", action_params)); 51 20 : _awh.addActionBlock(action); 52 : 53 : // Create a default SetupMeshCompleteAction 54 40 : action = std::static_pointer_cast<MooseObjectAction>( 55 60 : _action_factory.create("SetupMeshCompleteAction", "Mesh", action_params)); 56 20 : _awh.addActionBlock(action); 57 20 : } 58 : else 59 : mooseAssert(true, "Should not reach here"); 60 : }