13const 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'.");
142const std::vector<dof_id_type> &
150const std::vector<BoundaryName> &
std::vector< Real > _normals
Outward normals associated with connected components.
std::vector< RealVectorValue > _directions
Directions of connected components.
std::vector< BoundaryName > _boundary_names
Boundary names of connected components.
virtual void init() override
Initializes the component.
const std::vector< BoundaryName > & getBoundaryNames() const
Gets the boundary names for this component.
Component1DConnection(const InputParameters ¶ms)
static const std::map< std::string, EEndType > _end_type_to_enum
Map of end type string to enum.
virtual void setupMesh() override
Performs mesh setup such as creating mesh or naming mesh sets.
static InputParameters validParams()
std::vector< Point > _positions
Physical positions of connected components.
virtual void check() const override
Check the component integrity.
virtual const std::vector< dof_id_type > & getNodeIDs() const
Gets the list of boundary nodes connected to this component.
void checkNumberOfConnections(const unsigned int &n_connections) const
Checks that the number of connections is equal to the supplied value.
void addConnection(const BoundaryName &boundary_name)
Adds a connection for this component.
std::vector< const Elem * > _elems
Boundary elements of connected components.
std::vector< unsigned int > _boundary_ids
Boundary IDs of connected components.
std::vector< std::string > _connected_component_names
Vector of connected component names.
std::vector< dof_id_type > _nodes
Boundary node IDs from connected components.
std::vector< unsigned short int > _sides
Boundary sides of connected components.
std::vector< Connection > _connections
Vector of connections of this component.
std::vector< SubdomainName > _connected_subdomain_names
Vector of subdomain names of the connected components.
Base class for 1D components.
virtual const std::vector< Connection > & getConnections(Component1DConnection::EEndType end_type) const
Gets the vector of connections of an end type for this component.
Base class for THM components.
virtual void init()
Initializes the component.
virtual const std::vector< SubdomainName > & getSubdomainNames() const
Gets the subdomain names for this component.
void logError(Args &&... args) const
Logs an error.
void addDependency(const std::string &dependency)
Adds a component name to the list of dependencies.
THMProblem & getTHMProblem() const
Gets the THM problem.
virtual void check() const
Check the component integrity.
@ MESH_PREPARED
mesh set up
void checkSetupStatus(const EComponentSetupStatus &status) const
Throws an error if the supplied setup status of this component has not been reached.
static InputParameters validParams()
virtual RealVectorValue getDirection() const
const T & getComponentByName(const std::string &name) const
Get component by its name.
Component1DConnection::EEndType stringToEnum(const std::string &s)
Structure for holding data for a connection.