#ifndef COMPUCELL3DDIFFUSABLEVECTOR_H
#define COMPUCELL3DDIFFUSABLEVECTOR_H
#include <CompuCell3D/Field3D/Dim3D.h>
#include <CompuCell3D/Steppable.h>
#include <vector>
#include <string>
#include <iostream>
namespace CompuCell3D {

template <typename Y> class Field3DImpl;

/**
@author m
*/
template <typename precision>
class DiffusableVector:public Steppable{
public:
    DiffusableVector():Steppable(),concentrationFieldVector(0){};

    virtual ~DiffusableVector(){

      for(unsigned int i = 0 ; i< concentrationFieldVector.size() ; ++i){
         if(concentrationFieldVector[i]){
            delete concentrationFieldVector[i];
            concentrationFieldVector[i]=0;
         }
      }

        
    }
    //Field3DImpl<precision> * getConcentrationField(unsigned int i){return concentrationFieldVector[i];};
    
    virtual Field3DImpl<precision> * getConcentrationField(const std::string & name){
      using namespace std;
      for(unsigned int i=0 ; i < concentrationFieldNameVector.size() ; ++i){
         if(concentrationFieldNameVector[i]==name)
            return concentrationFieldVector[i];  
      }
      return 0;
    
    };
    virtual void allocateDiffusableFieldVector(unsigned int numberOfFields,Dim3D fieldDim)
    {
      for(unsigned int i = 0 ; i< numberOfFields ; ++i){
         concentrationFieldVector.push_back(new Field3DImpl<precision>(fieldDim, precision()));
      }
      concentrationFieldNameVector.assign(numberOfFields,std::string());
    }
    
protected:
   std::vector<Field3DImpl<precision> * > concentrationFieldVector;
   std::vector<std::string> concentrationFieldNameVector;
};

};

#endif
