ESyS-Particle  4.0.1
TempPartStore.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 __TEMPPARTSTORE_H
00014 #define __TEMPPARTSTORE_H
00015 
00016 // --- Project includes ---
00017 #include "vec3.h"
00018 
00019 // --- STL includes ---
00020 #include <map>
00021 #include <utility>
00022 
00023 using std::map;
00024 using std::multimap;
00025 using std::pair;
00026 using std::make_pair;
00027 
00032 class ATempPartStore
00033 {
00034  public:
00035   virtual ~ATempPartStore() {}
00036   virtual void addSlaveID(int,int,int,int)=0;
00037   virtual void addConnection(int,int,int)=0;
00038 };
00039 
00046 template<typename T>
00047 class TTempPartStore : public ATempPartStore
00048 {
00049  private:
00050   multimap<int,T> m_mmap;
00051   map<int,typename multimap<int,T>::iterator> m_by_id;
00052   map<int,int> m_slave_id_map;
00053 
00054   double m_xmin,m_xsize,m_ymin,m_ysize,m_zmin,m_zsize;
00055   int m_nx,m_ny,m_nz;
00056 
00057   int coordsToIndex(int,int,int);
00058   int posToIndex(const Vec3&);
00059 
00060  public:
00061   TTempPartStore(const Vec3&,const Vec3&, int,int,int);
00062 
00063   virtual void addSlaveID(int,int,int,int);
00064   virtual void addParticle(const T&);
00065   virtual void addConnection(int,int,int);
00066 
00067   const multimap<int,T>& getMap() const {return m_mmap;};
00068 };
00069 
00070 #include "TempPartStore.hpp"
00071 
00072 #endif //__TEMPPARTSTORE_H