ESyS-Particle  2.3.4
pi_storage_ne.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>
15 {
16  m_param=param;
18 }
19 
20 template<typename P,typename InteractionType>
22 {
23  m_exIG.push_back(eg);
24 }
25 
31 template<typename T,typename InteractionType>
33 {
34  bool in_exig=false;
35  if(m_exIG.size()>0){ // if there is an ExIG
36  vector<AParallelInteractionStorage*>::iterator exiter=m_exIG.begin();
37  while(exiter!=m_exIG.end() && (!in_exig)){ // not yet excluded and more excluders to check
38  in_exig=(*exiter)->isIn(tv);
39  exiter++;
40  }
41  }
42  return in_exig;
43 }
44 
48 template<typename T,typename InteractionType>
50 {
51  console.XDebug() << "ParallelInteractionStorage_NE::Update\n";
52  int count_l=0;
53  bool res=true;
54 
55  if(m_update_timestamp != this->m_ppa->getTimeStamp()){// m_ppa rebuild since last update
56  // clean out old interactions
57  this->m_interactions.clear();
58  m_set.erase(m_set.begin(),m_set.end());
59  // get list of pairs from m_ppa
61  ((ParallelParticleArray<T>*)this->m_ppa)->getFullPairList();
62  // generate interactions from pairs
63  for(typename ParallelParticleArray<T>::PairListIterator iter=plh->begin();
64  iter!=plh->end();
65  iter++){
66  // check vs. ExIG
67  vector<int> tv;
68  tv.push_back(iter->first->getID());
69  tv.push_back(iter->second->getID());
70  if(!isExcluded(tv)){
71  this->m_interactions.push_back(InteractionType(iter->first,iter->second,m_param));
72  m_set.insert(pair<int,int>(iter->first->getID(),iter->second->getID()));
73  count_l++;
74  }
75  }
76  } else { // m_ppa not rebuild since last update -> just get additional interactions
77  // get list of pairs from m_ppa
79  ((ParallelParticleArray<T>*)this->m_ppa)->getNewPairList();
80  //cout << "got NewPairList: ";
81  for(typename ParallelParticleArray<T>::PairListIterator iter=plh->begin();
82  iter!=plh->end();
83  iter++){
84  // cout << iter->first->getID() << "-" << iter->second->getID() << endl;
85  // check vs. ExIG
86  vector<int> tv;
87  tv.push_back(iter->first->getID());
88  tv.push_back(iter->second->getID());
89  if(!isExcluded(tv)){
90  this->m_interactions.push_back(InteractionType(iter->first,iter->second,m_param));
91  m_set.insert(pair<int,int>(iter->first->getID(),iter->second->getID()));
92  count_l++;
93  }
94  }
95  }
96  m_update_timestamp = this->m_ppa->getTimeStamp();
97 
98  console.XDebug() << "added " << count_l << " pairs to EIG\n";
99  console.XDebug() << "end ParallelInteractionStorage_NE::Update\n";
100 
101  return res;
102 }
103 
104 
108 template<typename P,typename InteractionType>
110 {
111  bool res;
112 
113  res=m_set.find(make_pair(pids[0],pids[1]))!=m_set.end();
114 
115  return res;
116 }
117 
121 template<typename P,typename InteractionType>
123 {
124  console.Debug()
125  << "calculating "
126  << this->m_interactions.size()
127  << " interaction forces\n";
128 
129  for(
130  typename list<InteractionType>::iterator it = this->m_interactions.begin();
131  it != this->m_interactions.end();
132  it++
133  ){
134  it->calcForces();
135  }
136 }
137 
138 template<typename P,typename InteractionType>
140 {
141  console.Debug()
142  << "calculating "
143  << this->m_interactions.size()
144  << " interaction heat transfers\n" ;
145 
146  for(
147  typename list<InteractionType>::iterator it = this->m_interactions.begin();
148  it != this->m_interactions.end();
149  it++
150  ){
151  it->calcHeatTrans();
152  }
153 }
ParallelParticleArray::PairListIterator
NeighborTable< T >::pairlist::iterator PairListIterator
Definition: pp_array.h:78
Console::Debug
Console & Debug()
set verbose level of next message to "dbg"
ParallelInteractionStorage_NE::isIn
virtual bool isIn(const vector< int > &)
do nothing
Definition: pi_storage_ne.hpp:109
ParallelInteractionStorage_NE::ParallelInteractionStorage_NE
ParallelInteractionStorage_NE(AParallelParticleArray *, const typename I::ParameterType &)
Definition: pi_storage_ne.hpp:14
AParallelInteractionStorage
abstract base class for parallel interaction storage array
Definition: pi_storage.h:45
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"
ParallelInteractionStorage_NE::m_param
I::ParameterType m_param
Definition: pi_storage_ne.h:35
ParallelInteractionStorage_NE::update
virtual bool update()
Definition: pi_storage_ne.hpp:49
ParallelInteractionStorage_NE::calcForces
virtual void calcForces()
Definition: pi_storage_ne.hpp:122
AParallelParticleArray
abstract base class for parallel particle storage array
Definition: pp_array.h:42
T_Handle
Template class for a handle/ref. counted pointer.
Definition: handle.h:27
TParallelInteractionStorage
templated abstract base class for parallel interaction storage array. Adds the vector of interactions...
Definition: pi_storage.h:91
esys::lsm::bpu::iter
boost::python::object iter(const boost::python::object &pyOb)
Definition: Util.h:25
ParallelInteractionStorage_NE::m_update_timestamp
int m_update_timestamp
Definition: pi_storage_ne.h:31
ParallelInteractionStorage_NE::calcHeatTrans
virtual void calcHeatTrans()
Definition: pi_storage_ne.hpp:139
ParallelInteractionStorage_NE::isExcluded
bool isExcluded(const vector< int >)
Definition: pi_storage_ne.hpp:32
ParallelInteractionStorage_NE::addExIG
virtual void addExIG(AParallelInteractionStorage *)
Definition: pi_storage_ne.hpp:21
console
Console console
Definition: console.cpp:25