Skip to content
Permalink
Browse files

Merge pull request #13005 from YaqiWang/close_13004

Small interface improvement in ActionWarehouse::getActionListByName
  • Loading branch information...
permcody committed Mar 6, 2019
2 parents 9a12949 + 19dab88 commit a0a6ea07e4997c787b6fa93ecc5a5399d66b9206
@@ -99,6 +99,7 @@ class ActionWarehouse : public ConsoleStreamInterface

/**
* Retrieve a constant list of \p Action pointers associated with the passed in task.
* Empty list will be returned if no actions are associated with the task.
*/
const std::list<Action *> & getActionListByName(const std::string & task) const;

@@ -282,6 +283,8 @@ class ActionWarehouse : public ConsoleStreamInterface
std::string _final_task;

ActionIterator _act_iter;

const std::list<Action *> _empty_action_list;
};

#endif // ACTIONWAREHOUSE_H
@@ -189,9 +189,9 @@ ActionWarehouse::getActionListByName(const std::string & task) const
{
const auto it = _action_blocks.find(task);
if (it == _action_blocks.end())
mooseError("The task ", task, " does not exist.");

return it->second;
return _empty_action_list;
else
return it->second;
}

bool
@@ -41,27 +41,24 @@ CheckOutputAction::act()
void
CheckOutputAction::checkVariableOutput(const std::string & task)
{
if (_awh.hasActions(task))
// Loop through the actions for the given task
const auto & actions = _awh.getActionListByName(task);
for (const auto & act : actions)
{
// Loop through the actions for the given task
const auto & actions = _awh.getActionListByName(task);
for (const auto & act : actions)
{
// Cast the object to AddVariableAction so that that
// OutputInterface::buildOutputHideVariableList may be called
AddVariableAction * ptr = dynamic_cast<AddVariableAction *>(act);

// If the cast fails move to the next action, this is the case with NodalNormals which is also
// associated with
// the "add_aux_variable" task.
if (ptr == NULL)
continue;

// Create the hide list for the action
std::set<std::string> names_set;
names_set.insert(ptr->name());
ptr->buildOutputHideVariableList(names_set);
}
// Cast the object to AddVariableAction so that that
// OutputInterface::buildOutputHideVariableList may be called
AddVariableAction * ptr = dynamic_cast<AddVariableAction *>(act);

// If the cast fails move to the next action, this is the case with NodalNormals which is also
// associated with
// the "add_aux_variable" task.
if (ptr == NULL)
continue;

// Create the hide list for the action
std::set<std::string> names_set;
names_set.insert(ptr->name());
ptr->buildOutputHideVariableList(names_set);
}
}

0 comments on commit a0a6ea0

Please sign in to comment.
You can’t perform that action at this time.