52 const std::string &
cname()
const;
121 template <
typename T>
129 template <
typename T>
138 template <
typename T>
147 template <
typename T>
154 const std::string & mooseName,
155 const std::string &
name)
const;
160 const std::string & mooseName,
161 const std::string &
name,
162 const std::string & par_name)
const;
172 const std::string & control_name,
173 const std::string & param =
"value")
const;
199 template <
typename T>
208 template <
typename T>
214 template <
typename... Args>
223 template <
typename... Args>
247 template <
typename T>
248 T
getEnumParam(
const std::string & param,
bool log_error =
true)
const;
258 const std::vector<dof_id_type> &
getNodeIDs()
const;
277 virtual const std::vector<Moose::CoordinateSystemType> &
getCoordSysTypes()
const;
290 template <
typename T>
292 const std::string & param_name)
const;
301 template <
typename T>
311 template <
typename T>
312 void checkSizeLessThan(
const std::string & param,
const unsigned int & n_entries)
const;
321 template <
typename T>
332 template <
typename T1,
typename T2>
333 void checkEqualSize(
const std::string & param1,
const std::string & param2)
const;
344 template <
typename T>
357 template <
typename T>
359 const unsigned int & n_entries,
360 const std::string & description)
const;
370 template <
typename T1,
typename T2>
380 bool need_one_specified =
true)
const;
423 Node *
addNode(
const Point & pt);
435 const std::string & subdomain_name,
498 template <
typename T>
505 template <
typename T>
509 const std::string & comp_name = getParam<std::string>(pname);
510 return getComponentByName<T>(comp_name);
513 template <
typename T>
520 template <
typename T>
524 const std::string & comp_name = getParam<std::string>(pname);
525 return hasComponentByName<T>(comp_name);
528 template <
typename T>
538 template <
typename T>
542 const MooseEnum & moose_enum = getParam<MooseEnum>(param);
543 const T
value = THM::stringToEnum<T>(moose_enum);
544 if (log_error && static_cast<int>(
value) < 0)
549 const std::vector<std::string> & keys = moose_enum.
getNames();
553 std::string keys_string =
"{";
554 for (
unsigned int i = 0; i < keys.size() - 1; ++i)
558 keys_string +=
"'" + keys[i] +
"'";
562 logError(
"The parameter '" + param +
"' was given an invalid value ('" +
563 std::string(moose_enum) +
"'). Valid values (case-insensitive) are " + keys_string);
569 template <
typename T>
572 const std::string & param_name)
const 574 if (!hasParam<T>(param_name))
578 " failed, parameter '",
580 "' does not exist or does not have the type you requested. Double check your " 581 "spelling and/or type of the parameter.");
584 template <
typename T>
588 insistParameterExists<std::string>(__FUNCTION__, param);
590 const std::string & comp_name = getParam<std::string>(param);
591 checkComponentOfTypeExistsByName<T>(comp_name);
594 template <
typename T>
603 logError(
"The component '", comp_name,
"' does not exist");
607 template <
typename T>
611 insistParameterExists<T>(__FUNCTION__, param);
613 const auto &
value = getParam<T>(param);
614 if (
value >= value_max)
615 logError(
"The value of parameter '", param,
"' (",
value,
") must be less than ", value_max);
618 template <
typename T>
622 insistParameterExists<std::vector<T>>(__FUNCTION__, param);
624 const auto &
value = getParam<std::vector<T>>(param);
625 if (
value.size() >= n_entries)
626 logError(
"The number of entries in the parameter '",
630 ") must be less than ",
634 template <
typename T>
638 insistParameterExists<std::vector<T>>(__FUNCTION__, param);
640 const auto &
value = getParam<std::vector<T>>(param);
641 if (
value.size() <= n_entries)
642 logError(
"The number of entries in the parameter '",
646 ") must be greater than ",
650 template <
typename T1,
typename T2>
654 insistParameterExists<std::vector<T1>>(__FUNCTION__, param1);
655 insistParameterExists<std::vector<T2>>(__FUNCTION__, param2);
657 const auto & value1 = getParam<std::vector<T1>>(param1);
658 const auto & value2 = getParam<std::vector<T2>>(param2);
659 if (value1.size() != value2.size())
660 logError(
"The number of entries in parameter '",
664 ") must equal the number of entries of parameter '",
671 template <
typename T>
675 insistParameterExists<std::vector<T>>(__FUNCTION__, param);
677 const auto & param_value = getParam<std::vector<T>>(param);
678 if (param_value.size() != n_entries)
679 logError(
"The number of entries in parameter '",
683 ") must be equal to ",
687 template <
typename T>
690 const unsigned int & n_entries,
691 const std::string & description)
const 693 insistParameterExists<std::vector<T>>(__FUNCTION__, param);
695 const auto & param_value = getParam<std::vector<T>>(param);
696 if (param_value.size() != n_entries)
697 logError(
"The number of entries in parameter '",
701 ") must be equal to ",
708 template <
typename T1,
typename T2>
711 const std::string & param2)
const 713 insistParameterExists<std::vector<T1>>(__FUNCTION__, param1);
714 insistParameterExists<T2>(__FUNCTION__, param2);
716 const auto & value1 = getParam<std::vector<T1>>(param1);
717 const auto & value2 = getParam<T2>(param2);
718 if (value1.size() != value2)
719 logError(
"The number of entries in parameter '",
723 ") must be equal to the value of parameter '",
void executeCheck() const
Wrapper function for check() that marks the function as being called.
Specialization of FEProblem to run with component subsystem.
Interface for handling names.
THMProblem & _sim
THM problem this component is part of TODO: make _sim private (applications need to switch to getters...
EComponentSetupStatus
Component setup status type.
virtual void setupMesh()
Performs mesh setup such as creating mesh or naming mesh sets.
THMProblem & getTHMProblem() const
Gets the THM problem.
void addDependency(const std::string &dependency)
Adds a component name to the list of dependencies.
const std::vector< dof_id_type > & getElementIDs() const
Gets the element IDs corresponding to this component.
std::vector< SubdomainName > _subdomain_names
List of subdomain names this components owns.
const T & getComponent(const std::string &name) const
Return a reference to a component via a parameter name.
T getEnumParam(const std::string ¶m, bool log_error=true) const
Gets an enum parameter.
const std::string & cname() const
Get the component name.
void logWarning(Args &&... args) const
Logs a warning.
void logComponentWarning(const std::string &component_name, Args &&... args) const
Logs a warning for a component.
void logComponentError(const std::string &component_name, Args &&... args) const
Logs an error for a component.
Component * _parent
Pointer to a parent component (used in composed components)
virtual void addVariables()
std::string stringify(EComponentSetupStatus status) const
Return a string for the setup status.
void makeFunctionControllableIfConstant(const FunctionName &fn_name, const std::string &control_name, const std::string ¶m="value") const
Makes a function controllable if it is constant.
virtual void setSubdomainInfo(SubdomainID subdomain_id, const std::string &subdomain_name, const Moose::CoordinateSystemType &coord_system=Moose::COORD_XYZ)
Sets the next subdomain ID, name, and coordinate system.
void checkParameterValueLessThan(const std::string ¶m, const T &value_max) const
Checks that a parameter value is less than a value.
Interface class for logging errors and warnings.
Node * addNode(const Point &pt)
static InputParameters validParams()
virtual const std::string & name() const
std::vector< Moose::CoordinateSystemType > _coord_sys
List of coordinate system for each subdomain.
void checkSizeLessThan(const std::string ¶m, const unsigned int &n_entries) const
Checks that the size of a vector parameter is less than a value.
std::vector< dof_id_type > _elem_ids
Element IDs of this component.
void logError(Args &&... args) const
Logs an error.
Elem * addNodeElement(dof_id_type node)
virtual void check() const
Check the component integrity.
bool hasComponent(const std::string &name) const
Find out if simulation has a component with the given name.
Component(const InputParameters ¶meters)
Real value(unsigned n, unsigned alpha, unsigned beta, Real x)
void checkComponentOfTypeExists(const std::string ¶m) const
Checks that the component of a certain type exists, where the name is given by a parameter.
const std::vector< std::string > & getDependencies() const
Returns a list of names of components that this component depends upon.
bool hasComponentByName(const std::string &cname) const
Check the existence and type of a component given its name.
std::function< void(const InputParameters &, InputParameters &)> RelationshipManagerInputParameterCallback
std::vector< dof_id_type > _node_ids
Node IDs of this component.
void checkComponentExistsByName(const std::string &comp_name) const
Checks that a component exists.
bool problemIsTransient() const
Whether the problem is transient.
mesh set up, called primary init
mesh set up, called both inits
virtual void init()
Initializes the component.
void checkSizeEqualsValue(const std::string ¶m, const unsigned int &n_entries) const
Checks that the size of a vector parameter equals a value.
const T & getComponentByName(const std::string &name) const
Get component by its name.
Base class for THM components.
std::string demangle(const char *name)
virtual const std::vector< Moose::CoordinateSystemType > & getCoordSysTypes() const
Gets the coordinate system types for this component.
std::vector< std::string > getNames() const
virtual void initSecondary()
Perform secondary initialization, which relies on init() being called for all components.
const THMMesh & constMesh() const
Const reference to mesh, which can be called at any point.
bool hasParam(const std::string &name) const
Test if a parameter exists in the object's input parameters.
void checkComponentOfTypeExistsByName(const std::string &comp_name) const
Checks that the component of a certain type exists.
void insistParameterExists(const std::string &function_name, const std::string ¶m_name) const
Runtime check to make sure that a parameter of specified type exists in the component's input paramet...
THMMesh & mesh()
Non-const reference to THM mesh, which can only be called before the end of mesh setup.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void addRelationshipManager(const InputParameters &moose_object_pars, std::string rm_name, Moose::RelationshipManagerType rm_type, Moose::RelationshipManagerInputParameterCallback rm_input_parameter_func, Moose::RMSystemType sys_type=Moose::RMSystemType::NONE)
Method for adding a single relationship manager.
EComponentSetupStatus _component_setup_status
Component setup status.
std::vector< std::string > _dependencies
List of names of components that this component depends upon.
void checkSetupStatus(const EComponentSetupStatus &status) const
Throws an error if the supplied setup status of this component has not been reached.
bool hasComponent(const std::string &name) const
Check the existence and type of a component via a parameter name.
std::vector< SubdomainID > _subdomain_ids
List of subdomain IDs this components owns.
Factory & _factory
The Factory associated with the MooseApp.
void connectObject(const InputParameters ¶ms, const std::string &mooseName, const std::string &name) const
Connect with control logic.
void mooseError(Args &&... args) const
const InputParameters & parameters() const
void checkSizeEqualsParameterValue(const std::string ¶m1, const std::string ¶m2) const
Checks that the size of a vector parameter equals the value of another parameter. ...
const T & getComponentByName(const std::string &cname) const
Return a reference to a component given its name.
mesh set up, called both inits, checked
void addRelationshipManagersFromParameters(const InputParameters &moose_object_pars)
Method to add a relationship manager for the objects being added to the system.
THMMesh & _mesh
The THM mesh TODO: make _mesh private (applications need to switch to getters to avoid breaking) ...
virtual bool isTransient() const override
virtual const std::vector< SubdomainName > & getSubdomainNames() const
Gets the subdomain names for this component.
void checkEqualSize(const std::string ¶m1, const std::string ¶m2) const
Checks that the size of two vector parameters are equal.
void executeInit()
Wrapper function for init() that marks the function as being called.
virtual void addMooseObjects()
virtual void addRelationshipManagers(Moose::RelationshipManagerType)
Adds relationship managers for the component.
void executeSetupMesh()
Wrapper function for setupMesh() that marks the function as being called.
const std::vector< dof_id_type > & getNodeIDs() const
Gets the node IDs corresponding to this component.
void executeInitSecondary()
Wrapper function for initSecondary() that marks the function as being called.
bool hasComponentOfType(const std::string &name) const
Find out if simulation has a component with the given name and specified type.
void checkMutuallyExclusiveParameters(const std::vector< std::string > ¶ms, bool need_one_specified=true) const
Checks that exactly one parameter out of a list is provided.
void checkSizeGreaterThan(const std::string ¶m, const unsigned int &n_entries) const
Checks that the size of a vector parameter is greater than a value.