tumopp: Tumor growth simulator in C++
tumopp::Tissue Class Reference

Population of Cell. More...

#include <tissue.hpp>

Classes

struct  equal_ptr_cell
 Equal function object for shared_pointer<Cell> More...
struct  hash_ptr_cell
 Hashing function object for shared_pointer<Cell> More...

Public Member Functions

 Tissue (size_t initial_size=1u, unsigned dimensions=3u, const std::string &coordinate="moore", const std::string &local_density_effect="const", const std::string &displacement_path="random", const EventRates &init_event_rates=EventRates{}, uint32_t seed=std::random_device{}(), bool verbose=false, bool enable_benchmark=false)
 Constructor.
bool grow (size_t max_size, double max_time=100.0, double snapshot_interval=0.0, size_t recording_early_growth=0u, size_t mutation_timing=0u)
 main function
void plateau (double time)
 Simulate turnover with the increased death_rate.
void treatment (double death_prob, size_t num_resistant_cells=3u)
 Simulate medical treatment with the increased death_prob.
std::ostream & write_history (std::ostream &) const
 Write extant_cells_ and their ancestors.
std::ostream & write_snapshots (std::ostream &) const
 Write snapshots_.
std::ostream & write_drivers (std::ostream &) const
 Write drivers_.
std::ostream & write_benchmark (std::ostream &) const
 Write benchmark_.

Friends

std::ostream & operator<< (std::ostream &ost, const Tissue &tissue)
 Stream operator for debug print.

Getter functions

std::function< bool(const std::shared_ptr< Cell > &)> insert
 initialized in init_insert_function()
std::unordered_set< std::shared_ptr< Cell >, hash_ptr_cell, equal_ptr_cellextant_cells_ {}
 cells
unsigned id_tail_ {0}
 incremented when a new cell is born
std::multimap< double, std::shared_ptr< Cell > > queue_ {}
 event queue
double time_ {0.0}
 continuous time
std::unique_ptr< Coordcoord_func_ {nullptr}
 initialized in init_coord() or init_coord_test()
std::stringstream cemetery_ {}
 record dead cells
std::stringstream snapshots_ {}
 record snapshots
std::stringstream drivers_ {}
 record driver mutations
std::unordered_set< unsigned > recorded_ {}
 id of recorded cells
std::unique_ptr< Benchmarkbenchmark_ {nullptr}
 record resource usage
std::unique_ptr< urbg_t > engine_ {nullptr}
 random number generator
bool verbose_ {false}
 print debug info
size_t size () const noexcept
 Get the number of extant cells.
void init_coord (unsigned dimensions, const std::string &coordinate)
 Set coord_func_.
void init_insert_function (const std::string &local_density_effect, const std::string &displacement_path)
 Set insert function.
void migrate (const std::shared_ptr< Cell > &)
 Swap with a random neighbor.
void push (std::shared_ptr< Cell > moving, const coord_t &direction)
 Emplace daughter cell and push other cells to the direction.
void push_minimum_drag (std::shared_ptr< Cell > moving)
 Push through the minimum drag path.
void stroll (std::shared_ptr< Cell > moving, const coord_t &direction)
 Try insert_adjacent() on every step in push()
bool insert_adjacent (const std::shared_ptr< Cell > &x)
 Insert x if any adjacent node is empty.
bool swap_existing (std::shared_ptr< Cell > *x)
 Put new cell and return existing.
size_t steps_to_empty (const coord_t &current, const coord_t &direction) const
 Count steps to the nearest empty.
const coord_t & to_nearest_empty (const coord_t &current) const
 Direction to the nearest empty.
coord_t roulette_direction (const coord_t &current) const
 Direction is selected with a probability proportional with 1/l.
uint_fast8_t num_empty_neighbors (const coord_t &) const
 Count adjacent empty sites.
double positional_value (const coord_t &) const
 TODO: Calculate positional value.
void queue_push (const std::shared_ptr< Cell > &, bool surrounded=false)
 Push a cell to event queue_.
void entomb (const std::shared_ptr< Cell > &)
 Put a cell to cemetery_.
void snapshots_append ()
 Write all cells to snapshots_ with time_.

Detailed Description

Population of Cell.


The documentation for this class was generated from the following files: