/* * 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 #include //#include "CodePatterns/Assert.hpp" //#include "CodePatterns/Log.hpp" //#include "CodePatterns/Verbose.hpp" #include "Helpers/defs.hpp" #include "LinearAlgebra/Vector.hpp" #include "World.hpp" /****************************************** forward declarations *****************************/ class IPointCloud; class TesselPoint; /********************************************** definitions *********************************/ //< Upper bound for number of cell nodes used in sensibility check on allocation. enum { MAX_LINKEDCELLNODES = 1000000 }; /********************************************** declarations *******************************/ typedef std::list TesselPointSTLList; /** Linked Cell class for containing Vectors in real space efficiently. */ class LinkedCell { private: public: Vector max; // upper boundary Vector min; // lower boundary TesselPointSTLList *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(IPointCloud &set, const double radius); ~LinkedCell(); const TesselPointSTLList* GetCurrentCell()const ; const TesselPointSTLList* GetRelativeToCurrentCell(const int relative[NDIM])const ; bool SetIndexToNode(const TesselPoint * const Walker)const ; bool SetIndexToVector(const Vector &x)const ; double SetClosestIndexToOutsideVector(const Vector * const x) const; bool CheckBounds()const ; bool CheckBounds(const int relative[NDIM])const ; void GetNeighbourBounds(int lower[NDIM], int upper[NDIM], int step = 1)const ; TesselPointSTLList* GetallNeighbours(const double distance = 0) const; TesselPointSTLList* GetPointsInsideSphere(const double radius, const Vector * const center) const; // not implemented yet bool AddNode(Vector *Walker); bool DeleteNode(Vector *Walker); bool MoveNode(Vector *Walker); }; #endif /*LINKEDCELL_HPP_*/