#ifndef __DENSITY_GRID2D_H__
#define __DENSITY_GRID2D_H__

// Compile time adjustable parameters for the Density grid

#define GRID_SIZE2D 1000           // size of Density grid
#define VIEW_SIZE2D 4000.0        // actual physical size of layout plane
                                // these values use more memory but have
                                // little effect on performance or layout

#define RADIUS2D 10               // radius for density fall-off:
                                // larger values tends to slow down
                                // the program and clump the data

#define HALF_VIEW2D 2000          // 1/2 of VIEW_SIZE
#define VIEW_TO_GRID2D .25       // ratio of GRID_SIZE to VIEW_SIZE

/*
   // original values for VxOrd
#define GRID_SIZE 400           // size of VxOrd Density grid
#define VIEW_SIZE 1600.0        // actual physical size of VxOrd plane
#define RADIUS 10               // radius for density fall-off

#define HALF_VIEW 800           // 1/2 of VIEW_SIZE
#define VIEW_TO_GRID .25        // ratio of GRID_SIZE to VIEW_SIZE
*/


// Compile time adjustable parameters


#include <deque>

using namespace std;

#include "ebNode2d.h"

class DensityGrid2d {

public:
  
	  // Methods
	  void Init();
	  void Subtract(Node2d &n, bool first_add, bool fine_first_add, bool fineDensity);
	  void Add(Node2d &n, bool fineDensity );
	  float GetDensity(float Nx, float Ny, bool fineDensity);

	  // Contructor/Destructor
	  DensityGrid2d() {};
	  ~DensityGrid2d();

private:

	  // Private Members
	  void Subtract( Node2d &N );
	  void Add( Node2d &N );
	  void fineSubtract( Node2d &N );
	  void fineAdd( Node2d &N );

	  // new dynamic variables -- SBM
	  float (*fall_off)[RADIUS2D*2+1];
	  float (*Density)[GRID_SIZE2D];
	  deque<Node2d> (*Bins)[GRID_SIZE2D];

	  // old static variables
	  //float fall_off[RADIUS*2+1][RADIUS*2+1];
	  //float Density[GRID_SIZE][GRID_SIZE];
	  //deque<Node *> Bins[GRID_SIZE][GRID_SIZE];
};

#endif // __DENSITY_GRID_H__
