MercuryDPM  0.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
HGRID_base.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 HGRIDBASE_H
27 #define HGRIDBASE_H
28 
29 #include <ostream>
30 #include <iostream>
31 #include <stdlib.h>
32 
33 #include "MD.h"
34 #include "HGRID.h"
35 
38 
43 class HGRID_base : public virtual MD
44 {
45  public:
46 
48  HGRID_base();
49 
51  ~HGRID_base();
52 
54  HGRID_base(MD& other);
55 
57  void constructor();
58 
61 
64 
66  void set_HGRID_num_buckets(unsigned int new_num_buckets);
67 
70 
72  void set_HGRID_num_buckets_to_power(unsigned int N);
73 
75  void read(std::istream& is);
76 
78  void write(std::ostream& os);
79 
81  void print(std::ostream& os, bool print_all);
82 
85 
86  void setHGridUpdateEachTimeStep(bool updateEachTimeStep);
88 
89  void setHGridMaxLevels(int HGridMaxLevels);
90  int getHGridMaxLevels();
91 
93  void setHGridMethod(HGridMethod hGridMethod);
94 
96  void setHGridDistribution(HGridDistribution hGridDistribution);
97 
99  void setHGridCellOverSizeRatio(Mdouble cellOverSizeRatio);
100 
101  protected:
102 
104  void InitBroadPhase();
105 
108 
110 #ifdef ContactListHgrid
111  void broad_phase(BaseParticle *i UNUSED){};
112 #else
114 #endif
115 
117  virtual void CheckObjAgainstGrid(HGrid *grid, BaseParticle *obj)=0;
118 
120  virtual bool TestObject(BaseParticle *pI, BaseParticle *pJ);
121 
122  void HGRID_update_move(BaseParticle * iP, Mdouble move);
123 
125 
127 
128  int readNextArgument(unsigned int& i, unsigned int argc, char *argv[]);
129 
130  public:
132 
133  private:
136 
139 
143  Mdouble cellOverSizeRatio_; //Can be set to give particles more space within a cell
144 };
145 
146 
147 
148 #endif
HGridMethod getHGridMethod()
Definition: HGRID_base.cc:298
void HGRID_actions_after_integration()
Definition: HGRID_base.cc:272
This is the base class for both HGRID_2D and HGRID_3D.
Definition: HGRID_base.h:43
Mdouble getHGridCellOverSizeRatio()
Definition: HGRID_base.cc:318
void setHGridCellOverSizeRatio(Mdouble cellOverSizeRatio)
Definition: HGRID_base.cc:323
void setHGridUpdateEachTimeStep(bool updateEachTimeStep)
Definition: HGRID_base.cc:137
void broad_phase(BaseParticle *i)
This makes the board_phase of contact point at the HGRID code.
Definition: HGRID_base.h:113
bool updateEachTimeStep_
Definition: HGRID_base.h:140
void set_HGRID_num_buckets_to_power()
set number of buckets to the smallest power of two bigger than the number of particles ...
Definition: HGRID_base.cc:84
virtual void CheckObjAgainstGrid(HGrid *grid, BaseParticle *obj)=0
This is a purly virtual function that checks if an object is in the grid, this code is again dim depe...
void set_HGRID_num_buckets(unsigned int new_num_buckets)
This sets the number of buckets for the HGRID.
Definition: HGRID_base.cc:71
void setHGridMethod(HGridMethod hGridMethod)
Definition: HGRID_base.cc:303
void InitBroadPhase()
This sets up the parameters required for the contact model.
Definition: HGRID_base.cc:147
void setHGridMaxLevels(int HGridMaxLevels)
Definition: HGRID_base.cc:328
void print(std::ostream &os, bool print_all)
This function outputs all HGRID data.
Definition: HGRID_base.cc:121
Mdouble currentMaxRelativeDisplacement_
Definition: HGRID_base.h:137
HGridDistribution
Definition: HGRID_base.h:37
Mdouble getHGridCurrentMaxRelativeDisplacement()
Definition: HGRID_base.cc:127
void constructor()
This is the actually constructor it is called do both constructors above.
Definition: HGRID_base.cc:49
int hGridMaxLevels_
Definition: HGRID_base.h:142
HGRID_base()
This is the default constructor. All it does is set senible defaults.
Definition: HGRID_base.cc:28
void write(std::ostream &os)
This function writes all HGRID data.
Definition: HGRID_base.cc:113
Mdouble cellOverSizeRatio_
Definition: HGRID_base.h:143
double Mdouble
Definition: ExtendedMath.h:33
This is the HGRID class - This is the actually HGRID code.
Definition: HGRID.h:39
void HGRID_actions_before_integration()
Definition: HGRID_base.cc:267
virtual bool TestObject(BaseParticle *pI, BaseParticle *pJ)
criterium for inserting a particle (returns false, if particles overlap;)
Definition: HGRID_base.cc:251
~HGRID_base()
This is the default destructor.
Definition: HGRID_base.cc:36
HGridMethod
Definition: HGRID_base.h:36
void setHGridDistribution(HGridDistribution hGridDistribution)
Definition: HGRID_base.cc:313
HGrid * grid
Definition: HGRID_base.h:131
int readNextArgument(unsigned int &i, unsigned int argc, char *argv[])
Definition: HGRID_base.cc:277
#define UNUSED
Definition: ExtendedMath.h:38
A class that defines and solves a MD problem.
Definition: MD.h:70
HGridMethod hGridMethod_
Definition: HGRID_base.h:134
HGridDistribution hGridDistribution_
Definition: HGRID_base.h:135
bool getHGridUpdateEachTimeStep()
Definition: HGRID_base.cc:142
void HGRID_InsertParticleToHgrid(BaseParticle *obj)
Inserts a single Particle to current grid.
Definition: HGRID_base.cc:214
int getHGridMaxLevels()
Definition: HGRID_base.cc:340
void read(std::istream &is)
This function reads all HGRID data.
Definition: HGRID_base.cc:99
int NUM_BUCKETS
Definition: HGRID_base.h:141
Mdouble getHGridTotalCurrentMaxRelativeDisplacement()
Definition: HGRID_base.cc:132
void HGRID_actions_before_time_step()
This resets all the bucket information.
Definition: HGRID_base.cc:221
void HGRID_actions_before_time_loop()
This sets up the broad phase information, has to be done at this stage becuase it requires the partcl...
Definition: HGRID_base.cc:66
Mdouble totalCurrentMaxRelativeDisplacement_
Definition: HGRID_base.h:138
HGridDistribution getHGridDistribution()
Definition: HGRID_base.cc:308
void HGRID_update_move(BaseParticle *iP, Mdouble move)
Definition: HGRID_base.cc:258