#ifndef __DENSITY_GRID_H__
#define __DENSITY_GRID_H__

// Compile time adjustable parameters for the Density grid

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

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

#define HALF_VIEW 2000          // 1/2 of VIEW_SIZE
#define VIEW_TO_GRID .025       // 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 "ebNode.h"

class DensityGrid {

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

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

private:

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

	  // new dynamic variables -- SBM
	  float (*fall_off)[RADIUS*2+1][RADIUS*2+1];
	  float (*Density)[GRID_SIZE][GRID_SIZE];
	  deque<Node> (*Bins)[GRID_SIZE][GRID_SIZE];

	  // 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__
