Canoe
Comprehensive Atmosphere N' Ocean Engine
particle_exchanger.hpp
Go to the documentation of this file.
1 #ifndef NBODY_PARTICLE_EXCHANGER_HPP_
2 #define NBODY_PARTICLE_EXCHANGER_HPP_
3 
4 // MPI header
5 #ifdef MPI_PARALLEL
6 #include <mpi.h>
7 #endif
8 
9 // C/C++ header
10 #include <vector>
11 
12 // communication
13 #include <communicator/exchanger.hpp>
14 
15 // n-body
16 #include "particle_data.hpp"
17 #include "particle_group.hpp"
18 
20 class ParticleExchanger : public Exchanger<ParticleData> {
21  protected:
22  Particle const *pmy_particle;
23 
24  public:
25  // functions
26  ParticleExchanger(Particle *pg) : pmy_particle(pg) {}
27 
29 
30  void DetachTo(std::vector<ParticleData> &buffer) override;
31  bool AttachTo(std::vector<ParticleData> &container) const override;
32 
33  protected:
35 
36  MeshBlock const *getMeshBlock() const override {
37  return pmy_particle->pmy_block;
38  }
39 };
40 
41 #endif // NBODY_PARTICLE_EXCHANGER_HPP_
Defines the class for managing buffers for transporting particles.
Particle const * pmy_particle
bool AttachTo(std::vector< ParticleData > &container) const override
ParticleExchanger(Particle *pg)
bool checkOutOfDomain(ParticleData &p) const
MeshBlock const * getMeshBlock() const override
void DetachTo(std::vector< ParticleData > &buffer) override