57 int myNumPtcles = pattr.
size();
58 int numPtcles = pattr.
size();
63 int otherNumPtcles = 0;
64 for (
int pe = 1; pe < npes; pe++) {
66 msg->
get(otherNumPtcles);
68 numPtcles += otherNumPtcles;
76 msg->
put(myNumPtcles);
84 spap(pattr, 0, numPtcles - 1, 1, docomm);
89 spap(pattr, 0, pattr.
size() - 1, 1, docomm);
110 spap(pattr, i, i, 1, docomm);
118 int ibase,
int ibound,
int istride,
bool docomm) {
133 bool okParameters =
true;
135 (*PtclDbgInform) <<
"spap() error: ibase (= " << ibase
136 <<
") < lowest index value (= " << 0 <<
")" <<
endl;
137 okParameters =
false;
142 (*PtclDbgInform) <<
"spap() error: istride < 0 not implemented yet."
144 okParameters =
false;
147 if ((ibound < ibase) && !((ibase == 0) && (ibound == -1))) {
148 (*PtclDbgInform) <<
"spap() error: ibase (= " << ibase
149 <<
") > ibound (= " << ibound
150 <<
") not implemented yet." <<
endl;
151 okParameters =
false;
155 if (((ibound - ibase) != 0) && !((ibase == 0) && (ibound == -1))) {
156 (*PtclDbgInform) <<
"spap() error: istride = 0 but (ibound - ibase) = "
157 << (ibound - ibase) <<
endl;
158 okParameters =
false;
165 if (!okParameters)
return;
171 int myNumPtcles = pattr.
size();
173 int* numsPtcles =
new int[npes];
175 for (
int pe=0; pe<npes; pe++) {
177 if (pe == mype) numsPtcles[pe] = myNumPtcles;
183 int otherNumPtcles = 0;
184 for (
int pe=1; pe<npes; pe++) {
186 msg->
get(otherNumPtcles);
188 numsPtcles[pe] = numsPtcles[pe - 1] + otherNumPtcles;
191 msg2->
putmsg((
void *)numsPtcles,
sizeof(
int), npes);
196 msg->
put(myNumPtcles);
204 int myPtcleIndexBegin, myPtcleIndexEnd;
206 myPtcleIndexBegin = 0;
207 myPtcleIndexEnd = myNumPtcles - 1;
210 myPtcleIndexBegin = numsPtcles[mype - 1];
211 myPtcleIndexEnd = myPtcleIndexBegin + myNumPtcles - 1;
214 Index myRange(myPtcleIndexBegin, myPtcleIndexEnd, 1);
215 Index requestedRange(ibase, ibound, istride);
216 for (
int pe=0; pe < npes; pe++) {
218 if (myNumPtcles > 0) {
219 if (myRange.
touches(requestedRange)) {
221 int mybase = myRequestedRange.
first();
222 int mybound = myRequestedRange.
last();
224 <<
" GLOBAL ptcle index subrange (" << mybase
225 <<
" : " << mybound <<
" : " << istride
229 ((p+item*istride) <= mybound)); item++) {
233 << pattr[p + item*istride] <<
" ";
248 delete [] numsPtcles;
255 int myNumPtcles = pattr.
size();
257 WARNMSG(
endl <<
"spap(): Currently, if docomm=false you must specify "
258 <<
"an Inform object having INFORM_ALL_NODES as its "
259 <<
"printing-node specifier if you want to see output from "
260 <<
"any processor calling [e,s]pap(); the Inform object "
261 <<
"you're trying to use has "
263 <<
"N.B.: If you called setInform() and didn't also call "
264 <<
"setPtclDbgInform() you are getting the FldDbgInform object "
265 <<
"you set with setInform, which you may not have constructed "
266 <<
"with INFORM_ALL_NODES." <<
endl <<
endl);
269 if (myNumPtcles > 0) {
271 <<
" LOCAL ptcle index range (" << ibase
272 <<
" : " << ibound <<
" : " << istride <<
")...." <<
endl;
273 int length = (ibound - ibase)/istride + 1;
276 (item < length)); item++) {
278 << pattr[p + item*istride] <<
" ";
285 <<
" has no particles ...." <<
endl;
void setPtclDbgInform(Inform &inform)
Inform & endl(Inform &inf)
void spap(ParticleAttrib< T > &pattr, int ibase, int ibound, int istride, bool docomm)
void pap(ParticleAttrib< T > &pattr, bool docomm)
void epap(ParticleAttrib< T > &pattr, int i, bool docomm)
Index intersect(const Index &) const
bool touches(const Index &a) const
bool send(Message *, int node, int tag, bool delmsg=true)
virtual int broadcast_others(Message *, int, bool delmsg=true)
Message * receive_block(int &node, int &tag)
Message & putmsg(void *, int, int=0)
Message & put(const T &val)
Message & get(const T &cval)
int next_tag(int t, int s=1000)
static Communicate * Comm