#ifndef COMPUCELL3DDIFFUSIONSOLVERFE_H
#define COMPUCELL3DDIFFUSIONSOLVERFE_H


//#include <CompuCell3D/Steppable.h>
#include <CompuCell3D/Potts3D/Cell.h>
#include <CompuCell3D/Diffusable.h>
#include <string>
#include <iostream>


namespace CompuCell3D {

/**
@author m
*/
//forward declarations
class Potts3D;
class Simulator;
class Cell;
class CellInventory;


template <typename Y> class Field3D;
template <typename Y> class Field3DImpl;

class DiffusionSolverFE :public Diffusable<float>
{
protected:

   Potts3D *potts;
   Simulator *simPtr;
   
   unsigned int currentStep;
   float diffConst;
   float secrConst;
   float decayConst;
   Field3D<CellG *> *cellFieldG;
   
   
   Field3DImpl<float> *scratchField;
   std::string concentrationFieldName;
   
   CellInventory *cellInventoryPtr;
   
   void (DiffusionSolverFE::*secretePtr)(void);///ptr to member method - chemical secretion
   void secrete();
   void secreteInCM();
   void (DiffusionSolverFE::*diffusePtr)(void);///ptr to member method - Forward Euler diffusion solver
   void diffuse();
   void scrarch2Concentration(Field3DImpl<float> *concentrationField, Field3DImpl<float> *scratchField);
   void DiffusionSolverFE::outputField( std::ostream & _out,Field3DImpl<float> *_concentrationField);

   
public:
    DiffusionSolverFE();

    virtual ~DiffusionSolverFE();
    
   
    virtual void init(Simulator *simulator);

    // Begin Steppable interface
    virtual void start();
    virtual void step(const unsigned int _currentStep);
    virtual void finish() {}
    // End Steppable interface

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

    
};

};

#endif
