1
0
mirror of https://github.com/paboyle/Grid.git synced 2025-06-13 04:37:05 +01:00

Hadrons: disk-based container

This commit is contained in:
2018-09-07 20:04:54 +01:00
parent 2bf3be5fae
commit 12c7c493bf
4 changed files with 353 additions and 1 deletions

View File

@ -1,3 +1,3 @@
AM_LDFLAGS += -L../../extras/Hadrons
AM_LDFLAGS += -L../../Hadrons
include Make.inc

View File

@ -0,0 +1,58 @@
#define DV_DEBUG
#include <Hadrons/DiskVector.hpp>
using namespace Grid;
using namespace Grid::QCD;
using namespace Grid::Hadrons;
GRID_SERIALIZABLE_ENUM(Enum, undef, red, 1, blue, 2, green, 3);
class Object: Serializable {
public:
GRID_SERIALIZABLE_CLASS_MEMBERS(Object,
Enum, e,
SpinColourMatrix, scm);
};
#ifdef HAVE_HDF5
typedef Hdf5Reader TestReader;
typedef Hdf5Writer TestWriter;
#else
typedef BinaryReader TestReader;
typedef BinaryWriter TestWriter;
#endif
int main(int argc, char *argv[])
{
Grid_init(&argc, &argv);
GridSerialRNG rng;
Object obj, v2w, v2r, v13w, v13r;
SerializableDiskVector<Object, TestReader, TestWriter> v("diskvector_test", 1000, 2);
obj.e = Enum::red;
random(rng, obj.scm);
v[32] = obj;
random(rng, obj.scm);
v[2] = obj;
v2w = obj;
random(rng, obj.scm);
v[6] = obj;
random(rng, obj.scm);
v[12] = obj;
random(rng, obj.scm);
v[13] = obj;
v13w = obj;
v2r = v[2];
LOG(Message) << "v[2] correct? "
<< ((v2r == v2w) ? "yes" : "no" ) << std::endl;
v13r = v[13];
LOG(Message) << "v[13] correct? "
<< ((v13r == v13w) ? "yes" : "no" ) << std::endl;
Grid_finalize();
return EXIT_SUCCESS;
}