OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
FieldDebug.hpp
Go to the documentation of this file.
1 // -*- C++ -*-
2 /***************************************************************************
3  *
4  * The IPPL Framework
5  *
6  * This program was prepared by PSI.
7  * All rights in the program are reserved by PSI.
8  * Neither PSI nor the author(s)
9  * makes any warranty, express or implied, or assumes any liability or
10  * responsibility for the use of this software
11  *
12  * Visit www.amas.web.psi for more details
13  *
14  ***************************************************************************/
15 
16 // -*- C++ -*-
17 /***************************************************************************
18  *
19  * The IPPL Framework
20  *
21  *
22  * Visit http://people.web.psi.ch/adelmann/ for more details
23  *
24  ***************************************************************************/
25 
26 // FieldDebug.cpp , Tim Williams 10/23/1996
27 
28 // include files
29 #include "Utility/FieldDebug.h"
31 #include "Utility/Inform.h"
32 
33 #include "Field/BareField.h"
34 
35 #include <iostream>
36 #include <iomanip> // need format fcns setf() and setprecision() from here
37 
38 
39 //----------------------------------------------------------------------
40 // Print a 1D Field
41 //----------------------------------------------------------------------
42 template<class T>
43 void fp1(BareField<T,1U>& field, bool docomm) {
44 
45 
46  if (!FldDbgInformIsSet) setInform(*IpplInfo::Info); // Set ptr if not set.
47  int base0 = field.getLayout().getDomain()[0].first();
48  int bound0 = field.getLayout().getDomain()[0].last();
49  int stride0 = field.getLayout().getDomain()[0].stride();
50  sfp1(field, base0, bound0, stride0, docomm);
51 }
52 //----------------------------------------------------------------------
53 // Print a 2D Field
54 //----------------------------------------------------------------------
55 template<class T>
56 void fp2(BareField<T,2U>& field, bool docomm) {
57 
58 
59  if (!FldDbgInformIsSet) setInform(*IpplInfo::Info); // Set ptr if not set.
60  int base0 = field.getLayout().getDomain()[0].first();
61  int bound0 = field.getLayout().getDomain()[0].last();
62  int stride0 = field.getLayout().getDomain()[0].stride();
63  int base1 = field.getLayout().getDomain()[1].first();
64  int bound1 = field.getLayout().getDomain()[1].last();
65  int stride1 = field.getLayout().getDomain()[1].stride();
66  sfp2(field, base0, bound0, stride0, base1, bound1, stride1, docomm);
67 }
68 //----------------------------------------------------------------------
69 // Print a 3D Field
70 //----------------------------------------------------------------------
71 template<class T>
72 void fp3(BareField<T,3U>& field, bool docomm) {
73 
74 
75  int base0 = field.getLayout().getDomain()[0].first();
76  int bound0 = field.getLayout().getDomain()[0].last();
77  int stride0 = field.getLayout().getDomain()[0].stride();
78  int base1 = field.getLayout().getDomain()[1].first();
79  int bound1 = field.getLayout().getDomain()[1].last();
80  int stride1 = field.getLayout().getDomain()[1].stride();
81  int base2 = field.getLayout().getDomain()[2].first();
82  int bound2 = field.getLayout().getDomain()[2].last();
83  int stride2 = field.getLayout().getDomain()[2].stride();
84  sfp3(field, base0, bound0, stride0, base1, bound1, stride1,
85  base2, bound2, stride2, docomm);
86 }
87 //----------------------------------------------------------------------
88 // Print a 1D Field, including global guard layers
89 //----------------------------------------------------------------------
90 template<class T>
91 void ggfp1(BareField<T,1U>& field, bool docomm) {
92 
93 
94  if (!FldDbgInformIsSet) setInform(*IpplInfo::Info); // Set ptr if not set.
95  int stride0 = field.getLayout().getDomain()[0].stride();
96  int base0 = field.getLayout().getDomain()[0].first() -
97  field.leftGuard(0)*stride0;
98  int bound0 = field.getLayout().getDomain()[0].last() +
99  field.leftGuard(0)*stride0;
100  sfp1(field, base0, bound0, stride0, docomm);
101 }
102 //----------------------------------------------------------------------
103 // Print a 2D Field, including global guard layers
104 //----------------------------------------------------------------------
105 template<class T>
106 void ggfp2(BareField<T,2U>& field, bool docomm) {
107 
108 
109  if (!FldDbgInformIsSet) setInform(*IpplInfo::Info); // Set ptr if not set.
110  int stride0 = field.getLayout().getDomain()[0].stride();
111  int base0 = field.getLayout().getDomain()[0].first() -
112  field.leftGuard(0)*stride0;
113  int bound0 = field.getLayout().getDomain()[0].last() +
114  field.leftGuard(0)*stride0;
115  int stride1 = field.getLayout().getDomain()[1].stride();
116  int base1 = field.getLayout().getDomain()[1].first() -
117  field.leftGuard(1)*stride1;
118  int bound1 = field.getLayout().getDomain()[1].last() +
119  field.leftGuard(1)*stride1;
120  sfp2(field, base0, bound0, stride0, base1, bound1, stride1, docomm);
121 }
122 //----------------------------------------------------------------------
123 // Print a 3D Field, including global guard layers
124 //----------------------------------------------------------------------
125 template<class T>
126 void ggfp3(BareField<T,3U>& field, bool docomm) {
127 
128 
129  int stride0 = field.getLayout().getDomain()[0].stride();
130  int base0 = field.getLayout().getDomain()[0].first() -
131  field.leftGuard(0)*stride0;
132  int bound0 = field.getLayout().getDomain()[0].last() +
133  field.leftGuard(0)*stride0;
134  int stride1 = field.getLayout().getDomain()[1].stride();
135  int base1 = field.getLayout().getDomain()[1].first() -
136  field.leftGuard(1)*stride1;
137  int bound1 = field.getLayout().getDomain()[1].last() +
138  field.leftGuard(1)*stride1;
139  int stride2 = field.getLayout().getDomain()[2].stride();
140  int base2 = field.getLayout().getDomain()[2].first() -
141  field.leftGuard(2)*stride2;
142  int bound2 = field.getLayout().getDomain()[2].last() +
143  field.leftGuard(2)*stride2;
144  sfp3(field, base0, bound0, stride0, base1, bound1, stride1,
145  base2, bound2, stride2, docomm);
146 }
147 //----------------------------------------------------------------------
148 // Print a 1D Field, including global and internal guard layers
149 //----------------------------------------------------------------------
150 template<class T>
151 void agfp1(BareField<T,1U>& field) {
152 
153 
154  if (!FldDbgInformIsSet) setInform(*IpplInfo::Info); // Set ptr if not set.
155  FieldDebugWriteb(field);
156 }
157 //----------------------------------------------------------------------
158 // Print a 2D Field, including global and internal guard layers
159 //----------------------------------------------------------------------
160 template<class T>
161 void agfp2(BareField<T,2U>& field) {
162 
163 
164  if (!FldDbgInformIsSet) setInform(*IpplInfo::Info); // Set ptr if not set.
165  FieldDebugWriteb(field);
166 }
167 //----------------------------------------------------------------------
168 // Print a 3D Field, including global and internal guard layers
169 //----------------------------------------------------------------------
170 template<class T>
171 void agfp3(BareField<T,3U>& field) {
172 
173 
174  if (!FldDbgInformIsSet) setInform(*IpplInfo::Info); // Set ptr if not set.
175  FieldDebugWriteb(field);
176 }
177 //----------------------------------------------------------------------
178 // Print a single element of a 1D Field
179 //----------------------------------------------------------------------
180 template<class T>
181 void efp1(BareField<T,1U>& field, int i, bool docomm) {
182 
183 
184  sfp1(field, i, i, 1, docomm);
185 }
186 //----------------------------------------------------------------------
187 // Print a single element of a 2D Field
188 //----------------------------------------------------------------------
189 template<class T>
190 void efp2(BareField<T,2U>& field, int i, int j, bool docomm) {
191 
192 
193  sfp2(field, i, i, 1, j, j, 1, docomm);
194 }
195 //----------------------------------------------------------------------
196 // Print a single element of a 3D Field
197 //----------------------------------------------------------------------
198 template<class T>
199 void efp3(BareField<T,3U>& field, int i, int j, int k, bool docomm) {
200 
201 
202  sfp3(field, i, i, 1, j, j, 1, k, k, 1, docomm);
203 }
204 //----------------------------------------------------------------------
205 // Print a strided slice (range) of a 1D Field
206 //----------------------------------------------------------------------
207 template<class T>
208 void sfp1(BareField<T,1U>& field,
209  int ibase, int ibound, int istride, bool docomm) {
210 
211 
212 
213  if (!FldDbgInformIsSet) setInform(*IpplInfo::Info); // Set ptr if not set.
214 
215  // Check input parameters for errors and unimplemented values:
216  bool okParameters = true;
217  int first0 = field.getLayout().getDomain()[0].first() -
218  field.leftGuard(0) * field.getDomain()[0].stride();
219  int last0 = field.getLayout().getDomain()[0].last() + field.leftGuard(0);
220  if (ibase < first0) {
221  (*FldDbgInform) << "sfp() error: ibase (= " << ibase
222  << ") < lowest index value (= " << first0 << ")" << endl;
223  okParameters = false;
224  }
225  if (ibound > last0) {
226  (*FldDbgInform) << "sfp() error: ibound (= " << ibound
227  << ") > highest index value (= " << last0 << ")" << endl;
228  okParameters = false;
229  }
230  if (istride < 0) {
231  (*FldDbgInform) << "sfp() error: istride < 0 not implemented yet." << endl;
232  okParameters = false;
233  } else {
234  if (ibound < ibase) {
235  (*FldDbgInform) << "sfp() error: ibase (= " << ibase
236  << ") > ibound (= " << ibound << ") not implemented yet." << endl;
237  okParameters = false;
238  }
239  }
240  if (istride == 0) {
241  if ( (ibound - ibase) != 0 ) {
242  (*FldDbgInform) << "sfp() error: istride = 0 but (ibound - ibase) = "
243  << (ibound - ibase) << endl;
244  okParameters = false;
245  } else {
246  istride = 1; // Allow specifying stride 0 for 1-element range; set=1
247  }
248  }
249 
250  if (okParameters) {
251  NDIndex<1U> ndi(Index(ibase,ibound,istride));
254  dfp.print(field, ndi, *FldDbgInform, docomm);
255  }
256 }
257 //----------------------------------------------------------------------
258 // Print a strided slice (range) of a 2D Field
259 //----------------------------------------------------------------------
260 template<class T>
261 void sfp2(BareField<T,2U>& field,
262  int ibase, int ibound, int istride,
263  int jbase, int jbound, int jstride, bool docomm) {
264 
265  if (!FldDbgInformIsSet) setInform(*IpplInfo::Info); // Set ptr if not set.
266 
267  // Check input parameters for errors and unimplemented values:
268  bool okParameters = true;
269  int first0 = field.getLayout().getDomain()[0].first() -
270  field.leftGuard(0) * field.getDomain()[0].stride();
271  int last0 = field.getLayout().getDomain()[0].last() + field.leftGuard(0);
272  if (ibase < first0) {
273  (*FldDbgInform) << "sfp() error: ibase (= " << ibase
274  << ") < lowest index value (= " << first0 << ")" << endl;
275  okParameters = false;
276  }
277  if (ibound > last0) {
278  (*FldDbgInform) << "sfp() error: ibound (= " << ibound
279  << ") > highest index value (= " << last0 << ")" << endl;
280  okParameters = false;
281  }
282  if (istride < 0) {
283  (*FldDbgInform) << "sfp() error: istride < 0 not implemented yet." << endl;
284  okParameters = false;
285  } else {
286  if (ibound < ibase) {
287  (*FldDbgInform) << "sfp() error: ibase (= " << ibase
288  << ") > ibound (= " << ibound << ") not implemented yet." << endl;
289  okParameters = false;
290  }
291  }
292  if (istride == 0) {
293  if ( (ibound - ibase) != 0 ) {
294  (*FldDbgInform) << "sfp() error: istride = 0 but (ibound - ibase) = "
295  << (ibound - ibase) << endl;
296  okParameters = false;
297  } else {
298  istride = 1; // Allow specifying stride 0 for 1-element range; set=1
299  }
300  }
301  int first1 = field.getLayout().getDomain()[1].first() -
302  field.leftGuard(1) * field.getDomain()[1].stride();
303  int last1 = field.getLayout().getDomain()[1].last() + field.leftGuard(1);
304  if (jbase < first1) {
305  (*FldDbgInform) << "sfp() error: jbase (= " << jbase
306  << ") < lowest index value (= " << first1 << ")" << endl;
307  okParameters = false;
308  }
309  if (jbound > last1) {
310  (*FldDbgInform) << "sfp() error: jbound (= " << jbound
311  << ") > highest index value (= " << last1 << ")" << endl;
312  okParameters = false;
313  }
314  if (jstride < 0) {
315  (*FldDbgInform) << "sfp() error: jstride < 0 not implemented yet." << endl;
316  okParameters = false;
317  } else {
318  if (jbound < jbase) {
319  (*FldDbgInform) << "sfp() error: jbase (= " << jbase
320  << ") > jbound (= " << jbound << ") not implemented yet." << endl;
321  okParameters = false;
322  }
323  }
324  if (jstride == 0) {
325  if ( (jbound - jbase) != 0 ) {
326  (*FldDbgInform) << "sfp() error: jstride = 0 but (jbound - jbase) = "
327  << (jbound - jbase) << endl;
328  okParameters = false;
329  } else {
330  jstride = 1; // Allow specifying stride 0 for 1-element range; set=1
331  }
332  }
333 
334  if (okParameters) {
335  NDIndex<2U> ndi(Index(ibase,ibound,istride),Index(jbase,jbound,jstride));
338  dfp.print(field, ndi, *FldDbgInform, docomm);
339  }
340 }
341 //----------------------------------------------------------------------
342 // Print a strided slice (range) of a 3D Field
343 //----------------------------------------------------------------------
344 template<class T>
345 void sfp3(BareField<T,3U>& field,
346  int ibase, int ibound, int istride,
347  int jbase, int jbound, int jstride,
348  int kbase, int kbound, int kstride, bool docomm) {
349 
350  if (!FldDbgInformIsSet) setInform(*IpplInfo::Info); // Set ptr if not set.
351 
352  // Check input parameters for errors and unimplemented values:
353  bool okParameters = true;
354  int first0 = field.getLayout().getDomain()[0].first() -
355  field.leftGuard(0) * field.getDomain()[0].stride();
356  int last0 = field.getLayout().getDomain()[0].last() + field.leftGuard(0);
357  if (ibase < first0) {
358  (*FldDbgInform) << "sfp() error: ibase (= " << ibase
359  << ") < lowest index value (= " << first0 << ")" << endl;
360  okParameters = false;
361  }
362  if (ibound > last0) {
363  (*FldDbgInform) << "sfp() error: ibound (= " << ibound
364  << ") > highest index value (= " << last0 << ")" << endl;
365  okParameters = false;
366  }
367  if (istride < 0) {
368  (*FldDbgInform) << "sfp() error: istride < 0 not implemented yet." << endl;
369  okParameters = false;
370  } else {
371  if (ibound < ibase) {
372  (*FldDbgInform) << "sfp() error: ibase (= " << ibase
373  << ") > ibound (= " << ibound << ") not implemented yet." << endl;
374  okParameters = false;
375  }
376  }
377  if (istride == 0) {
378  if ( (ibound - ibase) != 0 ) {
379  (*FldDbgInform) << "sfp() error: istride = 0 but (ibound - ibase) = "
380  << (ibound - ibase) << endl;
381  okParameters = false;
382  } else {
383  istride = 1; // Allow specifying stride 0 for 1-element range; set=1
384  }
385  }
386  int first1 = field.getLayout().getDomain()[1].first() -
387  field.leftGuard(1) * field.getDomain()[1].stride();
388  int last1 = field.getLayout().getDomain()[1].last() + field.leftGuard(1);
389  if (jbase < first1) {
390  (*FldDbgInform) << "sfp() error: jbase (= " << jbase
391  << ") < lowest index value (= " << first1 << ")" << endl;
392  okParameters = false;
393  }
394  if (jbound > last1) {
395  (*FldDbgInform) << "sfp() error: jbound (= " << jbound
396  << ") > highest index value (= " << last1 << ")" << endl;
397  okParameters = false;
398  }
399  if (jstride < 0) {
400  (*FldDbgInform) << "sfp() error: jstride < 0 not implemented yet." << endl;
401  okParameters = false;
402  } else {
403  if (jbound < jbase) {
404  (*FldDbgInform) << "sfp() error: jbase (= " << jbase
405  << ") > jbound (= " << jbound << ") not implemented yet." << endl;
406  okParameters = false;
407  }
408  }
409  if (jstride == 0) {
410  if ( (jbound - jbase) != 0 ) {
411  (*FldDbgInform) << "sfp() error: jstride = 0 but (jbound - jbase) = "
412  << (jbound - jbase) << endl;
413  okParameters = false;
414  } else {
415  jstride = 1; // Allow specifying stride 0 for 1-element range; set=1
416  }
417  }
418  int first2 = field.getLayout().getDomain()[2].first() -
419  field.leftGuard(2) * field.getDomain()[2].stride();
420  int last2 = field.getLayout().getDomain()[2].last() + field.leftGuard(2);
421  if (kbase < first2) {
422  (*FldDbgInform) << "sfp() error: kbase (= " << kbase
423  << ") < lowest index value (= " << first2 << ")" << endl;
424  okParameters = false;
425  }
426  if (kbound > last2) {
427  (*FldDbgInform) << "sfp() error: kbound (= " << kbound
428  << ") > highest index value (= " << last2 << ")" << endl;
429  okParameters = false;
430  }
431  if (kstride < 0) {
432  (*FldDbgInform) << "sfp() error: kstride < 0 not implemented yet." << endl;
433  okParameters = false;
434  } else {
435  if (kbound < kbase) {
436  (*FldDbgInform) << "sfp() error: kbase (= " << kbase
437  << ") > kbound (= " << jbound << ") not implemented yet." << endl;
438  okParameters = false;
439  }
440  }
441  if (kstride == 0) {
442  if ( (kbound - kbase) != 0 ) {
443  (*FldDbgInform) << "sfp() error: kstride = 0 but (kbound - kbase) = "
444  << (kbound - kbase) << endl;
445  okParameters = false;
446  } else {
447  kstride = 1; // Allow specifying stride 0 for 1-element range; set=1
448  }
449  }
450 
451  if (okParameters) {
452  NDIndex<3U> ndi(Index(ibase,ibound,istride),Index(jbase,jbound,jstride),
453  Index(kbase,kbound,kstride));
456  dfp.print(field, ndi, *FldDbgInform, docomm);
457  }
458 }
459 
460 //----------------------------------------------------------------------
461 // An output function which writes out a BareField a vnode at a time and
462 // includes the border information, using fp[1,2,3]-like formatting as much as
463 // possible. Patterned after BareField::writeb()
464 //----------------------------------------------------------------------
465 
466 template< class T, unsigned Dim >
468 {
469 
470 
471 
472  int ibase,ibound,istride,jbase,jbound,jstride,kbase,kbound,kstride;
473  istride = F.getLayout().getDomain()[0].stride();
474  ibase = F.getLayout().getDomain()[0].first() - F.leftGuard(0)*istride;
475  ibound = F.getLayout().getDomain()[0].last() + F.leftGuard(0)*istride;
476  if (Dim >= 2) {
477  jstride = F.getLayout().getDomain()[1].stride();
478  jbase = F.getLayout().getDomain()[1].first() - F.leftGuard(1)*jstride;
479  jbound = F.getLayout().getDomain()[1].last() + F.leftGuard(1)*jstride;
480  }
481  if (Dim >= 3) {
482  kstride = F.getLayout().getDomain()[2].stride();
483  kbase = F.getLayout().getDomain()[2].first() - F.leftGuard(2)*kstride;
484  kbound = F.getLayout().getDomain()[2].last() + F.leftGuard(2)*kstride;
485  }
486  (*FldDbgInform) << "~~~~~~~~ field slice ("
487  << ibase << ":" << ibound << ":" << istride << ", "
488  << jbase << ":" << jbound << ":" << jstride << ", "
489  << kbase << ":" << kbound << ":" << kstride << ") "
490  << "~~~~~~~~" << endl;
491  int icount = 0;
492  int iBlock;
494  for (l_i = F.begin_if(); l_i != F.end_if(); ++l_i) {
495  // find the offset within the global space
496  LField<T,Dim> *ldf = (*l_i).second.get();
497  const NDIndex<Dim> &Owned = ldf->getOwned();
498 
499  (*FldDbgInform) << "****************************************"
500  << "***************************************" << endl;
501  (*FldDbgInform) << "********* vnode = " << icount++ << " *********"
502  << endl;
503  (*FldDbgInform) << "****************************************"
504  << "***************************************" << endl;
505  std::cout << "Owned = " << endl << Owned << endl;
506  typename LField<T,Dim>::iterator lf_bi = ldf->begin();
507  if ( Dim==1 ) {
508  int n0 = ldf->size(0);
509  int l0 = -F.leftGuard(0); // tjw: assumes stride 1, right???
510  int r0 = n0 + F.rightGuard(0);
511  int ifirst = Owned[0].first() - F.leftGuard(0)*istride;
512  int ilast = Owned[0].last() + F.rightGuard(0);
513  (*FldDbgInform) << "- - - - - - - - - - - - - - - - - - - - - - - - - "
514  << "I = " << ifirst << ":" << ilast << ":"
515  << istride << endl;
516  for ( iBlock = l0 ; iBlock < r0 ; iBlock += elementsPerLine) {
517  for (int i0=iBlock;
518  ((i0 < iBlock + elementsPerLine*istride) && (i0 < r0));
519  i0 = i0 + istride) {
520  (*FldDbgInform) << std::setprecision(digitsPastDecimal)
521  << std::setw(widthOfElements)
522  << lf_bi.offset(i0) << " ";
523  }
524  (*FldDbgInform) << endl;
525  }
526  } else if ( Dim==2 ) {
527  int n0 = ldf->size(0);
528  int n1 = ldf->size(1);
529  int l0 = -F.leftGuard(0);
530  int l1 = -F.leftGuard(1);
531  int r0 = n0 + F.rightGuard(0);
532  int r1 = n1 + F.rightGuard(1);
533  int j = 0;
534  int ifirst = Owned[0].first() - F.leftGuard(0)*istride;
535  int ilast = Owned[0].last() + F.rightGuard(0);
536  int jfirst = Owned[1].first();
537  // (re)define jbase, jbound, jlast w/o guards
538  int jlast = Owned[1].last();
539  jbase = F.getLayout().getDomain()[1].first();
540  jbound = F.getLayout().getDomain()[1].last();
541  for (int i1=l1; i1<r1; ++i1) {
542  j = jfirst + i1;
543  if ((j < jfirst) || (j > jlast)) {
544  if ((j < jbase) || (j > jbound)) {
545  (*FldDbgInform)
546  << "--------------------------------global guard------";
547  } else {
548  (*FldDbgInform)
549  << "---------------------------------------guard------";
550  }
551  } else {
552  (*FldDbgInform)
553  << "--------------------------------------------------";
554  }
555  (*FldDbgInform) << "- - - - - - - - - - - - - - - - - - - - - - - - - "
556  << "I = " << ifirst << ":" << ilast << ":"
557  << istride << endl;
558  for ( iBlock = l0 ; iBlock < r0 ; iBlock += elementsPerLine) {
559  for (int i0=iBlock;
560  ((i0 < iBlock + elementsPerLine*istride) && (i0 < r0));
561  i0 = i0 + istride) {
562  (*FldDbgInform) << std::setprecision(digitsPastDecimal)
563  << std::setw(widthOfElements)
564  << lf_bi.offset(i0,i1) << " ";
565  }
566  (*FldDbgInform) << endl;
567  }
568  (*FldDbgInform) << endl;
569  }
570  } else if ( Dim==3 ) {
571  int n0 = ldf->size(0);
572  int n1 = ldf->size(1);
573  int n2 = ldf->size(2);
574  int l0 = -F.leftGuard(0);
575  int l1 = -F.leftGuard(1);
576  int l2 = -F.leftGuard(2);
577  int r0 = n0 + F.rightGuard(0);
578  int r1 = n1 + F.rightGuard(1);
579  int r2 = n2 + F.rightGuard(2);
580  int j = 0;
581  int k = 0;
582  int ifirst = Owned[0].first() - F.leftGuard(0)*istride;
583  int ilast = Owned[0].last() + F.rightGuard(0);
584  int jfirst = Owned[1].first();
585  // (re)define jbase, jbound, jlast w/o guards
586  int jlast = Owned[1].last();
587  jbase = F.getLayout().getDomain()[1].first();
588  jbound = F.getLayout().getDomain()[1].last();
589  int kfirst = Owned[2].first();
590  // (re)define kbase, kbound, klast w/o guards
591  int klast = Owned[2].last();
592  kbase = F.getLayout().getDomain()[2].first();
593  kbound = F.getLayout().getDomain()[2].last();
594  for (int i2=l2; i2<r2; ++i2) {
595  k = kfirst + i2;
596  if ((k < kfirst) || (k > klast)) {
597  if ((k < kbase) || (k > kbound)) {
598  (*FldDbgInform)
599  << "================================global guard======";
600  } else {
601  (*FldDbgInform)
602  << "=======================================guard======";
603  }
604  } else {
605  (*FldDbgInform)
606  << "==================================================";
607  }
608  (*FldDbgInform) << "K = " << k << endl;
609  for (int i1=l1; i1<r1; ++i1) {
610  j = jfirst + i1;
611  if ((j < jfirst) || (j > jlast)) {
612  if ((j < jbase) || (j > jbound)) {
613  (*FldDbgInform)
614  << "--------------------------------global guard------";
615  } else {
616  (*FldDbgInform)
617  << "---------------------------------------guard------";
618  }
619  } else {
620  (*FldDbgInform)
621  << "--------------------------------------------------";
622  }
623  (*FldDbgInform) << "J = " << j << endl;
624  (*FldDbgInform)
625  << "- - - - - - - - - - - - - - - - - - - - - - - - - "
626  << "I = " << ifirst << ":" << ilast << ":" << istride << endl;
627  for ( iBlock = l0 ; iBlock < r0 ; iBlock += elementsPerLine) {
628  for (int i0=iBlock;
629  ((i0 < iBlock + elementsPerLine*istride) && (i0 < r0));
630  i0 = i0 + istride) {
631  (*FldDbgInform) << std::setprecision(digitsPastDecimal)
632  << std::setw(widthOfElements)
633  << lf_bi.offset(i0,i1,i2) << " ";
634  }
635  (*FldDbgInform) << endl;
636  }
637  (*FldDbgInform) << endl;
638  }
639  (*FldDbgInform) << endl;
640  }
641  } else {
642  ERRORMSG(" can not write for larger than three dimensions " << endl);
643  }
644  }
645 }
646 
647 
648 /***************************************************************************
649  * $RCSfile: FieldDebug.cpp,v $ $Author: adelmann $
650  * $Revision: 1.1.1.1 $ $Date: 2003/01/23 07:40:33 $
651  * IPPL_VERSION_ID: $Id: FieldDebug.cpp,v 1.1.1.1 2003/01/23 07:40:33 adelmann Exp $
652  ***************************************************************************/
void fp1(BareField< T, 1U > &field, bool docomm=true)
Definition: FieldDebug.hpp:43
void agfp3(BareField< T, 3U > &field)
Definition: FieldDebug.hpp:171
Layout_t & getLayout() const
Definition: BareField.h:130
const NDIndex< Dim > & getDomain() const
Definition: BareField.h:151
void setInform(Inform &inform)
const NDIndex< Dim > & getOwned() const
Definition: LField.h:93
T & offset(int i) const
#define ERRORMSG(msg)
Definition: IpplInfo.h:399
void fp2(BareField< T, 2U > &field, bool docomm=true)
Definition: FieldDebug.hpp:56
void sfp2(BareField< T, 2U > &field, int ibase, int ibound, int istride, int jbase, int jbound, int jstride, bool docomm=true)
Definition: FieldDebug.hpp:261
Definition: FFT.h:31
int digitsPastDecimal
void print(BareField< T, Dim > &, const NDIndex< Dim > &, Inform &, bool=true)
void ggfp3(BareField< T, 3U > &field, bool docomm=true)
Definition: FieldDebug.hpp:126
void sfp3(BareField< T, 3U > &field, int ibase, int ibound, int istride, int jbase, int jbound, int jstride, int kbase, int kbound, int kstride, bool docomm=true)
Definition: FieldDebug.hpp:345
void FieldDebugWriteb(BareField< T, Dim > &F)
Definition: FieldDebug.hpp:467
void sfp1(BareField< T, 1U > &field, int ibase, int ibound, int istride, bool docomm=true)
Definition: FieldDebug.hpp:208
const iterator & begin() const
Definition: LField.h:104
int elementsPerLine
iterator_if end_if()
Definition: BareField.h:100
Definition: Index.h:236
void agfp2(BareField< T, 2U > &field)
Definition: FieldDebug.hpp:161
unsigned rightGuard(unsigned d) const
Definition: BareField.h:148
void ggfp2(BareField< T, 2U > &field, bool docomm=true)
Definition: FieldDebug.hpp:106
unsigned leftGuard(unsigned d) const
Definition: BareField.h:147
Definition: FFT.h:30
void efp2(BareField< T, 2U > &field, int i, int j, bool docomm=true)
Definition: FieldDebug.hpp:190
ac_id_larray::const_iterator const_iterator_if
Definition: BareField.h:92
Inform * FldDbgInform
static Inform * Info
Definition: IpplInfo.h:87
int widthOfElements
void agfp1(BareField< T, 1U > &field)
Definition: FieldDebug.hpp:151
const unsigned Dim
void ggfp1(BareField< T, 1U > &field, bool docomm=true)
Definition: FieldDebug.hpp:91
iterator_if begin_if()
Definition: BareField.h:99
int size(unsigned d) const
Definition: LField.h:91
const NDIndex< Dim > & getDomain() const
Definition: FieldLayout.h:325
bool FldDbgInformIsSet
void efp3(BareField< T, 3U > &field, int i, int j, int k, bool docomm=true)
Definition: FieldDebug.hpp:199
Inform & endl(Inform &inf)
Definition: Inform.cpp:42
void fp3(BareField< T, 3U > &field, bool docomm=true)
Definition: FieldDebug.hpp:72
void efp1(BareField< T, 1U > &field, int i, bool docomm=true)
Definition: FieldDebug.hpp:181