OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
FieldDebug.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 /***************************************************************************
3  *
4  * The IPPL Framework
5  *
6  *
7  * Visit http://people.web.psi.ch/adelmann/ for more details
8  *
9  ***************************************************************************/
10 
11 // FieldDebug.h , Tim Williams 10/23/1996
12 // Helper functions to print out (formatted ASCII) Field elements.
13 // Intended mainly for use from within a debugger, called interactively.
14 // See comments in FieldDebug.cpp for more details.
15 
16 #ifndef FIELD_DEBUG_H
17 #define FIELD_DEBUG_H
18 
20 
21 // forward declarations
22 class Inform;
23 template<class T, unsigned Dim> class BareField;
24 
25 // extern declarations of global variables in FieldDebugFunctions.cpp
26 extern Inform* FldDbgInform;
27 extern bool FldDbgInformIsSet;
28 extern int elementsPerLine;
29 extern int digitsPastDecimal;
30 extern int widthOfElements;
31 
32 //=============================================================================
33 // Helper functions to print out (formatted ASCII) Field elements.
34 // Intended mainly for use from within a debugger, called interactively.
35 // fp[1,2,3](Field&) print all elements of [1D,2D,3D] Field
36 // decimal point
37 // efp[1,2,3](Field&,....) prints single element of [1D,2D,3D] Field; requires
38 // specification of integer index for each
39 // sfp[1,2,3](Field&,....) prints strided slice of [1D,2D,3D] Field; requires
40 // specification of (base,bound,stride) for each
41 // dimension
42 // Implementation notes: The specially-named functions for [1D,2D,3D] are
43 // needed because the SGI debuggers don't handle single-name functions with
44 // multipple prototypes for different argument types/numbers properly.
45 //=============================================================================
46 
47 //------------------------------------------------------
48 // Function prototypes; see FieldDebug.cpp for comments:
49 //------------------------------------------------------
50 // For printing all elements of a Field:
51 #ifdef __MWERKS__
52 // Work around CW4 bug with default arguments of template functions
53 template<class T>
54 void fp1(BareField<T, 1U>& field) {fp1(field, true);}
55 template<class T>
56 void fp2(BareField<T, 2U>& field) {fp2(field, true);}
57 template<class T>
58 void fp3(BareField<T, 3U>& field) {fp3(field, true);}
59 #endif // __MWERKS__
60 template<class T>
61 void fp1(BareField<T, 1U>& field, bool docomm = true);
62 template<class T>
63 void fp2(BareField<T, 2U>& field, bool docomm = true);
64 template<class T>
65 void fp3(BareField<T, 3U>& field, bool docomm = true);
66 
67 // For printing all elements of a Field, including global guard layers:
68 #ifdef __MWERKS__
69 // Work around CW4 bug with default arguments of template functions
70 template<class T>
71 void ggfp1(BareField<T, 1U>& field) {ggfp1(field,true);}
72 template<class T>
73 void ggfp2(BareField<T, 2U>& field) {ggfp2(field,true);}
74 template<class T>
75 void ggfp3(BareField<T, 3U>& field) {ggfp3(field,true);}
76 #endif // __MWERKS__
77 template<class T>
78 void ggfp1(BareField<T, 1U>& field, bool docomm = true);
79 template<class T>
80 void ggfp2(BareField<T, 2U>& field, bool docomm = true);
81 template<class T>
82 void ggfp3(BareField<T, 3U>& field, bool docomm = true);
83 
84 // For printing all elements of a Field, including all guard layers (global and
85 // internal). These will print the data in a different format: all data for a
86 // vnode, one vnode at a time:
87 template<class T>
88 void agfp1(BareField<T, 1U>& field);
89 template<class T>
90 void agfp2(BareField<T, 2U>& field);
91 template<class T>
92 void agfp3(BareField<T, 3U>& field);
93 
94 // For printing one element of a Field:
95 #ifdef __MWERKS__
96 // Work around CW4 bug with default arguments of template functions
97 template<class T>
98 void efp1(BareField<T, 1U>& field, int i) {efp1(field,i,true);}
99 template<class T>
100 void efp2(BareField<T, 2U>& field, int i, int j) {efp2(field,i,j,true);}
101 template<class T>
102 void efp3(BareField<T, 3U>& field, int i, int j, int k) {
103  efp3(field,i,j,k,true);}
104 #endif // __MWERKS__
105 template<class T>
106 void efp1(BareField<T, 1U>& field, int i, bool docomm = true);
107 template<class T>
108 void efp2(BareField<T, 2U>& field, int i, int j, bool docomm = true);
109 template<class T>
110 void efp3(BareField<T, 3U>& field, int i, int j, int k, bool docomm = true);
111 
112 // For printing strided subrange of elements of a Field:
113 #ifdef __MWERKS__
114 // Work around CW4 bug with default arguments of template functions
115 template<class T>
116 void sfp1(BareField<T, 1U>& field,
117  int ibase, int ibound, int istride) {
118  sfp1(field,ibase,ibound,istride,true);}
119 template<class T>
120 void sfp2(BareField<T, 2U>& field,
121  int ibase, int ibound, int istride,
122  int jbase, int jbound, int jstride) {
123  sfp2(field,ibase,ibound,istride,jbase,jbound,jstride,true);}
124 template<class T>
125 void sfp3(BareField<T, 3U>& field,
126  int ibase, int ibound, int istride,
127  int jbase, int jbound, int jstride,
128  int kbase, int kbound, int kstride) {
129  sfp3(field,ibase,ibound,istride,jbase,jbound,jstride,
130  kbase,kbound,kstride,true);}
131 #endif // __MWERKS__
132 template<class T>
133 void sfp1(BareField<T, 1U>& field,
134  int ibase, int ibound, int istride, bool docomm = true);
135 template<class T>
136 void sfp2(BareField<T, 2U>& field,
137  int ibase, int ibound, int istride,
138  int jbase, int jbound, int jstride, bool docomm = true);
139 template<class T>
140 void sfp3(BareField<T, 3U>& field,
141  int ibase, int ibound, int istride,
142  int jbase, int jbound, int jstride,
143  int kbase, int kbound, int kstride, bool docomm = true);
144 
145 //-----------------------------------------------------------------------------
146 // Specializations, so that these types are available from debugger:
147 //
148 // USAGE:
149 // For now, all of these are commented out in this FieldDebug.h header file,
150 // so that libippl.a doesn't take forever to build and isn't unnecessarily
151 // large. (In fact, the KCC compiler dies if you have too many of these in
152 // here.) It is up to the user to include a line like these in his source
153 // (most logically in the main()), in order to have access to Field-printing
154 // for his special types of Field's from the debugger.
155 //
156 // To call the functions from the *code* (not from the debugger), the user need
157 // not include any lines like these; he can just invoke the generic
158 // parameterized functions from the list above: [e,s]fp[1,2,3]().
159 //-----------------------------------------------------------------------------
160 
161 // User must put lines like the commented-out ones in his own code to get
162 // access to specialized Field-type functions like these from the debugger.
163 
164 // Scalar Field's of double's:-------------------------------------------------
165 //void dfp1(BareField<double, 1U>& f) {fp1(f);}
166 //void defp1(BareField<double, 1U>& f, int i) {efp1(f,i);}
167 //void dsfp1(BareField<double,1U>& f,
168 // int base1, int bound1, int stride1) {sfp1(f,base1,bound1,stride1);}
169 //void dfp2(BareField<double, 2U>& f) {fp2(f);}
170 //void defp2(BareField<double, 2U>& f, int i, int j) {efp2(f,i,j);}
171 //void dsfp2(BareField<double,2U>& f,
172 // int base1, int bound1, int stride1,
173 // int base2, int bound2, int stride2) {
174 // sfp2(f,base1,bound1,stride1,base2,bound2,stride2);}
175 //void dfp3(BareField<double, 3U>& f) {fp3(f);}
176 //void defp3(BareField<double, 3U>& f, int i, int j, int k) {efp3(f,i,j,k);}
177 //void dsfp3(BareField<double,3U>& f,
178 // int base1, int bound1, int stride1,
179 // int base2, int bound2, int stride2,
180 // int base3, int bound3, int stride3) {
181 // sfp3(f,base1,bound1,stride1,base2,bound2,stride2,base3,bound3,stride3);}
182 
183 // Scalar Field's of float's:--------------------------------------------------
184 //void ffp1(BareField<float, 1U>& f) {fp1(f);}
185 //void fefp1(BareField<float, 1U>& f, int i) {efp1(f,i);}
186 //void fsfp1(BareField<float,1U>& f,
187 // int base1, int bound1, int stride1) {sfp1(f,base1,bound1,stride1);}
188 //void ffp2(BareField<float, 2U>& f) {fp2(f);}
189 //void fefp2(BareField<float, 2U>& f, int i, int j) {efp2(f,i,j);}
190 //void fsfp2(BareField<float,2U>& f,
191 // int base1, int bound1, int stride1,
192 // int base2, int bound2, int stride2) {
193 // sfp2(f,base1,bound1,stride1,base2,bound2,stride2);}
194 //void ffp3(BareField<float, 3U>& f) {fp3(f);}
195 //void fefp3(BareField<float, 3U>& f, int i, int j, int k) {efp3(f,i,j,k);}
196 //void fsfp3(BareField<float,3U>& f,
197 // int base1, int bound1, int stride1,
198 // int base2, int bound2, int stride2,
199 // int base3, int bound3, int stride3) {
200 // sfp3(f,base1,bound1,stride1,base2,bound2,stride2,base3,bound3,stride3);}
201 
202 // Vector Field's of double's:-------------------------------------------------
203 //void vdfp2(BareField<Vektor<double,2U>, 2U>& f) {fp2(f);}
204 //void vdefp2(BareField<Vektor<double,2U>, 2U>& f, int i, int j) {efp2(f,i,j);}
205 //void vdsfp2(BareField<Vektor<double,2U>,2U>& f,
206 // int base1, int bound1, int stride1,
207 // int base2, int bound2, int stride2) {
208 // sfp2(f,base1,bound1,stride1,base2,bound2,stride2);}
209 //void vdfp3(BareField<Vektor<double,3U>, 3U>& f) {fp3(f);}
210 //void vdefp3(BareField<Vektor<double,3U>, 3U>& f, int i, int j, int k) {
211 // efp3(f,i,j,k);}
212 //void vdsfp3(BareField<Vektor<double,3U>,3U>& f,
213 // int base1, int bound1, int stride1,
214 // int base2, int bound2, int stride2,
215 // int base3, int bound3, int stride3) {
216 // sfp3(f,base1,bound1,stride1,base2,bound2,stride2,base3,bound3,stride3);}
217 
218 // Vector Field's of float's:--------------------------------------------------
219 //void vffp2(BareField<Vektor<float,2U>, 2U>& f) {fp2(f);}
220 //void vfefp2(BareField<Vektor<float,2U>, 2U>& f, int i, int j) {efp2(f,i,j);}
221 //void vfsfp2(BareField<Vektor<float,2U>,2U>& f,
222 // int base1, int bound1, int stride1,
223 // int base2, int bound2, int stride2) {
224 // sfp2(f,base1,bound1,stride1,base2,bound2,stride2);}
225 //void vffp3(BareField<Vektor<float,3U>, 3U>& f) {fp3(f);}
226 //void vfefp3(BareField<Vektor<float,3U>, 3U>& f, int i, int j, int k) {
227 // efp3(f,i,j,k);}
228 //void vfsfp3(BareField<Vektor<float,3U>,3U>& f,
229 // int base1, int bound1, int stride1,
230 // int base2, int bound2, int stride2,
231 // int base3, int bound3, int stride3) {
232 // sfp3(f,base1,bound1,stride1,base2,bound2,stride2,base3,bound3,stride3);}
233 
234 #include "Utility/FieldDebug.hpp"
235 
236 #endif // FIELD_DEBUG_H
237 
238 /***************************************************************************
239  * $RCSfile: FieldDebug.h,v $ $Author: adelmann $
240  * $Revision: 1.1.1.1 $ $Date: 2003/01/23 07:40:33 $
241  * IPPL_VERSION_ID: $Id: FieldDebug.h,v 1.1.1.1 2003/01/23 07:40:33 adelmann Exp $
242  ***************************************************************************/
void fp1(BareField< T, 1U > &field, bool docomm=true)
Definition: FieldDebug.hpp:43
void agfp3(BareField< T, 3U > &field)
Definition: FieldDebug.hpp:171
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
int digitsPastDecimal
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 sfp1(BareField< T, 1U > &field, int ibase, int ibound, int istride, bool docomm=true)
Definition: FieldDebug.hpp:208
int elementsPerLine
void agfp2(BareField< T, 2U > &field)
Definition: FieldDebug.hpp:161
void ggfp2(BareField< T, 2U > &field, bool docomm=true)
Definition: FieldDebug.hpp:106
Definition: FFT.h:30
void efp2(BareField< T, 2U > &field, int i, int j, bool docomm=true)
Definition: FieldDebug.hpp:190
Inform * FldDbgInform
int widthOfElements
void agfp1(BareField< T, 1U > &field)
Definition: FieldDebug.hpp:151
void ggfp1(BareField< T, 1U > &field, bool docomm=true)
Definition: FieldDebug.hpp:91
Definition: Inform.h:41
bool FldDbgInformIsSet
void efp3(BareField< T, 3U > &field, int i, int j, int k, bool docomm=true)
Definition: FieldDebug.hpp:199
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