Commit ffdaa7bf authored by Vincent Noël's avatar Vincent Noël
Browse files

Reintroduced time stochasticity as gaelle was using, this time as a XML parameter

parent 8f47d8f0
......@@ -24,6 +24,7 @@ MaBoSSIntracellular::MaBoSSIntracellular(MaBoSSIntracellular* copy)
discrete_time = copy->discrete_time;
time_tick = copy->time_tick;
scaling = copy->scaling;
time_stochasticity = copy->time_stochasticity;
initial_values = copy->initial_values;
mutations = copy->mutations;
parameters = copy->parameters;
......@@ -36,6 +37,7 @@ MaBoSSIntracellular::MaBoSSIntracellular(MaBoSSIntracellular* copy)
maboss.set_update_time_step(copy->time_step);
maboss.set_discrete_time(copy->discrete_time, copy->time_tick);
maboss.set_scaling(copy->scaling);
maboss.set_time_stochasticity(copy->time_stochasticity);
maboss.restart_node_values();
//maboss.set_state(copy->maboss.get_maboss_state());
//std::cout << get_state();
......@@ -72,6 +74,7 @@ MaBoSSIntracellular::MaBoSSIntracellular(std::vector<char>& buffer, int& len_buf
MPI_Unpack(&buffer[0], len_buffer, &position, &(this->time_tick), 1, MPI_DOUBLE, MPI_COMM_WORLD);
MPI_Unpack(&buffer[0], len_buffer, &position, &(this->scaling), 1, MPI_DOUBLE, MPI_COMM_WORLD);
MPI_Unpack(&buffer[0], len_buffer, &position, &(this->time_stochasticity), 1, MPI_DOUBLE, MPI_COMM_WORLD);
this->maboss.init_maboss(this->bnd_filename, this->cfg_filename);
......@@ -180,6 +183,10 @@ void MaBoSSIntracellular::pack(std::vector<char>& buffer, int& len_buffer, int&
buffer.resize(len_buffer);
MPI_Pack(&(this->scaling), 1, MPI_DOUBLE, &buffer[0], len_buffer, &position, MPI_COMM_WORLD);
len_buffer = position + sizeof(double);
buffer.resize(len_buffer);
MPI_Pack(&(this->time_stochasticity), 1, MPI_DOUBLE, &buffer[0], len_buffer, &position, MPI_COMM_WORLD);
// Mutations
len_buffer = position + sizeof(int);
buffer.resize(len_buffer);
......@@ -373,6 +380,13 @@ void MaBoSSIntracellular::initialize_intracellular_from_pugixml(pugi::xml_node&
scaling = PhysiCell::xml_get_my_double_value( node_scaling );
maboss.set_scaling(scaling);
}
pugi::xml_node node_time_stochasticity = node.child( "time_stochasticity" );
if( node_time_stochasticity )
{
time_stochasticity = PhysiCell::xml_get_my_double_value( node_time_stochasticity );
maboss.set_time_stochasticity(time_stochasticity);
}
}
MaBoSSIntracellular* getMaBoSSModel(PhysiCell::Phenotype& phenotype) {
......
......@@ -24,6 +24,7 @@ class MaBoSSIntracellular : public PhysiCell::Intracellular {
bool discrete_time = false;
double time_tick = 0.5;
double scaling = 1.0;
double time_stochasticity = 0.0;
std::map<std::string, double> initial_values;
std::map<std::string, double> mutations;
......
......@@ -34,7 +34,7 @@ class MaBoSSNetwork
/** \brief Real time to update, after applying noise */
double time_to_update;
double time_stochasticity = 0;
double scaling = 1.0;
/** \brief Initial value probabilities, by node */
......@@ -46,7 +46,7 @@ class MaBoSSNetwork
std::map< std::string, Node*> nodesByName;
std::map< std::string, const Symbol*> parametersByName;
inline void set_time_to_update(){this->time_to_update = this->get_update_time_step();}
inline void set_time_to_update(){this->time_to_update = ( 1 + (PhysiCell::UniformRandom()*2-1)*time_stochasticity ) * this->get_update_time_step();}
public:
......@@ -128,7 +128,7 @@ class MaBoSSNetwork
/** \brief Get time to update*/
inline double get_time_to_update() {return this->time_to_update;}
inline void set_time_to_update(double time) { this->time_to_update = time; }
inline void set_time_to_update(double time) { this->time_to_update = ( 1 + (PhysiCell::UniformRandom()*2-1)*time_stochasticity ) * time; }
/** \brief Change simulation mode */
inline void set_discrete_time(bool discrete_time, double time_tick) {
......@@ -136,7 +136,7 @@ class MaBoSSNetwork
}
inline void set_scaling(double scaling) { this->scaling = scaling; }
inline void set_time_stochasticity(double t_stochasticity) { this->time_stochasticity = t_stochasticity; }
/**
* \brief Print current state of all the nodes of the network
* \param node_values Boolean vector mapping a boolean network
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment