void startComputation(RODFNet* optNet, RODFDetectorFlows& flows, RODFDetectorCon& detectors, OptionsCont& oc) { if (oc.getBool("print-absolute-flows")) { flows.printAbsolute(); } // if a network was loaded... (mode1) if (optNet != 0) { if (oc.getBool("remove-empty-detectors")) { PROGRESS_BEGIN_MESSAGE("Removing empty detectors"); optNet->removeEmptyDetectors(detectors, flows); PROGRESS_DONE_MESSAGE(); } else if (oc.getBool("report-empty-detectors")) { PROGRESS_BEGIN_MESSAGE("Scanning for empty detectors"); optNet->reportEmptyDetectors(detectors, flows); PROGRESS_DONE_MESSAGE(); } // compute the detector types (optionally) if (!detectors.detectorsHaveCompleteTypes() || oc.getBool("revalidate-detectors")) { optNet->computeTypes(detectors, oc.getBool("strict-sources")); } std::vector<RODFDetector*>::const_iterator i = detectors.getDetectors().begin(); for (; i != detectors.getDetectors().end(); ++i) { if ((*i)->getType() == SOURCE_DETECTOR) { break; } } if (i == detectors.getDetectors().end() && !oc.getBool("routes-for-all")) { throw ProcessError("No source detectors found."); } // compute routes between the detectors (optionally) if (!detectors.detectorsHaveRoutes() || oc.getBool("revalidate-routes") || oc.getBool("guess-empty-flows")) { PROGRESS_BEGIN_MESSAGE("Computing routes"); optNet->buildRoutes(detectors, oc.getBool("all-end-follower"), oc.getBool("keep-unfinished-routes"), oc.getBool("routes-for-all"), !oc.getBool("keep-longer-routes"), oc.getInt("max-search-depth")); PROGRESS_DONE_MESSAGE(); } } // check // whether the detectors are valid if (!detectors.detectorsHaveCompleteTypes()) { throw ProcessError("The detector types are not defined; use in combination with a network"); } // whether the detectors have routes if (!detectors.detectorsHaveRoutes()) { throw ProcessError("The emitters have no routes; use in combination with a network"); } // save the detectors if wished if (oc.isSet("detector-output")) { detectors.save(oc.getString("detector-output")); } // save their positions as POIs if wished if (oc.isSet("detectors-poi-output")) { detectors.saveAsPOIs(oc.getString("detectors-poi-output")); } // save the routes file if it was changed or it's wished if (detectors.detectorsHaveRoutes() && oc.isSet("routes-output")) { detectors.saveRoutes(oc.getString("routes-output")); } // guess flows if wished if (oc.getBool("guess-empty-flows")) { optNet->buildDetectorDependencies(detectors); detectors.guessEmptyFlows(flows); } const SUMOTime begin = string2time(oc.getString("begin")); const SUMOTime end = string2time(oc.getString("end")); const SUMOTime step = string2time(oc.getString("time-step")); // save emitters if wished if (oc.isSet("emitters-output") || oc.isSet("emitters-poi-output")) { optNet->buildEdgeFlowMap(flows, detectors, begin, end, step); // !!! if (oc.getBool("revalidate-flows")) { PROGRESS_BEGIN_MESSAGE("Rechecking loaded flows"); optNet->revalidateFlows(detectors, flows, begin, end, step); PROGRESS_DONE_MESSAGE(); } if (oc.isSet("emitters-output")) { PROGRESS_BEGIN_MESSAGE("Writing emitters"); detectors.writeEmitters(oc.getString("emitters-output"), flows, begin, end, step, *optNet, oc.getBool("calibrator-output"), oc.getBool("include-unused-routes"), oc.getFloat("scale"), // oc.getInt("max-search-depth"), oc.getBool("emissions-only")); PROGRESS_DONE_MESSAGE(); } if (oc.isSet("emitters-poi-output")) { PROGRESS_BEGIN_MESSAGE("Writing emitter pois"); detectors.writeEmitterPOIs(oc.getString("emitters-poi-output"), flows); PROGRESS_DONE_MESSAGE(); } } // save end speed trigger if wished if (oc.isSet("variable-speed-sign-output")) { PROGRESS_BEGIN_MESSAGE("Writing speed triggers"); detectors.writeSpeedTrigger(optNet, oc.getString("variable-speed-sign-output"), flows, begin, end, step); PROGRESS_DONE_MESSAGE(); } // save checking detectors if wished if (oc.isSet("validation-output")) { PROGRESS_BEGIN_MESSAGE("Writing validation detectors"); detectors.writeValidationDetectors(oc.getString("validation-output"), oc.getBool("validation-output.add-sources"), true, true); // !!! PROGRESS_DONE_MESSAGE(); } // build global rerouter on end if wished if (oc.isSet("end-reroute-output")) { PROGRESS_BEGIN_MESSAGE("Writing highway end rerouter"); detectors.writeEndRerouterDetectors(oc.getString("end-reroute-output")); // !!! PROGRESS_DONE_MESSAGE(); } /* // save the insertion definitions if(oc.isSet("flow-definitions")) { buildVehicleEmissions(oc.getString("flow-definitions")); } */ // }