Completed HDF5 support

This commit is contained in:
Yohai Meiron 2020-03-31 19:04:18 -04:00
parent b2943be7c1
commit 5cb4282be4
8 changed files with 258 additions and 185 deletions

16
io.h Normal file
View file

@ -0,0 +1,16 @@
#pragma once
#include <string>
#include "double3.h"
bool is_hdf5(std::string file_name);
// This function is implemented independently of the HDF5 library
void ascii_read(const std::string file_name, int *step_num, int *N, double *t, double *m, double3 *x, double3 *v);
void ascii_write(const std::string file_name, const int step_num, const int N, const double t, const double *m, const double3 *x, const double3 *v, int precision=10);
void h5_read(const std::string file_name, int *step_num, int *N, double *t, double m[], double3 x[], double3 v[]);
// In case the code is compiled without HDF5 support, the implementation of this function just throws an error
void h5_write(const std::string file_name, const int step_num, const int N, const double t, const double *m, const double3 *x, const double3 *v, const double *pot, const double3 *acc, const double3 *jrk, const int write_mode=0, const bool use_double_precision=true);
// In case the code is compiled without HDF5 support, the implementation of this function just throws an error