2018-03-13 13:51:09 +00:00
|
|
|
/*************************************************************************************
|
|
|
|
|
|
|
|
Grid physics library, www.github.com/paboyle/Grid
|
|
|
|
|
2018-09-01 21:30:30 +01:00
|
|
|
Source file: Hadrons/EigenPack.hpp
|
2018-03-13 13:51:09 +00:00
|
|
|
|
|
|
|
Copyright (C) 2015-2018
|
|
|
|
|
|
|
|
Author: Antonin Portelli <antonin.portelli@me.com>
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License along
|
|
|
|
with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
|
|
|
|
See the full license in the file "LICENSE" in the top level distribution directory
|
|
|
|
*************************************************************************************/
|
|
|
|
/* END LEGAL */
|
|
|
|
#ifndef Hadrons_EigenPack_hpp_
|
|
|
|
#define Hadrons_EigenPack_hpp_
|
|
|
|
|
2018-08-28 15:00:40 +01:00
|
|
|
#include <Hadrons/Global.hpp>
|
2018-03-14 14:54:25 +00:00
|
|
|
#include <Grid/algorithms/iterative/Deflation.h>
|
2018-03-13 13:51:09 +00:00
|
|
|
#include <Grid/algorithms/iterative/LocalCoherenceLanczos.h>
|
|
|
|
|
|
|
|
BEGIN_HADRONS_NAMESPACE
|
|
|
|
|
|
|
|
// Lanczos type
|
|
|
|
#ifndef HADRONS_DEFAULT_LANCZOS_NBASIS
|
|
|
|
#define HADRONS_DEFAULT_LANCZOS_NBASIS 60
|
|
|
|
#endif
|
|
|
|
|
2018-10-02 19:51:09 +01:00
|
|
|
#define HADRONS_DUMP_EP_METADATA(record) \
|
2018-10-01 20:15:21 +01:00
|
|
|
LOG(Message) << "Eigenpack metadata:" << std::endl;\
|
|
|
|
LOG(Message) << "* operator" << std::endl;\
|
2018-10-02 19:51:09 +01:00
|
|
|
LOG(Message) << (record).operatorXml << std::endl;\
|
2018-10-01 20:15:21 +01:00
|
|
|
LOG(Message) << "* solver" << std::endl;\
|
2018-10-02 19:51:09 +01:00
|
|
|
LOG(Message) << (record).solverXml << std::endl;
|
2018-10-01 20:15:21 +01:00
|
|
|
|
2018-10-02 00:02:34 +01:00
|
|
|
struct PackRecord
|
|
|
|
{
|
|
|
|
std::string operatorXml, solverXml;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct VecRecord: Serializable
|
|
|
|
{
|
|
|
|
GRID_SERIALIZABLE_CLASS_MEMBERS(VecRecord,
|
|
|
|
unsigned int, index,
|
|
|
|
double, eval);
|
|
|
|
VecRecord(void): index(0), eval(0.) {}
|
|
|
|
};
|
|
|
|
|
2018-10-02 19:51:09 +01:00
|
|
|
namespace EigenPackIo
|
2018-03-13 13:51:09 +00:00
|
|
|
{
|
2018-10-02 20:08:49 +01:00
|
|
|
inline void readHeader(PackRecord &record, ScidacReader &binReader)
|
2018-03-13 13:51:09 +00:00
|
|
|
{
|
2018-10-02 19:51:09 +01:00
|
|
|
std::string recordXml;
|
2018-03-13 13:51:09 +00:00
|
|
|
|
2018-10-02 19:51:09 +01:00
|
|
|
binReader.readLimeObject(recordXml, SCIDAC_FILE_XML);
|
|
|
|
XmlReader xmlReader(recordXml, true, "eigenPackPar");
|
|
|
|
xmlReader.push();
|
|
|
|
xmlReader.readCurrentSubtree(record.operatorXml);
|
|
|
|
xmlReader.nextElement();
|
|
|
|
xmlReader.readCurrentSubtree(record.solverXml);
|
2018-03-13 13:51:09 +00:00
|
|
|
}
|
|
|
|
|
2018-10-02 19:51:09 +01:00
|
|
|
template <typename T, typename TIo = T>
|
|
|
|
void readElement(T &evec, RealD &eval, const unsigned int index,
|
|
|
|
ScidacReader &binReader, TIo *ioBuf = nullptr)
|
2018-03-13 13:51:09 +00:00
|
|
|
{
|
2018-10-02 19:51:09 +01:00
|
|
|
VecRecord vecRecord;
|
|
|
|
|
|
|
|
LOG(Message) << "Reading eigenvector " << index << std::endl;
|
|
|
|
if (ioBuf == nullptr)
|
2018-05-07 17:25:36 +01:00
|
|
|
{
|
2018-10-02 19:51:09 +01:00
|
|
|
binReader.readScidacFieldRecord(evec, vecRecord);
|
2018-05-07 17:25:36 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-10-02 19:51:09 +01:00
|
|
|
binReader.readScidacFieldRecord(*ioBuf, vecRecord);
|
|
|
|
precisionChange(evec, *ioBuf);
|
2018-05-07 17:25:36 +01:00
|
|
|
}
|
2018-10-02 19:51:09 +01:00
|
|
|
if (vecRecord.index != index)
|
|
|
|
{
|
|
|
|
HADRONS_ERROR(Io, "Eigenvector " + std::to_string(index) + " has a"
|
|
|
|
+ " wrong index (expected " + std::to_string(vecRecord.index)
|
|
|
|
+ ")");
|
|
|
|
}
|
|
|
|
eval = vecRecord.eval;
|
2018-03-13 13:51:09 +00:00
|
|
|
}
|
|
|
|
|
2018-10-02 19:51:09 +01:00
|
|
|
template <typename T, typename TIo = T>
|
|
|
|
static void readPack(std::vector<T> &evec, std::vector<RealD> &eval,
|
|
|
|
PackRecord &record, const std::string filename,
|
|
|
|
const unsigned int size, bool multiFile,
|
|
|
|
GridBase *gridIo = nullptr)
|
2018-03-13 13:51:09 +00:00
|
|
|
{
|
2018-10-02 19:51:09 +01:00
|
|
|
std::unique_ptr<TIo> ioBuf{nullptr};
|
|
|
|
ScidacReader binReader;
|
|
|
|
|
|
|
|
if (typeHash<T>() != typeHash<TIo>())
|
|
|
|
{
|
|
|
|
if (gridIo == nullptr)
|
|
|
|
{
|
|
|
|
HADRONS_ERROR(Definition,
|
|
|
|
"I/O type different from vector type but null I/O grid passed");
|
|
|
|
}
|
|
|
|
ioBuf.reset(new TIo(gridIo));
|
|
|
|
}
|
2018-05-07 17:25:36 +01:00
|
|
|
if (multiFile)
|
|
|
|
{
|
2018-10-02 19:51:09 +01:00
|
|
|
std::string fullFilename;
|
|
|
|
|
|
|
|
for(int k = 0; k < size; ++k)
|
2018-05-07 17:25:36 +01:00
|
|
|
{
|
2018-10-02 19:51:09 +01:00
|
|
|
fullFilename = filename + "/v" + std::to_string(k) + ".bin";
|
|
|
|
binReader.open(fullFilename);
|
|
|
|
readHeader(record, binReader);
|
|
|
|
readElement(evec[k], eval[k], k, binReader, ioBuf.get());
|
|
|
|
binReader.close();
|
2018-05-07 17:25:36 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-10-02 19:51:09 +01:00
|
|
|
binReader.open(filename);
|
|
|
|
readHeader(record, binReader);
|
|
|
|
for(int k = 0; k < size; ++k)
|
|
|
|
{
|
|
|
|
readElement(evec[k], eval[k], k, binReader, ioBuf.get());
|
|
|
|
}
|
|
|
|
binReader.close();
|
2018-05-07 17:25:36 +01:00
|
|
|
}
|
2018-03-13 13:51:09 +00:00
|
|
|
}
|
|
|
|
|
2018-10-02 20:08:49 +01:00
|
|
|
inline void writeHeader(ScidacWriter &binWriter, PackRecord &record)
|
2018-10-02 00:02:34 +01:00
|
|
|
{
|
|
|
|
XmlWriter xmlWriter("", "eigenPackPar");
|
|
|
|
|
|
|
|
xmlWriter.pushXmlString(record.operatorXml);
|
|
|
|
xmlWriter.pushXmlString(record.solverXml);
|
|
|
|
binWriter.writeLimeObject(1, 1, xmlWriter, "parameters", SCIDAC_FILE_XML);
|
|
|
|
}
|
|
|
|
|
2018-10-02 19:51:09 +01:00
|
|
|
template <typename T, typename TIo = T>
|
|
|
|
void writeElement(ScidacWriter &binWriter, T &evec, RealD &eval,
|
|
|
|
const unsigned int index, TIo *ioBuf,
|
|
|
|
T *testBuf = nullptr)
|
2018-10-02 00:02:34 +01:00
|
|
|
{
|
2018-10-02 19:51:09 +01:00
|
|
|
VecRecord vecRecord;
|
2018-10-02 00:02:34 +01:00
|
|
|
|
2018-10-02 19:51:09 +01:00
|
|
|
LOG(Message) << "Writing eigenvector " << index << std::endl;
|
|
|
|
vecRecord.eval = eval;
|
|
|
|
vecRecord.index = index;
|
|
|
|
if ((ioBuf == nullptr) || (testBuf == nullptr))
|
2018-10-02 00:02:34 +01:00
|
|
|
{
|
2018-10-02 19:51:09 +01:00
|
|
|
binWriter.writeScidacFieldRecord(evec, vecRecord, DEFAULT_ASCII_PREC);
|
2018-10-02 00:02:34 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-10-02 19:51:09 +01:00
|
|
|
precisionChange(*ioBuf, evec);
|
|
|
|
precisionChange(*testBuf, *ioBuf);
|
|
|
|
*testBuf -= evec;
|
|
|
|
LOG(Message) << "Precision diff norm^2 " << norm2(*testBuf) << std::endl;
|
|
|
|
binWriter.writeScidacFieldRecord(*ioBuf, vecRecord, DEFAULT_ASCII_PREC);
|
|
|
|
}
|
2018-10-02 00:02:34 +01:00
|
|
|
}
|
2018-10-02 19:51:09 +01:00
|
|
|
|
|
|
|
template <typename T, typename TIo = T>
|
|
|
|
static void writePack(const std::string filename, std::vector<T> &evec,
|
|
|
|
std::vector<RealD> &eval, PackRecord &record,
|
|
|
|
const unsigned int size, bool multiFile,
|
|
|
|
GridBase *gridIo = nullptr)
|
2018-10-01 20:15:21 +01:00
|
|
|
{
|
2018-12-13 05:11:34 +00:00
|
|
|
GridBase *grid = evec[0].Grid();
|
2018-10-02 19:51:09 +01:00
|
|
|
std::unique_ptr<TIo> ioBuf{nullptr};
|
|
|
|
std::unique_ptr<T> testBuf{nullptr};
|
|
|
|
ScidacWriter binWriter(grid->IsBoss());
|
2018-10-01 20:15:21 +01:00
|
|
|
|
2018-10-02 19:51:09 +01:00
|
|
|
if (typeHash<T>() != typeHash<TIo>())
|
2018-03-13 13:51:09 +00:00
|
|
|
{
|
2018-10-02 19:51:09 +01:00
|
|
|
if (gridIo == nullptr)
|
|
|
|
{
|
|
|
|
HADRONS_ERROR(Definition,
|
|
|
|
"I/O type different from vector type but null I/O grid passed");
|
|
|
|
}
|
|
|
|
ioBuf.reset(new TIo(gridIo));
|
|
|
|
testBuf.reset(new T(grid));
|
|
|
|
}
|
|
|
|
if (multiFile)
|
|
|
|
{
|
|
|
|
std::string fullFilename;
|
2018-04-04 16:36:37 +01:00
|
|
|
|
2018-10-02 19:51:09 +01:00
|
|
|
for(int k = 0; k < size; ++k)
|
2018-04-04 16:36:37 +01:00
|
|
|
{
|
2018-10-02 19:51:09 +01:00
|
|
|
fullFilename = filename + "/v" + std::to_string(k) + ".bin";
|
|
|
|
|
|
|
|
makeFileDir(fullFilename, grid);
|
|
|
|
binWriter.open(fullFilename);
|
|
|
|
writeHeader(binWriter, record);
|
|
|
|
writeElement(binWriter, evec[k], eval[k], k, ioBuf.get(), testBuf.get());
|
|
|
|
binWriter.close();
|
2018-04-04 16:36:37 +01:00
|
|
|
}
|
2018-05-07 17:25:36 +01:00
|
|
|
}
|
2018-10-02 19:51:09 +01:00
|
|
|
else
|
|
|
|
{
|
|
|
|
makeFileDir(filename, grid);
|
|
|
|
binWriter.open(filename);
|
|
|
|
writeHeader(binWriter, record);
|
|
|
|
for(int k = 0; k < size; ++k)
|
|
|
|
{
|
|
|
|
writeElement(binWriter, evec[k], eval[k], k, ioBuf.get(), testBuf.get());
|
|
|
|
}
|
|
|
|
binWriter.close();
|
|
|
|
}
|
2018-05-07 17:25:36 +01:00
|
|
|
}
|
2018-10-02 19:51:09 +01:00
|
|
|
}
|
2018-05-07 17:25:36 +01:00
|
|
|
|
2018-10-03 14:45:01 +01:00
|
|
|
template <typename F>
|
|
|
|
class BaseEigenPack
|
2018-10-02 19:51:09 +01:00
|
|
|
{
|
|
|
|
public:
|
2018-10-03 14:45:01 +01:00
|
|
|
typedef F Field;
|
2018-10-02 19:51:09 +01:00
|
|
|
public:
|
|
|
|
std::vector<RealD> eval;
|
|
|
|
std::vector<F> evec;
|
|
|
|
PackRecord record;
|
2018-10-03 14:45:01 +01:00
|
|
|
public:
|
|
|
|
BaseEigenPack(void) = default;
|
|
|
|
BaseEigenPack(const size_t size, GridBase *grid)
|
|
|
|
{
|
|
|
|
resize(size, grid);
|
|
|
|
}
|
|
|
|
virtual ~BaseEigenPack(void) = default;
|
|
|
|
void resize(const size_t size, GridBase *grid)
|
|
|
|
{
|
|
|
|
eval.resize(size);
|
|
|
|
evec.resize(size, grid);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template <typename F, typename FIo = F>
|
|
|
|
class EigenPack: public BaseEigenPack<F>
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
typedef F Field;
|
|
|
|
typedef FIo FieldIo;
|
2018-10-02 19:51:09 +01:00
|
|
|
public:
|
|
|
|
EigenPack(void) = default;
|
|
|
|
virtual ~EigenPack(void) = default;
|
2018-05-07 17:25:36 +01:00
|
|
|
|
2018-10-02 19:51:09 +01:00
|
|
|
EigenPack(const size_t size, GridBase *grid, GridBase *gridIo = nullptr)
|
2018-10-03 14:45:01 +01:00
|
|
|
: BaseEigenPack<F>(size, grid)
|
2018-10-02 19:51:09 +01:00
|
|
|
{
|
|
|
|
if (typeHash<F>() != typeHash<FIo>())
|
2018-05-07 17:25:36 +01:00
|
|
|
{
|
2018-10-02 19:51:09 +01:00
|
|
|
if (gridIo == nullptr)
|
|
|
|
{
|
|
|
|
HADRONS_ERROR(Definition,
|
|
|
|
"I/O type different from vector type but null I/O grid passed");
|
|
|
|
}
|
2018-03-13 13:51:09 +00:00
|
|
|
}
|
2018-10-02 19:51:09 +01:00
|
|
|
gridIo_ = gridIo;
|
|
|
|
}
|
2018-04-04 16:36:37 +01:00
|
|
|
|
2018-10-02 19:51:09 +01:00
|
|
|
virtual void read(const std::string fileStem, const bool multiFile, const int traj = -1)
|
|
|
|
{
|
2018-10-03 14:45:01 +01:00
|
|
|
EigenPackIo::readPack<F, FIo>(this->evec, this->eval, this->record,
|
|
|
|
evecFilename(fileStem, traj, multiFile),
|
|
|
|
this->evec.size(), multiFile, gridIo_);
|
|
|
|
HADRONS_DUMP_EP_METADATA(this->record);
|
2018-03-13 13:51:09 +00:00
|
|
|
}
|
2018-05-07 17:25:36 +01:00
|
|
|
|
2018-10-02 19:51:09 +01:00
|
|
|
virtual void write(const std::string fileStem, const bool multiFile, const int traj = -1)
|
|
|
|
{
|
2018-10-03 14:45:01 +01:00
|
|
|
EigenPackIo::writePack<F, FIo>(evecFilename(fileStem, traj, multiFile),
|
|
|
|
this->evec, this->eval, this->record,
|
|
|
|
this->evec.size(), multiFile, gridIo_);
|
2018-10-02 19:51:09 +01:00
|
|
|
}
|
|
|
|
protected:
|
|
|
|
std::string evecFilename(const std::string stem, const int traj, const bool multiFile)
|
2018-05-07 17:25:36 +01:00
|
|
|
{
|
2018-10-02 19:51:09 +01:00
|
|
|
std::string t = (traj < 0) ? "" : ("." + std::to_string(traj));
|
2018-05-07 17:25:36 +01:00
|
|
|
|
2018-10-02 19:51:09 +01:00
|
|
|
if (multiFile)
|
|
|
|
{
|
|
|
|
return stem + t;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return stem + t + ".bin";
|
|
|
|
}
|
2018-05-07 17:25:36 +01:00
|
|
|
}
|
2018-10-02 19:51:09 +01:00
|
|
|
protected:
|
|
|
|
GridBase *gridIo_;
|
2018-03-13 13:51:09 +00:00
|
|
|
};
|
|
|
|
|
2018-10-02 19:51:09 +01:00
|
|
|
template <typename FineF, typename CoarseF,
|
|
|
|
typename FineFIo = FineF, typename CoarseFIo = CoarseF>
|
|
|
|
class CoarseEigenPack: public EigenPack<FineF, FineFIo>
|
2018-03-13 13:51:09 +00:00
|
|
|
{
|
|
|
|
public:
|
2018-10-02 19:51:09 +01:00
|
|
|
typedef CoarseF CoarseField;
|
2018-03-14 14:54:25 +00:00
|
|
|
std::vector<CoarseF> evecCoarse;
|
2018-10-02 19:51:09 +01:00
|
|
|
std::vector<RealD> evalCoarse;
|
2018-03-13 13:51:09 +00:00
|
|
|
public:
|
|
|
|
CoarseEigenPack(void) = default;
|
|
|
|
virtual ~CoarseEigenPack(void) = default;
|
|
|
|
|
|
|
|
CoarseEigenPack(const size_t sizeFine, const size_t sizeCoarse,
|
2018-10-02 19:51:09 +01:00
|
|
|
GridBase *gridFine, GridBase *gridCoarse,
|
|
|
|
GridBase *gridFineIo = nullptr,
|
|
|
|
GridBase *gridCoarseIo = nullptr)
|
2018-03-13 13:51:09 +00:00
|
|
|
{
|
2018-10-02 19:51:09 +01:00
|
|
|
if (typeHash<FineF>() != typeHash<FineFIo>())
|
|
|
|
{
|
|
|
|
if (gridFineIo == nullptr)
|
|
|
|
{
|
|
|
|
HADRONS_ERROR(Definition,
|
|
|
|
"Fine I/O type different from vector type but null fine I/O grid passed");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (typeHash<CoarseF>() != typeHash<CoarseFIo>())
|
|
|
|
{
|
|
|
|
if (gridCoarseIo == nullptr)
|
|
|
|
{
|
|
|
|
HADRONS_ERROR(Definition,
|
|
|
|
"Coarse I/O type different from vector type but null coarse I/O grid passed");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this->gridIo_ = gridFineIo;
|
|
|
|
gridCoarseIo_ = gridCoarseIo;
|
2018-03-13 13:51:09 +00:00
|
|
|
resize(sizeFine, sizeCoarse, gridFine, gridCoarse);
|
|
|
|
}
|
|
|
|
|
|
|
|
void resize(const size_t sizeFine, const size_t sizeCoarse,
|
|
|
|
GridBase *gridFine, GridBase *gridCoarse)
|
|
|
|
{
|
2018-10-02 19:51:09 +01:00
|
|
|
EigenPack<FineF, FineFIo>::resize(sizeFine, gridFine);
|
2018-03-13 13:51:09 +00:00
|
|
|
evalCoarse.resize(sizeCoarse);
|
|
|
|
evecCoarse.resize(sizeCoarse, gridCoarse);
|
|
|
|
}
|
|
|
|
|
2018-05-07 17:25:36 +01:00
|
|
|
void readFine(const std::string fileStem, const bool multiFile, const int traj = -1)
|
2018-03-13 13:51:09 +00:00
|
|
|
{
|
2018-10-02 19:51:09 +01:00
|
|
|
EigenPack<FineF, FineFIo>::read(fileStem + "_fine", multiFile, traj);
|
2018-04-03 17:42:21 +01:00
|
|
|
}
|
|
|
|
|
2018-05-07 17:25:36 +01:00
|
|
|
void readCoarse(const std::string fileStem, const bool multiFile, const int traj = -1)
|
2018-04-03 17:42:21 +01:00
|
|
|
{
|
2018-10-02 19:51:09 +01:00
|
|
|
PackRecord dummy;
|
|
|
|
|
|
|
|
EigenPackIo::readPack<CoarseF, CoarseFIo>(evecCoarse, evalCoarse, dummy,
|
|
|
|
this->evecFilename(fileStem + "_coarse", traj, multiFile),
|
|
|
|
evecCoarse.size(), multiFile, gridCoarseIo_);
|
2018-03-13 13:51:09 +00:00
|
|
|
}
|
|
|
|
|
2018-05-07 17:25:36 +01:00
|
|
|
virtual void read(const std::string fileStem, const bool multiFile, const int traj = -1)
|
2018-04-03 17:42:21 +01:00
|
|
|
{
|
2018-05-07 17:25:36 +01:00
|
|
|
readFine(fileStem, multiFile, traj);
|
|
|
|
readCoarse(fileStem, multiFile, traj);
|
2018-04-03 17:42:21 +01:00
|
|
|
}
|
|
|
|
|
2018-05-07 17:25:36 +01:00
|
|
|
void writeFine(const std::string fileStem, const bool multiFile, const int traj = -1)
|
2018-03-13 13:51:09 +00:00
|
|
|
{
|
2018-10-02 19:51:09 +01:00
|
|
|
EigenPack<FineF, FineFIo>::write(fileStem + "_fine", multiFile, traj);
|
2018-04-03 17:42:21 +01:00
|
|
|
}
|
|
|
|
|
2018-05-07 17:25:36 +01:00
|
|
|
void writeCoarse(const std::string fileStem, const bool multiFile, const int traj = -1)
|
2018-04-03 17:42:21 +01:00
|
|
|
{
|
2018-10-02 19:51:09 +01:00
|
|
|
EigenPackIo::writePack<CoarseF, CoarseFIo>(this->evecFilename(fileStem + "_coarse", traj, multiFile),
|
|
|
|
evecCoarse, evalCoarse, this->record,
|
|
|
|
evecCoarse.size(), multiFile, gridCoarseIo_);
|
2018-03-13 13:51:09 +00:00
|
|
|
}
|
2018-04-03 17:42:21 +01:00
|
|
|
|
2018-05-07 17:25:36 +01:00
|
|
|
virtual void write(const std::string fileStem, const bool multiFile, const int traj = -1)
|
2018-04-03 17:42:21 +01:00
|
|
|
{
|
2018-05-07 17:25:36 +01:00
|
|
|
writeFine(fileStem, multiFile, traj);
|
|
|
|
writeCoarse(fileStem, multiFile, traj);
|
2018-04-03 17:42:21 +01:00
|
|
|
}
|
2018-10-02 19:51:09 +01:00
|
|
|
private:
|
|
|
|
GridBase *gridCoarseIo_;
|
2018-03-13 13:51:09 +00:00
|
|
|
};
|
|
|
|
|
2018-10-03 14:45:01 +01:00
|
|
|
template <typename FImpl>
|
|
|
|
using BaseFermionEigenPack = BaseEigenPack<typename FImpl::FermionField>;
|
|
|
|
|
2018-10-02 19:51:09 +01:00
|
|
|
template <typename FImpl, typename FImplIo = FImpl>
|
|
|
|
using FermionEigenPack = EigenPack<typename FImpl::FermionField, typename FImplIo::FermionField>;
|
2018-03-13 13:51:09 +00:00
|
|
|
|
2018-10-02 19:51:09 +01:00
|
|
|
template <typename FImpl, int nBasis, typename FImplIo = FImpl>
|
2018-03-13 13:51:09 +00:00
|
|
|
using CoarseFermionEigenPack = CoarseEigenPack<
|
|
|
|
typename FImpl::FermionField,
|
|
|
|
typename LocalCoherenceLanczos<typename FImpl::SiteSpinor,
|
|
|
|
typename FImpl::SiteComplex,
|
2018-10-02 19:51:09 +01:00
|
|
|
nBasis>::CoarseField,
|
|
|
|
typename FImplIo::FermionField,
|
|
|
|
typename LocalCoherenceLanczos<typename FImplIo::SiteSpinor,
|
|
|
|
typename FImplIo::SiteComplex,
|
2018-03-13 13:51:09 +00:00
|
|
|
nBasis>::CoarseField>;
|
|
|
|
|
2018-10-01 20:15:21 +01:00
|
|
|
#undef HADRONS_DUMP_EP_METADATA
|
|
|
|
|
2018-03-13 13:51:09 +00:00
|
|
|
END_HADRONS_NAMESPACE
|
|
|
|
|
|
|
|
#endif // Hadrons_EigenPack_hpp_
|