00001 // -*- C++ -*- 00002 /*************************************************************************** 00003 * 00004 * The IPPL Framework 00005 * 00006 * 00007 * Visit http://people.web.psi.ch/adelmann/ for more details 00008 * 00009 ***************************************************************************/ 00010 00011 // FieldDebug.h , Tim Williams 10/23/1996 00012 // Helper functions to print out (formatted ASCII) Field elements. 00013 // Intended mainly for use from within a debugger, called interactively. 00014 // See comments in FieldDebug.cpp for more details. 00015 00016 #ifndef FIELD_DEBUG_H 00017 #define FIELD_DEBUG_H 00018 00019 // forward declarations 00020 class Inform; 00021 template<class T, unsigned Dim> class BareField; 00022 00023 // extern declarations of global variables in FieldDebugFunctions.cpp 00024 extern Inform* FldDbgInform; 00025 extern bool FldDbgInformIsSet; 00026 extern int elementsPerLine; 00027 extern int digitsPastDecimal; 00028 extern int widthOfElements; 00029 00030 // forward declarations of global functions in FieldDebugFunctions.cpp 00031 void setInform(Inform& inform); 00032 void setFormat(int ElementsPerLine, int DigitsPastDecimal, 00033 int WidthOfElements = 0); 00034 00035 //============================================================================= 00036 // Helper functions to print out (formatted ASCII) Field elements. 00037 // Intended mainly for use from within a debugger, called interactively. 00038 // fp[1,2,3](Field&) print all elements of [1D,2D,3D] Field 00039 // decimal point 00040 // efp[1,2,3](Field&,....) prints single element of [1D,2D,3D] Field; requires 00041 // specification of integer index for each 00042 // sfp[1,2,3](Field&,....) prints strided slice of [1D,2D,3D] Field; requires 00043 // specification of (base,bound,stride) for each 00044 // dimension 00045 // Implementation notes: The specially-named functions for [1D,2D,3D] are 00046 // needed because the SGI debuggers don't handle single-name functions with 00047 // multipple prototypes for different argument types/numbers properly. 00048 //============================================================================= 00049 00050 //------------------------------------------------------ 00051 // Function prototypes; see FieldDebug.cpp for comments: 00052 //------------------------------------------------------ 00053 // For printing all elements of a Field: 00054 #ifdef __MWERKS__ 00055 // Work around CW4 bug with default arguments of template functions 00056 template<class T> 00057 void fp1(BareField<T, 1U>& field) {fp1(field, true);} 00058 template<class T> 00059 void fp2(BareField<T, 2U>& field) {fp2(field, true);} 00060 template<class T> 00061 void fp3(BareField<T, 3U>& field) {fp3(field, true);} 00062 #endif // __MWERKS__ 00063 template<class T> 00064 void fp1(BareField<T, 1U>& field, bool docomm = true); 00065 template<class T> 00066 void fp2(BareField<T, 2U>& field, bool docomm = true); 00067 template<class T> 00068 void fp3(BareField<T, 3U>& field, bool docomm = true); 00069 00070 // For printing all elements of a Field, including global guard layers: 00071 #ifdef __MWERKS__ 00072 // Work around CW4 bug with default arguments of template functions 00073 template<class T> 00074 void ggfp1(BareField<T, 1U>& field) {ggfp1(field,true);} 00075 template<class T> 00076 void ggfp2(BareField<T, 2U>& field) {ggfp2(field,true);} 00077 template<class T> 00078 void ggfp3(BareField<T, 3U>& field) {ggfp3(field,true);} 00079 #endif // __MWERKS__ 00080 template<class T> 00081 void ggfp1(BareField<T, 1U>& field, bool docomm = true); 00082 template<class T> 00083 void ggfp2(BareField<T, 2U>& field, bool docomm = true); 00084 template<class T> 00085 void ggfp3(BareField<T, 3U>& field, bool docomm = true); 00086 00087 // For printing all elements of a Field, including all guard layers (global and 00088 // internal). These will print the data in a different format: all data for a 00089 // vnode, one vnode at a time: 00090 template<class T> 00091 void agfp1(BareField<T, 1U>& field); 00092 template<class T> 00093 void agfp2(BareField<T, 2U>& field); 00094 template<class T> 00095 void agfp3(BareField<T, 3U>& field); 00096 00097 // For printing one element of a Field: 00098 #ifdef __MWERKS__ 00099 // Work around CW4 bug with default arguments of template functions 00100 template<class T> 00101 void efp1(BareField<T, 1U>& field, int i) {efp1(field,i,true);} 00102 template<class T> 00103 void efp2(BareField<T, 2U>& field, int i, int j) {efp2(field,i,j,true);} 00104 template<class T> 00105 void efp3(BareField<T, 3U>& field, int i, int j, int k) { 00106 efp3(field,i,j,k,true);} 00107 #endif // __MWERKS__ 00108 template<class T> 00109 void efp1(BareField<T, 1U>& field, int i, bool docomm = true); 00110 template<class T> 00111 void efp2(BareField<T, 2U>& field, int i, int j, bool docomm = true); 00112 template<class T> 00113 void efp3(BareField<T, 3U>& field, int i, int j, int k, bool docomm = true); 00114 00115 // For printing strided subrange of elements of a Field: 00116 #ifdef __MWERKS__ 00117 // Work around CW4 bug with default arguments of template functions 00118 template<class T> 00119 void sfp1(BareField<T, 1U>& field, 00120 int ibase, int ibound, int istride) { 00121 sfp1(field,ibase,ibound,istride,true);} 00122 template<class T> 00123 void sfp2(BareField<T, 2U>& field, 00124 int ibase, int ibound, int istride, 00125 int jbase, int jbound, int jstride) { 00126 sfp2(field,ibase,ibound,istride,jbase,jbound,jstride,true);} 00127 template<class T> 00128 void sfp3(BareField<T, 3U>& field, 00129 int ibase, int ibound, int istride, 00130 int jbase, int jbound, int jstride, 00131 int kbase, int kbound, int kstride) { 00132 sfp3(field,ibase,ibound,istride,jbase,jbound,jstride, 00133 kbase,kbound,kstride,true);} 00134 #endif // __MWERKS__ 00135 template<class T> 00136 void sfp1(BareField<T, 1U>& field, 00137 int ibase, int ibound, int istride, bool docomm = true); 00138 template<class T> 00139 void sfp2(BareField<T, 2U>& field, 00140 int ibase, int ibound, int istride, 00141 int jbase, int jbound, int jstride, bool docomm = true); 00142 template<class T> 00143 void sfp3(BareField<T, 3U>& field, 00144 int ibase, int ibound, int istride, 00145 int jbase, int jbound, int jstride, 00146 int kbase, int kbound, int kstride, bool docomm = true); 00147 00148 //----------------------------------------------------------------------------- 00149 // Specializations, so that these types are available from debugger: 00150 // 00151 // USAGE: 00152 // For now, all of these are commented out in this FieldDebug.h header file, 00153 // so that libippl.a doesn't take forever to build and isn't unnecessarily 00154 // large. (In fact, the KCC compiler dies if you have too many of these in 00155 // here.) It is up to the user to include a line like these in his source 00156 // (most logically in the main()), in order to have access to Field-printing 00157 // for his special types of Field's from the debugger. 00158 // 00159 // To call the functions from the *code* (not from the debugger), the user need 00160 // not include any lines like these; he can just invoke the generic 00161 // parameterized functions from the list above: [e,s]fp[1,2,3](). 00162 //----------------------------------------------------------------------------- 00163 00164 // User must put lines like the commented-out ones in his own code to get 00165 // access to specialized Field-type functions like these from the debugger. 00166 00167 // Scalar Field's of double's:------------------------------------------------- 00168 //void dfp1(BareField<double, 1U>& f) {fp1(f);} 00169 //void defp1(BareField<double, 1U>& f, int i) {efp1(f,i);} 00170 //void dsfp1(BareField<double,1U>& f, 00171 // int base1, int bound1, int stride1) {sfp1(f,base1,bound1,stride1);} 00172 //void dfp2(BareField<double, 2U>& f) {fp2(f);} 00173 //void defp2(BareField<double, 2U>& f, int i, int j) {efp2(f,i,j);} 00174 //void dsfp2(BareField<double,2U>& f, 00175 // int base1, int bound1, int stride1, 00176 // int base2, int bound2, int stride2) { 00177 // sfp2(f,base1,bound1,stride1,base2,bound2,stride2);} 00178 //void dfp3(BareField<double, 3U>& f) {fp3(f);} 00179 //void defp3(BareField<double, 3U>& f, int i, int j, int k) {efp3(f,i,j,k);} 00180 //void dsfp3(BareField<double,3U>& f, 00181 // int base1, int bound1, int stride1, 00182 // int base2, int bound2, int stride2, 00183 // int base3, int bound3, int stride3) { 00184 // sfp3(f,base1,bound1,stride1,base2,bound2,stride2,base3,bound3,stride3);} 00185 00186 // Scalar Field's of float's:-------------------------------------------------- 00187 //void ffp1(BareField<float, 1U>& f) {fp1(f);} 00188 //void fefp1(BareField<float, 1U>& f, int i) {efp1(f,i);} 00189 //void fsfp1(BareField<float,1U>& f, 00190 // int base1, int bound1, int stride1) {sfp1(f,base1,bound1,stride1);} 00191 //void ffp2(BareField<float, 2U>& f) {fp2(f);} 00192 //void fefp2(BareField<float, 2U>& f, int i, int j) {efp2(f,i,j);} 00193 //void fsfp2(BareField<float,2U>& f, 00194 // int base1, int bound1, int stride1, 00195 // int base2, int bound2, int stride2) { 00196 // sfp2(f,base1,bound1,stride1,base2,bound2,stride2);} 00197 //void ffp3(BareField<float, 3U>& f) {fp3(f);} 00198 //void fefp3(BareField<float, 3U>& f, int i, int j, int k) {efp3(f,i,j,k);} 00199 //void fsfp3(BareField<float,3U>& f, 00200 // int base1, int bound1, int stride1, 00201 // int base2, int bound2, int stride2, 00202 // int base3, int bound3, int stride3) { 00203 // sfp3(f,base1,bound1,stride1,base2,bound2,stride2,base3,bound3,stride3);} 00204 00205 // Vector Field's of double's:------------------------------------------------- 00206 //void vdfp2(BareField<Vektor<double,2U>, 2U>& f) {fp2(f);} 00207 //void vdefp2(BareField<Vektor<double,2U>, 2U>& f, int i, int j) {efp2(f,i,j);} 00208 //void vdsfp2(BareField<Vektor<double,2U>,2U>& f, 00209 // int base1, int bound1, int stride1, 00210 // int base2, int bound2, int stride2) { 00211 // sfp2(f,base1,bound1,stride1,base2,bound2,stride2);} 00212 //void vdfp3(BareField<Vektor<double,3U>, 3U>& f) {fp3(f);} 00213 //void vdefp3(BareField<Vektor<double,3U>, 3U>& f, int i, int j, int k) { 00214 // efp3(f,i,j,k);} 00215 //void vdsfp3(BareField<Vektor<double,3U>,3U>& f, 00216 // int base1, int bound1, int stride1, 00217 // int base2, int bound2, int stride2, 00218 // int base3, int bound3, int stride3) { 00219 // sfp3(f,base1,bound1,stride1,base2,bound2,stride2,base3,bound3,stride3);} 00220 00221 // Vector Field's of float's:-------------------------------------------------- 00222 //void vffp2(BareField<Vektor<float,2U>, 2U>& f) {fp2(f);} 00223 //void vfefp2(BareField<Vektor<float,2U>, 2U>& f, int i, int j) {efp2(f,i,j);} 00224 //void vfsfp2(BareField<Vektor<float,2U>,2U>& f, 00225 // int base1, int bound1, int stride1, 00226 // int base2, int bound2, int stride2) { 00227 // sfp2(f,base1,bound1,stride1,base2,bound2,stride2);} 00228 //void vffp3(BareField<Vektor<float,3U>, 3U>& f) {fp3(f);} 00229 //void vfefp3(BareField<Vektor<float,3U>, 3U>& f, int i, int j, int k) { 00230 // efp3(f,i,j,k);} 00231 //void vfsfp3(BareField<Vektor<float,3U>,3U>& f, 00232 // int base1, int bound1, int stride1, 00233 // int base2, int bound2, int stride2, 00234 // int base3, int bound3, int stride3) { 00235 // sfp3(f,base1,bound1,stride1,base2,bound2,stride2,base3,bound3,stride3);} 00236 00237 #include "Utility/FieldDebug.cpp" 00238 00239 #endif // FIELD_DEBUG_H 00240 00241 /*************************************************************************** 00242 * $RCSfile: FieldDebug.h,v $ $Author: adelmann $ 00243 * $Revision: 1.1.1.1 $ $Date: 2003/01/23 07:40:33 $ 00244 * IPPL_VERSION_ID: $Id: FieldDebug.h,v 1.1.1.1 2003/01/23 07:40:33 adelmann Exp $ 00245 ***************************************************************************/