| Line | Branch | Decision | Exec | Source |
|---|---|---|---|---|
| 1 | #include "microtubule.hpp" | |||
| 2 | #include "region.hpp" | |||
| 3 | #include "system.hpp" | |||
| 4 | ||||
| 5 | ✗ | double Microtubule::length() | ||
| 6 | { | |||
| 7 | double temp = 0.0; | |||
| 8 | Segment* seg = segments.first(); | |||
| 9 | ||||
| 10 | // calculate total length of a MT | |||
| 11 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | while (seg != nullptr) | |
| 12 | { | |||
| 13 | ✗ | temp += seg->length(); | ||
| 14 | seg = seg->next(); | |||
| 15 | } | |||
| 16 | ✗ | return temp; | ||
| 17 | } | |||
| 18 | ||||
| 19 | ✗ | void Microtubule::update_length(bool force_update) | ||
| 20 | { | |||
| 21 | // can go wrong on position cache refresh, so need a better solution | |||
| 22 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | if ((previous_update_tag == system->current_time_tag) && (!force_update)) | |
| 23 | { | |||
| 24 | return; | |||
| 25 | } | |||
| 26 | ||||
| 27 | #ifdef DBG_ACID_TEST | |||
| 28 | if (segments.size() == 0) | |||
| 29 | { | |||
| 30 | cerr << "ERROR: no segments left. address=" << this << "\n"; | |||
| 31 | } | |||
| 32 | if (plus.event.queue->progression(previousUpdateTag) < -ZERO_CUTOFF) | |||
| 33 | { | |||
| 34 | cerr << "alarm\n"; | |||
| 35 | } | |||
| 36 | if (minus.event.queue->progression(previousUpdateTag) < -ZERO_CUTOFF) | |||
| 37 | { | |||
| 38 | cerr << "alarm\n"; | |||
| 39 | } | |||
| 40 | #endif | |||
| 41 | ||||
| 42 | // move the position of the active (first and last) segment end | |||
| 43 | ✗ | segments.last()->end | ||
| 44 | ✗ | += plus.event.queue->progression(previous_update_tag) * static_cast<double>(plus.dir) * plus.velocity; | ||
| 45 | ✗ | segments.first()->start | ||
| 46 | ✗ | += minus.event.queue->progression(previous_update_tag) * static_cast<double>(minus.dir) * minus.velocity; | ||
| 47 | ||||
| 48 | ✗ | previous_update_tag = system->current_time_tag; | ||
| 49 | ||||
| 50 | #ifdef DBG_ACID_TEST | |||
| 51 | if (segments.size() == 1) | |||
| 52 | { | |||
| 53 | if ((segments.first()->end - segments.first()->start) * segments.first()->dir < -ZERO_CUTOFF) | |||
| 54 | { | |||
| 55 | cerr << "ERROR: negative segment length after updating. [mt address=" << this | |||
| 56 | << ", length=" << (segments.first()->end - segments.first()->start) * segments.first()->dir << "]\n"; | |||
| 57 | cerr << "comparison value:" << -ZERO_CUTOFF << "\n"; | |||
| 58 | cerr << "previous update " << previousUpdateTag << " current " << system->currentTimeTag | |||
| 59 | << " progression=" << system->timeQueue.progression(previousUpdateTag) << "\n"; | |||
| 60 | exit(-1); | |||
| 61 | } | |||
| 62 | } | |||
| 63 | #endif | |||
| 64 | ||||
| 65 | ✗ | return; | ||
| 66 | } | |||
| 67 | ||||
| 68 | ✗ | Microtubule::Microtubule(System* s, TrajectoryVector tv, bool initialize): | ||
| 69 | ✗ | system(s), | ||
| 70 | ✗ | plus(this, tv, s->p.v_plus, &(s->v_plus_queue), s->p.v_plus), | ||
| 71 | ||||
| 72 | // reverse direction | |||
| 73 | ✗ | minus(this, tv.flipped(), -s->p.v_tm, &(s->time_queue), -s->p.v_tm), | ||
| 74 | ✗ | disappear_event(this, &(s->time_queue), -s->p.v_min + s->p.v_tm), | ||
| 75 | ✗ | type(MTType::GROWING), | ||
| 76 | ✗ | nucleation_time(s->system_time + s->system_time_offset), | ||
| 77 | ✗ | previous_update_tag(s->current_time_tag) | ||
| 78 | { | |||
| 79 | #ifdef DBG_MTS | |||
| 80 | cout << "DBG/MTS: Microtubule created.\n"; | |||
| 81 | #endif | |||
| 82 | ||||
| 83 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | if (initialize) | |
| 84 | { | |||
| 85 | // create a single segment MT | |||
| 86 | ✗ | segments.create(this, tv); | ||
| 87 | ||||
| 88 | // intialize the plus tip of MT | |||
| 89 | ✗ | plus.initialize(); | ||
| 90 | ||||
| 91 | // initialize the minus tip of MT | |||
| 92 | ✗ | minus.initialize(); | ||
| 93 | ||||
| 94 | // microtubule is disappearing (segment length finishing) | |||
| 95 | ✗ | set_disappear_event(); | ||
| 96 | } | |||
| 97 | ✗ | return; | ||
| 98 | ✗ | } | ||
| 99 | ||||
| 100 | ✗ | Microtubule::~Microtubule() | ||
| 101 | { | |||
| 102 | #ifdef DBG_MTS | |||
| 103 | cout << "DBG/MTS: Microtubule destroyed. address=" << this << "\n"; | |||
| 104 | #endif | |||
| 105 | ||||
| 106 | #ifdef DBG_ASSERT | |||
| 107 | if ((segments.first()->start - segments.last()->end) > ZERO_CUTOFF) | |||
| 108 | { | |||
| 109 | cerr << "DBG/ASSERT: Microtubule::~Microtubule: endpoints do not coincide/\n"; | |||
| 110 | exit(-1); | |||
| 111 | } | |||
| 112 | #endif | |||
| 113 | ||||
| 114 | // un-linking the MT from the trajectory(ies) | |||
| 115 | ✗ | plus.unlink_from_trajectory(); | ||
| 116 | ✗ | minus.unlink_from_trajectory(); | ||
| 117 | ||||
| 118 | ✗ | return; | ||
| 119 | ✗ | } | ||
| 120 | ||||
| 121 | ✗ | void Microtubule::set_disappear_event() | ||
| 122 | { | |||
| 123 | // push to disappear event: (plus.velocity - minus.velocity < 0) | |||
| 124 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | if ((segments.size() == 1) && (type == MTType::SHRINKING)) | |
| 125 | { | |||
| 126 | ✗ | disappear_event.push_on_queue(segments.first()->length(), DeterministicEventType::DISAPPEAR); | ||
| 127 | } | |||
| 128 | ||||
| 129 | // flush disappear event queue | |||
| 130 | else | |||
| 131 | { | |||
| 132 | ✗ | disappear_event.clear(); | ||
| 133 | } | |||
| 134 | ✗ | return; | ||
| 135 | } | |||
| 136 | ||||
| 137 | ✗ | void Microtubule::handle_event(const EventDescriptor* ei) | ||
| 138 | { | |||
| 139 | // better update length before processing next event | |||
| 140 | ✗ | update_length(); | ||
| 141 | ||||
| 142 | #ifdef DBG_ACID_TEST | |||
| 143 | if (!integrityCheck()) | |||
| 144 | { | |||
| 145 | cerr << "failed before event\n"; | |||
| 146 | exit(-1); | |||
| 147 | } | |||
| 148 | #endif | |||
| 149 | ||||
| 150 | ✗ | switch (ei->type) | ||
| 151 | { | |||
| 152 | // wall collision event encountered | |||
| 153 |
0/1✗ Decision 'true' not taken.
|
✗ | case DeterministicEventType::WALL: | |
| 154 | ✗ | wall(); | ||
| 155 | ✗ | break; | ||
| 156 | ||||
| 157 | // MT-MT collision event encountered | |||
| 158 |
0/1✗ Decision 'true' not taken.
|
✗ | case DeterministicEventType::COLLISION: | |
| 159 | ✗ | collision(); | ||
| 160 | ✗ | break; | ||
| 161 | ||||
| 162 | // back track event encountered | |||
| 163 |
0/1✗ Decision 'true' not taken.
|
✗ | case DeterministicEventType::BACKTRACK: | |
| 164 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | if (ei == &(plus.event)) | |
| 165 | { | |||
| 166 | ✗ | backtrack(&plus); | ||
| 167 | } | |||
| 168 | else | |||
| 169 | { | |||
| 170 | ✗ | backtrack(&minus); | ||
| 171 | } | |||
| 172 | break; | |||
| 173 | ||||
| 174 | // end of segment event encountered | |||
| 175 |
0/1✗ Decision 'true' not taken.
|
✗ | case DeterministicEventType::END_OF_SEGMENT: | |
| 176 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | if (ei == &(plus.event)) | |
| 177 | { | |||
| 178 | ✗ | end_of_segment(&plus); | ||
| 179 | } | |||
| 180 | else | |||
| 181 | { | |||
| 182 | ✗ | end_of_segment(&minus); | ||
| 183 | } | |||
| 184 | break; | |||
| 185 | ||||
| 186 | // disappear event encountered | |||
| 187 |
0/1✗ Decision 'true' not taken.
|
✗ | case DeterministicEventType::DISAPPEAR: | |
| 188 | ✗ | harakiri(); | ||
| 189 | ✗ | break; | ||
| 190 | ||||
| 191 | case DeterministicEventType::NONE: | |||
| 192 | break; | |||
| 193 | }; | |||
| 194 | ||||
| 195 | #ifdef DBG_ACID_TEST | |||
| 196 | if ((ei->type != ev_disappear) && (!integrityCheck())) | |||
| 197 | { | |||
| 198 | cerr << "failed after event\n"; | |||
| 199 | exit(-1); | |||
| 200 | } | |||
| 201 | #endif | |||
| 202 | ||||
| 203 |
0/1✗ Decision 'true' not taken.
|
✗ | return; | |
| 204 | } | |||
| 205 | ||||
| 206 | ✗ | void Microtubule::catastrophe() | ||
| 207 | { | |||
| 208 | #ifdef DBG_MTS | |||
| 209 | cout << "DBG/MTS: Microtubule::catastrophe() called.\n"; | |||
| 210 | #endif | |||
| 211 | ||||
| 212 | #ifdef DBG_EXTRA_CHECK | |||
| 213 | if (type != mt_growing) | |||
| 214 | { | |||
| 215 | cout << "ERROR: catastrophe called for non-growing MT\n"; | |||
| 216 | exit(-1); | |||
| 217 | } | |||
| 218 | #endif | |||
| 219 | ||||
| 220 | // update MT length | |||
| 221 | ✗ | update_length(); | ||
| 222 | ||||
| 223 | // growing MT will become shrinking MT, hence unregister the tip from growing-plus-tip list of this region | |||
| 224 | ✗ | plus.trajectory->base.region->unregister_from_region(plus.region_tag, TipType::PLUS, MTType::GROWING); | ||
| 225 | ||||
| 226 | // now, this is shrinking MT | |||
| 227 | ✗ | type = MTType::SHRINKING; | ||
| 228 | ||||
| 229 | // growing MT will become shrinking MT, hence register the tip on shrinking-plus-tip list of this region | |||
| 230 | ✗ | plus.region_tag = plus.trajectory->base.region->register_on_region(&plus, TipType::PLUS, MTType::SHRINKING); | ||
| 231 | ||||
| 232 | // replace plus velocity by minus velocity | |||
| 233 | ✗ | plus.velocity = system->p.v_min; | ||
| 234 | ||||
| 235 | // | |||
| 236 | ✗ | plus.event.reinitialize(&(system->time_queue), system->p.v_min); | ||
| 237 | ||||
| 238 | // import the growing MT as shrinking MT | |||
| 239 | ✗ | system->shrinking_mts.import(system->growing_mts, this); | ||
| 240 | ||||
| 241 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | if (system->p.v_min < 0) | |
| 242 | { | |||
| 243 | // velocity has changed sign, select a new event | |||
| 244 | ✗ | plus.advance_intersection(); | ||
| 245 | } | |||
| 246 | ||||
| 247 | // schedule next event, (if this is triggered by a collision, and vMin > 0, increase occupancy) | |||
| 248 | ✗ | plus.determine_event(); | ||
| 249 | ||||
| 250 | // check possibility of a disappear event | |||
| 251 | ✗ | set_disappear_event(); | ||
| 252 | ||||
| 253 | ✗ | return; | ||
| 254 | } | |||
| 255 | ||||
| 256 | ✗ | void Microtubule::rescue() | ||
| 257 | { | |||
| 258 | #ifdef DBG_MTS | |||
| 259 | cout << "DBG/MTS: Microtubule::rescue() called.\n"; | |||
| 260 | #endif | |||
| 261 | ||||
| 262 | #ifdef DBG_EXTRA_CHECK | |||
| 263 | if (type != mt_shrinking) | |||
| 264 | { | |||
| 265 | cout << "ERROR: rescue called for non-shrinking MT\n"; | |||
| 266 | exit(-1); | |||
| 267 | } | |||
| 268 | #endif | |||
| 269 | ||||
| 270 | ✗ | update_length(); | ||
| 271 | ||||
| 272 | // shrinking MT will become growing MT, hence unregister the tip from shrinking-plus-tip list of this region | |||
| 273 | ✗ | plus.trajectory->base.region->unregister_from_region(plus.region_tag, TipType::PLUS, MTType::SHRINKING); | ||
| 274 | ||||
| 275 | // now, this is growing MT | |||
| 276 | ✗ | type = MTType::GROWING; | ||
| 277 | ||||
| 278 | // shrinking MT will become growing MT, hence register the tip on growing-plus-tip list of this region | |||
| 279 | ✗ | plus.region_tag = plus.trajectory->base.region->register_on_region(&plus, TipType::PLUS, MTType::GROWING); | ||
| 280 | ||||
| 281 | // replace minue velocity by plus velocity | |||
| 282 | ✗ | plus.velocity = system->p.v_plus; | ||
| 283 | ||||
| 284 | ✗ | plus.event.reinitialize(&(system->v_plus_queue), system->p.v_plus); | ||
| 285 | ||||
| 286 | // import the shrinking MT as growing MT | |||
| 287 | ✗ | system->growing_mts.import(system->shrinking_mts, this); | ||
| 288 | ||||
| 289 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | if (system->p.v_min < 0) | |
| 290 | { | |||
| 291 | // velocity has changed sign, need to select a new event | |||
| 292 | ✗ | plus.advance_intersection(); | ||
| 293 | } | |||
| 294 | ||||
| 295 | // schedule next event | |||
| 296 | ✗ | plus.determine_event(); | ||
| 297 | ||||
| 298 | // check possibility of a disappear event | |||
| 299 | ✗ | set_disappear_event(); | ||
| 300 | ||||
| 301 | ✗ | return; | ||
| 302 | } | |||
| 303 | ||||
| 304 | ✗ | void Microtubule::sever(Segment* cut_seg, double cut_pos) | ||
| 305 | { | |||
| 306 | // sever MT at given position | |||
| 307 | ✗ | split_segment_at_traj_pos(cut_seg->start + static_cast<double>(cut_seg->dir) * cut_pos, cut_seg); | ||
| 308 | ✗ | system->total_length_severing_count++; | ||
| 309 | ✗ | return; | ||
| 310 | } | |||
| 311 | ||||
| 312 | ✗ | void Microtubule::sever_at_cross(IntersectionItr is, Segment* cut_seg) | ||
| 313 | { | |||
| 314 | // WARNING: take care to cut the segment right *after* the intersection. Not doing so can lead to problems | |||
| 315 | // when treadmilling is disabled. The microtubule end is then located *exactly* on the intersection and can be cut | |||
| 316 | // again and again, leading to problems. | |||
| 317 | ||||
| 318 | // this time, cutPos and cutSeg are already known. | |||
| 319 | ✗ | double split_pos(is->first); | ||
| 320 | // shift the cut ever so slightly away from the intersection, in the direction of the plus end. | |||
| 321 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | if (cut_seg->dir == Direction::FORWARD) | |
| 322 | { | |||
| 323 | ✗ | split_pos += ZERO_CUTOFF; | ||
| 324 | } | |||
| 325 | else | |||
| 326 | { | |||
| 327 | ✗ | split_pos -= ZERO_CUTOFF; | ||
| 328 | } | |||
| 329 | ||||
| 330 | // only cut if the severing position is comfortably located within the segment interval | |||
| 331 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | if ((cut_seg->start - split_pos) * (cut_seg->end - split_pos) < ZERO_CUTOFF) | |
| 332 | { | |||
| 333 | ✗ | split_segment_at_traj_pos(split_pos, cut_seg); | ||
| 334 | ✗ | system->total_intersection_severing_count++; | ||
| 335 | } | |||
| 336 | ✗ | return; | ||
| 337 | } | |||
| 338 | ||||
| 339 | ✗ | void Microtubule::split_segment_at_traj_pos(double cut_pos, Segment* cut_seg) | ||
| 340 | { | |||
| 341 | // used in sever and severAtCross | |||
| 342 | Microtubule* new_mt(nullptr); | |||
| 343 | TrajectoryVector tv; | |||
| 344 | ||||
| 345 | ✗ | tv.trajectory = cut_seg->trajectory; | ||
| 346 | ✗ | tv.dir = cut_seg->dir; | ||
| 347 | tv.pos = cut_pos; | |||
| 348 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | if (type == MTType::GROWING) | |
| 349 | { | |||
| 350 | ✗ | new_mt = system->growing_mts.create(system, tv, false); | ||
| 351 | } | |||
| 352 | else | |||
| 353 | { | |||
| 354 | ✗ | new_mt = system->shrinking_mts.create(system, tv, false); | ||
| 355 | } | |||
| 356 | ||||
| 357 | ✗ | new_mt->nucleation_time = nucleation_time; | ||
| 358 | ✗ | new_mt->type = type; | ||
| 359 | ||||
| 360 | // transfer segments | |||
| 361 | ✗ | new_mt->segments.create(new_mt, tv); | ||
| 362 | ✗ | new_mt->segments.first()->end = cut_seg->end; | ||
| 363 | ✗ | new_mt->segments.first()->end_itr = cut_seg->end_itr; | ||
| 364 | ✗ | new_mt->segments.first()->nucleation_time = cut_seg->nucleation_time; | ||
| 365 | ✗ | new_mt->segments.import_set(segments, cut_seg->next(), segments.last()); | ||
| 366 | Segment* temp_seg = new_mt->segments.first()->next(); | |||
| 367 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | while (temp_seg != nullptr) | |
| 368 | { | |||
| 369 | ✗ | temp_seg->mt = new_mt; | ||
| 370 | temp_seg = temp_seg->next(); | |||
| 371 | } | |||
| 372 | ||||
| 373 | // now update the plus tip trajectory/position | |||
| 374 | ✗ | new_mt->plus.trajectory = plus.trajectory; | ||
| 375 | ✗ | new_mt->plus.velocity = plus.velocity; | ||
| 376 | ✗ | new_mt->plus.event.reinitialize(plus.event.queue, plus.velocity); | ||
| 377 | ✗ | new_mt->plus.dir = plus.dir; | ||
| 378 | ✗ | new_mt->plus.next_collision = plus.next_collision; | ||
| 379 | ✗ | new_mt->plus.notification_tag = new_mt->plus.trajectory->register_for_notifications(&(new_mt->plus)); | ||
| 380 | new_mt->plus.region_tag | |||
| 381 | ✗ | = new_mt->plus.trajectory->base.region->register_on_region(&(new_mt->plus), TipType::PLUS, type); | ||
| 382 | ||||
| 383 | // next, update the minus end of the new MT | |||
| 384 | ✗ | new_mt->segments.first()->start = tv.pos; | ||
| 385 | ✗ | new_mt->minus.notification_tag = new_mt->minus.trajectory->register_for_notifications(&(new_mt->minus)); | ||
| 386 | new_mt->minus.region_tag | |||
| 387 | ✗ | = new_mt->minus.trajectory->base.region->register_on_region(&(new_mt->minus), TipType::MINUS, type); | ||
| 388 | ✗ | new_mt->minus.locate_intersection(); | ||
| 389 | ||||
| 390 | ✗ | new_mt->plus.determine_event(); | ||
| 391 | ✗ | new_mt->minus.determine_event(); | ||
| 392 | ✗ | new_mt->set_disappear_event(); | ||
| 393 | ||||
| 394 | // now, finish up the base microtubule | |||
| 395 | ✗ | segments.last()->end = cut_pos; | ||
| 396 | ||||
| 397 | // always unregister from region (just to be sure) | |||
| 398 | ✗ | plus.trajectory->base.region->unregister_from_region(plus.region_tag, TipType::PLUS, type); | ||
| 399 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | if (type == MTType::GROWING) | |
| 400 | { | |||
| 401 | ✗ | type = MTType::SHRINKING; | ||
| 402 | ✗ | plus.velocity = system->p.v_min; | ||
| 403 | ✗ | plus.event.reinitialize(&(system->time_queue), system->p.v_min); | ||
| 404 | ✗ | system->shrinking_mts.import(system->growing_mts, this); | ||
| 405 | } | |||
| 406 | ||||
| 407 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | if (plus.trajectory != tv.trajectory) | |
| 408 | { | |||
| 409 | ✗ | plus.trajectory->unregister_for_notifications(plus.notification_tag); | ||
| 410 | ✗ | plus.trajectory = tv.trajectory; | ||
| 411 | ✗ | plus.notification_tag = plus.trajectory->register_for_notifications(&(plus)); | ||
| 412 | } | |||
| 413 | //...and register on region again | |||
| 414 | ✗ | plus.region_tag = plus.trajectory->base.region->register_on_region(&plus, TipType::PLUS, MTType::SHRINKING); | ||
| 415 | ✗ | plus.dir = tv.dir; | ||
| 416 | ✗ | plus.next_collision = new_mt->minus.next_collision; | ||
| 417 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | if (system->p.v_min * new_mt->minus.velocity >= 0) | |
| 418 | { | |||
| 419 | // both tips move in opposite directions [this should generally be the case] | |||
| 420 | ✗ | plus.advance_intersection(); | ||
| 421 | } | |||
| 422 | ||||
| 423 | ✗ | plus.determine_event(); | ||
| 424 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | if (segments.size() == 1) | |
| 425 | { | |||
| 426 | ✗ | minus.determine_event(); | ||
| 427 | } | |||
| 428 | ✗ | set_disappear_event(); | ||
| 429 | ||||
| 430 | ✗ | return; | ||
| 431 | } | |||
| 432 | ||||
| 433 | ✗ | void Microtubule::translate_position_m_t2_segment(double& cut_pos, Segment*& cut_seg) | ||
| 434 | { | |||
| 435 | ✗ | cut_seg = segments.first(); | ||
| 436 |
0/1? Decision couldn't be analyzed.
|
✗ | while ((cut_seg != nullptr) && (cut_pos > cut_seg->length())) | |
| 437 | { | |||
| 438 | ✗ | cut_pos -= cut_seg->length(); | ||
| 439 | ✗ | cut_seg = cut_seg->next(); | ||
| 440 | } | |||
| 441 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | if (cut_pos > cut_seg->length()) | |
| 442 | { | |||
| 443 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | if (cut_pos - cut_seg->length() < ZERO_CUTOFF) | |
| 444 | { | |||
| 445 | ✗ | cut_pos = cut_seg->length() - ZERO_CUTOFF; | ||
| 446 | } | |||
| 447 | else | |||
| 448 | { | |||
| 449 | ✗ | std::cerr << "ERROR: position beyond the end of the microtubule.\n"; | ||
| 450 | ✗ | exit(-1); | ||
| 451 | } | |||
| 452 | } | |||
| 453 | ✗ | cut_pos = cut_seg->start + static_cast<double>(cut_seg->dir) * cut_pos; | ||
| 454 | ✗ | return; | ||
| 455 | } | |||
| 456 | ||||
| 457 | ✗ | void Microtubule::wall() | ||
| 458 | { | |||
| 459 | // only for plus end | |||
| 460 | ||||
| 461 | TrajectoryVector tv; | |||
| 462 | ||||
| 463 | // set position of the plus end equal to the event position, to mitigate the effect of cumulating addition errors | |||
| 464 | ✗ | segments.last()->end = plus.next_event_pos; | ||
| 465 | ✗ | tv = plus.trajectory->next_trajectory(plus.dir); | ||
| 466 | ||||
| 467 | // next trajectory on 'forbidden zone', leads catastrophe | |||
| 468 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | if (tv.trajectory->base.region->face_tag == -1) | |
| 469 | { | |||
| 470 | ✗ | tv.trajectory->conditional_remove(); | ||
| 471 | ✗ | catastrophe(); | ||
| 472 | ||||
| 473 | // no wall crossing | |||
| 474 | ✗ | return; | ||
| 475 | } | |||
| 476 | ||||
| 477 | // edge catastrophe enabled | |||
| 478 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | if (system->p.edge_catastrophe_enabled) | |
| 479 | { | |||
| 480 | ✗ | double cos_angle | ||
| 481 | ✗ | = (plus.dir == Direction::FORWARD) ? plus.trajectory->next_tr_cos_angle : plus.trajectory->prev_tr_cos_angle; | ||
| 482 | ||||
| 483 | // MT is moving non-parallel to the edege | |||
| 484 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | if ((1.0 - cos_angle) > ZERO_CUTOFF) | |
| 485 | { | |||
| 486 | double p_cat(0.0); | |||
| 487 | ||||
| 488 | // for sharp edged cube | |||
| 489 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | if (system->p.geometry == "cubeReal") | |
| 490 | { | |||
| 491 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | if (std::abs(plus.trajectory->base.region->face_tag - tv.trajectory->base.region->face_tag) > 0) | |
| 492 | { | |||
| 493 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | if (std::abs(plus.trajectory->base.region->face_tag - tv.trajectory->base.region->face_tag) > 1) | |
| 494 | { | |||
| 495 | ✗ | p_cat = system->p.p_cat_special_edge_max; | ||
| 496 | } | |||
| 497 | ||||
| 498 | else | |||
| 499 | { | |||
| 500 | ✗ | p_cat = system->p.p_cat_regular_edge_max; | ||
| 501 | } | |||
| 502 | } | |||
| 503 | } | |||
| 504 | ||||
| 505 | // other | |||
| 506 | else | |||
| 507 | { | |||
| 508 | p_cat | |||
| 509 | ✗ | = (plus.dir == Direction::FORWARD) ? plus.trajectory->next_trp_cat : plus.trajectory->prev_trp_cat; | ||
| 510 | } | |||
| 511 | ||||
| 512 | // when smooth catastrophe is enabled | |||
| 513 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | if (system->p.edge_catastrophe_smooth) | |
| 514 | { | |||
| 515 | ✗ | p_cat *= (1.0 - cos_angle); | ||
| 516 | } | |||
| 517 | ||||
| 518 | // apply catastrophe | |||
| 519 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | if (system->random_gen.rand() <= p_cat) | |
| 520 | { | |||
| 521 | ✗ | tv.trajectory->conditional_remove(); | ||
| 522 | ✗ | catastrophe(); | ||
| 523 | ||||
| 524 | // no wall crossing | |||
| 525 | ✗ | return; | ||
| 526 | } | |||
| 527 | } | |||
| 528 | } | |||
| 529 | ||||
| 530 | // update boundarty crossing count | |||
| 531 | ✗ | system->boundary_crossing_count++; | ||
| 532 | ||||
| 533 | #ifdef DBG_ASSERT | |||
| 534 | if (segments.last()->endItr != plus.nextCollision) | |||
| 535 | { | |||
| 536 | cerr << "DBG/ASSERT: nextCollision does not match with endItr upon entering wall event.\n"; | |||
| 537 | } | |||
| 538 | #endif | |||
| 539 | ||||
| 540 | // wall crossing | |||
| 541 | ✗ | segments.last()->end_itr = plus.next_collision; | ||
| 542 | ||||
| 543 | // create a new segment | |||
| 544 | ✗ | segments.create(this, tv); | ||
| 545 | ✗ | segments.last()->start_itr = tv.dir == Direction::FORWARD ? tv.trajectory->wall_begin() : tv.trajectory->wall_end(); | ||
| 546 | ||||
| 547 | // switch trajectory | |||
| 548 | ✗ | plus.switch_trajectory( | ||
| 549 | tv.trajectory, tv.dir, tv.dir == Direction::FORWARD ? tv.trajectory->wall_begin() : tv.trajectory->wall_end()); | |||
| 550 | ||||
| 551 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | if (segments.size() == 2) | |
| 552 | { | |||
| 553 | // MT with two segment of zero (=0) length, consider possibilty of a disappear event | |||
| 554 | ✗ | minus.determine_event(); | ||
| 555 | ✗ | set_disappear_event(); | ||
| 556 | } | |||
| 557 | ||||
| 558 | return; | |||
| 559 | } | |||
| 560 | ||||
| 561 | ✗ | void Microtubule::collision() | ||
| 562 | { | |||
| 563 | // set position of the plus end equal to the event position, to mitigate the effect of cumulating addition errors | |||
| 564 | ✗ | segments.last()->end = plus.next_event_pos; | ||
| 565 | CollisionType type; | |||
| 566 | Direction dir; | |||
| 567 | ||||
| 568 | // no MT(s) passing throught the next collision point, resulting a simple crossover | |||
| 569 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | if (plus.next_collision->second.mirror->second.occupancy == 0) | |
| 570 | { | |||
| 571 | type = CollisionType::CROSSOVER; | |||
| 572 | } | |||
| 573 | ||||
| 574 | // MT(s) passing through the next collision point | |||
| 575 | else | |||
| 576 | { | |||
| 577 | ✗ | double diff_angle = plus.trajectory->base.region->intersection_angle( | ||
| 578 | plus.trajectory, plus.next_collision->second.other_trajectory); | |||
| 579 | ||||
| 580 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | if (diff_angle > 0.5 * PI) | |
| 581 | { | |||
| 582 | ✗ | dir = (plus.dir == Direction::FORWARD) ? Direction::BACKWARD : Direction::FORWARD; | ||
| 583 | ✗ | diff_angle = PI - diff_angle; | ||
| 584 | } | |||
| 585 | else | |||
| 586 | { | |||
| 587 | ✗ | dir = plus.dir; | ||
| 588 | } | |||
| 589 | ||||
| 590 | // find out type of collision event to be occured | |||
| 591 | ✗ | type = system->collision_result( | ||
| 592 | diff_angle, plus.next_collision->second.occupancy, plus.next_collision->second.mirror->second.occupancy); | |||
| 593 | } | |||
| 594 | ||||
| 595 | ✗ | switch (type) | ||
| 596 | { | |||
| 597 | // zippering | |||
| 598 |
0/1✗ Decision 'true' not taken.
|
✗ | case CollisionType::ZIPPER: | |
| 599 | ✗ | system->total_zipper_count++; | ||
| 600 | ✗ | zipper(dir); | ||
| 601 | ✗ | break; | ||
| 602 | ||||
| 603 | // crossover | |||
| 604 |
0/1✗ Decision 'true' not taken.
|
✗ | case CollisionType::CROSSOVER: | |
| 605 | ✗ | system->total_crossover_count++; | ||
| 606 | ✗ | crossover(); | ||
| 607 | ✗ | break; | ||
| 608 | ||||
| 609 | // induced catastrophe | |||
| 610 |
0/1✗ Decision 'true' not taken.
|
✗ | case CollisionType::INDUCED_CATASTROPHE: | |
| 611 | ✗ | system->total_induced_catastrophe_count++; | ||
| 612 | ✗ | catastrophe(); | ||
| 613 | ✗ | break; | ||
| 614 | ||||
| 615 | #ifdef DBG_EXTRA_CHECK | |||
| 616 | default: | |||
| 617 | cerr << "Unknown collision result type (" << type << ") used.\n"; | |||
| 618 | exit(-1); | |||
| 619 | #endif | |||
| 620 | }; | |||
| 621 | ||||
| 622 |
0/1✗ Decision 'true' not taken.
|
✗ | return; | |
| 623 | } | |||
| 624 | ||||
| 625 | ✗ | void Microtubule::zipper(Direction dir) | ||
| 626 | { | |||
| 627 | #ifdef DBG_ASSERT | |||
| 628 | if (std::abs(plus.nextCollision->first - segments.last()->end) > ZERO_CUTOFF) | |||
| 629 | { | |||
| 630 | cout << "DBG/ASSERT: ERROR: end of segment does not match zippering location.[discrepancy: " | |||
| 631 | << std::abs(plus.nextCollision->first - segments.last()->end) << "]\n"; | |||
| 632 | exit(-1); | |||
| 633 | } | |||
| 634 | #endif | |||
| 635 | ||||
| 636 | // get a trajectory vetor on the new trajectory to be associted after zippering | |||
| 637 | ✗ | TrajectoryVector tv(plus.next_collision->second.mirror->first, dir, plus.next_collision->second.other_trajectory); | ||
| 638 | ||||
| 639 | // link the end of the last segment (containing the plus tip) to the next plus end collision | |||
| 640 | ✗ | segments.last()->end_itr = plus.next_collision; | ||
| 641 | ||||
| 642 | // create a new zero (=0) length segment on new position and direction (of course on new trajectory) | |||
| 643 | ✗ | segments.create(this, tv); | ||
| 644 | ||||
| 645 | // link the bottom of the last segment (containing the new minus tip) to the next plus end collision mirror | |||
| 646 | ✗ | segments.last()->start_itr = plus.next_collision->second.mirror; | ||
| 647 | ||||
| 648 | // now do the switching of trajectory from incoming to outgoing | |||
| 649 | ✗ | plus.switch_trajectory(plus.next_collision->second.other_trajectory, dir, plus.next_collision->second.mirror); | ||
| 650 | ||||
| 651 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | if (segments.size() == 2) | |
| 652 | { | |||
| 653 | // number of segment is two (=2), HERE it means two zero length segment, prepare to schedule a disappear event | |||
| 654 | ✗ | minus.determine_event(); | ||
| 655 | ✗ | set_disappear_event(); | ||
| 656 | } | |||
| 657 | ||||
| 658 | ✗ | return; | ||
| 659 | } | |||
| 660 | ||||
| 661 | ✗ | void Microtubule::end_of_segment(MTTip* tip) | ||
| 662 | { | |||
| 663 | #ifdef DBG_ASSERT | |||
| 664 | if (segments.size() == 1) | |||
| 665 | { | |||
| 666 | cout << "DBG/ASSERT: ERROR: end-of-segment event called for single-segmented microtubule.\n"; | |||
| 667 | // exit(-1); | |||
| 668 | } | |||
| 669 | #endif | |||
| 670 | ||||
| 671 | Direction new_dir; | |||
| 672 | Segment* new_seg(nullptr); | |||
| 673 | Segment* kill_seg(nullptr); | |||
| 674 | ||||
| 675 | // select plus tip associated segment | |||
| 676 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | if (tip == &plus) | |
| 677 | { | |||
| 678 | kill_seg = segments.last(); | |||
| 679 | new_seg = segments.last()->previous(); | |||
| 680 | ✗ | new_dir = new_seg->dir; | ||
| 681 | } | |||
| 682 | ||||
| 683 | // select minus tip associated segment | |||
| 684 | else | |||
| 685 | { | |||
| 686 | kill_seg = segments.first(); | |||
| 687 | new_seg = segments.first()->next(); | |||
| 688 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | if (new_seg->dir == Direction::FORWARD) | |
| 689 | { | |||
| 690 | new_dir = Direction::BACKWARD; | |||
| 691 | } | |||
| 692 | else | |||
| 693 | { | |||
| 694 | new_dir = Direction::FORWARD; | |||
| 695 | } | |||
| 696 | } | |||
| 697 | ||||
| 698 | #ifdef DBG_ASSERT | |||
| 699 | if (std::abs(killSeg->end - killSeg->start) > ZERO_CUTOFF) | |||
| 700 | { | |||
| 701 | cout << "DEBUG/ASSERT: ERROR: non-zero segment length on end of segment event\n"; | |||
| 702 | exit(-1); | |||
| 703 | } | |||
| 704 | #endif | |||
| 705 | ||||
| 706 | // kill the selected segment | |||
| 707 | ✗ | segments.remove(kill_seg); | ||
| 708 | ||||
| 709 | // tip switching to a new trajectory (in a different region) after encountering wall-begin/wall-end | |||
| 710 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | if ((tip->next_collision == tip->trajectory->wall_begin()) || (tip->next_collision == tip->trajectory->wall_end())) | |
| 711 | { | |||
| 712 | ✗ | tip->switch_trajectory(new_seg->trajectory, | ||
| 713 | new_dir, | |||
| 714 | ✗ | new_dir == Direction::FORWARD ? new_seg->trajectory->wall_end() | ||
| 715 | ✗ | : new_seg->trajectory->wall_begin()); | ||
| 716 | ✗ | system->boundary_crossing_count--; | ||
| 717 | } | |||
| 718 | ||||
| 719 | // tip switching to a new trajectory (in the same region) | |||
| 720 | else | |||
| 721 | { | |||
| 722 | ✗ | tip->switch_trajectory( | ||
| 723 | tip->next_collision->second.other_trajectory, new_dir, tip->next_collision->second.mirror); | |||
| 724 | } | |||
| 725 | ||||
| 726 | // MT length zero (=0) encountered | |||
| 727 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | if (segments.size() == 1) | |
| 728 | { | |||
| 729 | // current tip is a plus tip, so determine the minus tip associated event | |||
| 730 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | if (tip == &(plus)) | |
| 731 | { | |||
| 732 | ✗ | minus.determine_event(); | ||
| 733 | } | |||
| 734 | ||||
| 735 | // current tip is a minus tip, so determine the plus tip associated event | |||
| 736 | else | |||
| 737 | { | |||
| 738 | ✗ | plus.determine_event(); | ||
| 739 | } | |||
| 740 | ||||
| 741 | // schedule a disappear event | |||
| 742 | ✗ | set_disappear_event(); | ||
| 743 | } | |||
| 744 | ||||
| 745 | ✗ | return; | ||
| 746 | } | |||
| 747 | ||||
| 748 | ✗ | void Microtubule::backtrack(MTTip* tip) | ||
| 749 | { | |||
| 750 | // asociated with depolymerizing plus/minus end | |||
| 751 | ||||
| 752 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | if (tip == &(plus)) | |
| 753 | { | |||
| 754 | ✗ | segments.last()->end = plus.next_event_pos; | ||
| 755 | } | |||
| 756 | else | |||
| 757 | { | |||
| 758 | ✗ | segments.first()->start = minus.next_event_pos; | ||
| 759 | } | |||
| 760 | ||||
| 761 | // MT is back tracked from this site, resulting a decrease in occupancy | |||
| 762 | ✗ | tip->next_collision->second.occupancy--; | ||
| 763 | ||||
| 764 | #ifdef CROSS_SEV | |||
| 765 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | if ((tip->next_collision->second.occupancy == 0) && (tip->next_collision->second.mirror->second.occupancy > 0)) | |
| 766 | { | |||
| 767 | ✗ | system->remove_occupied_intersection(tip->next_collision->second); | ||
| 768 | } | |||
| 769 | #endif | |||
| 770 | ||||
| 771 | #ifdef DBG_ASSERT | |||
| 772 | if (tip->nextCollision->second.occupancy < 0) | |||
| 773 | { | |||
| 774 | cerr << "DBG/ASSERT: ERROR: negative intersection occupancy after "; | |||
| 775 | if (tip == &(plus)) | |||
| 776 | { | |||
| 777 | cerr << "plus"; | |||
| 778 | } | |||
| 779 | else | |||
| 780 | { | |||
| 781 | cerr << "minus"; | |||
| 782 | } | |||
| 783 | cerr << " end backtracking.\n"; | |||
| 784 | ||||
| 785 | cout << "number of equal elements: " << tip->trajectory->intersections.count(tip->nextCollision->first) << "\n"; | |||
| 786 | ; | |||
| 787 | ||||
| 788 | double temp = tip->nextCollision->first; | |||
| 789 | ||||
| 790 | do | |||
| 791 | { | |||
| 792 | cout << "pos=" << tip->mt->segments.last()->end << ", " << tip->mt->segments.first()->start | |||
| 793 | << ", occupancy=" << tip->nextCollision->second.occupancy << " "; | |||
| 794 | tip->advanceIntersection(); | |||
| 795 | tip->determineEvent(); | |||
| 796 | cout << "step (size=" << tip->nextCollision->first - temp << ")\n"; | |||
| 797 | } while (tip->event.type != ev_end_of_segment); | |||
| 798 | cout << "pos=" << tip->mt->segments.last()->end << ", " << tip->mt->segments.first()->start << " \n"; | |||
| 799 | ||||
| 800 | exit(-1); | |||
| 801 | } | |||
| 802 | #endif | |||
| 803 | ||||
| 804 | // schedule next event | |||
| 805 | ✗ | tip->advance_intersection(); | ||
| 806 | ✗ | tip->determine_event(); | ||
| 807 | ||||
| 808 | ✗ | return; | ||
| 809 | } | |||
| 810 | ||||
| 811 | ✗ | void Microtubule::crossover() | ||
| 812 | { | |||
| 813 | #ifdef DBG_ASSERT | |||
| 814 | if (plus.nextCollision->second.occupancy < 0) | |||
| 815 | { | |||
| 816 | cerr << "DBG/ASSERT: ERROR: negative intersection occupancy before crossover.\n"; | |||
| 817 | exit(-1); | |||
| 818 | } | |||
| 819 | #endif | |||
| 820 | ||||
| 821 | #ifdef CROSS_SEV | |||
| 822 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | if ((plus.next_collision->second.occupancy == 0) && plus.next_collision->second.mirror->second.occupancy > 0) | |
| 823 | { | |||
| 824 | ✗ | system->add_occupied_intersection(plus.next_collision); | ||
| 825 | } | |||
| 826 | #endif | |||
| 827 | ||||
| 828 | // skip any (active) event in the current intersection point, instead move the tip to the next intersection point | |||
| 829 | ✗ | plus.next_collision->second.occupancy++; | ||
| 830 | ✗ | plus.advance_intersection(); | ||
| 831 | ✗ | plus.determine_event(); | ||
| 832 | ||||
| 833 | ✗ | return; | ||
| 834 | } | |||
| 835 | ||||
| 836 | ✗ | void Microtubule::harakiri() | ||
| 837 | { | |||
| 838 | // MT disappear event encountered, remove the MT | |||
| 839 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | if (type == MTType::GROWING) | |
| 840 | { | |||
| 841 | ✗ | system->growing_mts.remove(this); | ||
| 842 | } | |||
| 843 | else | |||
| 844 | { | |||
| 845 | ✗ | system->shrinking_mts.remove(this); | ||
| 846 | } | |||
| 847 | ||||
| 848 | ✗ | return; | ||
| 849 | } | |||
| 850 | ||||
| 851 | ✗ | bool Microtubule::integrity_check() | ||
| 852 | { | |||
| 853 | bool valid(true); | |||
| 854 | ✗ | double max_deviation(0.0); | ||
| 855 | ||||
| 856 | Segment* seg(nullptr); | |||
| 857 | IntersectionItr is; | |||
| 858 | size_t count(0); | |||
| 859 | ||||
| 860 | // check connections between end-of segment iterators and match with positions (should be exact) | |||
| 861 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | if (segments.size() == 0) | |
| 862 | { | |||
| 863 | // MT should contain at least one segment | |||
| 864 | valid = false; | |||
| 865 | ✗ | std::cerr << "Microtubule contains no segments.\n"; | ||
| 866 | } | |||
| 867 | ||||
| 868 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | else if (segments.size() != 1) | |
| 869 | { | |||
| 870 | if (segments.size() == 0) | |||
| 871 | { | |||
| 872 | // MT should contain at least one segment | |||
| 873 | std::cerr << "microtubule without segments!\n"; | |||
| 874 | exit(-1); | |||
| 875 | } | |||
| 876 | ||||
| 877 | seg = segments.first(); | |||
| 878 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | if (seg == nullptr) | |
| 879 | { | |||
| 880 | // pointer to segment list can not be null | |||
| 881 | ✗ | std::cerr << "null pointer received\n"; | ||
| 882 | ✗ | exit(-1); | ||
| 883 | } | |||
| 884 | ||||
| 885 | // segment (some where) at the middle of a trajectory | |||
| 886 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | if ((seg->end_itr != seg->trajectory->wall_end()) && (seg->end_itr != seg->trajectory->wall_begin())) | |
| 887 | { | |||
| 888 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | if (seg->end_itr->second.mirror != seg->next()->start_itr) | |
| 889 | { | |||
| 890 | // next-start-iterator should match with the end-second-mirror-iterator | |||
| 891 | valid = false; | |||
| 892 | ✗ | std::cerr << "reciprocity violated\n"; | ||
| 893 | } | |||
| 894 | ||||
| 895 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | if (std::abs(seg->end - seg->end_itr->first) > ZERO_CUTOFF) | |
| 896 | { | |||
| 897 | // segment end location does not coincide with the first intersection site | |||
| 898 | valid = false; | |||
| 899 | ✗ | std::cerr << "Location of segment end does not coincide with intersection position\n"; | ||
| 900 | } | |||
| 901 | ||||
| 902 | ✗ | max_deviation = std::max(max_deviation, std::abs(seg->end - seg->end_itr->first)); | ||
| 903 | ||||
| 904 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | if (std::abs(seg->next()->start - seg->next()->start_itr->first) > ZERO_CUTOFF) | |
| 905 | { | |||
| 906 | // (next) segment end location does not coincide with the first intersection site | |||
| 907 | valid = false; | |||
| 908 | ✗ | std::cerr << "Location of segment end does not coincide with intersection position\n"; | ||
| 909 | } | |||
| 910 | ✗ | max_deviation = std::max(max_deviation, std::abs(seg->next()->start - seg->next()->start_itr->first)); | ||
| 911 | } | |||
| 912 | ||||
| 913 | // segment at the end of a trajectory | |||
| 914 | else | |||
| 915 | { | |||
| 916 | // positions should match with wall end location | |||
| 917 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | if (seg->end_itr == seg->trajectory->wall_end()) | |
| 918 | { | |||
| 919 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | if (std::abs(seg->end - seg->trajectory->length) > ZERO_CUTOFF) | |
| 920 | { | |||
| 921 | // segment end location does not coincide with the first intersection site | |||
| 922 | valid = false; | |||
| 923 | ✗ | std::cerr << "Segment end location does not coincide with end of trajectory\n"; | ||
| 924 | } | |||
| 925 | ✗ | max_deviation = std::max(max_deviation, std::abs(seg->end - seg->trajectory->length)); | ||
| 926 | } | |||
| 927 | ||||
| 928 | // positions should match with wall begin location | |||
| 929 | else | |||
| 930 | { | |||
| 931 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | if (std::abs(seg->end - 0) > ZERO_CUTOFF) | |
| 932 | { | |||
| 933 | // segment end location does not coincide with the first intersection site | |||
| 934 | valid = false; | |||
| 935 | ✗ | std::cerr << "Segment end location does not coincide with end of trajectory\n"; | ||
| 936 | } | |||
| 937 | ✗ | max_deviation = std::max(max_deviation, std::abs(seg->end - 0)); | ||
| 938 | } | |||
| 939 | ||||
| 940 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | if (seg->next()->start_itr == seg->next()->trajectory->wall_end()) | |
| 941 | { | |||
| 942 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | if (std::abs(seg->next()->start - seg->next()->trajectory->length) > ZERO_CUTOFF) | |
| 943 | { | |||
| 944 | valid = false; | |||
| 945 | ✗ | std::cerr << "Segment start location does not coincide with end of trajectory\n"; | ||
| 946 | ✗ | std::cerr << "start: " << seg->next()->start << ", length: " << seg->next()->trajectory->length | ||
| 947 | ✗ | << ", diff=" << std::abs(seg->next()->start - seg->next()->trajectory->length) << "\n"; | ||
| 948 | } | |||
| 949 | ✗ | max_deviation = std::max(max_deviation, std::abs(seg->next()->start - seg->next()->trajectory->length)); | ||
| 950 | } | |||
| 951 | else | |||
| 952 | { | |||
| 953 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | if (std::abs(seg->next()->start - 0) > ZERO_CUTOFF) | |
| 954 | { | |||
| 955 | valid = false; | |||
| 956 | ✗ | std::cerr << "Segment start location does not coincide with start of trajectory\n"; | ||
| 957 | ✗ | std::cerr << "start: " << seg->next()->start << ", length: " << seg->next()->trajectory->length | ||
| 958 | ✗ | << ", diff=" << std::abs(seg->next()->start) << "\n"; | ||
| 959 | } | |||
| 960 | ✗ | max_deviation = std::max(max_deviation, std::abs(seg->next()->start - 0)); | ||
| 961 | } | |||
| 962 | } | |||
| 963 | seg = seg->next(); | |||
| 964 | } | |||
| 965 | ||||
| 966 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | if (!valid) | |
| 967 | { | |||
| 968 | ✗ | std::cout << "Broken segment connections\n"; | ||
| 969 | } | |||
| 970 | ||||
| 971 | // check begin and end points | |||
| 972 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | if (static_cast<double>(plus.dir) * plus.velocity > 0) | |
| 973 | { | |||
| 974 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | if (plus.next_collision == plus.trajectory->wall_end()) | |
| 975 | { | |||
| 976 | // segment end location does not coincide with the first intersection site | |||
| 977 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | if (segments.last()->end - plus.trajectory->length > ZERO_CUTOFF) | |
| 978 | { | |||
| 979 | valid = false; | |||
| 980 | } | |||
| 981 | } | |||
| 982 | ||||
| 983 | else | |||
| 984 | { | |||
| 985 | // segment end location does not coincide with the first intersection site | |||
| 986 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | if (segments.last()->end - plus.next_collision->first > ZERO_CUTOFF) | |
| 987 | { | |||
| 988 | valid = false; | |||
| 989 | } | |||
| 990 | } | |||
| 991 | } | |||
| 992 | ||||
| 993 | else | |||
| 994 | { | |||
| 995 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | if (plus.next_collision == plus.trajectory->wall_begin()) | |
| 996 | { | |||
| 997 | // segment end location does not coincide with the first intersection site | |||
| 998 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | if (segments.last()->end < -ZERO_CUTOFF) | |
| 999 | { | |||
| 1000 | valid = false; | |||
| 1001 | } | |||
| 1002 | } | |||
| 1003 | else | |||
| 1004 | { | |||
| 1005 | // segment end location does not coincide with the first intersection site | |||
| 1006 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | if (segments.last()->end - plus.next_collision->first < -ZERO_CUTOFF) | |
| 1007 | { | |||
| 1008 | valid = false; | |||
| 1009 | } | |||
| 1010 | } | |||
| 1011 | } | |||
| 1012 | ||||
| 1013 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | if (!valid) | |
| 1014 | { | |||
| 1015 | ✗ | std::cerr << "ERROR: Problem with ordering of plus ends and next collisions.\n"; | ||
| 1016 | } | |||
| 1017 | ||||
| 1018 | // minus end velocity can be zero in the absence of treadmilling, that case skip this check to avoid numerical | |||
| 1019 | // directionality problems | |||
| 1020 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | if (static_cast<double>(minus.dir) * minus.velocity > ZERO_CUTOFF) | |
| 1021 | { | |||
| 1022 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | if (minus.next_collision == minus.trajectory->wall_end()) | |
| 1023 | { | |||
| 1024 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | if (segments.first()->start - minus.trajectory->length > ZERO_CUTOFF) | |
| 1025 | { | |||
| 1026 | valid = false; | |||
| 1027 | } | |||
| 1028 | } | |||
| 1029 | else | |||
| 1030 | { | |||
| 1031 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | if (segments.first()->start - minus.next_collision->first > ZERO_CUTOFF) | |
| 1032 | { | |||
| 1033 | valid = false; | |||
| 1034 | } | |||
| 1035 | } | |||
| 1036 | } | |||
| 1037 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | else if (static_cast<double>(minus.dir) * minus.velocity < -ZERO_CUTOFF) | |
| 1038 | { | |||
| 1039 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | if (minus.next_collision == minus.trajectory->wall_begin()) | |
| 1040 | { | |||
| 1041 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | if (segments.first()->start < -ZERO_CUTOFF) | |
| 1042 | { | |||
| 1043 | valid = false; | |||
| 1044 | } | |||
| 1045 | } | |||
| 1046 | else | |||
| 1047 | { | |||
| 1048 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | if (segments.first()->start - minus.next_collision->first < -ZERO_CUTOFF) | |
| 1049 | { | |||
| 1050 | valid = false; | |||
| 1051 | } | |||
| 1052 | } | |||
| 1053 | } | |||
| 1054 | ||||
| 1055 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | if (!valid) | |
| 1056 | { | |||
| 1057 | ✗ | std::cerr << "ERROR: Problem with ordering of minus ends and next collisions.\n"; | ||
| 1058 | } | |||
| 1059 | ||||
| 1060 | // check validity of intersections by running them to the end of the trajectory | |||
| 1061 | seg = segments.first(); | |||
| 1062 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | while (seg != nullptr) | |
| 1063 | { | |||
| 1064 | ✗ | is = seg->start_itr; | ||
| 1065 | count = 0; | |||
| 1066 |
0/1? Decision couldn't be analyzed.
|
✗ | while ((is != seg->trajectory->wall_end()) && (count != seg->trajectory->intersections.size())) | |
| 1067 | { | |||
| 1068 | is++; | |||
| 1069 | ✗ | count++; | ||
| 1070 | } | |||
| 1071 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | if (is != seg->trajectory->wall_end()) | |
| 1072 | { | |||
| 1073 | valid = false; | |||
| 1074 | ✗ | std::cerr << "Error: segment start iterator does not belong to correct trajectory\n"; | ||
| 1075 | ✗ | std::cerr << "Number of segments in MT: " << segments.size() << "\n"; | ||
| 1076 | } | |||
| 1077 | ✗ | is = seg->end_itr; | ||
| 1078 | count = 0; | |||
| 1079 |
0/1? Decision couldn't be analyzed.
|
✗ | while ((is != seg->trajectory->wall_end()) && (count != seg->trajectory->intersections.size())) | |
| 1080 | { | |||
| 1081 | is++; | |||
| 1082 | ✗ | count++; | ||
| 1083 | } | |||
| 1084 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | if (is != seg->trajectory->wall_end()) | |
| 1085 | { | |||
| 1086 | valid = false; | |||
| 1087 | ✗ | std::cerr << "Error: segment end iterator does not belong to correct trajectory\n"; | ||
| 1088 | ✗ | std::cerr << "Number of segments in MT: " << segments.size() << "\n"; | ||
| 1089 | } | |||
| 1090 | seg = seg->next(); | |||
| 1091 | } | |||
| 1092 | ||||
| 1093 | // check the tip's tipmap pointer (round-trip) | |||
| 1094 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | if (system->get_event_descriptor(plus.event.index) != &plus.event) | |
| 1095 | { | |||
| 1096 | valid = false; | |||
| 1097 | } | |||
| 1098 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | if (system->get_event_descriptor(minus.event.index) != &minus.event) | |
| 1099 | { | |||
| 1100 | valid = false; | |||
| 1101 | } | |||
| 1102 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | if (system->get_event_descriptor(disappear_event.index) != &disappear_event) | |
| 1103 | { | |||
| 1104 | valid = false; | |||
| 1105 | } | |||
| 1106 | ||||
| 1107 | // round-trip check of the segment-trajectory pairs | |||
| 1108 | seg = segments.first(); | |||
| 1109 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | while (seg != nullptr) | |
| 1110 | { | |||
| 1111 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | if (*(seg->trajectory_tag) != seg) | |
| 1112 | { | |||
| 1113 | valid = false; | |||
| 1114 | } | |||
| 1115 | ||||
| 1116 | seg = seg->next(); | |||
| 1117 | } | |||
| 1118 | ||||
| 1119 | // round-trip check of tip-trajectory pairs | |||
| 1120 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | if (*(plus.notification_tag) != &plus) | |
| 1121 | { | |||
| 1122 | valid = false; | |||
| 1123 | } | |||
| 1124 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | if (*(minus.notification_tag) != &minus) | |
| 1125 | { | |||
| 1126 | valid = false; | |||
| 1127 | } | |||
| 1128 | ||||
| 1129 | // check orientation of segments / start-end, and tips | |||
| 1130 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | if (segments.first()->dir == minus.dir) | |
| 1131 | { | |||
| 1132 | valid = false; | |||
| 1133 | } | |||
| 1134 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | if (segments.last()->dir != plus.dir) | |
| 1135 | { | |||
| 1136 | valid = false; | |||
| 1137 | } | |||
| 1138 | ||||
| 1139 | seg = segments.first(); | |||
| 1140 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | while (seg != nullptr) | |
| 1141 | { | |||
| 1142 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | if (seg->dir == Direction::FORWARD) | |
| 1143 | { | |||
| 1144 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | if (seg->end - seg->start < -ZERO_CUTOFF) | |
| 1145 | { | |||
| 1146 | ✗ | std::cerr << "false directionality in positions. diff=" << seg->end - seg->start << "\n"; | ||
| 1147 | valid = false; | |||
| 1148 | } | |||
| 1149 | ✗ | is = seg->start_itr; | ||
| 1150 | count = 0; | |||
| 1151 |
0/1? Decision couldn't be analyzed.
|
✗ | while ((is != seg->end_itr) && (count != seg->trajectory->intersections.size())) | |
| 1152 | { | |||
| 1153 | is++; | |||
| 1154 | ✗ | count++; | ||
| 1155 | } | |||
| 1156 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | if (is != seg->end_itr) | |
| 1157 | { | |||
| 1158 | ✗ | std::cerr << "false directionality in intersection iterators\n"; | ||
| 1159 | valid = false; | |||
| 1160 | } | |||
| 1161 | } | |||
| 1162 | else | |||
| 1163 | { | |||
| 1164 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | if (seg->end - seg->start > ZERO_CUTOFF) | |
| 1165 | { | |||
| 1166 | ✗ | std::cerr << "false directionality in positions. diff=" << seg->end - seg->start << "\n"; | ||
| 1167 | valid = false; | |||
| 1168 | } | |||
| 1169 | ✗ | is = seg->start_itr; | ||
| 1170 | count = 0; | |||
| 1171 |
0/1? Decision couldn't be analyzed.
|
✗ | while ((is != seg->end_itr) && (count != seg->trajectory->intersections.size())) | |
| 1172 | { | |||
| 1173 | is--; | |||
| 1174 | ✗ | count++; | ||
| 1175 | } | |||
| 1176 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | if (is != seg->end_itr) | |
| 1177 | { | |||
| 1178 | ✗ | std::cerr << "false directionality in intersection iterators\n"; | ||
| 1179 | valid = false; | |||
| 1180 | } | |||
| 1181 | } | |||
| 1182 | ||||
| 1183 | seg = seg->next(); | |||
| 1184 | } | |||
| 1185 | ||||
| 1186 | // check whether segment end iterators are close to tip->nextCollision | |||
| 1187 | ||||
| 1188 | ✗ | return valid; | ||
| 1189 | } | |||
| 1190 |