1
0
mirror of https://github.com/paboyle/Grid.git synced 2024-11-10 07:55:35 +00:00

Hadrons: better metadata for eigenpack

This commit is contained in:
Antonin Portelli 2018-04-06 19:29:53 +01:00
parent f117552334
commit 6b7228b3e6
4 changed files with 25 additions and 20 deletions

View File

@ -44,11 +44,9 @@ class EigenPack
{
public:
typedef F Field;
struct PackRecord: Serializable
struct PackRecord
{
GRID_SERIALIZABLE_CLASS_MEMBERS(PackRecord,
std::string, operatorPar,
std::string, solverPar);
std::string operatorXml, solverXml;
};
struct VecRecord: Serializable
{
@ -116,7 +114,7 @@ protected:
ScidacReader binReader;
binReader.open(filename);
binReader.readScidacFileRecord(evec[0]._grid, record);
binReader.skipPastObjectRecord(SCIDAC_FILE_XML);
for(int k = 0; k < size; ++k)
{
VecRecord vecRecord;
@ -136,10 +134,13 @@ protected:
void basicWrite(const std::string filename, std::vector<T> &evec,
const unsigned int size)
{
ScidacWriter binWriter(evec[0]._grid->IsBoss());
ScidacWriter binWriter(evec[0]._grid->IsBoss());
XmlWriter xmlWriter("", "");
xmlWriter.pushXmlString(record.operatorXml);
xmlWriter.pushXmlString(record.solverXml);
binWriter.writeLimeObject(1, 1, xmlWriter, "parameters", SCIDAC_FILE_XML);
binWriter.open(filename);
binWriter.writeScidacFileRecord(evec[0]._grid, record);
for(int k = 0; k < size; ++k)
{
VecRecord vecRecord;

View File

@ -256,11 +256,11 @@ void Module<P>::saveParameters(XmlWriter &writer, const std::string name)
template <typename P>
std::string Module<P>::parString(void) const
{
std::ostringstream s;
XmlWriter writer("", "");
s << par();
write(writer, par_.SerialisableClassName(), par_);
return s.str();
return writer.string();
}
template <typename P>

View File

@ -148,8 +148,8 @@ void TLocalCoherenceLanczos<FImpl, nBasis>::execute(void)
auto &coarsePar = par().coarseParams;
auto &epack = envGetDerived(BasePack, CoarsePack, getName());
epack.record.operatorPar = vm().getModule(par().action)->parString();
epack.record.solverPar = parString();
epack.record.operatorXml = vm().getModule(par().action)->parString();
epack.record.solverXml = parString();
envGetTmp(LCL, solver);
LOG(Message) << "Performing fine grid IRL -- Nstop= "
<< finePar.Nstop << ", Nk= " << finePar.Nk << ", Nm= "

View File

@ -320,16 +320,11 @@ class GridLimeWriter : public BinaryIO
////////////////////////////////////////////
// Write a generic serialisable object
////////////////////////////////////////////
template<class serialisable_object>
void writeLimeObject(int MB,int ME,serialisable_object &object,std::string object_name,std::string record_name)
void writeLimeObject(int MB,int ME,XmlWriter &writer,std::string object_name,std::string record_name)
{
if ( boss_node ) {
std::string xmlstring;
{
XmlWriter WR("","");
write(WR,object_name,object);
xmlstring = WR.docString();
}
std::string xmlstring = writer.docString();
// std::cout << "WriteLimeObject" << record_name <<std::endl;
uint64_t nbytes = xmlstring.size();
// std::cout << " xmlstring "<< nbytes<< " " << xmlstring <<std::endl;
@ -343,6 +338,15 @@ class GridLimeWriter : public BinaryIO
limeDestroyHeader(h);
}
}
template<class serialisable_object>
void writeLimeObject(int MB,int ME,serialisable_object &object,std::string object_name,std::string record_name)
{
XmlWriter WR("","");
write(WR,object_name,object);
writeLimeObject(MB, ME, WR, object_name, record_name);
}
////////////////////////////////////////////////////
// Write a generic lattice field and csum
// This routine is Collectively called by all nodes