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

A class for storing an input parameter name. More...

#include <MooseObjectParameterName.h>

Inheritance diagram for MooseObjectParameterName:
[legend]

Public Member Functions

 MooseObjectParameterName (std::string name)
 Build an object given a raw parameter name (e.g., from an input file parameter) More...
 
 MooseObjectParameterName (const MooseObjectName &obj_name, const std::string &param)
 Build an object given a MooseObjectName and parameter name. More...
 
 MooseObjectParameterName (const std::string &tag, const std::string &name, const std::string &param, const std::string &separator=std::string("/"))
 Build an object given a tag, object name, and parameter name. More...
 
const std::string & parameter () const
 Return the parameter name. More...
 
virtual void check () final
 Adds the parameter name to error checking. More...
 
const std::string & name () const
 Return the name. More...
 
const std::string & tag () const
 Return the tag. More...
 
bool operator== (const MooseObjectParameterName &rhs) const
 Comparison operators. More...
 
bool operator== (const MooseObjectName &rhs) const
 
bool operator!= (const MooseObjectParameterName &rhs) const
 
bool operator!= (const MooseObjectName &rhs) const
 
bool operator< (const MooseObjectParameterName &rhs) const
 
bool operator< (const MooseObjectName &rhs) const
 

Protected Attributes

std::string _parameter
 The name of the input parameter. More...
 
std::string _tag
 
std::string _name
 
std::string _combined
 
std::string _separator
 

Friends

std::ostream & operator<< (std::ostream &stream, const MooseObjectParameterName &obj)
 

Detailed Description

A class for storing an input parameter name.

This class is used by the Control logic system, allowing for multiple tags to be applied to many different MooseObject parameters.

This class simply adds a third field (parameter name) to the MooseObjectName class.

Definition at line 32 of file MooseObjectParameterName.h.

Constructor & Destructor Documentation

MooseObjectParameterName::MooseObjectParameterName ( std::string  name)

Build an object given a raw parameter name (e.g., from an input file parameter)

Definition at line 38 of file MooseObjectParameterName.C.

38  : MooseObjectName()
39 {
40  // The tag precedes the :: (this is used in _moose_base::name and control_tag::name conventions)
41  std::size_t idx = name.find("::");
42  if (idx != std::string::npos)
43  {
44  _tag = name.substr(0, idx);
45  name.erase(0, idx + 2);
46  _separator = "::";
47  }
48 
49  // Locate the param name
50  idx = name.rfind("/");
51  if (idx != std::string::npos)
52  {
53  _parameter = name.substr(idx + 1);
54  name.erase(idx);
55  }
56  else // if a slash isn't located then the entire name must be the parameter
57  {
58  _parameter = name;
59  name.erase();
60  }
61 
62  // If there is a second slash, there is a syntax based tag: tag/object_name/param
63  idx = name.rfind("/");
64  if (idx != std::string::npos)
65  {
66  _name = name.substr(idx + 1);
67  name.erase(idx);
68  _tag = name;
69  }
70 
71  // If content still exists in "name", then this must be the object name
72  if (_name.empty() && !name.empty())
73  _name = name;
74 
75  // Set the combined name for sorting
77 }
std::string _combined
std::string _tag
const std::string & name() const
Return the name.
std::string _parameter
The name of the input parameter.
std::string _name
MooseObjectName()
A constructor for use by MooseObjectParameterName.
std::string _separator
MooseObjectParameterName::MooseObjectParameterName ( const MooseObjectName obj_name,
const std::string &  param 
)

Build an object given a MooseObjectName and parameter name.

Definition at line 22 of file MooseObjectParameterName.C.

24  : MooseObjectName(obj_name), _parameter(param)
25 {
27 }
std::string _combined
std::string _tag
std::string _parameter
The name of the input parameter.
std::string _name
MooseObjectName()
A constructor for use by MooseObjectParameterName.
MooseObjectParameterName::MooseObjectParameterName ( const std::string &  tag,
const std::string &  name,
const std::string &  param,
const std::string &  separator = std::string("/") 
)

Build an object given a tag, object name, and parameter name.

Definition at line 29 of file MooseObjectParameterName.C.

33  : MooseObjectName(tag, name, separator), _parameter(param)
34 {
36 }
std::string _combined
const std::string & name() const
Return the name.
std::string _parameter
The name of the input parameter.
const std::string & tag() const
Return the tag.
MooseObjectName()
A constructor for use by MooseObjectParameterName.

Member Function Documentation

