#ifndef COMPUCELL3DTARGETVOLUMESTEPPABLEBIOFILM_H
#define COMPUCELL3DTARGETVOLUMESTEPPABLEBIOFILM_H


#include <CompuCell3D/Steppable.h>
#include <CompuCell3D/Field3D/Point3D.h>

template <typename Y> class BasicClassAccessor;

namespace CompuCell3D {

/**
@author m
*/
class Concentration;
class Potts3D;
class CellInventory;
class CellG;

class TargetVolumeSteppableBiofilm : public Steppable
{
private:

   Potts3D *potts;
   CellInventory * cellInventoryPtr;
   unsigned int currentStep;
   float initialTargetVolume;
   float initialTargetSurface;
   float minimalTargetVolume;
   
   unsigned int doublingVolume;
   unsigned int outerDieRadius;
   unsigned int killedCells;
   unsigned int markedCells;
   unsigned int markedByConcentration;
   unsigned int markedByOuterRing;
   
   float divideThreshold;
   float dieThreshold;
   float mitosisBoostFactor;
   
   BasicClassAccessor<Concentration> * concentrationAccessorPtr;
   float distance(Point3D a, Point3D b);

   void dieOrDivide(CellG *cell);
   void cellSurfaceAndVolume(CellG *cell,float averageConcentration);
   
   ///parameters for linear concentration-targetVolume dependence V=ax+b - x- is average concentration
   float volumeSlope;///a
   float volumeOffset;///b
   float surfaceFactor;///4*\pi*(3/(4*\pi))^{2/3} - surface of the ball in terms of its volume
   
public:
    TargetVolumeSteppableBiofilm();

   virtual ~TargetVolumeSteppableBiofilm();
   
   virtual void init(Simulator *simulator);
   
    // redefine step(const unsigned int _currentStep) from Steppable interface
    virtual void start();
    virtual void step(const unsigned int _currentStep);
    virtual void finish() {}

    
    // Begin XMLSerializable interface
    virtual void readXML(XMLPullParser &in);
    virtual void writeXML(XMLSerializer &out){};
    // End XMLSerializable interface



};

};

#endif
