44 template <
class T,
unsigned Dim,
class Mesh,
class CachingPolicy >
54 template <
class T,
unsigned Dim,
class Mesh,
class CachingPolicy >
65 template <
class T,
unsigned Dim,
class Mesh,
class CachingPolicy >
76 template <
class T,
unsigned Dim,
class Mesh,
class CachingPolicy >
85 template <
class T,
unsigned Dim,
class Mesh,
class CachingPolicy >
94 RLayout.checkin(*
this);
99 for (i = 0; i <
Dim; ++i)
100 SwapNodeList[i] =
new bool[N];
101 PutList =
new std::vector<size_t>[N];
105 NodeCount =
new size_t[N];
106 EmptyNode =
new bool[N];
107 for (i = 0; i < N; ++i)
110 EmptyNode[i] =
false;
114 if (RLayout.initialized())
115 rebuild_neighbor_data();
121 template <
class T,
unsigned Dim,
class Mesh,
class CachingPolicy >
127 delete [] SwapMsgList;
128 for (
unsigned int i=0; i <
Dim; i++)
129 delete [] (SwapNodeList[i]);
133 RLayout.checkout(*
this);
143 template <
class T,
unsigned Dim,
class Mesh,
class CachingPolicy >
146 #ifdef OLD_SWAP_PARTICLES
154 for (d = 0; d <
Dim; ++d)
156 NeighborNodes[d] = 0;
157 for (j = 0; j < N; j++)
158 SwapNodeList[d][j] =
false;
165 if (RLayout.begin_iv() == endLocalVN)
167 EmptyNode[myN] =
true;
172 for (d = 0; d <
Dim; ++d)
175 for (localVN = RLayout.
begin_iv(); localVN != endLocalVN; ++localVN)
180 chkDom[d] = (RLayout.getDomain())[d];
186 for ( ; tVN != touchingVN.second; ++tVN)
190 unsigned vn = ((*tVN).second)->getNode();
191 if ( ! SwapNodeList[d][vn] )
193 SwapNodeList[d][vn] =
true;
214 msg1->
put(EmptyNode[myN]);
221 msg2->
get(EmptyNode);
227 int notrecvd = N - 1;
233 msg1->
get(EmptyNode[node]);
240 msg2->
put(EmptyNode, EmptyNode+N);
250 for (j = 0; j < N; ++j)
254 SwapNodeList[0][j] =
true;
269 template <
class T,
unsigned Dim,
class Mesh,
class CachingPolicy>
277 size_t LocalNum = PData.getLocalNum();
278 size_t DestroyNum = PData.getDestroyNum();
287 PData.performDestroy();
288 LocalNum -= DestroyNum;
292 if ( ! RLayout.initialized())
293 rebuild_layout(LocalNum,PData);
297 this->apply_bconds(LocalNum, PData.R, this->getBConds(), RLayout.getDomain());
300 this->updateCacheInformation(*
this);
313 #ifndef OLD_SWAP_PARTICLES
315 LocalNum = new_swap_particles(LocalNum, PData);
317 LocalNum = new_swap_particles(LocalNum, PData, *canSwap);
320 LocalNum = swap_particles(LocalNum, PData);
322 LocalNum = swap_particles(LocalNum, PData, *canSwap);
330 TotalNum = NodeCount[myN] = LocalNum;
352 recmsg->
get(NodeCount);
353 recmsg->
get(TotalNum);
359 int notrecvd = N - 1;
366 size_t remNodeCount = 0;
367 recmsg->
get(remNodeCount);
372 TotalNum += remNodeCount;
373 NodeCount[node] = remNodeCount;
378 msg->
put(NodeCount, NodeCount + N);
385 PData.setTotalNum(TotalNum);
386 PData.setLocalNum(LocalNum);
389 this->updateGhostParticles(PData, *
this);
401 template <
class T,
unsigned Dim,
class Mesh,
class CachingPolicy >
402 std::ostream& operator<<(std::ostream& out, const ParticleSpatialLayout<T,Dim,Mesh,CachingPolicy>& L)
405 out <<
"ParticleSpatialLayout, with particle distribution:\n ";
407 out <<
"Number of particles " << L.getNodeCount(i) <<
" ";
408 out <<
"\nSpatialLayout decomposition = " << L.getLayout();
415 template <
class T,
unsigned Dim,
class Mesh,
class CachingPolicy >
419 o <<
"PSpatial: distrib = ";
421 o << NodeCount[i] <<
" ";
429 template <
class T,
unsigned Dim,
class Mesh,
class CachingPolicy >
440 rebuild_neighbor_data();
448 template <
class T,
unsigned Dim,
class Mesh,
class CachingPolicy >
virtual void Repartition(UserList *)
ID_t getUserListID() const
void update(IpplParticleBase< ParticleSpatialLayout< T, Dim, Mesh, CachingPolicy > > &p, const ParticleAttrib< char > *canSwap=0)
void printDebug(Inform &)
#define P_SPATIAL_LAYOUT_TAG
int next_tag(int t, int s=1000)
#define P_SPATIAL_RETURN_TAG
virtual int broadcast_others(Message *, int, bool delmsg=true)
Message & get(const T &cval)
Message & put(const T &val)
void rebuild_neighbor_data()
touch_range_dv touch_range_rdv(const NDRegion< T, Dim > &domain)
virtual void notifyUserOfDelete(UserList *)
Message * receive_block(int &node, int &tag)
static Communicate * Comm
bool send(Message *, int node, int tag, bool delmsg=true)