Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-25 09:16:36

0001 /*
0002  *  Copyright (c), 2017, Adrien Devresse <adrien.devresse@epfl.ch>
0003  *
0004  *  Distributed under the Boost Software License, Version 1.0.
0005  *    (See accompanying file LICENSE_1_0.txt or copy at
0006  *          http://www.boost.org/LICENSE_1_0.txt)
0007  *
0008  */
0009 #pragma once
0010 
0011 #include <algorithm>
0012 #include <functional>
0013 #include <numeric>
0014 #include <sstream>
0015 #include <string>
0016 
0017 #include <H5Ppublic.h>
0018 
0019 #include "h5d_wrapper.hpp"
0020 #include "H5Utils.hpp"
0021 
0022 namespace HighFive {
0023 
0024 inline uint64_t DataSet::getStorageSize() const {
0025     if (!this->isValid()) {
0026         throw DataSetException("Invalid call to `DataSet::getStorageSize` for invalid object");
0027     }
0028 
0029     return detail::h5d_get_storage_size(_hid);
0030 }
0031 
0032 inline DataType DataSet::getDataType() const {
0033     return DataType(detail::h5d_get_type(_hid));
0034 }
0035 
0036 inline DataSpace DataSet::getSpace() const {
0037     DataSpace space;
0038     space._hid = detail::h5d_get_space(_hid);
0039     return space;
0040 }
0041 
0042 inline DataSpace DataSet::getMemSpace() const {
0043     return getSpace();
0044 }
0045 
0046 inline uint64_t DataSet::getOffset() const {
0047     return static_cast<uint64_t>(detail::h5d_get_offset(_hid));
0048 }
0049 
0050 inline void DataSet::resize(const std::vector<size_t>& dims) {
0051     const size_t numDimensions = getSpace().getDimensions().size();
0052     if (dims.size() != numDimensions) {
0053         HDF5ErrMapper::ToException<DataSetException>("Invalid dataspace dimensions, got " +
0054                                                      std::to_string(dims.size()) + " expected " +
0055                                                      std::to_string(numDimensions));
0056     }
0057 
0058     std::vector<hsize_t> real_dims(dims.begin(), dims.end());
0059     detail::h5d_set_extent(getId(), real_dims.data());
0060 }
0061 
0062 #if H5_VERSION_GE(1, 10, 0)
0063 inline void DataSet::flush() {
0064     detail::h5d_flush(_hid);
0065 }
0066 #endif
0067 
0068 #if H5_VERSION_GE(1, 10, 2)
0069 inline void DataSet::refresh() {
0070     detail::h5d_refresh(_hid);
0071 }
0072 #endif
0073 
0074 }  // namespace HighFive