mirror of
				https://github.com/paboyle/Grid.git
				synced 2025-11-04 05:54:32 +00:00 
			
		
		
		
	Hdf5Type does not need to be a pointer anymore
This commit is contained in:
		@@ -12,7 +12,7 @@ Hdf5Writer::Hdf5Writer(const std::string &fileName)
 | 
			
		||||
{
 | 
			
		||||
  group_ = file_.openGroup("/");
 | 
			
		||||
  writeSingleAttribute(dataSetThres_, HDF5_GRID_GUARD "dataset_threshold",
 | 
			
		||||
                       *Hdf5Type<unsigned int>::type());
 | 
			
		||||
                       Hdf5Type<unsigned int>::type());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Hdf5Writer::push(const std::string &s)
 | 
			
		||||
@@ -62,7 +62,7 @@ Hdf5Reader::Hdf5Reader(const std::string &fileName)
 | 
			
		||||
{
 | 
			
		||||
  group_ = file_.openGroup("/");
 | 
			
		||||
  readSingleAttribute(dataSetThres_, HDF5_GRID_GUARD "dataset_threshold",
 | 
			
		||||
                      *Hdf5Type<unsigned int>::type());
 | 
			
		||||
                      Hdf5Type<unsigned int>::type());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Hdf5Reader::push(const std::string &s)
 | 
			
		||||
 
 | 
			
		||||
@@ -92,7 +92,7 @@ namespace Grid
 | 
			
		||||
  template <typename U>
 | 
			
		||||
  void Hdf5Writer::writeDefault(const std::string &s, const U &x)
 | 
			
		||||
  {
 | 
			
		||||
    writeSingleAttribute(x, s, *Hdf5Type<U>::type());
 | 
			
		||||
    writeSingleAttribute(x, s, Hdf5Type<U>::type());
 | 
			
		||||
  }
 | 
			
		||||
  
 | 
			
		||||
  template <>
 | 
			
		||||
@@ -122,7 +122,7 @@ namespace Grid
 | 
			
		||||
    {
 | 
			
		||||
      H5NS::DataSet dataSet;
 | 
			
		||||
      
 | 
			
		||||
      dataSet = group_.createDataSet(s, *Hdf5Type<Element>::type(), dataSpace);
 | 
			
		||||
      dataSet = group_.createDataSet(s, Hdf5Type<Element>::type(), dataSpace);
 | 
			
		||||
      dataSet.write(flatx.data(), *Hdf5Type<Element>::type());
 | 
			
		||||
    }
 | 
			
		||||
    else
 | 
			
		||||
@@ -140,7 +140,7 @@ namespace Grid
 | 
			
		||||
  {
 | 
			
		||||
    push(s);
 | 
			
		||||
    writeSingleAttribute(x.size(), HDF5_GRID_GUARD "vector_size",
 | 
			
		||||
                         *Hdf5Type<uint64_t>::type());
 | 
			
		||||
                         Hdf5Type<uint64_t>::type());
 | 
			
		||||
    for (hsize_t i = 0; i < x.size(); ++i)
 | 
			
		||||
    {
 | 
			
		||||
      write(s + "_" + std::to_string(i), x[i]);
 | 
			
		||||
@@ -162,7 +162,7 @@ namespace Grid
 | 
			
		||||
  template <typename U>
 | 
			
		||||
  void Hdf5Reader::readDefault(const std::string &s, U &output)
 | 
			
		||||
  {
 | 
			
		||||
    readSingleAttribute(output, s, *Hdf5Type<U>::type());
 | 
			
		||||
    readSingleAttribute(output, s, Hdf5Type<U>::type());
 | 
			
		||||
  }
 | 
			
		||||
  
 | 
			
		||||
  template <>
 | 
			
		||||
@@ -210,14 +210,14 @@ namespace Grid
 | 
			
		||||
      H5NS::DataSet dataSet;
 | 
			
		||||
      
 | 
			
		||||
      dataSet = group_.openDataSet(s);
 | 
			
		||||
      dataSet.read(buf.data(), *Hdf5Type<Element>::type());
 | 
			
		||||
      dataSet.read(buf.data(), Hdf5Type<Element>::type());
 | 
			
		||||
    }
 | 
			
		||||
    else
 | 
			
		||||
    {
 | 
			
		||||
      H5NS::Attribute attribute;
 | 
			
		||||
      
 | 
			
		||||
      attribute = group_.openAttribute(s);
 | 
			
		||||
      attribute.read(*Hdf5Type<Element>::type(), buf.data());
 | 
			
		||||
      attribute.read(Hdf5Type<Element>::type(), buf.data());
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    // reconstruct the multidimensional vector
 | 
			
		||||
@@ -234,7 +234,7 @@ namespace Grid
 | 
			
		||||
    
 | 
			
		||||
    push(s);
 | 
			
		||||
    readSingleAttribute(size, HDF5_GRID_GUARD "vector_size",
 | 
			
		||||
                        *Hdf5Type<uint64_t>::type());
 | 
			
		||||
                        Hdf5Type<uint64_t>::type());
 | 
			
		||||
    x.resize(size);
 | 
			
		||||
    for (hsize_t i = 0; i < x.size(); ++i)
 | 
			
		||||
    {
 | 
			
		||||
 
 | 
			
		||||
@@ -12,9 +12,9 @@
 | 
			
		||||
template <>\
 | 
			
		||||
struct Hdf5Type<cType>\
 | 
			
		||||
{\
 | 
			
		||||
static inline const H5NS::PredType *type(void)\
 | 
			
		||||
static inline const H5NS::PredType & type(void)\
 | 
			
		||||
{\
 | 
			
		||||
  return &H5NS::PredType::predType;\
 | 
			
		||||
  return H5NS::PredType::predType;\
 | 
			
		||||
}\
 | 
			
		||||
static constexpr bool       isNative = true;\
 | 
			
		||||
};
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user