src/Utility/FieldPrint.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_PRINT_H
00012 #define FIELD_PRINT_H
00013 
00014 // forward declarations
00015 template<class T, unsigned Dim> class BareField;
00016 template<unsigned Dim> class NDIndex;
00017 
00018 // class FieldPrint
00019 //----------------------------------------------------------------------
00020 template<class T, unsigned Dim> 
00021 class FieldPrint {
00022 
00023 public:
00024 
00025   // attach a 2D Field to a FieldPrint
00026   FieldPrint(BareField<T,Dim>& f, unsigned parent = 0, int indexWidth = 3,
00027              int dataWidth = 8, int dataPrecision = 4, 
00028              int carReturn = -1, bool scientific = false) :
00029     MyField(f), Parent(parent),IndexWidth(indexWidth), DataWidth(dataWidth), 
00030     DataPrecision(dataPrecision), CarReturn(carReturn), Scientific(scientific) { };
00031 
00032 
00033   ~FieldPrint() { };
00034   void print(NDIndex<Dim>& view);
00035 
00036   // reset values
00037   void set_IndexWidth( unsigned in )    { IndexWidth = in; }
00038   void set_DataWidth( unsigned in )     { DataWidth = in; }
00039   void set_DataPrecision( unsigned in ) { DataPrecision = in; }
00040   void set_CarReturn( int in )          { CarReturn = in; }
00041   void set_Scientific( bool in )        { Scientific = in; }
00042   
00043 private:
00044   BareField<T,Dim>& MyField;
00045 
00046   unsigned Parent;
00047 
00048   // formatting information
00049   unsigned IndexWidth; // the width for the Index fields
00050   unsigned DataWidth;  // the width for the Data fields
00051   unsigned DataPrecision; // the precision of the data
00052   int CarReturn; // how long before a carriage return
00053   bool Scientific;
00054 
00055 };
00056 //----------------------------------------------------------------------
00057 
00058 #include "Utility/FieldPrint.cpp"
00059 
00060 #endif // FIELD_PRINT_H
00061 
00062 /***************************************************************************
00063  * $RCSfile: FieldPrint.h,v $   $Author: adelmann $
00064  * $Revision: 1.1.1.1 $   $Date: 2003/01/23 07:40:33 $
00065  * IPPL_VERSION_ID: $Id: FieldPrint.h,v 1.1.1.1 2003/01/23 07:40:33 adelmann Exp $ 
00066  ***************************************************************************/

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