MercuryDPM  0.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
HGRID_2D.h
Go to the documentation of this file.
1 //Copyright (c) 2013-2014, The MercuryDPM Developers Team. All rights reserved.
2 //For the list of developers, see <http://www.MercuryDPM.org/Team>.
3 //
4 //Redistribution and use in source and binary forms, with or without
5 //modification, are permitted provided that the following conditions are met:
6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above copyright
9 // notice, this list of conditions and the following disclaimer in the
10 // documentation and/or other materials provided with the distribution.
11 // * Neither the name MercuryDPM nor the
12 // names of its contributors may be used to endorse or promote products
13 // derived from this software without specific prior written permission.
14 //
15 //THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16 //ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 //WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 //DISCLAIMED. IN NO EVENT SHALL THE MERCURYDPM DEVELOPERS TEAM BE LIABLE FOR ANY
19 //DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20 //(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 //LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22 //ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 //(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 //SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 
26 #ifndef HGRID_2D_H
27 #define HGrid_2D_H
28 
29 #include "HGRID_base.h"
30 #include <iostream>
31 
33 class HGRID_2D : public HGRID_base
34  {
35 public:
36 
39  {
40  constructor();
41  #ifdef CONSTUCTOR_OUTPUT
42  std::cerr << "HGRID_2D() finished"<<std::endl;
43  #endif
44  }
45 
47  //The copy-constructor of MD has to be called because the link from MD to HGRID_base is virtual
48  HGRID_2D(MD& other) : MD(other), HGRID_base(other)
49  {
50  constructor();
51  #ifdef CONSTUCTOR_OUTPUT
52  std::cerr << "HGRID_2D(MD& other) finished" << std::endl;
53  #endif
54  }
55  HGRID_2D(HGRID_base& other) : MD(other), HGRID_base(other)
56  {
57  constructor();
58  #ifdef CONSTUCTOR_OUTPUT
59  std::cerr << "HGRID_2D(HGRID_base& other) finished" << std::endl;
60  #endif
61  }
62 
64  void constructor() {}
65 
66 protected:
67 
71 
73  virtual void CheckCell(int x, int y, int l, BaseParticle *obj, HGrid *grid);
74 
76  virtual void CheckCell_current(int x, int y, int l, HGrid *grid);
77 
80 
83 
86  bool TestCell(int x, int y, int l, BaseParticle *obj, HGrid *grid);
87 
91 
92 #ifdef ContactListHgrid
93  void InsertCell(int x, int y, int l, Particle *obj, HGrid *grid);
94  void InsertObjAgainstGrid(HGrid *grid, Particle *obj);
95 #endif
96  };
97 //end class defintion
98 
99 #endif
This is the base class for both HGRID_2D and HGRID_3D.
Definition: HGRID_base.h:43
void CheckObjAgainstWholeGrid(HGrid *grid, BaseParticle *obj)
Check if an Particle has a collision in the grid.
HGRID_2D()
This is the default constructor. All it does is set senible defaults.
Definition: HGRID_2D.h:38
void HGRID_UpdateParticleInHgrid(BaseParticle *obj)
This adds a partcile to the Grid, called in the grid setup routies.
Definition: HGRID_2D.cc:179
This is the HGRID class - This is the actually HGRID code.
Definition: HGRID.h:39
HGRID_2D(HGRID_base &other)
Definition: HGRID_2D.h:55
virtual void CheckCell_current(int x, int y, int l, HGrid *grid)
Checks for a collision in the particles own cell.
Definition: HGRID_2D.cc:31
HGRID_2D(MD &other)
Copy-constructor for creates an HGRID problem from an existing MD problem.
Definition: HGRID_2D.h:48
HGrid * grid
Definition: HGRID_base.h:131
A class that defines and solves a MD problem.
Definition: MD.h:70
void CheckObjAgainstGrid(HGrid *grid, BaseParticle *obj)
Check if an Particle has a collision in the grid; avoids multiple checks.
Definition: HGRID_2D.cc:82
void constructor()
This is the actually constructor it is called do both constructors above.
Definition: HGRID_2D.h:64
void HGRID_RemoveParticleFromHgrid(BaseParticle *obj)
Definition: HGRID_2D.cc:227
This adds on the hierarchical grid code for 2D problems.
Definition: HGRID_2D.h:33
bool TestCell(int x, int y, int l, BaseParticle *obj, HGrid *grid)
Tests obj against all particles in cell similar to CheckCell, but links to TestObject instead of comp...
Definition: HGRID_2D.cc:244
bool TestObjAgainstGrid(HGrid *grid, BaseParticle *obj)
Tests obj against all neighbouring particles similar to CheckObjAgainstGrid, but links to TestCell in...
Definition: HGRID_2D.cc:268
virtual void CheckCell(int x, int y, int l, BaseParticle *obj, HGrid *grid)
Check collisions for a general cell.
Definition: HGRID_2D.cc:58