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

Interface for objects that need to use UserObjects. More...

#include <UserObjectInterface.h>

Inheritance diagram for UserObjectInterface:
[legend]

Public Member Functions

 UserObjectInterface (const MooseObject *moose_object)
 
template<class T >
const T & getUserObject (const std::string &name)
 Get an user object with a given parameter name. More...
 
template<class T >
const T & getUserObjectByName (const std::string &name)
 Get an user object with a given name. More...
 
const UserObjectgetUserObjectBase (const std::string &name)
 Get an user object with a given parameter name. More...
 
const UserObjectgetUserObjectBaseByName (const std::string &name)
 Get an user object with a given name. More...
 

Private Member Functions

bool isDiscreteUserObject (const UserObject &uo) const
 Check if the user object is a DiscreteElementUserObject. More...
 

Private Attributes

const InputParameters_uoi_params
 Parameters of the object with this interface. More...
 
FEProblemBase_uoi_feproblem
 Reference to the FEProblemBase instance. More...
 
THREAD_ID _uoi_tid
 Thread ID. More...
 

Detailed Description

Interface for objects that need to use UserObjects.

Definition at line 28 of file UserObjectInterface.h.

Constructor & Destructor Documentation

UserObjectInterface::UserObjectInterface ( const MooseObject moose_object)
Parameters
paramsThe parameters used by the object being instantiated. This class needs them so it can get the user object named in the input file, but the object calling getUserObject only needs to use the name on the left hand side of the statement "user_object = user_object_name"

Definition at line 20 of file UserObjectInterface.C.

21  : _uoi_params(moose_object->parameters()),
22  _uoi_feproblem(*_uoi_params.get<FEProblemBase *>("_fe_problem_base")),
23  _uoi_tid(_uoi_params.have_parameter<THREAD_ID>("_tid") ? _uoi_params.get<THREAD_ID>("_tid") : 0)
24 {
25 }
const InputParameters & _uoi_params
Parameters of the object with this interface.
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
FEProblemBase & _uoi_feproblem
Reference to the FEProblemBase instance.
THREAD_ID _uoi_tid
Thread ID.
const InputParameters & parameters() const
Get the parameters of the object.
Definition: MooseObject.h:53
unsigned int THREAD_ID
Definition: MooseTypes.h:79

Member Function Documentation

template<class T >
const T & UserObjectInterface::getUserObject ( const std::string &  name)

Get an user object with a given parameter name.

Parameters
nameThe name of the parameter key of the user object to retrieve
Returns
The user object with name associated with the parameter 'name'

Definition at line 85 of file UserObjectInterface.h.

86 {
87  unsigned int tid = isDiscreteUserObject(getUserObjectBase(name)) ? _uoi_tid : 0;
88  return _uoi_feproblem.getUserObject<T>(_uoi_params.get<UserObjectName>(name), tid);
89 }
bool isDiscreteUserObject(const UserObject &uo) const
Check if the user object is a DiscreteElementUserObject.
const InputParameters & _uoi_params
Parameters of the object with this interface.
FEProblemBase & _uoi_feproblem
Reference to the FEProblemBase instance.
THREAD_ID _uoi_tid
Thread ID.
const T & getUserObject(const std::string &name, unsigned int tid=0)
Get the user object by its name.
const UserObject & getUserObjectBase(const std::string &name)
Get an user object with a given parameter name.
const UserObject & UserObjectInterface::getUserObjectBase ( const std::string &  name)

Get an user object with a given parameter name.

Parameters
nameThe name of the parameter key of the user object to retrieve
Returns
The user object with name associated with the parameter 'name'

Definition at line 28 of file UserObjectInterface.C.

Referenced by getUserObject(), InitialCondition::getUserObjectBase(), and AuxKernel::getUserObjectBase().

29 {
30  return _uoi_feproblem.getUserObjectBase(_uoi_params.get<UserObjectName>(name));
31 }
const InputParameters & _uoi_params
Parameters of the object with this interface.
FEProblemBase & _uoi_feproblem
Reference to the FEProblemBase instance.
const UserObject & getUserObjectBase(const std::string &name)
Get the user object by its name.
const UserObject & UserObjectInterface::getUserObjectBaseByName ( const std::string &  name)

Get an user object with a given name.

Parameters
nameThe name of the user object to retrieve
Returns
The user object with the name

Definition at line 34 of file UserObjectInterface.C.

Referenced by getUserObjectByName().

35 {
36  return _uoi_feproblem.getUserObjectBase(name);
37 }
FEProblemBase & _uoi_feproblem
Reference to the FEProblemBase instance.
const UserObject & getUserObjectBase(const std::string &name)
Get the user object by its name.
template<class T >
const T & UserObjectInterface::getUserObjectByName ( const std::string &  name)

Get an user object with a given name.

Parameters
nameThe name of the user object to retrieve
Returns
The user object with the name

Definition at line 93 of file UserObjectInterface.h.

94 {
95  unsigned int tid = isDiscreteUserObject(getUserObjectBaseByName(name)) ? _uoi_tid : 0;
96  return _uoi_feproblem.getUserObject<T>(name, tid);
97 }
bool isDiscreteUserObject(const UserObject &uo) const
Check if the user object is a DiscreteElementUserObject.
const UserObject & getUserObjectBaseByName(const std::string &name)
Get an user object with a given name.
FEProblemBase & _uoi_feproblem
Reference to the FEProblemBase instance.
THREAD_ID _uoi_tid
Thread ID.
const T & getUserObject(const std::string &name, unsigned int tid=0)
Get the user object by its name.
bool UserObjectInterface::isDiscreteUserObject ( const UserObject uo) const
private

Check if the user object is a DiscreteElementUserObject.

Definition at line 40 of file UserObjectInterface.C.

Referenced by getUserObject(), and getUserObjectByName().

41 {
42  return dynamic_cast<const DiscreteElementUserObject *>(&uo) != NULL;
43 }

Member Data Documentation

FEProblemBase& UserObjectInterface::_uoi_feproblem
private

Reference to the FEProblemBase instance.

Definition at line 74 of file UserObjectInterface.h.

Referenced by getUserObject(), getUserObjectBase(), getUserObjectBaseByName(), and getUserObjectByName().

const InputParameters& UserObjectInterface::_uoi_params
private

Parameters of the object with this interface.

Definition at line 71 of file UserObjectInterface.h.

Referenced by getUserObject(), and getUserObjectBase().

THREAD_ID UserObjectInterface::_uoi_tid
private

Thread ID.

Definition at line 77 of file UserObjectInterface.h.

Referenced by getUserObject(), and getUserObjectByName().


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