Newer
Older
#include "MpiBodyComm.hpp"
namespace nbody {
MpiBodyComm::MpiBodyComm() {
this->buffer.push_back(Body());
this->buffer.back().mass = 0.0;
this->datatypes[0] = MPI::DOUBLE;
this->datatypes[1] = MPI::DOUBLE;
this->datatypes[2] = MPI::DOUBLE;
this->blocklengths[0] = 3;
this->blocklengths[1] = 3;
this->blocklengths[2] = 1;
this->displacements[0] = MPI::Get_address(&(this->buffer[0].position[0]));
this->displacements[1] = MPI::Get_address(&(this->buffer[0].velocity[0]));
this->displacements[2] = MPI::Get_address(&(this->buffer[0].mass));
this->commBodyType = this->commBodyType.Create_struct(3, this->blocklengths, this->displacements, this->datatypes);
this->commBodyType.Commit();
}
MpiBodyComm::~MpiBodyComm() {
this->commBodyType.Free();
if (this->request != MPI::REQUEST_NULL) {
this->request.Free();
}
bool MpiBodyComm::sendBlocking(int target, vector<Body> bodies) {
return true;
}
bool MpiBodyComm::sendUnblocking(int target, vector<Body> bodies) {
return true;
}