forked from BlueBrain/HighFive
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathboost_multiarray_complex.cpp
More file actions
31 lines (25 loc) · 880 Bytes
/
Copy pathboost_multiarray_complex.cpp
File metadata and controls
31 lines (25 loc) · 880 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/*
* Copyright (c), 2020 Blue Brain Project - EPFL
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
*
*/
#include <algorithm>
#include <complex>
#undef H5_USE_BOOST
#define H5_USE_BOOST
#include <boost/multi_array.hpp>
#include <highfive/H5DataSet.hpp>
#include <highfive/H5DataSpace.hpp>
#include <highfive/H5File.hpp>
typedef std::complex<double> complex_t;
int main() {
boost::multi_array<complex_t, 4> multi_array(boost::extents[3][2][1][1]);
std::fill_n(multi_array.origin(), multi_array.num_elements(), 1.0);
multi_array[1][1][0][0] = complex_t{1.1, 1.2};
HighFive::File file("multi_array_complex.h5", HighFive::File::Truncate);
HighFive::DataSet dataset = file.createDataSet("multi_array", multi_array);
return 0;
}