ESyS-Particle  4.0.1
SimpleNTable.h
00001 
00002 //                                                         //
00003 // Copyright (c) 2003-2011 by The University of Queensland //
00004 // Earth Systems Science Computational Centre (ESSCC)      //
00005 // http://www.uq.edu.au/esscc                              //
00006 //                                                         //
00007 // Primary Business: Brisbane, Queensland, Australia       //
00008 // Licensed under the Open Software License version 3.0    //
00009 // http://www.opensource.org/licenses/osl-3.0.php          //
00010 //                                                         //
00012 
00013 #ifndef __SIMPLENTABLE_H
00014 #define __SIMPLENTABLE_H
00015 
00016 //-- project includes --
00017 #include "Geometry/SimpleParticle.h"
00018 #include "Geometry/BasicInteraction.h"
00019 
00020 //-- STL-includes --
00021 #include <vector>
00022 #include <set>
00023 
00024 using std::vector;
00025 using std::set;
00026 
00035 class ASimpleNTable
00036 {
00037 protected:
00038   vector<SimpleParticle> *m_data;
00039   Vec3                   m_p0;
00040   double                 m_dim;
00041   int                    m_numInsertedParticles;  
00042 
00043   virtual int index(const Vec3&) const=0;
00044   virtual vector<int> allidx(const Vec3&) const=0;
00045   virtual void insertParticleCircular(SimpleParticle)=0;
00046 
00047 public:
00048   ASimpleNTable();
00049   virtual ~ASimpleNTable();
00050 
00051   int getNumInsertedParticles() const;
00052   const vector<SimpleParticle>* getNeighbors(const Vec3&) const;
00053   int getClosestParticleID(const Vec3&) const;
00054   virtual void getInteractions(set<BasicInteraction,BILess>&,double)=0;
00055   void insertParticle(SimpleParticle);
00056 };
00057 
00067 class CSimple2DNTable : public ASimpleNTable
00068 {
00069 private:
00070   Vec3 m_xshift,m_yshift;
00071   int m_xsize,m_ysize;
00072   bool m_xcirc,m_ycirc;
00073   
00074 protected:
00075   virtual int index(const Vec3&) const;
00076   virtual vector<int> allidx(const Vec3&) const;
00077   virtual void insertParticleCircular(SimpleParticle);
00078 
00079 public:
00080   CSimple2DNTable(const Vec3&,const Vec3&,double,bool xcirc=false,bool ycirc=false);
00081   virtual void getInteractions(set<BasicInteraction,BILess>&,double);
00082   void print();
00083 };
00084 
00085 
00086 #endif //__SIMPLENTABLE_H