3
0
mirror of https://github.com/triqs/dft_tools synced 2024-12-27 06:43:40 +01:00
dft_tools/doc/reference/arrays/examples_h5/h5_stack_ex.cpp
tayral edd1ff4529 Restructuring documentation.
A first general restructuration of the doc according to the pattern [tour|tutorial|reference].
In the reference part, objects are documented per topic.
In each topic, [definition|c++|python|hdf5] (not yet implemented)
2014-10-18 12:21:08 +01:00

24 lines
617 B
C++

#include <triqs/arrays/array.hpp>
#include <triqs/arrays/h5/array_stack.hpp>
namespace tqa=triqs::arrays; namespace h5=tqa::h5;
int main() {
const size_t N = 100, bufsize = 5;
h5::H5File file("ess.h5", H5F_ACC_TRUNC); // open a file
tqa::array<double,2> A(3,2); // an array of the shape of the base of the stack
h5::array_stack< tqa::array<double,2> > S(file, "my_stack", A.shape(), bufsize);
for (int u = 0; u< N ; ++u) { // fill the stack for a while...
A() = (u+1)* 20;
S << A;
// S() = A; ++S; // equivalent
}
S.flush(); // useless at the end...
}