29 int nin_field = v->
nin();
30 int nex_field = v->
nex();
35 if ((nin_file == 0) || (nex_file == 0)) {
42 int size = nin_file * Lvol * nex_file;
49 vtmp.
reset(nin_field, Lvol, nex_field);
52 infile.open(filename.c_str(), std::ios::in | std::ios::binary);
54 bool do_byteswap =
false;
62 infile.read((
char *)&flen,
sizeof(uint32_t) * 1);
69 if (flen ==
sizeof(
double) * size) {
73 uint32_t flen_s = flen;
76 if (flen_s ==
sizeof(
double) * size) {
87 const int block_size = nin_file;
88 char buf[
sizeof(double) * block_size];
90 for (
int j = 0; j < nex_file; ++j) {
91 for (
int isite = 0; isite < Lvol; ++isite) {
93 infile.read(buf,
sizeof(
double) * block_size);
96 byte_swap(buf,
sizeof(
double), block_size);
99 double *ptr = (
double *)buf;
101 for (
int i = 0; i < nin_file; ++i) {
105 vtmp.
set(s, isite, t, ptr[i]);
112 infile.read((
char *)&ftail,
sizeof(uint32_t) * 1);
135 int nin_field = v->
nin();
136 int nex_field = v->
nex();
141 if ((nin_file == 0) || (nex_file == 0)) {
142 nin_file = nin_field;
143 nex_file = nex_field;
150 vtmp.
reset(nin_field, Lvol, nex_field);
153 size_t count = nin_file * Lvol * nex_file;
160 std::ofstream outfile(filename.c_str(), std::ios::out | std::ios::binary);
166 uint32_t flen =
sizeof(double) * count;
169 outfile.write((
char *)&flen,
sizeof(uint32_t) * 1);
172 const int block_size = nin_file;
173 char buf[
sizeof(double) * block_size];
176 for (
int j = 0; j < nex_file; ++j) {
177 for (
int isite = 0; isite < Lvol; ++isite) {
178 double *ptr = (
double *)buf;
180 for (
int i = 0; i < nin_file; ++i) {
184 ptr[i] = vtmp.
cmp(s, isite, t);
187 outfile.write(buf,
sizeof(
double) * block_size);
192 outfile.write((
char *)&flen,
sizeof(uint32_t) * 1);