@@ -85,11 +85,17 @@ void Environment::assemble() { // NOLINT
85
85
recursive_assemble (reactor);
86
86
}
87
87
88
- log ::Debug () << " start optimization on port graph" ;
89
- this ->optimize ();
88
+ // this assembles all the contained environments aka enclaves
89
+ for (auto * env : contained_environments_) {
90
+ env->assemble ();
91
+ }
90
92
91
- log ::Debug () << " instantiating port graph declaration " ;
93
+ // If this is the top level environment, then instantiate all connections.
92
94
if (top_environment_ == nullptr || top_environment_ == this ) {
95
+ log ::Debug () << " start optimization on port graph" ;
96
+ this ->optimize ();
97
+
98
+ log ::Debug () << " instantiating port graph declaration" ;
93
99
log ::Debug () << " graph: " ;
94
100
log ::Debug () << optimized_graph_;
95
101
@@ -136,18 +142,6 @@ void Environment::assemble() { // NOLINT
136
142
}
137
143
}
138
144
}
139
-
140
- log ::Debug () << " Building the Dependency-Graph" ;
141
- for (auto * reactor : top_level_reactors_) {
142
- build_dependency_graph (reactor);
143
- }
144
-
145
- calculate_indexes ();
146
-
147
- // this assembles all the contained environments aka enclaves
148
- for (auto * env : contained_environments_) {
149
- env->assemble ();
150
- }
151
145
}
152
146
153
147
void Environment::build_dependency_graph (Reactor* reactor) { // NOLINT
@@ -326,6 +320,13 @@ auto Environment::startup() -> std::thread {
326
320
auto Environment::startup (const TimePoint& start_time) -> std::thread {
327
321
validate (this ->phase () == Phase::Assembly, " startup() may only be called during assembly phase!" );
328
322
323
+ log ::Debug () << " Building the Dependency-Graph" ;
324
+ for (auto * reactor : top_level_reactors_) {
325
+ build_dependency_graph (reactor);
326
+ }
327
+
328
+ calculate_indexes ();
329
+
329
330
log_.debug () << " Starting the execution" ;
330
331
phase_ = Phase::Startup;
331
332
0 commit comments