26   int nin_field = v->
nin();
 
   27   int nex_field = v->
nex();
 
   32   if ((nin_file == 0) || (nex_file == 0)) {
 
   39   int size = nin_file * Lvol * nex_file;
 
   46     vtmp.
reset(nin_field, Lvol, nex_field);
 
   49     infile.open(filename.c_str(), std::ios::in | std::ios::binary);
 
   55     bool do_byteswap = 
false;
 
   63     infile.read((
char *)&flen, 
sizeof(uint32_t) * 1);
 
   70     if (flen == 
sizeof(
double) * size) {
 
   74       uint32_t flen_s = flen;
 
   77       if (flen_s == 
sizeof(
double) * size) {
 
   88     const int block_size = nin_file;
 
   89     char      buf[
sizeof(double) * block_size];
 
   91     for (
int j = 0; j < nex_file; ++j) {
 
   92       for (
int isite = 0; isite < Lvol; ++isite) {
 
   94         infile.read(buf, 
sizeof(
double) * block_size);
 
  107           byte_swap(buf, 
sizeof(
double), block_size);
 
  110         double *ptr = (
double *)buf;
 
  112         for (
int i = 0; i < nin_file; ++i) {
 
  116           vtmp.
set(s, isite, t, ptr[i]);
 
  123     infile.read((
char *)&ftail, 
sizeof(uint32_t) * 1);
 
  146   int nin_field = v->
nin();
 
  147   int nex_field = v->
nex();
 
  152   if ((nin_file == 0) || (nex_file == 0)) {
 
  153     nin_file = nin_field;
 
  154     nex_file = nex_field;
 
  161     vtmp.
reset(nin_field, Lvol, nex_field);
 
  164   size_t count = nin_file * Lvol * nex_file;
 
  171     std::ofstream outfile(filename.c_str(), std::ios::out | std::ios::binary);
 
  177     uint32_t flen = 
sizeof(double) * count;
 
  180     outfile.write((
char *)&flen, 
sizeof(uint32_t) * 1);
 
  183       vout.
crucial(
m_vl, 
"Error at %s: io error. write record header failed.\n", __func__);
 
  188     const int block_size = nin_file;
 
  189     char      buf[
sizeof(double) * block_size];
 
  192     for (
int j = 0; j < nex_file; ++j) {
 
  193       for (
int isite = 0; isite < Lvol; ++isite) {
 
  194         double *ptr = (
double *)buf;
 
  196         for (
int i = 0; i < nin_file; ++i) {
 
  200           ptr[i] = vtmp.
cmp(s, isite, t);
 
  203         outfile.write(buf, 
sizeof(
double) * block_size);
 
  213     outfile.write((
char *)&flen, 
sizeof(uint32_t) * 1);
 
  216       vout.
crucial(
m_vl, 
"Error at %s: write record footer failed.\n", __func__);
 
  232   if ((vv.size() == 0) || (filename == 
"")) 
return;
 
  234   int nin_field = vv[0]->nin();
 
  235   int nex_field = vv[0]->nex();
 
  240   if ((nin_file == 0) || (nex_file == 0)) {
 
  241     nin_file = nin_field;
 
  242     nex_file = nex_field;
 
  247   int size = nin_file * Lvol * nex_file;
 
  254     vtmp.
reset(nin_field, Lvol, nex_field);
 
  257     infile.open(filename.c_str(), std::ios::in | std::ios::binary);
 
  263     bool do_byteswap = 
false;
 
  265     for (
size_t i = 0, nrec = vv.size(); i < nrec; ++i) {
 
  272       infile.read((
char *)&flen, 
sizeof(uint32_t) * 1);
 
  279       if (flen == 
sizeof(
double) * size) {
 
  283         uint32_t flen_s = flen;
 
  286         if (flen_s == 
sizeof(
double) * size) {
 
  297       const int block_size = nin_file;
 
  298       char      buf[
sizeof(double) * block_size];
 
  300       for (
int j = 0; j < nex_file; ++j) {
 
  301         for (
int isite = 0; isite < Lvol; ++isite) {
 
  303           infile.read(buf, 
sizeof(
double) * block_size);
 
  316             byte_swap(buf, 
sizeof(
double), block_size);
 
  319           double *ptr = (
double *)buf;
 
  321           for (
int i = 0; i < nin_file; ++i) {
 
  325             vtmp.
set(s, isite, t, ptr[i]);
 
  332       infile.read((
char *)&ftail, 
sizeof(uint32_t) * 1);
 
  348     for (
size_t i = 0, nrec = vv.size(); i < nrec; ++i) {
 
  360   if ((vv.size() == 0) || (filename == 
"")) 
return;
 
  362   int nin_field = vv[0]->nin();
 
  363   int nex_field = vv[0]->nex();
 
  368   if ((nin_file == 0) || (nex_file == 0)) {
 
  369     nin_file = nin_field;
 
  370     nex_file = nex_field;
 
  374   size_t count = nin_file * Lvol * nex_file;
 
  379     vtmp.
reset(nin_field, Lvol, nex_field);
 
  385     std::ofstream outfile(filename.c_str(), std::ios::out | std::ios::binary);
 
  391     for (
size_t i = 0, nrec = vv.size(); i < nrec; ++i) {
 
  394       uint32_t flen = 
sizeof(double) * count;
 
  397       outfile.write((
char *)&flen, 
sizeof(uint32_t) * 1);
 
  400         vout.
crucial(
m_vl, 
"Error at %s: io error. write record header failed.\n", __func__);
 
  405       const int block_size = nin_file;
 
  406       char      buf[
sizeof(double) * block_size];
 
  408       for (
int j = 0; j < nex_file; ++j) {
 
  409         for (
int isite = 0; isite < Lvol; ++isite) {
 
  410           double *ptr = (
double *)buf;
 
  412           for (
int i = 0; i < nin_file; ++i) {
 
  416             ptr[i] = vtmp.
cmp(s, isite, t);
 
  419           outfile.write(buf, 
sizeof(
double) * block_size);
 
  429       outfile.write((
char *)&flen, 
sizeof(uint32_t) * 1);
 
  432         vout.
crucial(
m_vl, 
"Error at %s: io error. write record footer failed.\n", __func__);
 
  439     for (
size_t i = 0, nrec = vv.size(); i < nrec; ++i) {
 
static void byte_swap(void *buf, size_t size, size_t nmemb)
< convert byte order. alternative interface. 
 
void detailed(const char *format,...)
 
static void abort()
terminate communicator 
 
void set(const int jin, const int site, const int jex, double v)
 
void deliver(Field *vlocal, Field *vglobal)
distribute data on primary node over parallel nodes. 
 
Container of Field-type object. 
 
double cmp(const int jin, const int site, const int jex) const 
 
void read_file(Field *v, std::string filename)
read data from file. 
 
static const std::string class_name
 
void reset(const int Nin, const int Nvol, const int Nex, const element_type cmpl=COMPLEX)
 
const IO_Format::Format * m_format
 
void crucial(const char *format,...)
 
void write_file(Field *v, std::string filename)
write data to file. 
 
static bool is_primary()
check if the present node is primary in small communicator. 
 
void gather(Field *vglobal, Field *vlocal)
gather data on parallel nodes to primary node. 
 
Bridge::VerboseLevel m_vl