CHROMA
follana_io_s.cc
Go to the documentation of this file.
1 /*
2  * $Id: follana_io_s.cc,v 3.1 2007-06-10 14:40:23 edwards Exp $
3  *
4  * These are a few simple I/O routines that we can use until QIO makes its appearance
5  * I have tried to include a simple header by means of a structure.
6  */
7 
8 #include "chromabase.h"
9 #include "io/follana_io_s.h"
10 #include "qdp_util.h"
11 #include <string>
12 
13 namespace Chroma {
14 
15 
16 void readQpropFollana(char file[], LatticePropagator& quark_prop, bool swap)
17 {
18  /*
19  * Now the local variables
20  */
21 
22  BinaryFileReader prop_in(file);
23 
24  int x, y, z, t, src_col, snk_col, src_spin, snk_spin, index;
25  Propagator site_prop;
26 
27  Complex tmp_cmpx;
28  const multi1d<int>& latt_size = Layout::lattSize();
29  multi1d<int> coords(Nd);
30 
31  multi1d<Real64> buf( latt_size[0]*Nc*Nc*2 );
32  /* Get size of the lattice */
33  /* Read the file somehow */
34 
35  for( t = 0; t < latt_size[3]; t++) {
36  QDPIO::cout << "Reading timeslice: " << t << std::endl;
37 
38  for( z = 0; z < latt_size[2]; z++) {
39  for( y = 0; y < latt_size[1]; y++ ) {
40 
41 
42 
43  read(prop_in, buf, latt_size[0]*Nc*Nc*2);
44 
45  if( swap == true ) {
46  QDPUtil::byte_swap((void *)&buf[0], sizeof(Real64), latt_size[0]*Nc*Nc*2 );
47  }
48  index = 0;
49 
50  for( x = 0; x < latt_size[0]; x++) {
51 
52  coords[0] = x;
53  coords[1] = y;
54  coords[2] = z;
55  coords[3] = t;
56 
57  for( snk_spin = 0; snk_spin < Ns; snk_spin++) {
58  for( src_spin = 0; src_spin < Ns; src_spin++) {
59 
60  ColorMatrix tmp_col;
61 
62  for( snk_col = 0; snk_col < Nc; snk_col++) {
63  for( src_col = 0; src_col < Nc; src_col++) {
64 
65  Real32 re, im;
66 
67  re = (Real32)(buf[index]);
68  index++;
69  im = (Real32)(buf[index]);
70  index++;
71 
72  tmp_cmpx = cmplx(Real(re), Real(im));
73 
74  tmp_col = pokeColor(tmp_col,
75  tmp_cmpx,
76  snk_col,
77  src_col);
78  }
79  }
80 
81  site_prop = pokeSpin(site_prop,
82  tmp_col,
83  snk_spin,
84  src_spin);
85  }
86  }
87 
88  pokeSite(quark_prop,
89  site_prop,
90  coords);
91 
92  }
93  }
94  }
95  }
96 }
97 
98 
99 } // end namespace Chroma
Primary include file for CHROMA library code.
void read(XMLReader &xml, const std::string &path, AsqtadFermActParams &param)
Read parameters.
int y
Definition: meslate.cc:35
int z
Definition: meslate.cc:36
int x
Definition: meslate.cc:34
int t
Definition: meslate.cc:37
Nd
Definition: meslate.cc:74
multi1d< int > coords(const int x, const int y, const int z, const int t)
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
void readQpropFollana(char file[], LatticePropagator &quark_prop, bool swap)
Definition: follana_io_s.cc:16
#define index(c)