13 const std::map<std::string, Component1DConnection::EEndType>
37 const std::string & comp_name = connection._component_name;
39 if (hasComponentByName<Component1D>(comp_name))
43 const Component1D & comp = getComponentByName<Component1D>(comp_name);
48 _elems.push_back(conn._elem);
49 _sides.push_back(conn._side);
50 _nodes.push_back(conn._node->id());
57 logError(
"Trying to connect to a component '",
59 "', but there is no such component in the simulation. Please check your spelling.");
70 std::vector<UserObjectName> fp_names;
71 std::vector<THM::FlowModelID> flow_model_ids;
74 const std::string comp_name = connection._component_name;
75 if (hasComponentByName<Component1D>(comp_name))
87 logError(
"The component is not connected.");
96 checkComponentOfTypeExistsByName<Component1D>(comp_name);
102 const size_t oparenthesis_pos = boundary_name.find(
'(');
103 if (oparenthesis_pos != std::string::npos)
105 logError(
"You are using the old connection format 'comp_name(end)'. Please update your input " 106 "file to the new one 'comp_name:end'.");
110 const size_t colon_pos = boundary_name.rfind(
':');
112 if (colon_pos != std::string::npos)
114 const std::string connected_component_name = boundary_name.substr(0, colon_pos);
115 const std::string str_end =
116 boundary_name.substr(colon_pos + 1, boundary_name.length() - colon_pos - 1);
117 const EEndType end_type = THM::stringToEnum<EEndType>(str_end);
128 logError(
"Incorrect connection specified '",
130 "'. Valid connection format is 'component_name:end_type'.");
142 const std::vector<dof_id_type> &
150 const std::vector<BoundaryName> &
virtual void init() override
Initializes the component.
static InputParameters validParams()
virtual const std::vector< dof_id_type > & getNodeIDs() const
Gets the list of boundary nodes connected to this component.
Component1DConnection::EEndType stringToEnum(const std::string &s)
std::vector< unsigned short int > _sides
Boundary sides of connected components.
THMProblem & getTHMProblem() const
Gets the THM problem.
void addDependency(const std::string &dependency)
Adds a component name to the list of dependencies.
std::vector< SubdomainName > _connected_subdomain_names
Vector of subdomain names of the connected components.
const std::vector< BoundaryName > & getBoundaryNames() const
Gets the boundary names for this component.
virtual RealVectorValue getDirection() const
Structure for holding data for a connection.
std::vector< Connection > _connections
Vector of connections of this component.
std::vector< BoundaryName > _boundary_names
Boundary names of connected components.
void addConnection(const BoundaryName &boundary_name)
Adds a connection for this component.
static InputParameters validParams()
std::vector< dof_id_type > _nodes
Boundary node IDs from connected components.
void logError(Args &&... args) const
Logs an error.
virtual void check() const
Check the component integrity.
std::vector< std::string > _connected_component_names
Vector of connected component names.
std::vector< unsigned int > _boundary_ids
Boundary IDs of connected components.
std::vector< Point > _positions
Physical positions of connected components.
void checkNumberOfConnections(const unsigned int &n_connections) const
Checks that the number of connections is equal to the supplied value.
virtual void init()
Initializes the component.
Base class for 1D components.
const T & getComponentByName(const std::string &name) const
Get component by its name.
Base class for THM components.
Component1DConnection(const InputParameters ¶ms)
std::vector< const Elem * > _elems
Boundary elements of connected components.
virtual const std::vector< Connection > & getConnections(Component1DConnection::EEndType end_type) const
Gets the vector of connections of an end type for this component.
virtual void check() const override
Check the component integrity.
void checkSetupStatus(const EComponentSetupStatus &status) const
Throws an error if the supplied setup status of this component has not been reached.
virtual void setupMesh() override
Performs mesh setup such as creating mesh or naming mesh sets.
virtual const std::vector< SubdomainName > & getSubdomainNames() const
Gets the subdomain names for this component.
std::vector< Real > _normals
Outward normals associated with connected components.
std::vector< RealVectorValue > _directions
Directions of connected components.
static const std::map< std::string, EEndType > _end_type_to_enum
Map of end type string to enum.