mirror of
https://github.com/paboyle/Grid.git
synced 2025-04-28 06:35:55 +01:00
C++ emacs happy
This commit is contained in:
parent
dda151250f
commit
ab1068044e
@ -23,7 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
See the full license in the file "LICENSE" in the top level distribution
|
See the full license in the file "LICENSE" in the top level distribution
|
||||||
directory
|
directory
|
||||||
*************************************************************************************/
|
*************************************************************************************/
|
||||||
/* END LEGAL */
|
/* END LEGAL */
|
||||||
#ifndef GRID_ILDG_IO_H
|
#ifndef GRID_ILDG_IO_H
|
||||||
#define GRID_ILDG_IO_H
|
#define GRID_ILDG_IO_H
|
||||||
|
|
||||||
@ -38,29 +38,28 @@ directory
|
|||||||
#include <sys/utsname.h>
|
#include <sys/utsname.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
//C-Lime is a must have for this functionality
|
//C-Lime is a must have for this functionality
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include "lime.h"
|
#include "lime.h"
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Grid {
|
NAMESPACE_BEGIN(Grid);
|
||||||
namespace QCD {
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Encode word types as strings
|
// Encode word types as strings
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
template<class word> inline std::string ScidacWordMnemonic(void){ return std::string("unknown"); }
|
template<class word> inline std::string ScidacWordMnemonic(void){ return std::string("unknown"); }
|
||||||
template<> inline std::string ScidacWordMnemonic<double> (void){ return std::string("D"); }
|
template<> inline std::string ScidacWordMnemonic<double> (void){ return std::string("D"); }
|
||||||
template<> inline std::string ScidacWordMnemonic<float> (void){ return std::string("F"); }
|
template<> inline std::string ScidacWordMnemonic<float> (void){ return std::string("F"); }
|
||||||
template<> inline std::string ScidacWordMnemonic< int32_t>(void){ return std::string("I32_t"); }
|
template<> inline std::string ScidacWordMnemonic< int32_t>(void){ return std::string("I32_t"); }
|
||||||
template<> inline std::string ScidacWordMnemonic<uint32_t>(void){ return std::string("U32_t"); }
|
template<> inline std::string ScidacWordMnemonic<uint32_t>(void){ return std::string("U32_t"); }
|
||||||
template<> inline std::string ScidacWordMnemonic< int64_t>(void){ return std::string("I64_t"); }
|
template<> inline std::string ScidacWordMnemonic< int64_t>(void){ return std::string("I64_t"); }
|
||||||
template<> inline std::string ScidacWordMnemonic<uint64_t>(void){ return std::string("U64_t"); }
|
template<> inline std::string ScidacWordMnemonic<uint64_t>(void){ return std::string("U64_t"); }
|
||||||
|
|
||||||
/////////////////////////////////////////
|
/////////////////////////////////////////
|
||||||
// Encode a generic tensor as a string
|
// Encode a generic tensor as a string
|
||||||
/////////////////////////////////////////
|
/////////////////////////////////////////
|
||||||
template<class vobj> std::string ScidacRecordTypeString(int &colors, int &spins, int & typesize,int &datacount) {
|
template<class vobj> std::string ScidacRecordTypeString(int &colors, int &spins, int & typesize,int &datacount) {
|
||||||
|
|
||||||
typedef typename getPrecision<vobj>::real_scalar_type stype;
|
typedef typename getPrecision<vobj>::real_scalar_type stype;
|
||||||
|
|
||||||
@ -109,21 +108,21 @@ namespace QCD {
|
|||||||
datacount = _LorentzN;
|
datacount = _LorentzN;
|
||||||
|
|
||||||
return stream.str();
|
return stream.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class vobj> std::string ScidacRecordTypeString(Lattice<vobj> & lat,int &colors, int &spins, int & typesize,int &datacount) {
|
template<class vobj> std::string ScidacRecordTypeString(Lattice<vobj> & lat,int &colors, int &spins, int & typesize,int &datacount) {
|
||||||
return ScidacRecordTypeString<vobj>(colors,spins,typesize,datacount);
|
return ScidacRecordTypeString<vobj>(colors,spins,typesize,datacount);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Helper to fill out metadata
|
// Helper to fill out metadata
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
template<class vobj> void ScidacMetaData(Lattice<vobj> & field,
|
template<class vobj> void ScidacMetaData(Lattice<vobj> & field,
|
||||||
FieldMetaData &header,
|
FieldMetaData &header,
|
||||||
scidacRecord & _scidacRecord,
|
scidacRecord & _scidacRecord,
|
||||||
scidacFile & _scidacFile)
|
scidacFile & _scidacFile)
|
||||||
{
|
{
|
||||||
typedef typename getPrecision<vobj>::real_scalar_type stype;
|
typedef typename getPrecision<vobj>::real_scalar_type stype;
|
||||||
|
|
||||||
/////////////////////////////////////
|
/////////////////////////////////////
|
||||||
@ -148,25 +147,25 @@ namespace QCD {
|
|||||||
_scidacRecord = sr;
|
_scidacRecord = sr;
|
||||||
|
|
||||||
// std::cout << GridLogMessage << "Build SciDAC datatype " <<sr.datatype<<std::endl;
|
// std::cout << GridLogMessage << "Build SciDAC datatype " <<sr.datatype<<std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////
|
||||||
// Scidac checksum
|
// Scidac checksum
|
||||||
///////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////
|
||||||
static int scidacChecksumVerify(scidacChecksum &scidacChecksum_,uint32_t scidac_csuma,uint32_t scidac_csumb)
|
static int scidacChecksumVerify(scidacChecksum &scidacChecksum_,uint32_t scidac_csuma,uint32_t scidac_csumb)
|
||||||
{
|
{
|
||||||
uint32_t scidac_checksuma = stoull(scidacChecksum_.suma,0,16);
|
uint32_t scidac_checksuma = stoull(scidacChecksum_.suma,0,16);
|
||||||
uint32_t scidac_checksumb = stoull(scidacChecksum_.sumb,0,16);
|
uint32_t scidac_checksumb = stoull(scidacChecksum_.sumb,0,16);
|
||||||
if ( scidac_csuma !=scidac_checksuma) return 0;
|
if ( scidac_csuma !=scidac_checksuma) return 0;
|
||||||
if ( scidac_csumb !=scidac_checksumb) return 0;
|
if ( scidac_csumb !=scidac_checksumb) return 0;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Lime, ILDG and Scidac I/O classes
|
// Lime, ILDG and Scidac I/O classes
|
||||||
////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////
|
||||||
class GridLimeReader : public BinaryIO {
|
class GridLimeReader : public BinaryIO {
|
||||||
public:
|
public:
|
||||||
///////////////////////////////////////////////////
|
///////////////////////////////////////////////////
|
||||||
// FIXME: format for RNG? Now just binary out instead
|
// FIXME: format for RNG? Now just binary out instead
|
||||||
///////////////////////////////////////////////////
|
///////////////////////////////////////////////////
|
||||||
@ -273,7 +272,7 @@ class GridLimeReader : public BinaryIO {
|
|||||||
};
|
};
|
||||||
|
|
||||||
class GridLimeWriter : public BinaryIO {
|
class GridLimeWriter : public BinaryIO {
|
||||||
public:
|
public:
|
||||||
///////////////////////////////////////////////////
|
///////////////////////////////////////////////////
|
||||||
// FIXME: format for RNG? Now just binary out instead
|
// FIXME: format for RNG? Now just binary out instead
|
||||||
// FIXME: collective calls or not ?
|
// FIXME: collective calls or not ?
|
||||||
@ -386,7 +385,7 @@ class GridLimeWriter : public BinaryIO {
|
|||||||
};
|
};
|
||||||
|
|
||||||
class ScidacWriter : public GridLimeWriter {
|
class ScidacWriter : public GridLimeWriter {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
template<class SerialisableUserFile>
|
template<class SerialisableUserFile>
|
||||||
void writeScidacFileRecord(GridBase *grid,SerialisableUserFile &_userFile)
|
void writeScidacFileRecord(GridBase *grid,SerialisableUserFile &_userFile)
|
||||||
@ -424,7 +423,7 @@ class ScidacWriter : public GridLimeWriter {
|
|||||||
|
|
||||||
|
|
||||||
class ScidacReader : public GridLimeReader {
|
class ScidacReader : public GridLimeReader {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
template<class SerialisableUserFile>
|
template<class SerialisableUserFile>
|
||||||
void readScidacFileRecord(GridBase *grid,SerialisableUserFile &_userFile)
|
void readScidacFileRecord(GridBase *grid,SerialisableUserFile &_userFile)
|
||||||
@ -483,7 +482,7 @@ class ScidacReader : public GridLimeReader {
|
|||||||
|
|
||||||
|
|
||||||
class IldgWriter : public ScidacWriter {
|
class IldgWriter : public ScidacWriter {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
///////////////////////////////////
|
///////////////////////////////////
|
||||||
// A little helper
|
// A little helper
|
||||||
@ -573,7 +572,7 @@ class IldgWriter : public ScidacWriter {
|
|||||||
};
|
};
|
||||||
|
|
||||||
class IldgReader : public GridLimeReader {
|
class IldgReader : public GridLimeReader {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////
|
||||||
// Read either Grid/SciDAC/ILDG configuration
|
// Read either Grid/SciDAC/ILDG configuration
|
||||||
@ -788,9 +787,9 @@ class IldgReader : public GridLimeReader {
|
|||||||
std::cout << GridLogMessage<<"Plaquette and link trace match " << std::endl;
|
std::cout << GridLogMessage<<"Plaquette and link trace match " << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}}
|
NAMESPACE_END(Grid);
|
||||||
|
|
||||||
//HAVE_LIME
|
//HAVE_LIME
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user