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.; @@ -324,9 +331,9 @@ class CellBase : public QObject, public for (list::const_iterator w=walls.begin(); w!=walls.end(); w++) { - sum += (*w)->c1 == this ? - f( *((*w)->c1), *((*w)->c2), **w ) : - f( *((*w)->c2), *((*w)->c1), **w ); + sum += ((*w)->c1 == this) ? + f( ((*w)->c1), ((*w)->c2), *w ) : + f( ((*w)->c2), ((*w)->c1), *w ); } return sum; } @@ -447,6 +454,8 @@ protected: bool dead; bool flag_for_divide; + Vector *division_axis; + int cell_type; //double length; @@ -475,8 +484,8 @@ protected: ostream &operator<<(ostream &os, const CellBase &v); -inline Vector PINdir(CellBase &here, CellBase &nb, Wall &w) { - return w.getTransporter( &here, 1) * w.getInfluxVector(&here); +inline Vector PINdir(CellBase *here, CellBase *nb, Wall *w) { + return w->getTransporter( here, 1) * w->getInfluxVector(here); }