src/Utility/FieldDebugPrint.h

Go to the documentation of this file.
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 #ifndef FIELD_DEBUG_PRINT_H
00012 #define FIELD_DEBUG_PRINT_H
00013 
00014 // forward declarations
00015 template<class T, unsigned Dim> class BareField;
00016 template<unsigned Dim> class NDIndex;
00017 class Inform;
00018 
00019 
00020 template<class T, unsigned Dim> 
00021 class FieldDebugPrint {
00022 
00023 public:
00024   // constructor: set up to print with the given format options, and if we
00025   // print the values of boundary cells
00026   // if they would be included in the specified domain in the print function.
00027   FieldDebugPrint(bool printbc = false,
00028                   unsigned int dataWidth = 0, unsigned int dataPrecision = 0, 
00029                   unsigned int carReturn = 0, bool scientific = true) :
00030     DataWidth(dataWidth), DataPrecision(dataPrecision),
00031     CarReturn(carReturn), Scientific(scientific), PrintBC(printbc) { }
00032 
00033   // Destructor: nothing to do
00034   ~FieldDebugPrint() { }
00035 
00036   // print out all the values in the field, or just a subset.  If the
00037   // final boolean argument is true, execute the routine as if it were
00038   // being run on all the nodes at once.  If the argument is false, assume
00039   // it is being run by nodes separately, and do not do any communication.
00040   void print(BareField<T,Dim>&, const NDIndex<Dim>&, Inform&, bool = true);
00041   void print(BareField<T,Dim>&, Inform&, bool = true);
00042   void print(BareField<T,Dim>&, const NDIndex<Dim>&, bool = true);
00043   void print(BareField<T,Dim>&, bool = true);
00044 
00045   // set values for how to format the data
00046   void set_DataWidth(unsigned int in) { DataWidth = in; }
00047   void set_DataPrecision(unsigned int in) { DataPrecision = in; }
00048   void set_CarReturn(unsigned int in) { CarReturn = in; }
00049   void set_Scientific(bool in) { Scientific = in; }
00050   void set_PrintBC(bool in) { PrintBC = in; }
00051 
00052   // query the current values for how to format the data
00053   unsigned int get_DataWidth() const { return DataWidth; }
00054   unsigned int get_DataPrecision() const { return DataPrecision; }
00055   unsigned int get_CarReturn() const { return CarReturn; }
00056   bool get_Scientific() const { return Scientific; }
00057   bool get_PrintBC() const { return PrintBC; }
00058 
00059 private:
00060   // formatting information
00061   unsigned int DataWidth;       // the width for the Data fields
00062   unsigned int DataPrecision;   // the precision of the data
00063   unsigned int CarReturn;       // how long before a carriage return
00064   bool Scientific;              // print data in scientific format?
00065   bool PrintBC;                 // print boundary condition cells?
00066 
00067   // print a single value to the screen
00068   void printelem(bool, T&, unsigned int, Inform&);
00069 };
00070 
00071 #include "Utility/FieldDebugPrint.cpp"
00072 
00073 #endif
00074 
00075 /***************************************************************************
00076  * $RCSfile: FieldDebugPrint.h,v $   $Author: adelmann $
00077  * $Revision: 1.1.1.1 $   $Date: 2003/01/23 07:40:33 $
00078  * IPPL_VERSION_ID: $Id: FieldDebugPrint.h,v 1.1.1.1 2003/01/23 07:40:33 adelmann Exp $ 
00079  ***************************************************************************/

Generated on Mon Jan 16 13:23:58 2006 for IPPL by  doxygen 1.4.6