MercuryDPM  0.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
HGRID_3D.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_3D_H
27 #define HGRID_3D_H
28 
29 
30 #include "HGRID_base.h"
31 #include <iostream>
32 
34 
35 class HGRID_3D : public HGRID_base
36  {
37 public:
38 
41  {
42  constructor();
43  #ifdef CONSTUCTOR_OUTPUT
44  std::cerr << "HGRID_3D() finished"<<std::endl;
45  #endif
46  }
47 
49 
51 
52  //The copy-constructor of MD has to be called because the link from MD to HGRID_base is virtual
53  HGRID_3D(MD& other) : MD(other), HGRID_base(other)
54  {
55  /*constructor();*/
56  #ifdef CONSTUCTOR_OUTPUT
57  std::cerr << "HGRID_3D(MD& other) finished"<<std::endl;
58  #endif
59  }
60  HGRID_3D(HGRID_base& other) : MD(other), HGRID_base(other)
61  {
62  /*constructor();*/
63  #ifdef CONSTUCTOR_OUTPUT
64  std::cerr << "HGRID_3D(HGRID_base& other) finished"<<std::endl;
65  #endif
66  }
67 
69  void constructor(){
71  set_dim(3);
72  }
73 
74 protected:
75 
79 
81  virtual void CheckCell(int x, int y, int z, int l, BaseParticle *obj, HGrid *grid);
82 
84  virtual void CheckCell_current(int x, int y, int z, int l, HGrid *grid);
85 
88 
91 
94  bool TestCell(int x, int y, int z, int l, BaseParticle *obj, HGrid *grid);
95 
99 
100 #ifdef ContactListHgrid
101  void InsertCell(int x, int y, int z, int l, Particle *obj, HGrid *grid);
102  void InsertObjAgainstGrid(HGrid *grid, BaseParticle *obj);
103 #endif
104 
105  };
106 //end class defintion
107 
108 #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.
void HGRID_UpdateParticleInHgrid(BaseParticle *obj)
This adds a partcile to the Grid, called in the grid setup routies.
Definition: HGRID_3D.cc:220
HGRID_3D(MD &other)
Copy-constructor for creates an HGRID problem from an existing MD problem.
Definition: HGRID_3D.h:53
virtual void CheckCell(int x, int y, int z, int l, BaseParticle *obj, HGrid *grid)
Check collisions for a general cell.
Definition: HGRID_3D.cc:58
void HGRID_RemoveParticleFromHgrid(BaseParticle *obj)
Definition: HGRID_3D.cc:269
void constructor()
This is the actually constructor it is called do both constructors above.
Definition: HGRID_3D.h:69
This adds on the hierarchical grid code for 3D problems.
Definition: HGRID_3D.h:35
bool TestCell(int x, int y, int z, 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_3D.cc:286
bool TestObjAgainstGrid(HGrid *grid, BaseParticle *obj)
Tests obj against all neighbouring particles similar to CheckObjAgainstGrid, but links to TestCell in...
Definition: HGRID_3D.cc:310
This is the HGRID class - This is the actually HGRID code.
Definition: HGRID.h:39
void set_dim_particle(int new_, unsigned int indSpecies=0)
Allows the dimension of the particle (f.e. for mass) to be changed.
Definition: MD.h:261
void CheckObjAgainstGrid(HGrid *grid, BaseParticle *obj)
Check if an Particle has a collision in the grid; avoids multiple checks.
Definition: HGRID_3D.cc:83
HGrid * grid
Definition: HGRID_base.h:131
A class that defines and solves a MD problem.
Definition: MD.h:70
void set_dim(int new_dim)
Allows the dimension of the simulation to be changed.
Definition: MD.h:367
HGRID_3D()
This is the default constructor. All it does is set senible defaults.
Definition: HGRID_3D.h:40
virtual void CheckCell_current(int x, int y, int z, int l, HGrid *grid)
Checks for a collision in the particles own cell.
Definition: HGRID_3D.cc:31
HGRID_3D(HGRID_base &other)
Definition: HGRID_3D.h:60