ESyS-Particle  4.0.1
SubLatticeControler.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 __SUBLATTICECONTROLER_H
00014 #define __SUBLATTICECONTROLER_H
00015 
00016 //--- MPI --- 
00017 #include <mpi.h>
00018 
00019 //--- TML includes ---
00020 #include "tml/comm/comm.h"
00021 #include "tml/comm/comm_world.h"
00022 
00023 #include "Parallel/SubLattice.h"
00024 #include "Parallel/CheckPointable.h"
00025 #include "Foundation/Timer.h"
00026 
00027 #include <boost/shared_ptr.hpp>
00028 
00029 class CheckPointer;
00030 
00041 class CSubLatticeControler : esys::lsm::CheckPointable
00042 {
00043  private:
00044   int m_global_rank;
00045   int m_global_size;
00046   int m_local_rank;
00047   int m_local_size;
00048 
00049   MPI_Comm m_global_comm; // global MPI communicator
00050   MPI_Comm m_local_comm; //  MPI communicator of the spawned workers
00051   TML_Comm m_tml_global_comm;
00052   TML_Comm m_tml_local_comm;
00053   
00054   ASubLattice*  m_lattice;
00055   CheckPointer* m_pCheckPointer; // for restatable checkpoints
00056   CheckPointer* m_pSnapShooter; // for visualization dumps
00057   std::string   m_timingFileName;
00058   typedef boost::shared_ptr<MpiWTimers> MpiWTimersPtr;
00059   MpiWTimersPtr m_timersPtr;
00060 
00061  public:
00062   CSubLatticeControler();
00063   ~CSubLatticeControler();
00064 
00065   void initMPI();
00066   void makeLattice();
00067   void initLattice();
00068   void initLatticeCirc();
00069   void init2DTriangularLocal();  
00070   void init3DTriangularLocal();
00071   void searchNeighbors();
00072   void performTiming();
00073   void saveTimingData();
00074   void getIdParticleData();
00075   void setTimeStepSize();
00076   void setTimingFileName(const std::string &timingFileName) {m_timingFileName=timingFileName;}
00077   const std::string &getTimingFileName() const {return m_timingFileName;}
00078   void do2dCalculations();
00079   void getNumParticles();
00080   void findParticleNearestToPoint();
00081   void getParticlePosn();
00082   void moveSingleParticle();
00083 //  void getBondGroupIdPairs();
00084   void translateMeshBy();
00085   void run();
00086 
00087   void setVerbosity();
00088 
00089   virtual void saveCheckPointData(std::ostream &oStream);
00090   virtual void saveSnapShotData(std::ostream &oStream);
00091 
00092   virtual void loadCheckPointData(std::istream &iStream);
00093   
00094 };
00095 
00096 #endif //__SUBLATTICECONTROLER_H