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>
246 template <
typename T>
257 const std::vector<dof_id_type> &
getNodeIDs()
const;
276 virtual const std::vector<Moose::CoordinateSystemType> &
getCoordSysTypes()
const;
319 Node *
addNode(
const Point & pt);
331 const std::string & subdomain_name,
345 template <
typename T>
347 const std::string & param_name)
const;
356 template <
typename T>
366 template <
typename T>
367 void checkSizeLessThan(
const std::string & param,
const unsigned int & n_entries)
const;
376 template <
typename T>
387 template <
typename T1,
typename T2>
388 void checkEqualSize(
const std::string & param1,
const std::string & param2)
const;
399 template <
typename T>
412 template <
typename T>
414 const unsigned int & n_entries,
415 const std::string & description)
const;
425 template <
typename T1,
typename T2>
435 bool need_one_specified =
true)
const;
497 template <
typename T>
504 template <
typename T>
508 const std::string & comp_name = getParam<std::string>(pname);
509 return getComponentByName<T>(comp_name);
512 template <
typename T>
519 template <
typename T>
523 const std::string & comp_name = getParam<std::string>(pname);
524 return hasComponentByName<T>(comp_name);
527 template <
typename T>
537 template <
typename T>
541 const MooseEnum & moose_enum = getParam<MooseEnum>(param);
542 const T
value = THM::stringToEnum<T>(moose_enum);
543 if (static_cast<int>(
value) < 0)
548 const std::vector<std::string> & keys = moose_enum.
getNames();
552 std::string keys_string =
"{";
553 for (
unsigned int i = 0; i < keys.size() - 1; ++i)
557 keys_string +=
"'" + keys[i] +
"'";
561 logError(
"The parameter '" + param +
"' was given an invalid value ('" +
562 std::string(moose_enum) +
"'). Valid values (case-insensitive) are " + keys_string);
568 template <
typename T>
571 const std::string & param_name)
const 573 if (!hasParam<T>(param_name))
577 " failed, parameter '",
579 "' does not exist or does not have the type you requested. Double check your " 580 "spelling and/or type of the parameter.");
583 template <
typename T>
587 insistParameterExists<std::string>(__FUNCTION__, param);
589 const std::string & comp_name = getParam<std::string>(param);
590 checkComponentOfTypeExistsByName<T>(comp_name);
593 template <
typename T>
602 logError(
"The component '", comp_name,
"' does not exist");
606 template <
typename T>
610 insistParameterExists<T>(__FUNCTION__, param);
612 const auto &
value = getParam<T>(param);
613 if (
value >= value_max)
614 logError(
"The value of parameter '", param,
"' (",
value,
") must be less than ", value_max);
617 template <
typename T>
621 insistParameterExists<std::vector<T>>(__FUNCTION__, param);
623 const auto &
value = getParam<std::vector<T>>(param);
624 if (
value.size() >= n_entries)
625 logError(
"The number of entries in the parameter '",
629 ") must be less than ",
633 template <
typename T>
637 insistParameterExists<std::vector<T>>(__FUNCTION__, param);
639 const auto &
value = getParam<std::vector<T>>(param);
640 if (
value.size() <= n_entries)
641 logError(
"The number of entries in the parameter '",
645 ") must be greater than ",
649 template <
typename T1,
typename T2>
653 insistParameterExists<std::vector<T1>>(__FUNCTION__, param1);
654 insistParameterExists<std::vector<T2>>(__FUNCTION__, param2);
656 const auto & value1 = getParam<std::vector<T1>>(param1);
657 const auto & value2 = getParam<std::vector<T2>>(param2);
658 if (value1.size() != value2.size())
659 logError(
"The number of entries in parameter '",
663 ") must equal the number of entries of parameter '",
670 template <
typename T>
674 insistParameterExists<std::vector<T>>(__FUNCTION__, param);
676 const auto & param_value = getParam<std::vector<T>>(param);
677 if (param_value.size() != n_entries)
678 logError(
"The number of entries in parameter '",
682 ") must be equal to ",
686 template <
typename T>
689 const unsigned int & n_entries,
690 const std::string & description)
const 692 insistParameterExists<std::vector<T>>(__FUNCTION__, param);
694 const auto & param_value = getParam<std::vector<T>>(param);
695 if (param_value.size() != n_entries)
696 logError(
"The number of entries in parameter '",
700 ") must be equal to ",
707 template <
typename T1,
typename T2>
710 const std::string & param2)
const 712 insistParameterExists<std::vector<T1>>(__FUNCTION__, param1);
713 insistParameterExists<T2>(__FUNCTION__, param2);
715 const auto & value1 = getParam<std::vector<T1>>(param1);
716 const auto & value2 = getParam<T2>(param2);
717 if (value1.size() != value2)
718 logError(
"The number of entries in parameter '",
722 ") 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.
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.
T getEnumParam(const std::string ¶m) const
Gets an enum parameter.
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.