MCPcopy Create free account
hub / github.com/OpenMS/OpenMS / buildRoundPackages

Method buildRoundPackages

src/openms_gui/source/VISUAL/TOPPASVertex.cpp:233–329  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

231 }
232
233 bool TOPPASVertex::buildRoundPackages(RoundPackages& pkg, String& error_msg) // check all incoming edges for this node and construct the package
234 {
235 if (inEdgesBegin() == inEdgesEnd())
236 {
237 error_msg = "buildRoundPackages() called on vertex with no input edges!\n";
238 OPENMS_LOG_ERROR << error_msg;
239 return false;
240 }
241
242 // -- determine number of rounds from incoming edges
243 int round_common = -1; // number of rounds common to all
244 int no_recycle_count = 0; // number of edges that do NOT do recycling (there needs to be at least one)
245 for (ConstEdgeIterator it = inEdgesBegin(); it != inEdgesEnd(); ++it) // all incoming edges should have the same number of rounds (or should be set to 'recycle') !
246 {
247 TOPPASVertex* tv = (*it)->getSourceVertex();
248 if (tv->allow_output_recycling_)
249 {
250 continue;
251 }
252
253 ++no_recycle_count;
254 if (round_common == -1)
255 {
256 round_common = tv->round_total_; // first non-recycler sets the pace
257 }
258
259 if (round_common != tv->round_total_)
260 {
261 error_msg = String("Number of rounds for incoming edges of node #") + this->getTopoNr() + " are not equal. No idea on how to combine them! Did you want to recycle its input?\n";
262 std::cerr << error_msg;
263 return false;
264 }
265 }
266
267 // -- we demand at least one node with no recycling to allow to determine number of rounds
268 if (no_recycle_count == 0)
269 {
270 error_msg = String("Number of rounds of node #") + this->getTopoNr() + " cannot be determined since all input nodes have recycling enabled. Disable for at least one input!\n";
271 std::cerr << error_msg;
272 return false;
273 }
274
275 // -- check if rounds from recyling nodes are an integer part of total rounds, i.e. total_rounds = X * node_rounds, X from N+
276 for (ConstEdgeIterator it = inEdgesBegin(); it != inEdgesEnd(); ++it) // look at all all recycling edges
277 {
278 TOPPASVertex * tv = (*it)->getSourceVertex();
279 if (!tv->allow_output_recycling_)
280 {
281 continue;
282 }
283 if (round_common % tv->round_total_ != 0) // modulo should be 0, if not ...
284 {
285 error_msg = String(tv->round_total_) + " rounds for incoming edges of node #" + this->getTopoNr() + " are recycled to meet a total of " + round_common + " rounds. But modulo is not 0. No idea on how to combine them! Adapt the number of input files?\n";
286 std::cerr << error_msg;
287 return false;
288 }
289 }
290

Callers

nothing calls this directly

Calls 10

getTopoNrMethod · 0.95
getSourceVertexMethod · 0.80
getSourceOutParamMethod · 0.80
getTargetInParamMethod · 0.80
getFileNamesMethod · 0.80
countMethod · 0.80
StringClass · 0.50
clearMethod · 0.45
resizeMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected