| Line | Branch | Decision | Exec | Source |
|---|---|---|---|---|
| 1 | #include "segment.hpp" | |||
| 2 | #include "system.hpp" | |||
| 3 | #include "microtubule.hpp" | |||
| 4 | ||||
| 5 | ✗ | Segment::Segment(Microtubule* m, TrajectoryVector& tv): | ||
| 6 | ✗ | mt(m), | ||
| 7 | ✗ | trajectory(tv.trajectory), | ||
| 8 | ✗ | trajectory_tag(tv.trajectory->segments.end()), | ||
| 9 | ✗ | nucleation_time(m->system->system_time + m->system->system_time_offset), | ||
| 10 | ✗ | dir(tv.dir), | ||
| 11 | ✗ | start(tv.pos), | ||
| 12 | ✗ | end(tv.pos), | ||
| 13 | ✗ | start_itr(tv.trajectory->wall_end()), | ||
| 14 | ✗ | end_itr(tv.trajectory->wall_end()) | ||
| 15 | { | |||
| 16 | #ifdef DBG_MTS | |||
| 17 | cout << "DBG/MTS: Segment created.\n"; | |||
| 18 | cout << "begin position: " << start << ", end position: " << end << "\n"; | |||
| 19 | #endif | |||
| 20 | ||||
| 21 | // insert this segment to the associated MT trajectory | |||
| 22 | ✗ | trajectory_tag = tv.trajectory->insert_segment(this); | ||
| 23 | ||||
| 24 | // increase total number of segments for the associated MT | |||
| 25 | ✗ | mt->system->count_segments++; | ||
| 26 | ✗ | return; | ||
| 27 | } | |||
| 28 | ||||
| 29 | ✗ | Segment::~Segment() | ||
| 30 | { | |||
| 31 | #ifdef DBG_MTS | |||
| 32 | cout << "DBG/MTS: Segment destroyed.\n"; | |||
| 33 | #endif | |||
| 34 | ||||
| 35 | // decrease total number of segments for the associated MT | |||
| 36 | ✗ | mt->system->count_segments--; | ||
| 37 | ||||
| 38 | // if this is the last segment, remove the tip references... | |||
| 39 | ✗ | trajectory->remove_segment(trajectory_tag); | ||
| 40 | ✗ | return; | ||
| 41 | ✗ | } | ||
| 42 | ||||
| 43 | ✗ | bool Segment::is_last_in_mt() | ||
| 44 | { | |||
| 45 | // check whether this is the last segment of the MT | |||
| 46 | ✗ | return (this == mt->segments.last()); | ||
| 47 | } | |||
| 48 | ||||
| 49 | ✗ | bool Segment::is_first_in_mt() | ||
| 50 | { | |||
| 51 | // check whether this is the first segment of the MT | |||
| 52 | ✗ | return (this == mt->segments.first()); | ||
| 53 | } | |||
| 54 | ||||
| 55 | ✗ | bool Segment::crosses_intersection(IntersectionItr& is) | ||
| 56 | { | |||
| 57 | // check whether the segment has a cross intersection with a trajectory | |||
| 58 | double temp(0.0); | |||
| 59 | ✗ | temp = (is->first - end) * (is->first - start); | ||
| 60 | ||||
| 61 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | if (temp < -ZERO_CUTOFF) | |
| 62 | { | |||
| 63 | return true; | |||
| 64 | } | |||
| 65 | ||||
| 66 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | else if (temp < ZERO_CUTOFF) | |
| 67 | { | |||
| 68 | ✗ | int sign1 = trajectory->difference_sign( | ||
| 69 | ✗ | (this == mt->segments.last()) ? mt->plus.next_collision : end_itr, end, is, is->first); | ||
| 70 | ✗ | int sign2 = trajectory->difference_sign( | ||
| 71 | ✗ | (this == mt->segments.first()) ? mt->minus.next_collision : start_itr, start, is, is->first); | ||
| 72 | ||||
| 73 |
0/2✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
|
✗ | if (sign1 * sign2 == -1) | |
| 74 | { | |||
| 75 | return true; | |||
| 76 | } | |||
| 77 | } | |||
| 78 | ||||
| 79 | return false; | |||
| 80 | } | |||
| 81 |