|
16 | 16 | #include "io/load_particle.hpp" |
17 | 17 | #include "io/vtk_save.h" |
18 | 18 | #include "io/vtu_save.h" |
| 19 | +#include "io/hdf5_save.h" |
19 | 20 | #include <fstream> |
20 | 21 | #include <iostream> |
21 | 22 | #include <omp.h> |
22 | 23 | #include <string> |
23 | 24 | #include <vector> |
24 | 25 |
|
| 26 | +using next::OutputFormat; |
| 27 | + |
25 | 28 | int main(int argc, char **argv) { |
26 | 29 | auto args = next::parse_arguments(argc, argv); |
27 | 30 |
|
@@ -62,21 +65,33 @@ _ _ ________ _________ |
62 | 65 | Step(particles, dtAdaptive); |
63 | 66 | simTime += dtAdaptive; |
64 | 67 |
|
65 | | - if (simTime >= nextDump) { |
66 | | - std::string out = |
67 | | - "dump_" + std::to_string(step) + (args.use_vtu ? ".vtu" : ".vtk"); |
| 68 | + if (simTime >= nextDump) { |
| 69 | + std::string out = "dump_" + std::to_string(step); |
68 | 70 |
|
69 | | - if (args.use_vtu) |
70 | | - SaveVTU(particles, out); |
71 | | - else |
72 | | - SaveVTK(particles, out); |
| 71 | + switch (args.format) { |
| 72 | + case OutputFormat::VTK: |
| 73 | + out += ".vtk"; |
| 74 | + SaveVTK(particles, out); |
| 75 | + break; |
73 | 76 |
|
74 | | - std::cout << "[Dump " << step << "] " << "t = " << simTime |
75 | | - << ", file: " << out << "\n"; |
| 77 | + case OutputFormat::VTU: |
| 78 | + out += ".vtu"; |
| 79 | + SaveVTU(particles, out); |
| 80 | + break; |
| 81 | + |
| 82 | + case OutputFormat::HDF5: |
| 83 | + out += ".hdf5"; |
| 84 | + SaveHDF5(particles, out); |
| 85 | + break; |
| 86 | + } |
| 87 | + |
| 88 | + std::cout << "[Dump " << step << "] t = " << simTime |
| 89 | + << ", file: " << out << "\n"; |
| 90 | + |
| 91 | + nextDump += args.dump_interval; |
| 92 | + step++; |
| 93 | + } |
76 | 94 |
|
77 | | - nextDump += args.dump_interval; |
78 | | - step++; |
79 | | - } |
80 | 95 |
|
81 | 96 | if (std::cin.rdbuf()->in_avail() > 0) { |
82 | 97 | std::cin >> command; |
|
0 commit comments