Skip to content

Commit

Permalink
Use UserObjectInterface methods with error checking
Browse files Browse the repository at this point in the history
  • Loading branch information
loganharbour committed Apr 7, 2021
1 parent 039b121 commit 4040c34
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
14 changes: 9 additions & 5 deletions framework/include/ics/InitialConditionBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,13 @@ class InitialConditionBase : public MooseObject,
/**
* reimplements the getUserObject method from UserObjectInterface
*/
template <typename T2>
const T2 & getUserObject(const std::string & name);
template <typename T>
const T & getUserObject(const std::string & name) const;
/**
* reimplements the getUserObjectByName method from UserObjectInterface
*/
template <typename T2>
const T2 & getUserObjectByName(const UserObjectName & name);
template <typename T>
const T & getUserObjectByName(const UserObjectName & name) const;

/**
* reimplements the getUserObjectBase method from UserObjectInterface
Expand All @@ -112,6 +112,10 @@ class InitialConditionBase : public MooseObject,
/// The system object
SystemBase & _sys;

/// If set, UOs retrieved by this IC will not be executed before this IC
const bool _ignore_uo_dependency;

private:
/// Dependent variables
std::set<std::string> _depend_vars;
/// Supplied variables
Expand All @@ -126,7 +130,7 @@ const T &
InitialConditionBase::getUserObject(const std::string & name) const
{
if (!_ignore_uo_dependency)
_depend_uo.insert(_pars.get<UserObjectName>(name));
_depend_uo.insert(getUserObjectName(name));
return UserObjectInterface::getUserObject<T>(name);
}

Expand Down
2 changes: 1 addition & 1 deletion framework/src/ics/InitialConditionBase.C
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,6 @@ const UserObject &
InitialConditionBase::getUserObjectBase(const std::string & name) const
{
if (!_ignore_uo_dependency)
_depend_uo.insert(_pars.get<UserObjectName>(name));
_depend_uo.insert(getUserObjectName(name));
return UserObjectInterface::getUserObjectBase(name);
}

0 comments on commit 4040c34

Please sign in to comment.