Skip to content
Snippets Groups Projects
BaseGrid.h 18.79 KiB
//////////////////////////////////////////////////////////////////////
// Grid base class that does just the basics.
// Author: Jeff Comer <jcomer2@illinois.edu>
#ifndef BASEGRID_H
#define BASEGRID_H


#ifdef __CUDACC__
    #define HOST __host__
    #define DEVICE __device__
#else
    #define HOST 
    #define DEVICE 
#endif

#include "useful.h"
#include <cmath>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <cuda.h>


using namespace std;

#define STRLEN 512

class NeighborList {
public:
  float v[3][3][3];
};

class ForceEnergy {
public:
	DEVICE ForceEnergy(Vector3 &f, float &e) :
		f(f), e(e) {};
	Vector3 f;
	float e;
};

class BaseGrid {
  friend class SparseGrid;
 
private:
  // Initialize the variables that get used a lot.
  // Also, allocate the main value array.
  void init();

public:

	/*                               \
	| CONSTRUCTORS, DESTRUCTORS, I/O |
	\===============================*/
	
	// RBTODO Fix?
	BaseGrid(); // cmaffeo2 (2015) moved this out of protected, cause I wanted BaseGrid in a struct
  // The most obvious of constructors.
		BaseGrid(Matrix3 basis0, Vector3 origin0, int nx0, int ny0, int nz0);

  // Make an orthogonal grid given the box dimensions and resolution.
  BaseGrid(Vector3 box, float dx);

  // The box gives the system geometry.
  // The grid point numbers define the resolution.
  BaseGrid(Matrix3 box, int nx0, int ny0, int nz0);

  // The box gives the system geometry.
  // dx is the approx. resolution.
  // The grid spacing is always a bit larger than dx.