Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-04-19 08:55:33

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     return detail::h5d_get_storage_size(_hid);
0026 }
0027 
0028 inline DataType DataSet::getDataType() const {
0029     return DataType(detail::h5d_get_type(_hid));
0030 }
0031 
0032 inline DataSpace DataSet::getSpace() const {
0033     DataSpace space;
0034     space._hid = detail::h5d_get_space(_hid);
0035     return space;
0036 }
0037 
0038 inline DataSpace DataSet::getMemSpace() const {
0039     return getSpace();
0040 }
0041 
0042 inline uint64_t DataSet::getOffset() const {
0043     return static_cast<uint64_t>(detail::h5d_get_offset(_hid));
0044 }
0045 
0046 inline void DataSet::resize(const std::vector<size_t>& dims) {
0047     const size_t numDimensions = getSpace().getDimensions().size();
0048     if (dims.size() != numDimensions) {
0049         HDF5ErrMapper::ToException<DataSetException>("Invalid dataspace dimensions, got " +
0050                                                      std::to_string(dims.size()) + " expected " +
0051                                                      std::to_string(numDimensions));
0052     }
0053 
0054     std::vector<hsize_t> real_dims(dims.begin(), dims.end());
0055     detail::h5d_set_extent(getId(), real_dims.data());
0056 }
0057 
0058 }  // namespace HighFive