diff --git a/src/VirtualLeaf.pro b/src/VirtualLeaf.pro --- a/src/VirtualLeaf.pro +++ b/src/VirtualLeaf.pro @@ -19,8 +19,8 @@ # Copyright 2010 Roeland Merks. # -CONFIG -= release -CONFIG += debug +CONFIG += release +CONFIG -= debug CONFIG += qt QMAKE_CXXFLAGS += -fexceptions diff --git a/src/build_models/plugin_test.pro b/src/build_models/plugin_test.pro --- a/src/build_models/plugin_test.pro +++ b/src/build_models/plugin_test.pro @@ -19,7 +19,6 @@ # Copyright 2010 Roeland Merks. # - CONFIG += release CONFIG -= debug CONFIG += plugin diff --git a/src/cell.cpp b/src/cell.cpp --- a/src/cell.cpp +++ b/src/cell.cpp @@ -415,6 +415,7 @@ void Cell::DivideWalls(ItList new_node_l daughter->chem[i]=chem[i]; } + daughter->cell_type = cell_type; //extern double auxin_account; //auxin_account += daughter->chem[0]; diff --git a/src/cellbase.cpp b/src/cellbase.cpp --- a/src/cellbase.cpp +++ b/src/cellbase.cpp @@ -101,6 +101,7 @@ Vector() div_counter=0; cell_type = 0; flag_for_divide = false; + division_axis = 0; } @@ -140,6 +141,7 @@ CellBase::CellBase(double x,double y,dou div_counter = 0; cell_type = 0; flag_for_divide = false; + division_axis = 0; } @@ -180,7 +182,7 @@ CellBase::CellBase(const CellBase &src) cell_type = src.cell_type; div_counter = src.div_counter; flag_for_divide = src.flag_for_divide; - + division_axis = src.division_axis; } @@ -219,6 +221,7 @@ CellBase CellBase::operator=(const CellB cell_type = src.cell_type; div_counter = src.div_counter; flag_for_divide = src.flag_for_divide; + division_axis = src.division_axis; return *this; } diff --git a/src/cellbase.h b/src/cellbase.h --- a/src/cellbase.h +++ b/src/cellbase.h @@ -96,6 +96,7 @@ class CellBase : public QObject, public virtual ~CellBase() { delete[] chem; delete[] new_chem; + if (division_axis) delete division_axis; //cerr << "CellBase " << index << " is dying. " << endl; } @@ -217,7 +218,13 @@ class CellBase : public QObject, public inline void Divide(void) { flag_for_divide = true; } - //Vector Strain(void) const; + + inline void DivideOverAxis(const Vector &v) { + division_axis = new Vector(v); + flag_for_divide = true; + } + + //Vector Strain(void) const; inline double Circumference(void) const { double sum=0.; @@ -447,6 +454,8 @@ protected: bool dead; bool flag_for_divide; + Vector *division_axis; + int cell_type; //double length; diff --git a/src/mesh.cpp b/src/mesh.cpp --- a/src/mesh.cpp +++ b/src/mesh.cpp @@ -1983,9 +1983,21 @@ void Mesh::Derivatives(double *derivs) { // (*wr)(*w, &(derivs[i]), &(derivs[i+nchems])); plugin->WallDynamics(*w, &(derivs[i]), &(derivs[i+nchems])); // Transport function adds to derivatives of cell chemicals - plugin->CelltoCellTransport(*w, &(derivs[(*w)->c1->Index() * nchems]), - &(derivs[(*w)->c2->Index() * nchems])); - + double *dchem_c1 = &(derivs[(*w)->c1->Index() * nchems]); + double *dchem_c2 = &(derivs[(*w)->c2->Index() * nchems]); + //plugin->CelltoCellTransport(*w, &(derivs[(*w)->c1->Index() * nchems]), + // &(derivs[(*w)->c2->Index() * nchems])); + // quick fix: dummy values to prevent end user from writing into outer space and causing a crash :-) + // start here if you want to implement chemical input/output into environment over boundaries + double dummy1, dummy2; + if ((*w)->c1->Index()<0) { // tests if c1 is the boundary pol + dchem_c1 = &dummy1; + } + if ((*w)->c2->Index()<0) { + dchem_c2 = &dummy2; + } + plugin->CelltoCellTransport(*w, dchem_c1, dchem_c2); + //(*tf)(*w, &(derivs[(*w)->c1->Index() * nchems]), //&(derivs[(*w)->c2->Index() * nchems] ) ); i+=2*nchems; diff --git a/src/mesh.h b/src/mesh.h --- a/src/mesh.h +++ b/src/mesh.h @@ -242,7 +242,13 @@ public: // Call functions of Cell that cannot be called from CellBase, including Division if ((*i)->flag_for_divide) { - (*i)->Divide(); + if ((*i)->division_axis) { + (*i)->DivideOverAxis(*(*i)->division_axis); + delete (*i)->division_axis; + (*i)->division_axis = 0; + } else { + (*i)->Divide(); + } (*i)->flag_for_divide=false; } }