void MooseObjectParameterName::check ( )
finalvirtual

Adds the parameter name to error checking.

Reimplemented from MooseObjectName.

Definition at line 126 of file MooseObjectParameterName.C.

Referenced by parameter().

127 {
129  if (_parameter.empty())
130  mooseError("The supplied parameter name cannot be empty, to allow for any parameter name to be "
131  "supplied use the '*' character.");
132 }
void mooseError(Args &&...args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:182
std::string _parameter
The name of the input parameter.
virtual void check()
Check that the name and tag are supplied correctly.
const std::string& MooseObjectName::name ( ) const
inlineinherited

Return the name.

Definition at line 71 of file MooseObjectName.h.

Referenced by MooseObjectName::MooseObjectName(), and MooseObjectParameterName().

71 { return _name; }
std::string _name
bool MooseObjectParameterName::operator!= ( const MooseObjectParameterName rhs) const

Definition at line 95 of file MooseObjectParameterName.C.

Referenced by parameter().

96 {
97  return !(*this == rhs);
98 }
bool MooseObjectParameterName::operator!= ( const MooseObjectName rhs) const

Definition at line 101 of file MooseObjectParameterName.C.

102 {
103  return MooseObjectName::operator!=(rhs);
104 }
bool operator!=(const MooseObjectName &rhs) const
bool MooseObjectParameterName::operator< ( const MooseObjectParameterName rhs) const

Definition at line 107 of file MooseObjectParameterName.C.

Referenced by parameter().

108 {
109  return (_combined < rhs._combined);
110 }
std::string _combined
bool MooseObjectName::operator< ( const MooseObjectName rhs) const
inherited

Definition at line 84 of file MooseObjectName.C.

Referenced by MooseObjectName::tag().

85 {
86  return (_combined < rhs._combined);
87 }
std::string _combined
bool MooseObjectParameterName::operator== ( const MooseObjectParameterName rhs) const

Comparison operators.

Not that this class may be compared with MooseObjectName, this feature is used by ControlInterface.

The less than operator is required so this container can work in std::map.

See also
InputParameterWarehouse

Definition at line 80 of file MooseObjectParameterName.C.

Referenced by parameter().

81 {
82  if (MooseObjectName::operator==(rhs) &&
83  (_parameter == rhs._parameter || _parameter == "*" || rhs._parameter == "*"))
84  return true;
85  return false;
86 }
std::string _parameter
The name of the input parameter.
bool MooseObjectParameterName::operator== ( const MooseObjectName rhs) const

Definition at line 89 of file MooseObjectParameterName.C.

90 {
91  return MooseObjectName::operator==(rhs);
92 }
bool operator==(const MooseObjectName &rhs) const
Comparison operators.
const std::string& MooseObjectParameterName::parameter ( ) const
inline

Return the parameter name.

Definition at line 56 of file MooseObjectParameterName.h.

Referenced by InputParameterWarehouse::getControllableParameter(), and ControllableParameter< T >::insert().

56 { return _parameter; }
std::string _parameter
The name of the input parameter.
const std::string& MooseObjectName::tag ( ) const
inlineinherited

Return the tag.

Definition at line 76 of file MooseObjectName.h.

76 { return _tag; }
std::string _tag

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  stream,
const MooseObjectParameterName obj 
)
friend

Definition at line 113 of file MooseObjectParameterName.C.

Referenced by parameter().

114 {
115  if (obj._tag.empty() && obj._name.empty())
116  return stream << obj._parameter;
117  else if (obj._tag.empty())
118  return stream << obj._name << "/" << obj._parameter;
119  else if (obj._name.empty())
120  return stream << obj._tag << obj._separator << obj._parameter;
121  else
122  return stream << obj._tag << obj._separator << obj._name << "/" << obj._parameter;
123 }
std::string _tag
if(nl->nonlinearSolver() ->matvec &&nl->nonlinearSolver() ->residual_and_jacobian_object)
std::string _parameter
The name of the input parameter.
std::string _name
std::string _separator

Member Data Documentation

std::string MooseObjectName::_combined
protectedinherited
std::string MooseObjectName::_name
protectedinherited
std::string MooseObjectParameterName::_parameter
protected

The name of the input parameter.

Definition at line 88 of file MooseObjectParameterName.h.

Referenced by check(), MooseObjectParameterName(), operator<<(), operator==(), and parameter().

std::string MooseObjectName::_separator
protectedinherited
std::string MooseObjectName::_tag
protectedinherited

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