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

Merge branch 'develop' into feature/hadrons

# Conflicts:
#	lib/qcd/action/fermion/FermionOperator.h
This commit is contained in:
2018-04-20 17:15:21 +01:00
13 changed files with 307 additions and 13 deletions

View File

@ -55,6 +55,11 @@ void Hdf5Writer::writeDefault(const std::string &s, const char *x)
writeDefault(s, sx);
}
Group & Hdf5Writer::getGroup(void)
{
return group_;
}
// Reader implementation ///////////////////////////////////////////////////////
Hdf5Reader::Hdf5Reader(const std::string &fileName)
: fileName_(fileName)
@ -103,3 +108,8 @@ void Hdf5Reader::readDefault(const std::string &s, std::string &x)
x.resize(strType.getSize());
attribute.read(strType, &(x[0]));
}
Group & Hdf5Reader::getGroup(void)
{
return group_;
}

View File

@ -38,6 +38,7 @@ namespace Grid
template <typename U>
typename std::enable_if<!element<std::vector<U>>::is_number, void>::type
writeDefault(const std::string &s, const std::vector<U> &x);
H5NS::Group & getGroup(void);
private:
template <typename U>
void writeSingleAttribute(const U &x, const std::string &name,
@ -65,6 +66,7 @@ namespace Grid
template <typename U>
typename std::enable_if<!element<std::vector<U>>::is_number, void>::type
readDefault(const std::string &s, std::vector<U> &x);
H5NS::Group & getGroup(void);
private:
template <typename U>
void readSingleAttribute(U &x, const std::string &name,

View File

@ -78,6 +78,48 @@ namespace Grid {
typedef typename std::vector<std::vector<typename TensorToVec<T>::type>> type;
};
template <typename T>
void tensorDim(std::vector<size_t> &dim, const T &t, const bool wipe = true)
{
if (wipe)
{
dim.clear();
}
}
template <typename T>
void tensorDim(std::vector<size_t> &dim, const iScalar<T> &t, const bool wipe = true)
{
if (wipe)
{
dim.clear();
}
tensorDim(dim, t._internal, false);
}
template <typename T, int N>
void tensorDim(std::vector<size_t> &dim, const iVector<T, N> &t, const bool wipe = true)
{
if (wipe)
{
dim.clear();
}
dim.push_back(N);
tensorDim(dim, t._internal[0], false);
}
template <typename T, int N>
void tensorDim(std::vector<size_t> &dim, const iMatrix<T, N> &t, const bool wipe = true)
{
if (wipe)
{
dim.clear();
}
dim.push_back(N);
dim.push_back(N);
tensorDim(dim, t._internal[0][0], false);
}
template <typename T>
typename TensorToVec<T>::type tensorToVec(const T &t)
{