mirror of
https://github.com/paboyle/Grid.git
synced 2025-04-09 13:40:46 +01:00
Hadrons: new layer in eigenpacks class hierarchy
This commit is contained in:
parent
52569d98d8
commit
5a3e83ff7b
@ -224,21 +224,41 @@ namespace EigenPackIo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename F, typename FIo = F>
|
template <typename F>
|
||||||
class EigenPack
|
class BaseEigenPack
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef F Field;
|
typedef F Field;
|
||||||
typedef FIo FieldIo;
|
|
||||||
public:
|
public:
|
||||||
std::vector<RealD> eval;
|
std::vector<RealD> eval;
|
||||||
std::vector<F> evec;
|
std::vector<F> evec;
|
||||||
PackRecord record;
|
PackRecord record;
|
||||||
|
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;
|
||||||
public:
|
public:
|
||||||
EigenPack(void) = default;
|
EigenPack(void) = default;
|
||||||
virtual ~EigenPack(void) = default;
|
virtual ~EigenPack(void) = default;
|
||||||
|
|
||||||
EigenPack(const size_t size, GridBase *grid, GridBase *gridIo = nullptr)
|
EigenPack(const size_t size, GridBase *grid, GridBase *gridIo = nullptr)
|
||||||
|
: BaseEigenPack<F>(size, grid)
|
||||||
{
|
{
|
||||||
if (typeHash<F>() != typeHash<FIo>())
|
if (typeHash<F>() != typeHash<FIo>())
|
||||||
{
|
{
|
||||||
@ -249,24 +269,21 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
gridIo_ = gridIo;
|
gridIo_ = gridIo;
|
||||||
resize(size, grid);
|
|
||||||
}
|
|
||||||
|
|
||||||
void resize(const size_t size, GridBase *grid)
|
|
||||||
{
|
|
||||||
eval.resize(size);
|
|
||||||
evec.resize(size, grid);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void read(const std::string fileStem, const bool multiFile, const int traj = -1)
|
virtual void read(const std::string fileStem, const bool multiFile, const int traj = -1)
|
||||||
{
|
{
|
||||||
EigenPackIo::readPack<F, FIo>(evec, eval, record, evecFilename(fileStem, traj, multiFile), evec.size(), multiFile, gridIo_);
|
EigenPackIo::readPack<F, FIo>(this->evec, this->eval, this->record,
|
||||||
HADRONS_DUMP_EP_METADATA(record);
|
evecFilename(fileStem, traj, multiFile),
|
||||||
|
this->evec.size(), multiFile, gridIo_);
|
||||||
|
HADRONS_DUMP_EP_METADATA(this->record);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void write(const std::string fileStem, const bool multiFile, const int traj = -1)
|
virtual void write(const std::string fileStem, const bool multiFile, const int traj = -1)
|
||||||
{
|
{
|
||||||
EigenPackIo::writePack<F, FIo>(evecFilename(fileStem, traj, multiFile), evec, eval, record, evec.size(), multiFile, gridIo_);
|
EigenPackIo::writePack<F, FIo>(evecFilename(fileStem, traj, multiFile),
|
||||||
|
this->evec, this->eval, this->record,
|
||||||
|
this->evec.size(), multiFile, gridIo_);
|
||||||
}
|
}
|
||||||
protected:
|
protected:
|
||||||
std::string evecFilename(const std::string stem, const int traj, const bool multiFile)
|
std::string evecFilename(const std::string stem, const int traj, const bool multiFile)
|
||||||
@ -282,8 +299,6 @@ protected:
|
|||||||
return stem + t + ".bin";
|
return stem + t + ".bin";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
GridBase *gridIo_;
|
GridBase *gridIo_;
|
||||||
};
|
};
|
||||||
@ -375,6 +390,9 @@ private:
|
|||||||
GridBase *gridCoarseIo_;
|
GridBase *gridCoarseIo_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <typename FImpl>
|
||||||
|
using BaseFermionEigenPack = BaseEigenPack<typename FImpl::FermionField>;
|
||||||
|
|
||||||
template <typename FImpl, typename FImplIo = FImpl>
|
template <typename FImpl, typename FImplIo = FImpl>
|
||||||
using FermionEigenPack = EigenPack<typename FImpl::FermionField, typename FImplIo::FermionField>;
|
using FermionEigenPack = EigenPack<typename FImpl::FermionField, typename FImplIo::FermionField>;
|
||||||
|
|
||||||
|
@ -54,9 +54,9 @@ template <typename Pack>
|
|||||||
class TLoadEigenPack: public Module<LoadEigenPackPar>
|
class TLoadEigenPack: public Module<LoadEigenPackPar>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef typename Pack::Field Field;
|
typedef typename Pack::Field Field;
|
||||||
typedef typename Pack::FieldIo FieldIo;
|
typedef typename Pack::FieldIo FieldIo;
|
||||||
typedef EigenPack<Field, FieldIo> BasePack;
|
typedef BaseEigenPack<Field> BasePack;
|
||||||
public:
|
public:
|
||||||
// constructor
|
// constructor
|
||||||
TLoadEigenPack(const std::string name);
|
TLoadEigenPack(const std::string name);
|
||||||
|
@ -32,5 +32,5 @@ using namespace Grid;
|
|||||||
using namespace Hadrons;
|
using namespace Hadrons;
|
||||||
using namespace MSolver;
|
using namespace MSolver;
|
||||||
|
|
||||||
template class Grid::Hadrons::MSolver::TA2AVectors<FIMPL, FermionEigenPack<FIMPL>>;
|
template class Grid::Hadrons::MSolver::TA2AVectors<FIMPL, BaseFermionEigenPack<FIMPL>>;
|
||||||
template class Grid::Hadrons::MSolver::TA2AVectors<ZFIMPL, FermionEigenPack<ZFIMPL>>;
|
template class Grid::Hadrons::MSolver::TA2AVectors<ZFIMPL, BaseFermionEigenPack<ZFIMPL>>;
|
||||||
|
@ -79,9 +79,9 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
MODULE_REGISTER_TMP(A2AVectors,
|
MODULE_REGISTER_TMP(A2AVectors,
|
||||||
ARG(TA2AVectors<FIMPL, FermionEigenPack<FIMPL>>), MSolver);
|
ARG(TA2AVectors<FIMPL, BaseFermionEigenPack<FIMPL>>), MSolver);
|
||||||
MODULE_REGISTER_TMP(ZA2AVectors,
|
MODULE_REGISTER_TMP(ZA2AVectors,
|
||||||
ARG(TA2AVectors<ZFIMPL, FermionEigenPack<ZFIMPL>>), MSolver);
|
ARG(TA2AVectors<ZFIMPL, BaseFermionEigenPack<ZFIMPL>>), MSolver);
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* TA2AVectors implementation *
|
* TA2AVectors implementation *
|
||||||
|
@ -39,7 +39,7 @@ std::shared_ptr<LinearFunction<typename FImpl::FermionField>>
|
|||||||
makeGuesser(const std::string epackName)
|
makeGuesser(const std::string epackName)
|
||||||
{
|
{
|
||||||
typedef typename FImpl::FermionField FermionField;
|
typedef typename FImpl::FermionField FermionField;
|
||||||
typedef FermionEigenPack<FImpl> EPack;
|
typedef BaseFermionEigenPack<FImpl> EPack;
|
||||||
typedef CoarseFermionEigenPack<FImpl, nBasis> CoarseEPack;
|
typedef CoarseFermionEigenPack<FImpl, nBasis> CoarseEPack;
|
||||||
typedef DeflatedGuesser<FermionField> FineGuesser;
|
typedef DeflatedGuesser<FermionField> FineGuesser;
|
||||||
typedef LocalCoherenceDeflatedGuesser<
|
typedef LocalCoherenceDeflatedGuesser<
|
||||||
|
@ -63,7 +63,7 @@ public:
|
|||||||
typedef LocalCoherenceLanczos<typename FImpl::SiteSpinor,
|
typedef LocalCoherenceLanczos<typename FImpl::SiteSpinor,
|
||||||
typename FImpl::SiteComplex,
|
typename FImpl::SiteComplex,
|
||||||
nBasis> LCL;
|
nBasis> LCL;
|
||||||
typedef FermionEigenPack<FImpl> BasePack;
|
typedef BaseFermionEigenPack<FImpl> BasePack;
|
||||||
typedef CoarseFermionEigenPack<FImpl, nBasis> CoarsePack;
|
typedef CoarseFermionEigenPack<FImpl, nBasis> CoarsePack;
|
||||||
typedef HADRONS_DEFAULT_SCHUR_OP<FMat, FermionField> SchurFMat;
|
typedef HADRONS_DEFAULT_SCHUR_OP<FMat, FermionField> SchurFMat;
|
||||||
public:
|
public:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user