mirror of
https://github.com/paboyle/Grid.git
synced 2025-04-09 21:50:45 +01:00
Grid tensor serialisation
This commit is contained in:
parent
971c2379bd
commit
c49be8988b
@ -5,6 +5,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <H5Cpp.h>
|
#include <H5Cpp.h>
|
||||||
|
#include <Grid/tensors/Tensors.h>
|
||||||
#include "Hdf5Type.h"
|
#include "Hdf5Type.h"
|
||||||
|
|
||||||
#ifndef H5_NO_NAMESPACE
|
#ifndef H5_NO_NAMESPACE
|
||||||
@ -37,6 +38,12 @@ namespace Grid
|
|||||||
template <typename U>
|
template <typename U>
|
||||||
typename std::enable_if<!element<std::vector<U>>::is_number, void>::type
|
typename std::enable_if<!element<std::vector<U>>::is_number, void>::type
|
||||||
writeDefault(const std::string &s, const std::vector<U> &x);
|
writeDefault(const std::string &s, const std::vector<U> &x);
|
||||||
|
template <typename T>
|
||||||
|
void writeDefault(const std::string &s, const iScalar<T> &t);
|
||||||
|
template <typename T, int N>
|
||||||
|
void writeDefault(const std::string &s, const iVector<T, N> &t);
|
||||||
|
template <typename T, int N>
|
||||||
|
void writeDefault(const std::string &s, const iMatrix<T, N> &t);
|
||||||
private:
|
private:
|
||||||
template <typename U>
|
template <typename U>
|
||||||
void writeSingleAttribute(const U &x, const std::string &name,
|
void writeSingleAttribute(const U &x, const std::string &name,
|
||||||
@ -147,6 +154,24 @@ namespace Grid
|
|||||||
}
|
}
|
||||||
pop();
|
pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
void Hdf5Writer::writeDefault(const std::string &s, const iScalar<T> &t)
|
||||||
|
{
|
||||||
|
writeDefault(s, tensorToVec(t));
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T, int N>
|
||||||
|
void Hdf5Writer::writeDefault(const std::string &s, const iVector<T, N> &t)
|
||||||
|
{
|
||||||
|
writeDefault(s, tensorToVec(t));
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T, int N>
|
||||||
|
void Hdf5Writer::writeDefault(const std::string &s, const iMatrix<T, N> &t)
|
||||||
|
{
|
||||||
|
writeDefault(s, tensorToVec(t));
|
||||||
|
}
|
||||||
|
|
||||||
// Reader template implementation ////////////////////////////////////////////
|
// Reader template implementation ////////////////////////////////////////////
|
||||||
template <typename U>
|
template <typename U>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user