Bridge++  Ver. 1.3.x
gaugeConfig.cpp
Go to the documentation of this file.
1 
14 #include "gaugeConfig.h"
15 
16 const std::string GaugeConfig::class_name = "GaugeConfig";
17 
18 //====================================================================
19 GaugeConfig::GaugeConfig(const string& type)
20  : m_vl(CommonParameters::Vlevel()), m_fieldio()
21 {
22  if (type == "Text") {
24  } else if (type == "Text_4x4x4x8") {
26  } else if (type == "Binary") {
28  } else if (type == "Fortran_JLQCD") {
30  } else if (type == "Fortran_ILDG") {
32  } else if (type == "ILDG") {
34  } else if (type == "Binary_Parallel") {
36  } else if (type == "Binary_Distributed") {
38  } else if (type == "ILDG_Parallel") {
40  } else {
41  vout.crucial("%s: unsupported type \"%s\".\n", class_name.c_str(), type.c_str());
42  exit(EXIT_FAILURE);
43  }
44 }
45 
46 
47 //====================================================================
49 {
50  if (m_fieldio) delete m_fieldio;
51  m_fieldio = 0;
52 }
53 
54 
55 //====================================================================
56 void GaugeConfig::read_file(Field *U, const string& filename)
57 {
58  if (!m_fieldio) {
59  vout.crucial("%s::read_file(): FieldIO not set.\n", class_name.c_str());
60  exit(EXIT_FAILURE);
61  }
62 
63  m_fieldio->read_file(U, filename);
64 }
65 
66 
67 //====================================================================
68 void GaugeConfig::read_file(unique_ptr<Field_G>& U, const string& filename)
69 {
70  if (!m_fieldio) {
71  vout.crucial("%s::read_file(): FieldIO not set.\n", class_name.c_str());
72  exit(EXIT_FAILURE);
73  }
74 
75  m_fieldio->read_file((Field *)U.get(), filename);
76 }
77 
78 
79 //====================================================================
80 void GaugeConfig::write_file(Field *U, const string& filename)
81 {
82  if (!m_fieldio) {
83  vout.crucial("%s::write_file(): FieldIO not set.\n", class_name.c_str());
84  exit(EXIT_FAILURE);
85  }
86 
87  string filename_header = filename.substr(0, 9);
88 
89  if (filename_header != "NO_OUTPUT") {
90  m_fieldio->write_file(U, filename);
91  }
92 }
93 
94 
95 //====================================================================
96 void GaugeConfig::write_file(unique_ptr<Field_G>& U, const string& filename)
97 {
98  if (!m_fieldio) {
99  vout.crucial("%s::write_file(): FieldIO not set.\n", class_name.c_str());
100  exit(EXIT_FAILURE);
101  }
102 
103  string filename_header = filename.substr(0, 9);
104 
105  if (filename_header != "NO_OUTPUT") {
106  m_fieldio->write_file((Field *)U.get(), filename);
107  }
108 }
109 
110 
111 //====================================================================
112 //============================================================END=====
static const std::string class_name
Definition: gaugeConfig.h:64
BridgeIO vout
Definition: bridgeIO.cpp:278
virtual ~GaugeConfig()
Definition: gaugeConfig.cpp:48
FieldIO_LIME class for file I/O of Field data in LIME format.
Definition: fieldIO_LIME.h:89
FieldIO * m_fieldio
Definition: gaugeConfig.h:85
Container of Field-type object.
Definition: field.h:39
FieldIO_Text class for file I/O of Field data in plain text format.
Definition: fieldIO_Text.h:32
GaugeConfig(const string &type)
Definition: gaugeConfig.cpp:19
const Format * ILDG
Definition: io_format.cpp:28
void read_file(Field *U, const string &filename)
Definition: gaugeConfig.cpp:56
FieldIO_Fortran class for file I/O of Field data in Fortran binary format.
FieldIO_Binary_Parallel class for file I/O of Field data in binary format using MPI parallel I/O...
FieldIO_Text class for file I/O of Field data in plain text format.
pointer get() const
Common parameter class: provides parameters as singleton.
void write_file(Field *U, const string &filename)
Definition: gaugeConfig.cpp:80
void crucial(const char *format,...)
Definition: bridgeIO.cpp:48
const Format * JLQCD
Definition: io_format.cpp:29
FieldIO_Binary class for file I/O of Field data in binary format.
virtual void read_file(Field *v, std::string)=0
read data from file.
virtual void write_file(Field *v, std::string)=0
write data to file.
FieldIO_Binary_Distributed class for file I/O of Field data in binary format.
FieldIO_LIME_MPIIO class for file I/O of Field data in LIME format.