24 params.
addPrivateParam<std::string>(
"built_by_action",
"add_component");
41 _parent(getParam<
Component *>(
"_parent")),
42 _sim(*getCheckedPointerParam<
THMProblem *>(
"_thm_problem")),
43 _factory(_app.getFactory()),
44 _zero(_sim._real_zero[0]),
46 _component_setup_status(CREATED)
64 "A non-const reference to the THM mesh cannot be obtained after mesh setup is complete.");
99 const std::string & mooseName,
100 const std::string &
name)
const 107 const std::string & mooseName,
108 const std::string &
name,
109 const std::string & par_name)
const 121 ": The component setup status (",
123 ") is less than the required status (",
142 const std::string & control_name,
143 const std::string & param)
const 146 if (dynamic_cast<const ConstantFunction *>(&fn) !=
nullptr)
154 logError(
"The component '", comp_name,
"' does not exist");
162 for (
const auto & buildable_type : buildable_types)
164 auto & rm_name = std::get<0>(buildable_type);
165 auto & rm_type = std::get<1>(buildable_type);
166 auto rm_input_parameter_func = std::get<2>(buildable_type);
181 static unsigned int unique_object_id = 0;
183 auto new_name = moose_object_pars.
get<std::string>(
"_moose_base") +
'_' +
name() +
'_' + rm_name +
189 rm_params.set<std::string>(
"for_whom") =
name();
192 if (rm_input_parameter_func)
193 rm_input_parameter_func(moose_object_pars, rm_params);
197 if (!rm_params.areAllRequiredParamsValid())
198 mooseError(
"Missing required parameters for RelationshipManager " + rm_name +
" for object " +
230 const std::string & subdomain_name,
247 bool need_one_specified)
const 249 unsigned int n_provided_params = 0;
250 for (
const auto & param : params)
254 if (n_provided_params != 1)
256 std::string params_list_string =
"{'" + params[0] +
"'";
257 for (
unsigned int i = 1; i < params.size(); ++i)
258 params_list_string +=
", '" + params[i] +
"'";
259 params_list_string +=
"}";
261 if (n_provided_params == 0 && need_one_specified)
262 logError(
"One of the parameters ", params_list_string,
" must be provided");
264 if (n_provided_params != 0)
265 logError(
"Only one of the parameters ", params_list_string,
" can be provided");
276 return "component created";
278 return "component mesh set up";
280 return "primary initialization completed";
282 return "secondary initialization completed";
284 return "component fully set up and checked";
290 const std::vector<dof_id_type> &
298 const std::vector<dof_id_type> &
306 const std::vector<SubdomainName> &
314 const std::vector<Moose::CoordinateSystemType> &
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.
InputParameterWarehouse & getInputParameterWarehouse()
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.
std::shared_ptr< MooseObject > create(const std::string &obj_name, const std::string &name, const InputParameters ¶meters, THREAD_ID tid=0, bool print_deprecated=true)
static InputParameters validParams()
InputParameters getValidParams(const std::string &name) const
const std::string & cname() const
Get the component name.
Component * _parent
Pointer to a parent component (used in composed components)
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.
Interface class for logging errors and warnings.
Node * addNode(const Point &pt)
static InputParameters validParams()
virtual const std::string & name() const
Elem * addNodeElement(dof_id_type node)
std::vector< Moose::CoordinateSystemType > _coord_sys
List of coordinate system for each subdomain.
std::vector< dof_id_type > _elem_ids
Element IDs of this component.
void logError(Args &&... args) const
Logs an error.
bool isParamValid(const std::string &name) const
Elem * addNodeElement(dof_id_type node)
virtual void check() const
Check the component integrity.
virtual Function & getFunction(const std::string &name, const THREAD_ID tid=0)
bool hasComponent(const std::string &name) const
Find out if simulation has a component with the given name.
bool addRelationshipManager(std::shared_ptr< RelationshipManager > relationship_manager)
Component(const InputParameters ¶meters)
void setSubdomainName(SubdomainID subdomain_id, const SubdomainName &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.
mesh set up, called primary init
mesh set up, called both inits
virtual void init()
Initializes the component.
Base class for THM components.
std::string stringify(const T &t)
virtual const std::vector< Moose::CoordinateSystemType > & getCoordSysTypes() const
Gets the coordinate system types for this component.
virtual void initSecondary()
Perform secondary initialization, which relies on init() being called for all components.
void releaseSharedObjects(const MooseObject &moose_object, THREAD_ID tid=0)
THMMesh & mesh()
Non-const reference to THM mesh, which can only be called before the end of mesh setup.
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.
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
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 const std::vector< SubdomainName > & getSubdomainNames() const
Gets the subdomain names for this component.
static InputParameters validParams()
void executeInit()
Wrapper function for init() that marks the function as being called.
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.
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.
Node * addNode(const Point &pt)
Add a new node into the mesh.