CHROMA
milc_io.cc
Go to the documentation of this file.
1 
2 /*! \file
3  * \brief MILC gauge format routines
4  */
5 
6 #include "chromabase.h"
7 #include "io/milc_io.h"
8 #include <time.h>
9 
10 namespace Chroma
11 {
12 
13  //! Initialize header with default values
15  {
16  nrow = Layout::lattSize();
17 
18  time_t now = time(NULL);
19  {
20  char *tmp = ctime(&now);
21  int date_size = strlen(tmp);
22  char *datetime = new(std::nothrow) char[date_size+1];
23  if( datetime == 0x0 ) {
24  QDP_error_exit("Unable to allocate datetime in qdp_iogauge.cc\n");
25  }
26 
27  strcpy(datetime,ctime(&now));
28 
29  for(int i=0; i < date_size; ++i)
30  if ( datetime[i] == '\n' )
31  {
32  datetime[i] = '\0';
33  date_size = i;
34  break;
35  }
36 
37  date = datetime;
38  delete[] datetime;
39  }
40  }
41 
42 
43 
44  //! Source header read
45  void read(XMLReader& xml, const std::string& path, MILCGauge_t& header)
46  {
47  XMLReader paramtop(xml, path);
48 
49  read(paramtop, "date", header.date);
50  read(paramtop, "nrow", header.nrow);
51  }
52 
53 
54  //! Source header writer
55  void write(XMLWriter& xml, const std::string& path, const MILCGauge_t& header)
56  {
57  push(xml, path);
58 
59  write(xml, "date", header.date);
60  write(xml, "nrow", header.nrow);
61 
62  pop(xml);
63  }
64 
65 } // end namespace Chroma
Primary include file for CHROMA library code.
void read(XMLReader &xml, const std::string &path, AsqtadFermActParams &param)
Read parameters.
void write(XMLWriter &xml, const std::string &path, const AsqtadFermActParams &param)
Writer parameters.
MILC gauge format routines.
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
QDP_error_exit("too many BiCG iterations", n_count, rsd_sq, cp, c, re_rvr, im_rvr, re_a, im_a, re_b, im_b)
LatticeFermion tmp
Definition: mespbg5p_w.cc:36
push(xml_out,"Condensates")
int i
Definition: pbg5p_w.cc:55
pop(xml_out)
::std::string string
Definition: gtest.h:1979
MILC gauge field header.
Definition: milc_io.h:17
multi1d< int > nrow
Definition: milc_io.h:19
MILCGauge_t()
Initialize header with default values.
Definition: milc_io.cc:14
std::string date
Definition: milc_io.h:20