*/
template <typename T>
T
- attr(const std::string attr_name);
+ attr(const std::string &attr_name);
/**
* Writes an attribute. `T` can be `float`, `double`, `std::complex<float>`,
*/
template <typename T>
void
- write_attr(const std::string attr_name, const T value);
+ write_attr(const std::string &attr_name, const T value);
const std::string name;
protected:
// Open dataset
- DataSet(const std::string name, const hid_t &parent_group_id, bool mpi);
+ DataSet(const std::string &name, const hid_t &parent_group_id, bool mpi);
// Create dataset
- DataSet(const std::string name,
- const hid_t & parent_group_id,
- std::vector<hsize_t> dimensions,
- std::shared_ptr<hid_t> t_type,
- bool mpi);
+ DataSet(const std::string & name,
+ const hid_t & parent_group_id,
+ const std::vector<hsize_t> &dimensions,
+ std::shared_ptr<hid_t> t_type,
+ const bool mpi);
public:
/**
*/
template <typename number>
std::vector<number>
- read_selection(const std::vector<hsize_t> coordinates);
+ read_selection(const std::vector<hsize_t> &coordinates);
/**
* Reads a hyperslab from the dataset. The parameters are summarized
*/
template <typename number>
void
- write_selection(const std::vector<number> &data,
- const std::vector<hsize_t> coordinates);
+ write_selection(const std::vector<number> & data,
+ const std::vector<hsize_t> &coordinates);
/**
* Writes a data hyperslab to the dataset. The parameters are summarized
open
};
- Group(const std::string name,
- const Group & parent_group,
- const bool mpi,
- const Mode mode);
+ Group(const std::string &name,
+ const Group & parent_group,
+ const bool mpi,
+ const Mode mode);
// This constructor is used by File
- Group(const std::string name, const bool mpi);
+ Group(const std::string &name, const bool mpi);
public:
/**
* Opens a group.
*/
Group
- group(const std::string name);
+ group(const std::string &name);
/**
* Creates a group.
*/
Group
- create_group(const std::string name);
+ create_group(const std::string &name);
/**
* Opens a dataset.
*/
DataSet
- dataset(const std::string name);
+ dataset(const std::string &name);
/**
* Creates a dataset. Number can be `float`, `double`,
*/
template <typename number>
DataSet
- create_dataset(const std::string name,
- const std::vector<hsize_t> dimensions) const;
+ create_dataset(const std::string & name,
+ const std::vector<hsize_t> &dimensions) const;
/**
* Creates and writes data to a dataset. Number can be `float`, `double`,
*/
template <template <class...> class Container, typename number>
void
- write_dataset(const std::string name, const Container<number> &data) const;
+ write_dataset(const std::string &name, const Container<number> &data) const;
};
/**
};
private:
- File(const std::string name,
- const bool mpi,
- const MPI_Comm mpi_communicator,
- const Mode mode);
+ File(const std::string &name,
+ const bool mpi,
+ const MPI_Comm mpi_communicator,
+ const Mode mode);
public:
/**
* Creates or opens a hdf5 file in parallel.
*/
- File(const std::string name,
- const MPI_Comm mpi_communicator,
- const Mode mode = Mode::create);
+ File(const std::string &name,
+ const MPI_Comm mpi_communicator,
+ const Mode mode = Mode::create);
/**
* Creates or opens a hdf5 file.
*/
- File(const std::string name, const Mode mode = Mode::create);
+ File(const std::string &name, const Mode mode = Mode::create);
};
} // namespace HDF5
template <typename T>
T
- HDF5Object::attr(const std::string attr_name)
+ HDF5Object::attr(const std::string &attr_name)
{
std::shared_ptr<hid_t> t_type = internal::get_hdf5_datatype<T>();
T value;
template <>
bool
- HDF5Object::attr(const std::string attr_name)
+ HDF5Object::attr(const std::string &attr_name)
{
// The enum field generated by h5py can be casted to int
int int_value;
template <>
std::string
- HDF5Object::attr(const std::string attr_name)
+ HDF5Object::attr(const std::string &attr_name)
{
// Reads a UTF8 variable string
//
template <typename T>
void
- HDF5Object::write_attr(const std::string attr_name, const T value)
+ HDF5Object::write_attr(const std::string &attr_name, const T value)
{
hid_t attr;
hid_t aid;
template <>
void
- HDF5Object::write_attr(const std::string attr_name, const std::string value)
+ HDF5Object::write_attr(const std::string &attr_name, const std::string value)
{
// Writes a UTF8 variable string
//
Assert(ret >= 0, ExcMessage("Error at H5Aclose"));
}
- DataSet::DataSet(const std::string name,
- const hid_t & parent_group_id,
- const bool mpi)
+ DataSet::DataSet(const std::string &name,
+ const hid_t & parent_group_id,
+ const bool mpi)
: HDF5Object(name, mpi)
, _query_io_mode(false)
, _io_mode(H5D_MPIO_NO_COLLECTIVE)
}
}
- DataSet::DataSet(const std::string name,
- const hid_t & parent_group_id,
- std::vector<hsize_t> dimensions,
- std::shared_ptr<hid_t> t_type,
- const bool mpi)
+ DataSet::DataSet(const std::string & name,
+ const hid_t & parent_group_id,
+ const std::vector<hsize_t> &dimensions,
+ std::shared_ptr<hid_t> t_type,
+ const bool mpi)
: HDF5Object(name, mpi)
, _rank(dimensions.size())
, _dimensions(dimensions)
template <typename number>
std::vector<number>
- DataSet::read_selection(const std::vector<hsize_t> coordinates)
+ DataSet::read_selection(const std::vector<hsize_t> &coordinates)
{
Assert(coordinates.size() % _rank == 0,
ExcMessage(
template <typename number>
void
- DataSet::write_selection(const std::vector<number> &data,
- const std::vector<hsize_t> coordinates)
+ DataSet::write_selection(const std::vector<number> & data,
+ const std::vector<hsize_t> &coordinates)
{
AssertDimension(coordinates.size(), data.size() * _rank);
std::shared_ptr<hid_t> t_type = internal::get_hdf5_datatype<number>();
return _rank;
}
- Group::Group(const std::string name,
- const Group & parentGroup,
- const bool mpi,
- const Mode mode)
+ Group::Group(const std::string &name,
+ const Group & parentGroup,
+ const bool mpi,
+ const Mode mode)
: HDF5Object(name, mpi)
{
hdf5_reference = std::shared_ptr<hid_t>(new hid_t, [](auto pointer) {
}
}
- Group::Group(const std::string name, const bool mpi)
+ Group::Group(const std::string &name, const bool mpi)
: HDF5Object(name, mpi)
{}
Group
- Group::group(const std::string name)
+ Group::group(const std::string &name)
{
return Group(name, *this, mpi, Mode::open);
}
Group
- Group::create_group(const std::string name)
+ Group::create_group(const std::string &name)
{
return Group(name, *this, mpi, Mode::create);
}
DataSet
- Group::dataset(const std::string name)
+ Group::dataset(const std::string &name)
{
return DataSet(name, *hdf5_reference, mpi);
}
template <typename number>
DataSet
- Group::create_dataset(const std::string name,
- const std::vector<hsize_t> dimensions) const
+ Group::create_dataset(const std::string & name,
+ const std::vector<hsize_t> &dimensions) const
{
std::shared_ptr<hid_t> t_type = internal::get_hdf5_datatype<number>();
return DataSet(name, *hdf5_reference, dimensions, t_type, mpi);
template <template <class...> class Container, typename number>
void
- Group::write_dataset(const std::string name,
+ Group::write_dataset(const std::string & name,
const Container<number> &data) const
{
std::vector<hsize_t> dimensions = internal::get_container_dimensions(data);
dataset.write(data);
}
- File::File(const std::string name,
- const bool mpi,
- const MPI_Comm mpi_communicator,
- const Mode mode)
+ File::File(const std::string &name,
+ const bool mpi,
+ const MPI_Comm mpi_communicator,
+ const Mode mode)
: Group(name, mpi)
{
hdf5_reference = std::shared_ptr<hid_t>(new hid_t, [](auto pointer) {
}
}
- File::File(const std::string name,
- const MPI_Comm mpi_communicator,
- const Mode mode)
+ File::File(const std::string &name,
+ const MPI_Comm mpi_communicator,
+ const Mode mode)
: File(name, true, mpi_communicator, mode)
{}
- File::File(const std::string name, const Mode mode)
+ File::File(const std::string &name, const Mode mode)
: File(name, false, MPI_COMM_NULL, mode)
{}
// std::complex<float> and std::complex<double> in hdf5.inst
template int
- HDF5Object::attr<int>(const std::string attr_name);
+ HDF5Object::attr<int>(const std::string &attr_name);
template unsigned int
- HDF5Object::attr<unsigned int>(const std::string attr_name);
+ HDF5Object::attr<unsigned int>(const std::string &attr_name);
// The specializations of HDF5Object::attr<std::string>
// and HDF5Object::attr<bool> have been defined above
template void
- HDF5Object::write_attr<int>(const std::string attr_name, int value);
+ HDF5Object::write_attr<int>(const std::string &attr_name, int value);
template void
- HDF5Object::write_attr<unsigned int>(const std::string attr_name,
- unsigned int value);
+ HDF5Object::write_attr<unsigned int>(const std::string &attr_name,
+ unsigned int value);
template std::vector<int>
DataSet::read<std::vector, int>();
DataSet::read<std::vector, unsigned int>();
template std::vector<int>
- DataSet::read_selection<int>(const std::vector<hsize_t> coordinates);
+ DataSet::read_selection<int>(const std::vector<hsize_t> &coordinates);
template std::vector<unsigned int>
- DataSet::read_selection<unsigned int>(const std::vector<hsize_t> coordinates);
+ DataSet::read_selection<unsigned int>(
+ const std::vector<hsize_t> &coordinates);
template std::vector<int>
DataSet::read_hyperslab<std::vector, int>(const std::vector<hsize_t> &offset,
const std::vector<unsigned int> &data);
template void
- DataSet::write_selection<int>(const std::vector<int> & data,
- const std::vector<hsize_t> coordinates);
+ DataSet::write_selection<int>(const std::vector<int> & data,
+ const std::vector<hsize_t> &coordinates);
template void
DataSet::write_selection<unsigned int>(
const std::vector<unsigned int> &data,
- const std::vector<hsize_t> coordinates);
+ const std::vector<hsize_t> & coordinates);
template void
DataSet::write_hyperslab<std::vector, int>(const std::vector<int> & data,
DataSet::write_none<unsigned int>();
template DataSet
- Group::create_dataset<int>(const std::string name,
- const std::vector<hsize_t> dimensions) const;
+ Group::create_dataset<int>(const std::string & name,
+ const std::vector<hsize_t> &dimensions) const;
template DataSet
Group::create_dataset<unsigned int>(
- const std::string name,
- const std::vector<hsize_t> dimensions) const;
+ const std::string & name,
+ const std::vector<hsize_t> &dimensions) const;
template void
- Group::write_dataset<std::vector, int>(const std::string name,
+ Group::write_dataset<std::vector, int>(const std::string & name,
const std::vector<int> &data) const;
template void
Group::write_dataset<std::vector, unsigned int>(
- const std::string name,
+ const std::string & name,
const std::vector<unsigned int> &data) const;
# endif // DOXYGEN
for (number : REAL_AND_COMPLEX_SCALARS)
{
- template number HDF5Object::attr<number>(const std::string attr_name);
- template void HDF5Object::write_attr<number>(const std::string attr_name,
- number value);
+ template number HDF5Object::attr<number>(const std::string &attr_name);
+ template void HDF5Object::write_attr<number>(const std::string &attr_name,
+ number value);
template std::vector<number> DataSet::read<std::vector, number>();
template Vector<number> DataSet::read<Vector, number>();
template FullMatrix<number> DataSet::read<FullMatrix, number>();
template std::vector<number> DataSet::read_selection<number>(
- const std::vector<hsize_t> coordinates);
+ const std::vector<hsize_t> &coordinates);
template std::vector<number> DataSet::read_hyperslab<std::vector, number>(
const std::vector<hsize_t> &offset, const std::vector<hsize_t> &count);
const FullMatrix<number> &data);
template void DataSet::write_selection<number>(
- const std::vector<number> &data, const std::vector<hsize_t> coordinates);
+ const std::vector<number> &data, const std::vector<hsize_t> &coordinates);
template void DataSet::write_hyperslab<std::vector, number>(
const std::vector<number> & data,
template void DataSet::write_none<number>();
template DataSet Group::create_dataset<number>(
- const std::string name, const std::vector<hsize_t> dimensions) const;
+ const std::string &name, const std::vector<hsize_t> &dimensions) const;
template void Group::write_dataset<std::vector, number>(
- const std::string name, const std::vector<number> &data) const;
+ const std::string &name, const std::vector<number> &data) const;
template void Group::write_dataset<Vector, number>(
- const std::string name, const Vector<number> &data) const;
+ const std::string &name, const Vector<number> &data) const;
template void Group::write_dataset<FullMatrix, number>(
- const std::string name, const FullMatrix<number> &data) const;
+ const std::string &name, const FullMatrix<number> &data) const;
}