ESyS-Particle  4.0.1
mesh2d_pis_eb.h
1 
2 // //
3 // Copyright (c) 2003-2011 by The University of Queensland //
4 // Earth Systems Science Computational Centre (ESSCC) //
5 // http://www.uq.edu.au/esscc //
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 __MESH2D_PIS_EB_H
14 #define __MESH2D_PIS_EB_H
15 
16 #include "tml/comm/cart_comm.h"
17 #include "pis/mesh2d_pis.h"
18 #include <vector>
19 
25 template<class ParticleType,class IType>
26 class Mesh2D_PIS_EB : public Mesh2D_PIS<ParticleType>
27 {
28  private:
29  static const int m_edge_exchg_tag;
30  static const int m_corner_exchg_tag;
31  void exchange_boundary(int,int);
32 
33  protected:
34  typename IType::ParameterType m_param;
35 
36  TML_CartComm m_comm;
37  std::set<pair<int,int> > m_edge_int_set; // for isIn, <edge ID,particle ID> pairs
38  std::set<pair<int,int> > m_corner_int_set; // for isIn, <corner ID,particle ID> pairs
39 
40  std::list<typename IType::TriIntType> m_edge_interactions;
41  std::list<typename IType::CornerIntType> m_corner_interactions;
42 
43  public:
44 
45  // --- iterator class ===
47  public:
48  typedef typename IType::TriIntType Interaction;
49  typedef typename list<Interaction>::iterator Iterator;
50 
51  InteractionIterator(Iterator begin, Iterator end, AParallelParticleArray* ppa);
52 
53  bool hasNext();
54 
55  Interaction &next();
56 
57  int getNumRemaining();
58 
59  protected:
60  bool isInner(const Iterator &it);
61 
62  private:
63  int m_numRemaining;
64  Iterator m_it;
65  Iterator m_end;
67  };
68 
69  // --- member functions ---
70  Mesh2D_PIS_EB(Mesh2D*,ParallelParticleArray<ParticleType>*,typename IType::ParameterType);
71 
72  virtual bool isIn(const vector<int>&);
73  virtual void setTimeStepSize(double dt);
74  virtual void calcForces();
75  virtual bool update();
76  virtual void exchange();
77  virtual void rebuild();
78  virtual void tryInsert(const typename IType::TriIntType&);
79  virtual void tryInsert(const typename IType::CornerIntType&);
80  virtual void tryInsert(const vector<int>&);
81 
82  InteractionIterator getInnerInteractionIterator();
83 
84  void buildFromPPATagged(int,int);
85  void buildFromPPAByGap(double);
86 
87  virtual void saveCheckPointData(std::ostream&);
88  virtual void loadCheckPointData(std::istream&);
89 };
90 
91 #include "pis/mesh2d_pis_eb.hpp"
92 
93 #endif //__MESH2D_PIS_EB_H