libcosim
0.7.0
C++ library for distributed co-simulation
|
A description of the structure of a modelled system. More...
#include <cosim/system_structure.hpp>
Classes | |
struct | connection |
Information about a connection. More... | |
struct | entity |
Information about a simulation entity. More... | |
struct | function_io_description |
A description of a function variable, including group and variable indices. More... | |
Public Types | |
using | entity_type = std::variant< std::shared_ptr< model >, std::shared_ptr< function_type > > |
The type of an entity. More... | |
using | entity_range = boost::select_second_const_range< entity_map > |
using | connection_range = boost::transformed_range< connection_transform, const connection_map > |
Public Member Functions | |
void | add_entity (const entity &e) |
Adds an entity to the system. More... | |
void | add_entity (std::string_view name, std::shared_ptr< cosim::model > type, duration stepSizeHint=duration::zero()) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
void | add_entity (std::string_view name, std::shared_ptr< function_type > type, function_parameter_value_map parameters) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
entity_range | entities () const noexcept |
Returns a list of the entities in the system. More... | |
const entity * | find_entity (std::string_view name) const |
Returns a pointer to the named entity if it exists, null otherwise. | |
void | connect_variables (const connection &c) |
Establishes a connection between two variables. More... | |
void | connect_variables (const full_variable_name &source, const full_variable_name &target) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
connection_range | connections () const noexcept |
Returns a list of the scalar connections in the system. More... | |
const variable_description & | get_variable_description (const full_variable_name &v) const |
Retrieves the description of a simulator variable, given its qualified name. More... | |
const function_io_description & | get_function_io_description (const full_variable_name &v) const |
Retrieves the description of a function variable, given its qualified name. More... | |
A description of the structure of a modelled system.
The system structure description contains the list of entities in the system and the connections between them. Validation is performed on the fly by the class' mutators, and any attempt to make an invalid change will result in an exception of type cosim::error
with error code cosim::errc::invalid_system_structure
.
using cosim::system_structure::entity_type = std::variant< std::shared_ptr<model>, std::shared_ptr<function_type> > |
The type of an entity.
This is a shared pointer to a cosim::model
if the entity is a simulator, and to a cosim::function_type
if the entity is a function instance.
void cosim::system_structure::add_entity | ( | const entity & | e | ) |
Adds an entity to the system.
e.name
must be unique in the context of the present system.
void cosim::system_structure::connect_variables | ( | const connection & | c | ) |
Establishes a connection between two variables.
The same target variable may not be connected several times.
|
noexcept |
Returns a list of the scalar connections in the system.
connection
objects.
|
noexcept |
Returns a list of the entities in the system.
entity
objects. const function_io_description& cosim::system_structure::get_function_io_description | ( | const full_variable_name & | v | ) | const |
Retrieves the description of a function variable, given its qualified name.
This is a convenience function that provides fast variable lookup (O(1) on average).
const variable_description& cosim::system_structure::get_variable_description | ( | const full_variable_name & | v | ) | const |
Retrieves the description of a simulator variable, given its qualified name.
This is a convenience function that provides fast variable lookup (O(1) on average).