ESyS-Particle  2.3.2
VectorParticleFieldSlaveTagged.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 
35 template <typename T>
36 VectorParticleFieldSlaveTagged<T>::VectorParticleFieldSlaveTagged(TML_Comm* comm,ParallelParticleArray<T>* ppa,typename T::VectorFieldFunction rdf,int tag,int mask):VectorParticleFieldSlave<T>(comm,ppa,rdf)
37 {
38  m_tag=tag;
39  m_mask=mask;
40 }
41 
42 template <typename T>
44 {
45  vector<pair<int,Vec3> > data_vec;
46  vector<pair<int,Vec3> > pos_vec;
47 
48  data_vec =
49  this->m_ppa->forAllInnerTaggedParticlesGetIndexed(
50  this->m_rdf,
51  m_tag,
52  m_mask
53  );
54  pos_vec =
55  this->m_ppa->forAllInnerTaggedParticlesGetIndexed(
56  typename T::VectorFieldFunction(&T::getPos),
57  m_tag,
58  m_mask
59  );
60 
61  // send data to master
62  this->m_comm->send_gather(data_vec,0);
63  this->m_comm->send_gather(pos_vec,0);
64 }