ESyS-Particle  2.3.4
pi_storage_ne_t.hpp
Go to the documentation of this file.
1 // //
3 // Copyright (c) 2003-2017 by The University of Queensland //
4 // Centre for Geoscience Computing //
5 // http://earth.uq.edu.au/centre-geoscience-computing //
6 // //
7 // Primary Business: Brisbane, Queensland, Australia //
8 // Licensed under the Open Software License version 3.0 //
9 // http://www.apache.org/licenses/LICENSE-2.0 //
10 // //
12 
13 template<typename P,typename I>
14 ParallelInteractionStorage_NE_T<P,I>::ParallelInteractionStorage_NE_T(AParallelParticleArray* ppa,const typename I::ParameterType& param,int tag1, int mask1, int tag2, int mask2):ParallelInteractionStorage_NE<P,I>(ppa,param)
15 {
16  if(tag1<=tag2){ // sort tags so that m_tag1<=m_tag2
17  m_tag1=tag1;
18  m_mask1=mask1;
19  m_tag2=tag2;
20  m_mask2=mask2;
21  } else {
22  m_tag1=tag2;
23  m_mask1=mask2;
24  m_tag2=tag1;
25  m_mask2=mask1;
26  }
27 }
28 
29 
33 template<typename T,typename InteractionType>
35 {
36  console.XDebug() << "ParallelInteractionStorage_NE_T::Update\n";
37  int count_l=0;
38  bool res=true;
39 
40  if(this->m_update_timestamp != this->m_ppa->getTimeStamp()){// m_ppa rebuild since last update
41  // clean out old interactions
42  this->m_interactions.clear();
43  this->m_set.erase(this->m_set.begin(),this->m_set.end());
44  // get list of pairs from m_ppa
46  ((ParallelParticleArray<T>*)this->m_ppa)->getFullPairList();
47  // generate interactions from pairs
48  for(typename ParallelParticleArray<T>::PairListIterator iter=plh->begin();
49  iter!=plh->end();
50  iter++){
51  //--- check particle tags ---
52  // get tags
53  int t1=iter->first->getTag();
54  int t2=iter->second->getTag();
55  // sort tags
56  if(t1>t2){
57  int th=t1;
58  t1=t2;
59  t2=th;
60  }
61  // tags fit -> go on
62  if(((t1 & m_mask1)==(m_tag1 & m_mask1)) && ((t2 & m_mask2)==(m_tag2 & m_mask2))){
63  // check vs. ExIG
64  vector<int> tv;
65  tv.push_back(iter->first->getID());
66  tv.push_back(iter->second->getID());
67  if(!this->isExcluded(tv)){
68  this->m_interactions.push_back(InteractionType(iter->first,iter->second,this->m_param));
69  this->m_set.insert(pair<int,int>(iter->first->getID(),iter->second->getID()));
70  count_l++;
71  }
72  }
73  }
74  } else { // m_ppa not rebuild since last update -> just get additional interactions
75  // get list of pairs from m_ppa
77  ((ParallelParticleArray<T>*)this->m_ppa)->getNewPairList();
78  for(typename ParallelParticleArray<T>::PairListIterator iter=plh->begin();
79  iter!=plh->end();
80  iter++){
81  //--- check particle tags ---
82  // get tags
83  int t1=iter->first->getTag();
84  int t2=iter->second->getTag();
85  // sort tags
86  if(t1>t2){
87  int th=t1;
88  t1=t2;
89  t2=th;
90  }
91  // tags fit -> go on
92  if(((t1 & m_mask1)==(m_tag1 & m_mask1)) && ((t2 & m_mask2)==(m_tag2 & m_mask2))){
93  // check vs. ExIG
94  vector<int> tv;
95  tv.push_back(iter->first->getID());
96  tv.push_back(iter->second->getID());
97  if(!this->isExcluded(tv)){
98  this->m_interactions.push_back(InteractionType(iter->first,iter->second,this->m_param));
99  this->m_set.insert(pair<int,int>(iter->first->getID(),iter->second->getID()));
100  count_l++;
101  }
102  }
103  }
104  }
105  this->m_update_timestamp = this->m_ppa->getTimeStamp();
106 
107  console.XDebug() << "added " << count_l << " pairs to EIG\n";
108  console.XDebug() << "end ParallelInteractionStorage_NE_T::Update\n";
109 
110  return res;
111 }
ParallelParticleArray::PairListIterator
NeighborTable< T >::pairlist::iterator PairListIterator
Definition: pp_array.h:78
ParallelInteractionStorage_NE_T::ParallelInteractionStorage_NE_T
ParallelInteractionStorage_NE_T(AParallelParticleArray *, const typename I::ParameterType &, int, int, int, int)
Definition: pi_storage_ne_t.hpp:14
ParallelInteractionStorage_NE_T::m_tag1
int m_tag1
Definition: pi_storage_ne_t.h:33
ParallelParticleArray
parrallel particle storage array with neighborsearch and variable exchange
Definition: pp_array.h:75
Console::XDebug
Console & XDebug()
set verbose level of next message to "xdg"
AParallelParticleArray
abstract base class for parallel particle storage array
Definition: pp_array.h:42
ParallelInteractionStorage_NE
parallel storage array without exchange for dynamically created interactions (elastic)
Definition: pi_storage_ne.h:29
T_Handle
Template class for a handle/ref. counted pointer.
Definition: handle.h:27
ParallelInteractionStorage_NE_T::m_mask1
int m_mask1
Definition: pi_storage_ne_t.h:34
ParallelInteractionStorage_NE_T::update
virtual bool update()
Definition: pi_storage_ne_t.hpp:34
esys::lsm::bpu::iter
boost::python::object iter(const boost::python::object &pyOb)
Definition: Util.h:25
ParallelInteractionStorage_NE_T::m_tag2
int m_tag2
Definition: pi_storage_ne_t.h:33
console
Console console
Definition: console.cpp:25
ParallelInteractionStorage_NE_T::m_mask2
int m_mask2
Definition: pi_storage_ne_t.h:34