32 bool okay = hd.
create(
"test_read_partial.hdf");
37 for (
int i = 0; i < 3; i++)
39 for (
int j = 0; j < 4; j++)
41 allData(i, j) = i + j * 0.1;
42 allData_cplx(i, j) = std::complex<float>(i, j * 0.1);
46 hd.
write(allData,
"matrix");
48 const auto& const_allData_cplx = allData_cplx;
49 hd.
write(const_allData_cplx,
"matrix_cplx_float");
53 okay = hd2.
open(
"test_read_partial.hdf");
57 std::vector<int> datashape;
64 okay = hd2.
getShape<std::complex<float>>(
"matrix_cplx_float", datashape);
71 okay = hd2.
getShape<
float>(
"matrix_cplx_float", datashape);
84 std::array<size_t, 2> dims_unused;
87 std::array<size_t, 2> dims_local;
90 std::array<size_t, 2> offsets;
95 hd2.
read(pxy1,
"matrix");
96 for (
int i = 0; i < 4; i++)
98 CHECK(outbuffer1(0, i) == Approx(allData(1, i)));
106 hd2.
read(pxy2,
"matrix");
107 for (
int i = 0; i < 3; i++)
108 CHECK(outbuffer2(i, 0) == Approx(allData(i, 2)));
119 hd2.
read(pxy3,
"matrix");
120 CHECK(outbuffer3(0, 0) == Approx(allData(2, 0)));
128 hd2.
read(pxy4,
"matrix");
131 for (
int i = 0; i < 3; i++)
132 CHECK(outbuffer2(i, 0) == Approx(allData(i, 2)));
135 std::vector<double> locob1;
138 std::array<int, 2> readSpec{1, -1};
141 for (
int i = 0; i < 4; i++)
143 CHECK(locob1[i] == Approx(allData(1, i)));
149 for (
int i = 0; i < 3; i++)
151 CHECK(locob2.
data()[i] == Approx(allData(i, 2)));
152 CHECK(locob2(i) == Approx(allData(i, 2)));
158 CHECK(locob3.
data()[0] == Approx(allData(2, 0)));
void write(T &data, const std::string &aname)
write the data to the group aname and check status runtime error is issued on I/O error ...
bool open(const std::filesystem::path &fname, unsigned flags=H5F_ACC_RDWR)
open a file
helper functions for EinsplineSetBuilder
class to use file space hyperslab with a serialized container
TEST_CASE("complex_helper", "[type_traits]")
void close()
close all the open groups and file
void readSlabSelection(T &data, const std::array< IT, RANK > &readSpec, const std::string &aname)
read a portion of the data from the group aname and check status runtime error is issued on I/O error...
bool getShape(const std::string &aname, std::vector< int > &sizes_out)
read the shape of multidimensional filespace from the group aname this function can be used to query ...
REQUIRE(std::filesystem::exists(filename))
Declaraton of Vector<T,Alloc> Manage memory through Alloc directly and allow referencing an existing ...
bool create(const std::filesystem::path &fname, unsigned flags=H5F_ACC_TRUNC)
create a file
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
void read(T &data, const std::string &aname)
read the data from the group aname and check status runtime error is issued on I/O error ...