OPAL (Object Oriented Parallel Accelerator Library)  2021.1.99
OPAL
FieldDebugPrint.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_DEBUG_PRINT_H
12 #define FIELD_DEBUG_PRINT_H
13 
14 // forward declarations
15 template<class T, unsigned Dim> class BareField;
16 template<unsigned Dim> class NDIndex;
17 class Inform;
18 
19 
20 template<class T, unsigned Dim>
22 
23 public:
24  // constructor: set up to print with the given format options, and if we
25  // print the values of boundary cells
26  // if they would be included in the specified domain in the print function.
27  FieldDebugPrint(bool printbc = false,
28  unsigned int dataWidth = 0, unsigned int dataPrecision = 0,
29  unsigned int carReturn = 0, bool scientific = true) :
30  DataWidth(dataWidth), DataPrecision(dataPrecision),
31  CarReturn(carReturn), Scientific(scientific), PrintBC(printbc) { }
32 
33  // Destructor: nothing to do
35 
36  // print out all the values in the field, or just a subset. If the
37  // final boolean argument is true, execute the routine as if it were
38  // being run on all the nodes at once. If the argument is false, assume
39  // it is being run by nodes separately, and do not do any communication.
40  void print(BareField<T,Dim>&, const NDIndex<Dim>&, Inform&, bool = true);
41  void print(BareField<T,Dim>&, Inform&, bool = true);
42  void print(BareField<T,Dim>&, const NDIndex<Dim>&, bool = true);
43  void print(BareField<T,Dim>&, bool = true);
44 
45  // set values for how to format the data
46  void set_DataWidth(unsigned int in) { DataWidth = in; }
47  void set_DataPrecision(unsigned int in) { DataPrecision = in; }
48  void set_CarReturn(unsigned int in) { CarReturn = in; }
49  void set_Scientific(bool in) { Scientific = in; }
50  void set_PrintBC(bool in) { PrintBC = in; }
51 
52  // query the current values for how to format the data
53  unsigned int get_DataWidth() const { return DataWidth; }
54  unsigned int get_DataPrecision() const { return DataPrecision; }
55  unsigned int get_CarReturn() const { return CarReturn; }
56  bool get_Scientific() const { return Scientific; }
57  bool get_PrintBC() const { return PrintBC; }
58 
59 private:
60  // formatting information
61  unsigned int DataWidth; // the width for the Data fields
62  unsigned int DataPrecision; // the precision of the data
63  unsigned int CarReturn; // how long before a carriage return
64  bool Scientific; // print data in scientific format?
65  bool PrintBC; // print boundary condition cells?
66 
67  // print a single value to the screen
68  void printelem(bool, T&, unsigned int, Inform&);
69 };
70 
72 
73 #endif
74 
75 /***************************************************************************
76  * $RCSfile: FieldDebugPrint.h,v $ $Author: adelmann $
77  * $Revision: 1.1.1.1 $ $Date: 2003/01/23 07:40:33 $
78  * IPPL_VERSION_ID: $Id: FieldDebugPrint.h,v 1.1.1.1 2003/01/23 07:40:33 adelmann Exp $
79  ***************************************************************************/
unsigned int get_CarReturn() const
void set_CarReturn(unsigned int in)
unsigned int CarReturn
unsigned int DataPrecision
void set_DataWidth(unsigned int in)
void set_Scientific(bool in)
void print(BareField< T, Dim > &, const NDIndex< Dim > &, Inform &, bool=true)
unsigned int get_DataWidth() const
void set_PrintBC(bool in)
bool get_Scientific() const
FieldDebugPrint(bool printbc=false, unsigned int dataWidth=0, unsigned int dataPrecision=0, unsigned int carReturn=0, bool scientific=true)
void printelem(bool, T &, unsigned int, Inform &)
unsigned int get_DataPrecision() const
void set_DataPrecision(unsigned int in)
bool get_PrintBC() const
unsigned int DataWidth
Definition: Inform.h:42