OPAL (Object Oriented Parallel Accelerator Library)  2021.1.99
OPAL
FieldPrint.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 #ifndef FIELD_PRINT_H
12 #define FIELD_PRINT_H
13 
14 // forward declarations
15 template<class T, unsigned Dim> class BareField;
16 template<unsigned Dim> class NDIndex;
17 
18 // class FieldPrint
19 //----------------------------------------------------------------------
20 template<class T, unsigned Dim>
21 class FieldPrint {
22 
23 public:
24 
25  // attach a 2D Field to a FieldPrint
26  FieldPrint(BareField<T,Dim>& f, unsigned parent = 0, int indexWidth = 3,
27  int dataWidth = 8, int dataPrecision = 4,
28  int carReturn = -1, bool scientific = false) :
29  MyField(f), Parent(parent),IndexWidth(indexWidth), DataWidth(dataWidth),
30  DataPrecision(dataPrecision), CarReturn(carReturn), Scientific(scientific) { };
31 
32 
33  ~FieldPrint() { };
34  void print(NDIndex<Dim>& view);
35 
36  // reset values
37  void set_IndexWidth( unsigned in ) { IndexWidth = in; }
38  void set_DataWidth( unsigned in ) { DataWidth = in; }
39  void set_DataPrecision( unsigned in ) { DataPrecision = in; }
40  void set_CarReturn( int in ) { CarReturn = in; }
41  void set_Scientific( bool in ) { Scientific = in; }
42 
43 private:
45 
46  unsigned Parent;
47 
48  // formatting information
49  unsigned IndexWidth; // the width for the Index fields
50  unsigned DataWidth; // the width for the Data fields
51  unsigned DataPrecision; // the precision of the data
52  int CarReturn; // how long before a carriage return
53  bool Scientific;
54 
55 };
56 //----------------------------------------------------------------------
57 
58 #include "Utility/FieldPrint.hpp"
59 
60 #endif // FIELD_PRINT_H
61 
62 /***************************************************************************
63  * $RCSfile: FieldPrint.h,v $ $Author: adelmann $
64  * $Revision: 1.1.1.1 $ $Date: 2003/01/23 07:40:33 $
65  * IPPL_VERSION_ID: $Id: FieldPrint.h,v 1.1.1.1 2003/01/23 07:40:33 adelmann Exp $
66  ***************************************************************************/
unsigned IndexWidth
Definition: FieldPrint.h:49
void set_IndexWidth(unsigned in)
Definition: FieldPrint.h:37
void set_CarReturn(int in)
Definition: FieldPrint.h:40
unsigned Parent
Definition: FieldPrint.h:46
unsigned DataWidth
Definition: FieldPrint.h:50
void set_DataPrecision(unsigned in)
Definition: FieldPrint.h:39
bool Scientific
Definition: FieldPrint.h:53
int CarReturn
Definition: FieldPrint.h:52
unsigned DataPrecision
Definition: FieldPrint.h:51
void set_Scientific(bool in)
Definition: FieldPrint.h:41
FieldPrint(BareField< T, Dim > &f, unsigned parent=0, int indexWidth=3, int dataWidth=8, int dataPrecision=4, int carReturn=-1, bool scientific=false)
Definition: FieldPrint.h:26
BareField< T, Dim > & MyField
Definition: FieldPrint.h:44
void set_DataWidth(unsigned in)
Definition: FieldPrint.h:38
void print(NDIndex< Dim > &view)
Definition: FieldPrint.hpp:39