14 #ifndef _REGIONGATHERI_H_ 15 #define _REGIONGATHERI_H_ 17 #ifndef _REGIONGATHER_CPP_ 48 const BoxLayout& layout_out = a_gatherObjects.boxLayout();
50 if (!(layout_input == layout_out))
52 a_gatherObjects.
define(layout_input);
75 std::list<GatherBuffer> glist;
77 for (dit.
begin(); dit.
ok(); ++dit)
80 for (
int i=0; i<m.
size(); ++i)
82 glist.push_back(&(m[i]));
95 std::list<GatherBuffer>::iterator iter;
102 for (
int i=0; i<count; )
104 iter->buffer = (
char*)&(recvBuffer[i]);
105 sendBuffer[i] = a_local[iter->message->srcIndex];
106 plast = iter->message->procID;
110 if (i==count || plast != iter->message->procID)
114 int numChar = messageSize*
sizeof(T);
115 MPI_Isend(&(sendBuffer[index]), numChar, MPI_CHAR, plast,
116 0, Chombo_MPI::comm, &(sends[sends.
size()-1]));
117 MPI_Irecv(&(recvBuffer[index]), numChar, MPI_CHAR, plast,
118 0, Chombo_MPI::comm, &(receives[receives.
size()-1]));
132 for (dit.
begin(); dit.
ok(); ++dit)
134 const T& val = a_local[dit];
138 for (
int i=0; i<local.
size(); ++i)
151 if (sends.
size() > 0)
157 CH_TIME(
"MPI_GatherSendWaitall");
158 result = MPI_Waitall(sends.
size(), &(sends[0]),
162 if (receives.
size() > 0)
168 CH_TIME(
"MPI_GatherRecvWaitall");
169 result = MPI_Waitall(receives.
size(), &(receives[0]),
172 iter = glist.begin();
174 for (
int i=0; i<count; ++i, ++iter)
177 g.
m_value = *((T*)iter->buffer);
178 g.
m_offset = -iter->message->distance;
virtual void define(const Vector< Box > &a_boxes, const Vector< int > &a_procIDs)
T m_value
Definition: RegionGather.H:35
A not-necessarily-disjoint collective of boxes.
Definition: BoxLayout.H:146
one dimensional dynamic array
Definition: Vector.H:52
Data that maintains a one-to-one mapping of T to the boxes in a BoxLayout.
Definition: LayoutData.H:46
GatherBuffer(const RegionGather::Message *a_message)
Definition: RegionGatherI.H:26
Definition: RegionGather.H:63
void regionGather< Real >(const LayoutData< Real > &a_local, const RegionGather &a_copier, LayoutData< Vector< GatherObject< Real > > > &a_gatherObjects)
const BoxLayout & boxLayout() const
Definition: LayoutData.H:108
void begin()
initialize this iterator to the first Box in its Layout
Definition: LayoutIterator.H:115
DataIterator dataIterator() const
Definition: LayoutDataI.H:79
void regionGather(const LayoutData< T > &a_local, const RegionGather &a_copier, LayoutData< Vector< GatherObject< T > > > &a_gatherObjects)
Function performs a distance cut-off gather operation.
Definition: RegionGatherI.H:42
virtual bool ok() const
return true if this iterator is still in its Layout
Definition: LayoutIterator.H:110
Definition: DataIterator.H:140
DataIndex destIndex
Definition: RegionGather.H:69
void resize(unsigned int isize)
Definition: Vector.H:323
IntVect m_offset
Definition: RegionGather.H:34
void gather(Vector< T > &a_outVec, const T &a_input, int a_dest)
Definition: SPMDI.H:194
LayoutData< Vector< RegionGather::Message > > m_local
Definition: RegionGather.H:76
void push_back(const T &in)
Definition: Vector.H:283
#define CH_TIME(name)
Definition: CH_Timer.H:59
bool operator<(const GatherBuffer &rhs) const
Definition: RegionGatherI.H:30
size_t size() const
Definition: Vector.H:177
const RegionGather::Message * message
Definition: RegionGatherI.H:35
Definition: RegionGatherI.H:23
Data coordination class for the regionGather function.
Definition: RegionGather.H:52
return object for the regionGather function
Definition: RegionGather.H:31
char * buffer
Definition: RegionGatherI.H:36
IntVect distance
Definition: RegionGather.H:66
LayoutData< Vector< RegionGather::Message > > m_messages
Definition: RegionGather.H:75