You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently when a reaction references a port of a child reactor, the Rust target exposes a port with a special name, that is bound to the child's port. For reactor banks this is more problematic, since banks are flattened into a Vec of ports, and the structure of the bank is lost.
The C++ and C targets do not do this. They expose a view on the child instance that allows access to only the declared dependencies. Implementing this would make the Rust target more similar to the others and simplify interactions with banks´.
See also this comment:
Are other targets doing this differently?
I am not sure if I understand how this works in Rust, but in C++ we do not unroll the multiport. In the case of multiports within a bank, the reaction body can say precisely which port in which reactor instance it wants to access. If it wants to read all values, it needs two nested loops:
target Cpp
reactor Source {
output[5] out: int;
reaction (startup) -> out {= /* ... */ =}
}
main reactor {
source = new[4] Source()
reaction (source.out) {=
for (int i{0}; i < source.size(); i++) {
for (int j{0}; j < source[i].out.size(); j++) {
int value = *source[i].out[j].get();
// ....
}
}
=}
}
Currently when a reaction references a port of a child reactor, the Rust target exposes a port with a special name, that is bound to the child's port. For reactor banks this is more problematic, since banks are flattened into a Vec of ports, and the structure of the bank is lost.
The C++ and C targets do not do this. They expose a view on the child instance that allows access to only the declared dependencies. Implementing this would make the Rust target more similar to the others and simplify interactions with banks´.
See also this comment:
The text was updated successfully, but these errors were encountered: