12 parity_inflate(parity_inflate)
17 if (strcmp(filename.c_str(),
"") == 0) {
errorQuda(
"No eigenspace input file defined."); }
23 const int Nvec = vecs.size();
24 auto spinor_parity = vecs[0]->SuggestedParity();
27 std::vector<ColorSpinorField *>
tmp;
47 for (
int i = 0; i < Nvec; i++) {
tmp.push_back(vecs[i]); }
51 if (vecs[0]->Ndim() == 4 || vecs[0]->Ndim() == 5) {
53 auto Ls = vecs[0]->Ndim() == 5 ?
tmp[0]->X(4) : 1;
54 auto V4 =
tmp[0]->Volume() /
Ls;
55 auto stride = V4 *
tmp[0]->Ncolor() *
tmp[0]->Nspin() * 2 *
tmp[0]->Precision();
56 void **
V =
static_cast<void **
>(
safe_malloc(Nvec *
Ls *
sizeof(
void *)));
57 for (
int i = 0; i < Nvec; i++) {
58 for (
int j = 0; j <
Ls; j++) {
V[i *
Ls + j] =
static_cast<char *
>(
tmp[i]->V()) + j * stride; }
62 tmp[0]->Ncolor(),
tmp[0]->Nspin(), Nvec *
Ls, 0, (
char **)0);
66 errorQuda(
"Unexpected field dimension %d", vecs[0]->Ndim());
73 for (
int i = 0; i < Nvec; i++) {
86 for (
int i = 0; i < Nvec; i++) {
92 errorQuda(
"When loading single parity vectors, the suggested parity must be set.");
94 *vecs[i] = *tmp_intermediate;
98 delete tmp_intermediate;
101 for (
int i = 0; i < Nvec; i++) {
107 errorQuda(
"When loading single parity vectors, the suggested parity must be set.");
115 errorQuda(
"\nQIO library was not built.\n");
122 const int Nvec = vecs.size();
123 std::vector<ColorSpinorField *>
tmp;
125 auto spinor_parity = vecs[0]->SuggestedParity();
135 for (
int i = 0; i < Nvec; i++) {
148 for (
int i = 0; i < Nvec; i++) {
153 *tmp_intermediate = *vecs[i];
161 errorQuda(
"When saving single parity vectors, the suggested parity must be set.");
163 delete tmp_intermediate;
171 for (
int i = 0; i < Nvec; i++) {
178 errorQuda(
"When saving single parity vectors, the suggested parity must be set.");
181 for (
int i = 0; i < Nvec; i++) {
tmp.push_back(vecs[i]); }
187 if (vecs[0]->Ndim() == 4 || vecs[0]->Ndim() == 5) {
189 auto Ls = vecs[0]->Ndim() == 5 ?
tmp[0]->X(4) : 1;
190 auto V4 =
tmp[0]->Volume() /
Ls;
191 auto stride = V4 *
tmp[0]->Ncolor() *
tmp[0]->Nspin() * 2 *
tmp[0]->Precision();
192 void **
V =
static_cast<void **
>(
safe_malloc(Nvec *
Ls *
sizeof(
void *)));
193 for (
int i = 0; i < Nvec; i++) {
194 for (
int j = 0; j <
Ls; j++) {
V[i *
Ls + j] =
static_cast<char *
>(
tmp[i]->V()) + j * stride; }
198 tmp[0]->Ncolor(),
tmp[0]->Nspin(), Nvec *
Ls, 0, (
char **)0);
202 errorQuda(
"Unexpected field dimension %d", vecs[0]->Ndim());
208 for (
int i = 0; i < Nvec; i++)
delete tmp[i];
211 errorQuda(
"\nQIO library was not built.\n");
static ColorSpinorField * Create(const ColorSpinorParam ¶m)
void load(std::vector< ColorSpinorField * > &vecs)
Load vectors from filename.
void save(const std::vector< ColorSpinorField * > &vecs)
Save vectors to filename.
VectorIO(const std::string &filename, bool parity_inflate=false)
cudaColorSpinorField * tmp
@ QUDA_CUDA_FIELD_LOCATION
@ QUDA_CPU_FIELD_LOCATION
@ QUDA_PARITY_SITE_SUBSET
@ QUDA_SPACE_SPIN_COLOR_FIELD_ORDER
#define safe_malloc(size)
void copy(ColorSpinorField &dst, const ColorSpinorField &src)
void read_spinor_field(const char *filename, void *V[], QudaPrecision precision, const int *X, QudaSiteSubset subset, QudaParity parity, int nColor, int nSpin, int Nvec, int argc, char *argv[])
void write_spinor_field(const char *filename, void *V[], QudaPrecision precision, const int *X, QudaSiteSubset subset, QudaParity parity, int nColor, int nSpin, int Nvec, int argc, char *argv[])
QudaVerbosity getVerbosity()