Page MenuHomec4science

deltaNotch2.hpp
No OneTemporary

File Metadata

Created
Sat, Nov 16, 17:41

deltaNotch2.hpp

#ifndef __DELTANOTCH2_HPP__
#define __DELTANOTCH2_HPP__
#include <iostream>
#include <boost/array.hpp>
#include <iterator>
#include "lattice.hpp"
#define BOUNDARY_STATE_DIM 4
#define CELL_STATE_DIM 1
using namespace std;
//using namespace boost::numeric::odeint;
typedef vector<double> state_type;
class KeepLast{
protected:
state_type last;
public:
KeepLast(){}
KeepLast(state_type x):last(x){}
void operator()(const state_type& x, double t);
void resize(uint n){last.resize(n);}
state_type& getState(){return last;}
};
struct push_back_state_and_time
{
std::vector< state_type >& m_states;
std::vector< double >& m_times;
push_back_state_and_time( std::vector< state_type > &states , std::vector< double > &times )
: m_states( states ) , m_times( times ) { }
void operator()( const state_type &x , double t )
{m_states.push_back( x );m_times.push_back( t );}
state_type& getState(){return m_states.back();}
};
struct push_back_sel_state_and_time: push_back_state_and_time{
std::vector<uint>& m_idx;
push_back_sel_state_and_time( std::vector< state_type > &states , std::vector< double > &times, std::vector<uint> &idx):
push_back_state_and_time(states,times),m_idx(idx){}
void operator()( const state_type &x , double t )
{
state_type x_sel(m_idx.size());
for(int i=0;i<m_idx.size();i++){
x_sel[i]=x[m_idx[i]];
}
m_states.push_back( x_sel );
m_times.push_back( t );
}
};
class DeltaNotch2{
protected:
double gd;
double bn;
double gn;
double ktp;
double ktm;
double kcp;
double kcm;
double ks;
double ki;
double gs;
double diffu;
double dprod; //delta prod
double hfdp;//hill coeff for delta prod
// uint nbcells;
Lattice *lattice;
state_type state;
uint state_dim;
KeepLast observer;
struct visitorParams{
uint *cnt;
DeltaNotch2 *dn;
visitorParams(uint *c=NULL, DeltaNotch2 *d=NULL){cnt=c;dn=d;}
};
public:
DeltaNotch2():observer(state){setDefaultParameters();}
DeltaNotch2(double diff):observer(state){setDefaultParameters();diffu=diff;}
virtual ~DeltaNotch2(){}
virtual void setDefaultParameters(){
gd = 0.1;
bn = 2;
gn = 0.1;
ktp = 20;
ktm = 0.1;
kcp = 4;
kcm = 0.01;
ks = 0.01;
ki = 2;
gs = 0.05;
diffu = 0.0;
dprod = 3;
hfdp = 3;
}
void operator() (const state_type &y , state_type &dydt , const double t);
void setLattice(Lattice *lat)
{lattice=lat;state_dim=setStateVectorIndex();state.resize(state_dim);observer.resize(state_dim);}
void setDiffusion(double d){diffu=d;}
void setNotchProduction(double p){bn=p;}
void setDeltaProduction(double p){dprod=p;}
void setNotchCleavageRate(double r){ks = r;}
void setTransBindingRate(double r){ktp = r;}
void setTransUnbindingRate(double r){ktm = r;}
void setCisBindingRate(double r){kcp = r;}
void setCisUnbindingRate(double r){kcm = r;}
void setNotchDegradation(double r){gd = r;}
void initState();
bool deltaUp(uint cell)
{if(cell>=lattice->getNbCells())return false;state[lattice->getCell(cell).stateVectorIndex()] /= 5;return true;}
void writeState();
state_type& getState(){return state;}
virtual double getDeltaProduction(double si){return dprod/(1+pow(si,hfdp));}
virtual uint setStateVectorIndex();
uint getStateDimension(){return state_dim;}
virtual uint boundaryStateDim(){ return 4;}
virtual uint cellStateDim(){ return 1;}
virtual uint extraCellStateDim(){return 0;}
KeepLast& observeLast(){return observer;};
// static function used for visiting lattices
static void initCellState(Cell *ce, void *pt);
static void initBoundaryState(Boundary *bo, void *pt);
static void setCellIndex(Cell *ce, void *pt);
static void setBoundaryIndex(Boundary *bo, void *pt);
static void collectCellIdx(Cell *c,void *arg);
};
// ostream& operator<<(ostream& out,const state_type& vec){
// for(uint i=0;i<vec.size();i++){
// out<<vec[i]<<" ";
// }
// return out;
// }
#endif

Event Timeline