ESyS-Particle
4.0.1
|
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 __MESH2D_PIS_EB_H 00014 #define __MESH2D_PIS_EB_H 00015 00016 #include "tml/comm/cart_comm.h" 00017 #include "pis/mesh2d_pis.h" 00018 #include <vector> 00019 00025 template<class ParticleType,class IType> 00026 class Mesh2D_PIS_EB : public Mesh2D_PIS<ParticleType> 00027 { 00028 private: 00029 static const int m_edge_exchg_tag; 00030 static const int m_corner_exchg_tag; 00031 void exchange_boundary(int,int); 00032 00033 protected: 00034 typename IType::ParameterType m_param; 00035 00036 TML_CartComm m_comm; 00037 std::set<pair<int,int> > m_edge_int_set; // for isIn, <edge ID,particle ID> pairs 00038 std::set<pair<int,int> > m_corner_int_set; // for isIn, <corner ID,particle ID> pairs 00039 00040 std::list<typename IType::TriIntType> m_edge_interactions; 00041 std::list<typename IType::CornerIntType> m_corner_interactions; 00042 00043 public: 00044 00045 // --- iterator class === 00046 class InteractionIterator { 00047 public: 00048 typedef typename IType::TriIntType Interaction; 00049 typedef typename list<Interaction>::iterator Iterator; 00050 00051 InteractionIterator(Iterator begin, Iterator end, AParallelParticleArray* ppa); 00052 00053 bool hasNext(); 00054 00055 Interaction &next(); 00056 00057 int getNumRemaining(); 00058 00059 protected: 00060 bool isInner(const Iterator &it); 00061 00062 private: 00063 int m_numRemaining; 00064 Iterator m_it; 00065 Iterator m_end; 00066 AParallelParticleArray *m_ppa; 00067 }; 00068 00069 // --- member functions --- 00070 Mesh2D_PIS_EB(Mesh2D*,ParallelParticleArray<ParticleType>*,typename IType::ParameterType); 00071 00072 virtual bool isIn(const vector<int>&); 00073 virtual void setTimeStepSize(double dt); 00074 virtual void calcForces(); 00075 virtual bool update(); 00076 virtual void exchange(); 00077 virtual void rebuild(); 00078 virtual void tryInsert(const typename IType::TriIntType&); 00079 virtual void tryInsert(const typename IType::CornerIntType&); 00080 virtual void tryInsert(const vector<int>&); 00081 00082 InteractionIterator getInnerInteractionIterator(); 00083 00084 void buildFromPPATagged(int,int); 00085 void buildFromPPAByGap(double); 00086 00087 virtual void saveCheckPointData(std::ostream&); 00088 virtual void loadCheckPointData(std::istream&); 00089 }; 00090 00091 #include "pis/mesh2d_pis_eb.hpp" 00092 00093 #endif //__MESH2D_PIS_EB_H