~esys-p-dev/esys-particle/trunk

482 by slatham
Added bond checking-pointing which works with rotational
1
template<typename P,typename I>
2
ParallelInteractionStorage_EB<P,I>::ParallelInteractionStorage_EB(AParallelParticleArray* ppa,const typename I::ParameterType& param):ParallelInteractionStorage_E<P,I>(ppa,param)
109 by slatham
Restructure of pis subdir (removal of pis/include).
3
{
4
}
482 by slatham
Added bond checking-pointing which works with rotational
5
6
/*!
109 by slatham
Restructure of pis subdir (removal of pis/include).
7
  Update interactions. Check for broken interactions and remove them.
8
*/
9
template<typename P,typename InteractionType>
10
bool ParallelInteractionStorage_EB<P,InteractionType>::update()
11
{
12
  bool res=false;
13
14
  //cout << "PIS_EB::update on node " << m_comm.rank() << endl << flush;
15
  typename list<InteractionType>::iterator iter=m_interactions.begin();
432 by steffen
fix for bug w.r.t. ID ordering
16
  while(iter!=m_interactions.end()){
109 by slatham
Restructure of pis subdir (removal of pis/include).
17
    if(iter->broken()){
18
      res=true;
19
      typename list<InteractionType>::iterator er_iter=iter;
20
      // get IDs to remove from set
21
      vector<int> pids=iter->getAllID();
22
      m_set.erase(make_pair(pids[0],pids[1]));
23
      iter++;
24
       // remove interaction
25
      m_interactions.erase(er_iter);
26
    } else {
27
      iter++;
28
    }
29
  }
30
  //  cout << "end PIS_EB::update on node " << m_comm.rank() << endl << flush;
31
  return res;
32
}
33
34
template<typename P,typename InteractionType>
482 by slatham
Added bond checking-pointing which works with rotational
35
void ParallelInteractionStorage_EB<P,InteractionType>::saveCheckPointData(std::ostream &oStream)
36
{
37
  const std::string delim = "\n";
38
  typedef typename InteractionType::CheckPointable CheckPointable;
39
40
  typename ParallelInteractionStorage_E<P,InteractionType>::InteractionIterator it = getInnerInteractionIterator();
41
  oStream << it.getNumRemaining();
42
  if (it.hasNext()) {
43
    oStream << delim;
44
    CheckPointable(it.next()).saveCheckPointData(oStream);
45
    while (it.hasNext())
46
    {
47
      oStream << delim;
48
      CheckPointable(it.next()).saveCheckPointData(oStream);
49
    }
50
  }
51
}
52
53
template<typename P,typename InteractionType>
54
void ParallelInteractionStorage_EB<P,InteractionType>::loadCheckPointData(std::istream &iStream)
55
{
56
  ParallelInteractionStorage_E<P,InteractionType>::loadCheckPointData(iStream);
57
}
58
59