Lagrangian Liquid Simulation
Master Thesis project on simulation of liquids using Lagrangian approach and SPH
include/Neighbour.h
Go to the documentation of this file.
00001 #ifndef NEIGHBOUR_H
00002 #define NEIGHBOUR_H
00003 
00004 #include "map"
00005 
00006 #include "FluidParticle.h"
00007 
00009 typedef std::multimap<int, FluidParticle> hashmap;
00010 
00020 
00021 class Neighbour
00022 {
00023 public:
00027     Neighbour
00028             (
00029                 const int _numParticles,
00030                 const float _smoothingLength
00031             );
00032 
00034     ~Neighbour();
00035 
00039     void reInitialise
00040             (
00041                 const int _numParticles,
00042                 const float _smoothingLength
00043             );
00044 
00047     void refreshHashmap(std::vector<FluidParticle>& _particleList);
00048 
00050     void clearHashmap();
00051 
00054     std::vector<FluidParticle> determineNeighbours(const ngl::Vector _centerPosition);
00055 
00058     inline void setCellSize(const ngl::Real _size) { m_cellSize = _size; }
00059 
00060 
00061 private:
00063     hashmap m_hashMap;
00064 
00066     float m_cellSize;
00067 
00069     int m_mapSize;
00070 
00072     int m_largePrime1;
00073 
00075     int m_largePrime2;
00076 
00078     int m_largePrime3;
00079 
00081     int m_initialNeighbourListSize;
00082 
00083 private:
00087     int modulus
00088             (
00089                 const int _a,
00090                 const int _b
00091             );
00092 
00095     int getNextPrimeNumber(const int _start);
00096 
00099     std::vector<int> discretize(const ngl::Vector _position);
00100 
00103     int hashPosition(const ngl::Vector _position);
00104 
00109     void getCellNeighbours
00110                     (
00111                         const ngl::Vector _centerPosition,
00112                         const bool _checkWithinSmoothingLength,
00113                         std::vector<FluidParticle>& o_neighbourList
00114                     );
00115 
00119     bool isParticleAlreadyInList
00120                     (
00121                         const int _testId,
00122                         std::vector<FluidParticle>& _neighbourList
00123                     );
00124 
00125 
00126 };
00127 
00128 #endif // NEIGHBOUR_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator