ESyS-Particle  2.3.2
SimpleNTable3D.h
Go to the documentation of this file.
1 
2 // //
3 // Copyright (c) 2003-2014 by The University of Queensland //
4 // Centre for Geoscience Computing //
5 // http://earth.uq.edu.au/centre-geoscience-computing //
6 // //
7 // Primary Business: Brisbane, Queensland, Australia //
8 // Licensed under the Open Software License version 3.0 //
9 // http://www.opensource.org/licenses/osl-3.0.php //
10 // //
12 
13 #ifndef __SIMPLENTABLE3D_H
14 #define __SIMPLENTABLE3D_H
15 
16 //-- project includes --
19 #include "Geometry/SimpleNTable.h"
20 
21 typedef std::set<BasicInteraction,BILess> InteractionSet;
22 typedef std::vector<SimpleParticle> ParticleVector;
23 
33 {
34 private:
38 
39 protected:
40  virtual int index(const Vec3&) const;
41  virtual vector<int> allidx(const Vec3&) const;
43 
44 public:
45  CSimple3DNTable(const Vec3&,const Vec3&,double,bool xcirc=false,bool ycirc=false,bool zcirc=false);
46  virtual void getInteractions(set<BasicInteraction,BILess>&,double);
47  void print();
48 
49  template <class TmplInteractionValidator>
50  InteractionSet getInteractions(const TmplInteractionValidator &validator) const
51  {
52  InteractionSet iset;
53  for(int i=0;i<m_xsize;i++){
54  for(int j=0;j<m_ysize;j++){
55  for(int k=0;k<m_zsize;k++){
56  int idx=i+m_xsize*j+k*m_xsize*m_zsize;
57  if(m_data[idx].size() >= 2){
58  for(ParticleVector::const_iterator iter = m_data[idx].begin();
59  iter != m_data[idx].end()-1;
60  iter++)
61  {
62  for (
63  ParticleVector::const_iterator iter2 = iter+1;
64  iter2 != m_data[idx].end();
65  iter2++)
66  {
67  if (validator.isValid(*iter, *iter2))
68  {
69  iset.insert(BasicInteraction(iter->getID(),iter2->getID()));
70  }
71  }
72  }
73  }
74  }
75  }
76  }
77  return iset;
78  }
79 };
80 
81 #endif //__SIMPLENTABLE3D_H