45 #ifdef CHECK_MEMORY_LEAKS
47 #endif // CHECK_MEMORY_LEAKS
54 : myDistricts(dc), myNoLoaded(0), myNoWritten(0), myNoDiscarded(0) {}
67 SUMOTime end,
const std::string& origin,
const std::string& destination,
68 const std::string& vehicleType) {
71 WRITE_WARNING(
"Missing origin '" + origin +
"' and destination '" + destination +
"' (" +
toString(vehicleNumber) +
" vehicles).");
75 }
else if (
myDistricts.
get(destination) == 0 && vehicleNumber > 0) {
76 WRITE_ERROR(
"Missing destination '" + destination +
"' (" +
toString(vehicleNumber) +
" vehicles).");
80 WRITE_ERROR(
"District '" + origin +
"' has no source.");
83 WRITE_ERROR(
"District '" + destination +
"' has no sink.");
101 size_t& vehName, std::vector<ODVehicle> &into,
102 bool uniform,
const std::string& prefix) {
112 for (
int i = 0; i < vehicles2insert; ++i) {
134 const std::string& prefix,
bool stepLog) {
139 std::map<std::pair<std::string, std::string>,
SUMOReal> fractionLeft;
144 begin =
MAX2(begin, first->begin);
146 std::vector<ODVehicle> vehicles;
148 for (
SUMOTime t = begin; t != end; t++) {
150 std::cout <<
"Parsing time " +
toString(t) <<
'\r';
153 bool changed =
false;
154 while (next !=
myContainer.end() && (*next)->begin <= t && (*next)->end > t) {
155 std::pair<std::string, std::string> odID = std::make_pair((*next)->origin, (*next)->destination);
157 if (fractionLeft.find(odID) != fractionLeft.end()) {
158 (*next)->vehicleNumber += fractionLeft[odID];
159 fractionLeft[odID] = 0;
162 std::vector<ODVehicle> tmp;
165 if (tmp.size() != 0) {
166 copy(tmp.begin(), tmp.end(), back_inserter(vehicles));
171 if (fractionLeft.find(odID) == fractionLeft.end()) {
172 fractionLeft[odID] = fraction;
174 fractionLeft[odID] += fraction;
183 std::vector<ODVehicle>::reverse_iterator i = vehicles.rbegin();
184 for (; i != vehicles.rend() && (*i).depart == t; ++i) {
186 dev.
openTag(
"trip") <<
" id=\"" << (*i).id <<
"\" depart=\"" << t <<
".00\" "
187 <<
"from=\"" << (*i).from <<
"\" "
188 <<
"to=\"" << (*i).to <<
"\"";
189 if (!noVtype && (*i).cell->vehicleType.length() != 0) {
190 dev <<
" type=\"" << (*i).cell->vehicleType <<
"\"";
192 dev <<
" fromTaz=\"" << (*i).cell->origin <<
"\"";
193 dev <<
" toTaz=\"" << (*i).cell->destination <<
"\"";
194 if (oc.
isSet(
"departlane") && oc.
getString(
"departlane") !=
"default") {
195 dev <<
" departLane=\"" << oc.
getString(
"departlane") <<
"\"";
197 if (oc.
isSet(
"departpos")) {
198 dev <<
" departPos=\"" << oc.
getString(
"departpos") <<
"\"";
200 if (oc.
isSet(
"departspeed") && oc.
getString(
"departspeed") !=
"default") {
201 dev <<
" departSpeed=\"" << oc.
getString(
"departspeed") <<
"\"";
203 if (oc.
isSet(
"arrivallane")) {
204 dev <<
" arrivalLane=\"" << oc.
getString(
"arrivallane") <<
"\"";
206 if (oc.
isSet(
"arrivalpos")) {
207 dev <<
" arrivalPos=\"" << oc.
getString(
"arrivalpos") <<
"\"";
209 if (oc.
isSet(
"arrivalspeed")) {
210 dev <<
" arrivalSpeed=\"" << oc.
getString(
"arrivalspeed") <<
"\"";
214 while (vehicles.size() != 0 && (*vehicles.rbegin()).depart == t) {
241 for (
size_t i = 0; i < ps.
getAreaNo(); ++i) {
249 newCells.push_back(ncell);
258 for (CellVector::iterator i = oldCells.begin(); i != oldCells.end(); ++i) {
261 copy(newCells.begin(), newCells.end(), back_inserter(
myContainer));