8#ifndef COMMUNICATIONPARTNER_H_
9#define COMMUNICATIONPARTNER_H_
14#include "CommunicationBuffer.h"
17 LEAVING_AND_HALO_COPIES = 0,
26 double _bothLow[3], _bothHigh[3];
27 double _leavingLow[3], _leavingHigh[3];
28 double _copiesLow[3], _copiesHigh[3];
41 const double bHi[3],
const double sh[3],
const int offset[3],
const bool enlarged[3][2]);
54 MessageType msgType, std::vector<Molecule>& invalidParticles,
bool mightUseInvalidParticles,
55 bool doHaloPositionCheck,
bool removeFromContainer =
false);
61 bool iprobeCount(
const MPI_Comm& comm,
const MPI_Datatype&
type);
63 bool testRecv(
ParticleContainer* moleculeContainer,
bool removeRecvDuplicates,
bool force =
false);
65 void initRecv(
int numParticles,
const MPI_Comm& comm,
const MPI_Datatype&
type);
67 void deadlockDiagnosticSendRecv();
68 void deadlockDiagnosticSend();
69 void deadlockDiagnosticRecv();
75 const int* getOffset() {
76 return _haloInfo[0]._offset;
82 return (!!_haloInfo[0]._offset[0] + !!_haloInfo[0]._offset[1] + !!_haloInfo[0]._offset[2]) == 1;
88 return !!_haloInfo[0]._offset[1] * 1 + !!_haloInfo[0]._offset[2] * 2;
91 void enlargeInOtherDirections(
unsigned int d,
double enlargement) {
92 for (
unsigned int p = 0; p < _haloInfo.size(); p++) {
93 for (
unsigned int d2 = 0; d2 < 3; d2++) {
96 if (!_haloInfo[p]._enlarged[d2][0]) {
97 _haloInfo[p]._bothLow[d2] -= enlargement;
98 _haloInfo[p]._leavingLow[d2] -= enlargement;
99 _haloInfo[p]._copiesLow[d2] -= enlargement;
100 _haloInfo[p]._enlarged[d2][0] =
true;
102 if (!_haloInfo[p]._enlarged[d2][1]) {
103 _haloInfo[p]._bothHigh[d2] += enlargement;
104 _haloInfo[p]._leavingHigh[d2] += enlargement;
105 _haloInfo[p]._copiesHigh[d2] += enlargement;
106 _haloInfo[p]._enlarged[d2][1] =
true;
116 size_t getDynamicSize();
118 void print(std::ostream& stream)
const;
120 enum HaloOrLeavingCorrection{
126 void collectMoleculesInRegion(
ParticleContainer* moleculeContainer,
const double lowCorner[3],
127 const double highCorner[3],
const double shift[3],
bool removeFromContainer,
128 HaloOrLeavingCorrection haloLeaveCorr,
bool doHaloPositionCheck =
true);
132 std::vector<PositionInfo> _haloInfo;
135 MPI_Request *_sendRequest, *_recvRequest;
136 MPI_Status *_sendStatus, *_recvStatus;
138 bool _msgSent, _countReceived, _msgReceived, _isSending, _isReceiving;
140 void collectLeavingMoleculesFromInvalidParticles(std::vector<Molecule>& invalidParticles,
double lowCorner [3],
double highCorner [3],
double shift [3]);
142 friend class NeighborAcquirerTest;
Definition: CommunicationBuffer.h:37
Definition: CommunicationPartner.h:38
bool isFaceCommunicator() const
Definition: CommunicationPartner.h:81
int getFaceCommunicationDirection() const
Definition: CommunicationPartner.h:85
void add(CommunicationPartner partner)
Definition: CommunicationPartner.cpp:428
This Interface is used to get access to particles and pairs of particles.
Definition: ParticleContainer.h:69
Enumeration class corresponding to the type schema type.
Definition: vtk-unstructured.h:1746
Definition: CommunicationPartner.h:25
int _offset[3]
for periodic boundaries
Definition: CommunicationPartner.h:30