53 const std::string &
cname()
const;
127 template <
typename T>
135 template <
typename T>
144 template <
typename T>
153 template <
typename T>
168 const std::string & obj_name,
169 const std::string & param)
const;
182 const std::string & obj_name,
183 const std::string & comp_param,
184 const std::string & obj_param)
const;
210 template <
typename T>
219 template <
typename T>
225 template <
typename... Args>
234 template <
typename... Args>
258 template <
typename T>
259 T getEnumParam(
const std::string & param,
bool log_error =
true)
const;
269 const std::vector<dof_id_type> &
getNodeIDs()
const;
288 virtual const std::vector<Moose::CoordinateSystemType> &
getCoordSysTypes()
const;
301 template <
typename T>
303 const std::string & param_name)
const;
312 template <
typename T>
322 template <
typename T>
323 void checkSizeLessThan(
const std::string & param,
const unsigned int & n_entries)
const;
332 template <
typename T>
343 template <
typename T1,
typename T2>
344 void checkEqualSize(
const std::string & param1,
const std::string & param2)
const;
355 template <
typename T>
368 template <
typename T>
370 const unsigned int & n_entries,
371 const std::string & description)
const;
381 template <
typename T1,
typename T2>
391 bool need_one_specified =
true)
const;
434 Node *
addNode(
const Point & pt);
446 const std::string & subdomain_name,
458 const std::string & property,
470 const std::string & pp_name,
471 const Real normalization,
472 const std::vector<SubdomainName> & subdomains);
482 const std::vector<std::string> & descriptions,
483 const std::vector<Real> & tolerances);
548 template <
typename T>
555 template <
typename T>
559 const std::string & comp_name = getParam<std::string>(pname);
560 return getComponentByName<T>(comp_name);
563 template <
typename T>
570 template <
typename T>
574 const std::string & comp_name = getParam<std::string>(pname);
575 return hasComponentByName<T>(comp_name);
578 template <
typename T>
588 template <
typename T>
592 const MooseEnum & moose_enum = getParam<MooseEnum>(param);
593 const T value = THM::stringToEnum<T>(moose_enum);
594 if (log_error && static_cast<int>(
value) < 0)
599 const std::vector<std::string> & keys = moose_enum.
getNames();
603 std::string keys_string =
"{";
604 for (
unsigned int i = 0; i < keys.size() - 1; ++i)
608 keys_string +=
"'" + keys[i] +
"'";
612 logError(
"The parameter '" + param +
"' was given an invalid value ('" +
613 std::string(moose_enum) +
"'). Valid values (case-insensitive) are " + keys_string);
619 template <
typename T>
622 const std::string & param_name)
const 624 if (!hasParam<T>(param_name))
628 " failed, parameter '",
630 "' does not exist or does not have the type you requested. Double check your " 631 "spelling and/or type of the parameter.");
634 template <
typename T>
638 insistParameterExists<std::string>(__FUNCTION__, param);
640 const std::string & comp_name = getParam<std::string>(param);
641 checkComponentOfTypeExistsByName<T>(comp_name);
644 template <
typename T>
653 logError(
"The component '", comp_name,
"' does not exist");
657 template <
typename T>
661 insistParameterExists<T>(__FUNCTION__, param);
663 const auto &
value = getParam<T>(param);
664 if (
value >= value_max)
665 logError(
"The value of parameter '", param,
"' (",
value,
") must be less than ", value_max);
668 template <
typename T>
672 insistParameterExists<std::vector<T>>(__FUNCTION__, param);
674 const auto &
value = getParam<std::vector<T>>(param);
675 if (
value.size() >= n_entries)
676 logError(
"The number of entries in the parameter '",
680 ") must be less than ",
684 template <
typename T>
688 insistParameterExists<std::vector<T>>(__FUNCTION__, param);
690 const auto &
value = getParam<std::vector<T>>(param);
691 if (
value.size() <= n_entries)
692 logError(
"The number of entries in the parameter '",
696 ") must be greater than ",
700 template <
typename T1,
typename T2>
704 insistParameterExists<std::vector<T1>>(__FUNCTION__, param1);
705 insistParameterExists<std::vector<T2>>(__FUNCTION__, param2);
707 const auto & value1 = getParam<std::vector<T1>>(param1);
708 const auto & value2 = getParam<std::vector<T2>>(param2);
709 if (value1.size() != value2.size())
710 logError(
"The number of entries in parameter '",
714 ") must equal the number of entries of parameter '",
721 template <
typename T>
725 insistParameterExists<std::vector<T>>(__FUNCTION__, param);
727 const auto & param_value = getParam<std::vector<T>>(param);
728 if (param_value.size() != n_entries)
729 logError(
"The number of entries in parameter '",
733 ") must be equal to ",
737 template <
typename T>
740 const unsigned int & n_entries,
741 const std::string & description)
const 743 insistParameterExists<std::vector<T>>(__FUNCTION__, param);
745 const auto & param_value = getParam<std::vector<T>>(param);
746 if (param_value.size() != n_entries)
747 logError(
"The number of entries in parameter '",
751 ") must be equal to ",
758 template <
typename T1,
typename T2>
761 const std::string & param2)
const 763 insistParameterExists<std::vector<T1>>(__FUNCTION__, param1);
764 insistParameterExists<T2>(__FUNCTION__, param2);
766 const auto & value1 = getParam<std::vector<T1>>(param1);
767 const auto & value2 = getParam<T2>(param2);
768 if (value1.size() != value2)
769 logError(
"The number of entries in parameter '",
773 ") must be equal to the value of parameter '",
void connectObject(const InputParameters &obj_params, const std::string &obj_name, const std::string ¶m) const
Connects a controllable parameter of the component to a controllable parameter of a constituent objec...
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.
void addMaximumFunctorPostprocessor(const std::string &functor_name, const std::string &pp_name, const Real normalization, const std::vector< SubdomainName > &subdomains)
Adds a Postprocessor to compute the maximum of a functor over some domain.
std::string genName(const std::string &prefix, unsigned int id, const std::string &suffix="") const
Build a name from a prefix, number and possible suffix.
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 InputParameters & parameters() const
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.
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()
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.
const std::string & name() const
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.
std::string nonlinearConvergenceName() const
Nonlinear Convergence name.
mesh set up, called primary init
mesh set up, called both inits
void addMultiPostprocessorConvergence(const std::vector< PostprocessorName > &postprocessors, const std::vector< std::string > &descriptions, const std::vector< Real > &tolerances)
Adds a MultiPostprocessorConvergence for nonlinear convergence for the component. ...
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.
subdomain_id_type SubdomainID
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.
void addNonlinearStepFunctorMaterial(const std::string &functor_name, const std::string &property, bool functor_is_ad)
Adds a functor material to compute the absolute value of the change (step) of some functor between no...
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 mooseError(Args &&... args) const
virtual Convergence * getNonlinearConvergence() const
Gets the Component's nonlinear Convergence object if it has one.
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.