| 1 | /* | 
|---|
| 2 | *    vmg - a versatile multigrid solver | 
|---|
| 3 | *    Copyright (C) 2012 Institute for Numerical Simulation, University of Bonn | 
|---|
| 4 | * | 
|---|
| 5 | *  vmg is free software: you can redistribute it and/or modify | 
|---|
| 6 | *  it under the terms of the GNU General Public License as published by | 
|---|
| 7 | *  the Free Software Foundation, either version 3 of the License, or | 
|---|
| 8 | *  (at your option) any later version. | 
|---|
| 9 | * | 
|---|
| 10 | *  vmg is distributed in the hope that it will be useful, | 
|---|
| 11 | *  but WITHOUT ANY WARRANTY; without even the implied warranty of | 
|---|
| 12 | *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
|---|
| 13 | *  GNU General Public License for more details. | 
|---|
| 14 | * | 
|---|
| 15 | *  You should have received a copy of the GNU General Public License | 
|---|
| 16 | *  along with this program.  If not, see <http://www.gnu.org/licenses/>. | 
|---|
| 17 | */ | 
|---|
| 18 |  | 
|---|
| 19 | /** | 
|---|
| 20 | * @file   linked_cell_list.hpp | 
|---|
| 21 | * @author Julian Iseringhausen <isering@ins.uni-bonn.de> | 
|---|
| 22 | * @date   Mon Nov 21 13:27:22 2011 | 
|---|
| 23 | * | 
|---|
| 24 | * @brief  A linked cell list implementation. | 
|---|
| 25 | * | 
|---|
| 26 | */ | 
|---|
| 27 |  | 
|---|
| 28 | #ifndef LINKED_CELL_LIST_HPP_ | 
|---|
| 29 | #define LINKED_CELL_LIST_HPP_ | 
|---|
| 30 |  | 
|---|
| 31 | #include <list> | 
|---|
| 32 | #include <vector> | 
|---|
| 33 |  | 
|---|
| 34 | #include "base/index.hpp" | 
|---|
| 35 | #include "grid/is_grid.hpp" | 
|---|
| 36 | #include "units/particle/particle.hpp" | 
|---|
| 37 |  | 
|---|
| 38 | namespace VMG | 
|---|
| 39 | { | 
|---|
| 40 |  | 
|---|
| 41 | namespace Particle | 
|---|
| 42 | { | 
|---|
| 43 |  | 
|---|
| 44 | class LinkedCellList : public IsGrid< std::list<Particle*> > | 
|---|
| 45 | { | 
|---|
| 46 | public: | 
|---|
| 47 | typedef std::list<Particle*>::iterator iterator; | 
|---|
| 48 | typedef std::list<Particle*>::const_iterator const_iterator; | 
|---|
| 49 | typedef std::list<Particle*>::reverse_iterator reverse_iterator; | 
|---|
| 50 | typedef std::list<Particle*>::const_reverse_iterator const_reverse_iterator; | 
|---|
| 51 |  | 
|---|
| 52 | LinkedCellList(std::list<Particle>& particles, | 
|---|
| 53 | const int& near_field_cells, const Grid& grid); | 
|---|
| 54 |  | 
|---|
| 55 | ~LinkedCellList(); | 
|---|
| 56 |  | 
|---|
| 57 | void AddParticle(Particle* particle); | 
|---|
| 58 | void AddParticleToHalo(const vmg_float* x, const vmg_float& q); | 
|---|
| 59 |  | 
|---|
| 60 | void ClearHalo(); | 
|---|
| 61 |  | 
|---|
| 62 | const Index& NearFieldCells() const {return near_field_cells_;} | 
|---|
| 63 | private: | 
|---|
| 64 | Index near_field_cells_; | 
|---|
| 65 | }; | 
|---|
| 66 |  | 
|---|
| 67 | } | 
|---|
| 68 |  | 
|---|
| 69 | } | 
|---|
| 70 |  | 
|---|
| 71 | #endif /* LINKED_CELL_LIST_HPP_ */ | 
|---|