| Line | Branch | Decision | Exec | Source |
|---|---|---|---|---|
| 1 | #ifndef SYSTEM_HPP | |||
| 2 | #define SYSTEM_HPP | |||
| 3 | ||||
| 4 | #include "randhub.hpp" | |||
| 5 | #include "types.hpp" | |||
| 6 | #include "CompactList.hpp" | |||
| 7 | #include "det_queue.hpp" | |||
| 8 | #include "event.hpp" | |||
| 9 | #include "measurement.hpp" | |||
| 10 | #include "parameters.hpp" | |||
| 11 | #include "microtubule.hpp" | |||
| 12 | #include "mt_tip.hpp" | |||
| 13 | ||||
| 14 | class System | |||
| 15 | // Master object defining an interacting mt system | |||
| 16 | { | |||
| 17 | public: | |||
| 18 | ||||
| 19 | Geometry* geometry; | |||
| 20 | DLList<Microtubule, MICROTUBULE_GRANULARITY> growing_mts; | |||
| 21 | DLList<Microtubule, MICROTUBULE_GRANULARITY> shrinking_mts; | |||
| 22 | ||||
| 23 | #ifdef CROSS_SEV | |||
| 24 | CompactList<OccupiedIntersection, OCCUPIED_INTERSECTION_GRANULARITY> occupied_intersection_list; | |||
| 25 | #endif | |||
| 26 | ||||
| 27 | std::vector<int> growing_tips_reg; | |||
| 28 | ||||
| 29 | Parameters p; | |||
| 30 | ||||
| 31 | // random generator | |||
| 32 | RandHub<> random_gen; | |||
| 33 | ||||
| 34 | // current system time with respect to offset | |||
| 35 | double system_time; | |||
| 36 | ||||
| 37 | // current system time offset | |||
| 38 | double system_time_offset; | |||
| 39 | ||||
| 40 | int current_time_tag; | |||
| 41 | double total_length; | |||
| 42 | int mem_usage; | |||
| 43 | bool stop_signal; | |||
| 44 | ||||
| 45 | time_t wall_clock_start_time; | |||
| 46 | int total_s_event_count; | |||
| 47 | int total_valid_d_event_count; | |||
| 48 | int total_invalid_d_event_count; | |||
| 49 | int total_length_severing_count; | |||
| 50 | int total_intersection_severing_count; | |||
| 51 | int boundary_crossing_count; | |||
| 52 | int total_zipper_count; | |||
| 53 | int total_crossover_count; | |||
| 54 | int total_induced_catastrophe_count; | |||
| 55 | ||||
| 56 | int count_segments; | |||
| 57 | int count_trajectories; | |||
| 58 | int count_intersections; | |||
| 59 | int estimate_memory_footprint(); | |||
| 60 | ||||
| 61 | double next_stochastic_event_time; | |||
| 62 | StochasticEventType next_stochastic_event_type; | |||
| 63 | ||||
| 64 | // queue object for time-defined events | |||
| 65 | DeterministicQueue time_queue; | |||
| 66 | ||||
| 67 | // queue object for vPlus-defined events (regulated by tubulin pool size) | |||
| 68 | DeterministicQueue v_plus_queue; | |||
| 69 | ||||
| 70 | ✗ | double identity(double i) { return i; } | ||
| 71 | ||||
| 72 | // distance to time conversion for growing tips | |||
| 73 | double v_plus_to_time(double); | |||
| 74 | ||||
| 75 | // time to distance conversion for growing tips | |||
| 76 | double time_to_v_plus(double); | |||
| 77 | ||||
| 78 | double next_status_event_time; | |||
| 79 | double next_snapshot_event_time; | |||
| 80 | double next_parameter_event_time; | |||
| 81 | double next_ppb_event_time; | |||
| 82 | ||||
| 83 | // current tag for event descriptor | |||
| 84 | EventDescriptorIndex event_descriptor_id; | |||
| 85 | ||||
| 86 | // structure that maps EventDescriptorIDs onto EventDescriptor objects | |||
| 87 | std::map<EventDescriptorIndex, EventDescriptor*> event_descriptor_map; | |||
| 88 | ||||
| 89 | // returns a new event descriptor tag | |||
| 90 | EventDescriptorIndex register_event_descriptor(EventDescriptor*); | |||
| 91 | ||||
| 92 | // invalidates an event descriptor tag | |||
| 93 | void unregister_event_descriptor(EventDescriptorIndex); | |||
| 94 | ||||
| 95 | // returns a pointer to an EventDescriptor through its tag | |||
| 96 | EventDescriptor* get_event_descriptor(EventDescriptorIndex); | |||
| 97 | ||||
| 98 | // the current event tracking tag | |||
| 99 | EventTrackingTag event_id; | |||
| 100 | ||||
| 101 | // returns a new event tracking tag | |||
| 102 | ✗ | EventTrackingTag get_event_tag() { return event_id++; } | ||
| 103 | ||||
| 104 | System(char*); | |||
| 105 | ~System(); | |||
| 106 | bool integrity_check(); | |||
| 107 | void flush_and_reload(bool = true); | |||
| 108 | void advance_time(double next_time); | |||
| 109 | ||||
| 110 | // updates all positions in the system to the system time | |||
| 111 | void update_all(bool force_update = false); | |||
| 112 | void emergency_break(); | |||
| 113 | ||||
| 114 | void run(double, std::string&, std::string&); | |||
| 115 | void next_event(void); | |||
| 116 | void handle_global_event(DeterministicEvent&); | |||
| 117 | void determine_stochastic_event(); | |||
| 118 | void handle_nucleation_event(); | |||
| 119 | void handle_severing_event(); | |||
| 120 | ||||
| 121 | #ifdef CROSS_SEV | |||
| 122 | void handle_severing_at_cross_event(); | |||
| 123 | #endif | |||
| 124 | ||||
| 125 | void handle_rescue_event(); | |||
| 126 | void handle_catastrophe_event(); | |||
| 127 | void random_position_on_microtubule(double& cut_length, Segment*& cut_seg); | |||
| 128 | ||||
| 129 | // returns the result of a collision at a specified angle, and bundle | |||
| 130 | // occupancies | |||
| 131 | CollisionType collision_result(double, int, int); | |||
| 132 | ||||
| 133 | // returns the probabilities for induced catastrophes and zippering, as a | |||
| 134 | // function of the angle | |||
| 135 | void collision_probabilities(double, double&, double&); | |||
| 136 | ||||
| 137 | // binomial table. Necessary for bundle collision type: multi-collisions | |||
| 138 | double binomial_table[MAXBINOM][MAXBINOM]; | |||
| 139 | void make_binomial_table(void); | |||
| 140 | ||||
| 141 | double multi_pcross(int npar, int ncoll, double x_single, double z_single); | |||
| 142 | double multi_pzip(int npar, int ncoll, double x_single, double z_single); | |||
| 143 | ||||
| 144 | std::ofstream parameter_file; | |||
| 145 | std::ofstream movie_file; | |||
| 146 | std::ofstream heat_map_file; | |||
| 147 | std::ofstream measurement_file; | |||
| 148 | std::ofstream order_director_file; | |||
| 149 | std::deque<Measurement> measurement_history; | |||
| 150 | bool data_saved; | |||
| 151 | void initialize_output(); | |||
| 152 | void perform_measurement(); | |||
| 153 | void write_measurements_to_file(int = 0); | |||
| 154 | void close_files(); | |||
| 155 | ||||
| 156 | #ifdef CROSS_SEV | |||
| 157 | // removes pointers from is and its mirror | |||
| 158 | void remove_occupied_intersection(Intersection& is); | |||
| 159 | ||||
| 160 | // creates pointers for is and its mirror [occupiedIntersection contains | |||
| 161 | // only one pointer: to the one "on top" (to be cut)] | |||
| 162 | void add_occupied_intersection(IntersectionItr is); | |||
| 163 | #endif | |||
| 164 | ||||
| 165 | private: | |||
| 166 | ||||
| 167 | // avoid accidental (expensive) copying of Trajectory objects, by declaring | |||
| 168 | // private copy constructors without definitions | |||
| 169 | System(const System&); | |||
| 170 | System& operator=(const System&); | |||
| 171 | }; | |||
| 172 | ||||
| 173 | #endif // SYSTEM_HPP | |||
| 174 |