1
0
mirror of https://github.com/paboyle/Grid.git synced 2025-04-10 14:10:46 +01:00

Hadrons: eigenvalue metadata saved with 16 significant digits

This commit is contained in:
Antonin Portelli 2018-05-07 21:37:03 +01:00
parent 54d789204f
commit 899f961d0d
3 changed files with 14 additions and 49 deletions

View File

@ -204,7 +204,7 @@ protected:
vecRecord.index = index;
vecRecord.eval = eval;
LOG(Message) << "Writing eigenvector " << index << std::endl;
binWriter.writeScidacFieldRecord(evec, vecRecord);
binWriter.writeScidacFieldRecord(evec, vecRecord, DEFAULT_ASCII_PREC);
binWriter.close();
}
};
@ -237,18 +237,6 @@ public:
void readFine(const std::string fileStem, const bool multiFile, const int traj = -1)
{
// std::string evecFineFilename, evalFineFilename;
// std::string evecCoarseFilename, evalCoarseFilename;
// this->makeFilenames(evecFineFilename, evalFineFilename,
// fileStem + "_fine", traj);
// XmlReader xmlFineReader(evalFineFilename);
// LOG(Message) << "Reading " << this->eval.size() << " fine eigenvalues from '"
// << evalFineFilename << "'" << std::endl;
// Grid::read(xmlFineReader, "evals", this->eval);
// LOG(Message) << "Reading " << this->evec.size() << " fine eigenvectors from '"
// << evecFineFilename << "'" << std::endl;
// this->basicRead(this->evec, evecFineFilename, this->evec.size());
if (multiFile)
{
for(int k = 0; k < this->evec.size(); ++k)
@ -264,17 +252,6 @@ public:
void readCoarse(const std::string fileStem, const bool multiFile, const int traj = -1)
{
// std::string evecCoarseFilename, evalCoarseFilename;
// this->makeFilenames(evecCoarseFilename, evalCoarseFilename,
// fileStem + "_coarse", traj);
// XmlReader xmlCoarseReader(evalCoarseFilename);
// LOG(Message) << "Reading " << evalCoarse.size() << " coarse eigenvalues from '"
// << evalCoarseFilename << "'" << std::endl;
// Grid::read(xmlCoarseReader, "evals", evalCoarse);
// LOG(Message) << "Reading " << evecCoarse.size() << " coarse eigenvectors from '"
// << evecCoarseFilename << "'" << std::endl;
// this->basicRead(evecCoarse, evecCoarseFilename, evecCoarse.size());
if (multiFile)
{
for(int k = 0; k < evecCoarse.size(); ++k)
@ -296,17 +273,6 @@ public:
void writeFine(const std::string fileStem, const bool multiFile, const int traj = -1)
{
// std::string evecFineFilename, evalFineFilename;
// this->makeFilenames(evecFineFilename, evalFineFilename,
// fileStem + "_fine", traj);
// XmlWriter xmlFineWriter(evalFineFilename);
// LOG(Message) << "Writing " << this->eval.size() << " fine eigenvalues to '"
// << evalFineFilename << "'" << std::endl;
// Grid::write(xmlFineWriter, "evals", this->eval);
// LOG(Message) << "Writing " << this->evec.size() << " fine eigenvectors to '"
// << evecFineFilename << "'" << std::endl;
// this->basicWrite(evecFineFilename, this->evec, this->evec.size());
if (multiFile)
{
for(int k = 0; k < this->evec.size(); ++k)
@ -322,17 +288,6 @@ public:
void writeCoarse(const std::string fileStem, const bool multiFile, const int traj = -1)
{
// std::string evecCoarseFilename, evalCoarseFilename;
// this->makeFilenames(evecCoarseFilename, evalCoarseFilename,
// fileStem + "_coarse", traj);
// XmlWriter xmlCoarseWriter(evalCoarseFilename);
// LOG(Message) << "Writing " << evalCoarse.size() << " coarse eigenvalues to '"
// << evalCoarseFilename << "'" << std::endl;
// Grid::write(xmlCoarseWriter, "evals", evalCoarse);
// LOG(Message) << "Writing " << evecCoarse.size() << " coarse eigenvectors to '"
// << evecCoarseFilename << "'" << std::endl;
// this->basicWrite(evecCoarseFilename, evecCoarse, evecCoarse.size());
if (multiFile)
{
for(int k = 0; k < evecCoarse.size(); ++k)

View File

@ -39,6 +39,10 @@ See the full license in the file "LICENSE" in the top level distribution directo
#define SITE_SIZE_TYPE size_t
#endif
#ifndef DEFAULT_ASCII_PREC
#define DEFAULT_ASCII_PREC 16
#endif
#define BEGIN_HADRONS_NAMESPACE \
namespace Grid {\
using namespace QCD;\

View File

@ -340,10 +340,15 @@ class GridLimeWriter : public BinaryIO
}
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,serialisable_object &object,std::string object_name,std::string record_name, const unsigned int scientificPrec = 0)
{
XmlWriter WR("","");
if (scientificPrec)
{
WR.scientificFormat(true);
WR.setPrecision(scientificPrec);
}
write(WR,object_name,object);
writeLimeObject(MB, ME, WR, object_name, record_name);
}
@ -453,7 +458,8 @@ class ScidacWriter : public GridLimeWriter {
// Write generic lattice field in scidac format
////////////////////////////////////////////////
template <class vobj, class userRecord>
void writeScidacFieldRecord(Lattice<vobj> &field,userRecord _userRecord)
void writeScidacFieldRecord(Lattice<vobj> &field,userRecord _userRecord,
const unsigned int recordScientificPrec = 0)
{
GridBase * grid = field._grid;
@ -471,7 +477,7 @@ class ScidacWriter : public GridLimeWriter {
//////////////////////////////////////////////
if ( this->boss_node ) {
writeLimeObject(1,0,header ,std::string("FieldMetaData"),std::string(GRID_FORMAT)); // Open message
writeLimeObject(0,0,_userRecord,_userRecord.SerialisableClassName(),std::string(SCIDAC_RECORD_XML));
writeLimeObject(0,0,_userRecord,_userRecord.SerialisableClassName(),std::string(SCIDAC_RECORD_XML), recordScientificPrec);
writeLimeObject(0,0,_scidacRecord,_scidacRecord.SerialisableClassName(),std::string(SCIDAC_PRIVATE_RECORD_XML));
}
// Collective call