ESyS-Particle  2.3.2
ScalarInteractionFieldSlave.hpp
Go to the documentation of this file.
1 
2 // //
3 // Copyright (c) 2003-2014 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.opensource.org/licenses/osl-3.0.php //
10 // //
12 
13 //-- STL includes --
14 #include <vector>
15 #include <utility>
16 
17 using std::vector;
18 using std::pair;
19 
20 // -- IO includes --
21 #include <iostream>
22 
23 using std::cout;
24 using std::endl;
25 
26 #include "Foundation/quadtuple.h"
27 #include "pis/pi_storage.h"
28 
36 template <typename T>
38 {
39  m_rdf=rdf;
40 }
41 
45 template <typename T>
47 {
48  vector<pair<Vec3,double> > data;
49 
50  data=this->m_pis->forAllInnerInteractionsGetWithPos(m_rdf);
51 
52  // send data to master
53  this->m_comm->send_gather(data,0);
54 }
55 
59 template <typename T>
61 {
62  vector<pair<esys::lsm::quintuple<Vec3,double,Vec3,double,Vec3>,double> > data;
63 
64  data=this->m_pis->forAllInnerInteractionsGetRaw2(m_rdf);
65 
66  // send data to master
67  this->m_comm->send_gather(data,0);
68 }
69 
73 template <typename T>
75 {
76  vector<pair<esys::lsm::quintuple<int,int,Vec3,Vec3,Vec3>, double> > data;
77 
78  // debug output
79  console.XDebug() << "ScalarInteractionFieldSlave<T>::SendDataWithPosID()\n";
80 
81  data=this->m_pis->forAllInnerInteractionsGetDataWithPosID(m_rdf);
82 
83  // debug output
84  console.XDebug() << "sending " << data.size() << " data\n";
85 
86  // send data to master
87  this->m_comm->send_gather(data,0);
88 }
89 
93 template <typename T>
95 {
96  vector<double> data_vec;
97 
98  // get data from interactions
99  this->m_pis->forAllInnerInteractionsGet(data_vec,m_rdf);
100 
101  // sum data
102  double sum=0.0;
103  for(vector<double>::iterator iter=data_vec.begin();
104  iter!=data_vec.end();
105  iter++){
106  sum+=*iter;
107  }
108 
109  vector<double> sum_vec;
110  sum_vec.push_back(sum);
111  this->m_comm->send_gather(sum_vec,0);
112 }
113 
117 template <typename T>
119 {
120  vector<pair<esys::lsm::triplet<int,int,Vec3>, double> > data;
121 
122  // debug output
123  console.XDebug() << "ScalarInteractionFieldSlave<T>::SendDataWithID()\n";
124 
125  data=this->m_pis->forAllInnerInteractionsGetDataWithID(m_rdf);
126 
127  // debug output
128  console.XDebug() << "sending " << data.size() << " data\n";
129 
130  // send data to master
131  this->m_comm->send_gather(data,0);
132 }
133 
134 
138 template <typename T>
140 {
141  vector<double> data_vec;
142 
143  // get data from interactions
144  this->m_pis->forAllInnerInteractionsGet(data_vec,m_rdf);
145 
146  // sum data
147  double max=*(data_vec.begin());
148  for(vector<double>::iterator iter=data_vec.begin();
149  iter!=data_vec.end();
150  iter++){
151  max=(*iter > max) ? *iter : max;
152  }
153 
154  vector<double> max_vec;
155  max_vec.push_back(max);
156  this->m_comm->send_gather(max_vec,0);
157 }