/* * linkedcell.hpp * * If the linked cell should be usable, the class has to inherit LCNodeSet and the nodes (containing the Vectors) have to inherit LCNode. This works well * for molecule and atom classes. * * Created on: Aug 3, 2009 * Author: heber */ #ifndef LINKEDCELL_HPP_ #define LINKEDCELL_HPP_ using namespace std; /*********************************************** includes ***********************************/ // include config.h #ifdef HAVE_CONFIG_H #include #endif #include #include "defs.hpp" #include "vector.hpp" /****************************************** forward declarations *****************************/ class PointCloud; class TesselPoint; /********************************************** definitions *********************************/ #define LinkedNodes list /********************************************** declarations *******************************/ /** Linked Cell class for containing Vectors in real space efficiently. */ class LinkedCell { public: Vector max; // upper boundary Vector min; // lower boundary LinkedNodes *LC; // linked cell list double RADIUS; // cell edge length int N[NDIM]; // number of cells per axis mutable int n[NDIM]; // temporary variable for current cell per axis mutable int index; // temporary index variable , access by index = n[0] * N[1] * N[2] + n[1] * N[2] + n[2]; LinkedCell(); LinkedCell(const PointCloud * const set, const double RADIUS); LinkedCell(LinkedNodes *set, const double radius); ~LinkedCell(); const LinkedNodes* GetCurrentCell()const ; const LinkedNodes* GetRelativeToCurrentCell(const int relative[NDIM])const ; bool SetIndexToNode(const TesselPoint * const Walker)const ; bool SetIndexToVector(const Vector * const x)const ; bool CheckBounds()const ; bool CheckBounds(const int relative[NDIM])const ; void GetNeighbourBounds(int lower[NDIM], int upper[NDIM])const ; // not implemented yet bool AddNode(Vector *Walker); bool DeleteNode(Vector *Walker); bool MoveNode(Vector *Walker); }; #endif /*LINKEDCELL_HPP_*/