Fixed memory issue with reading of HDF5 input file and improved style
This commit is contained in:
parent
b6c55a30da
commit
8adb4ac813
5 changed files with 63 additions and 44 deletions
12
io.h
12
io.h
|
|
@ -1,15 +1,23 @@
|
|||
#pragma once
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "double3.h"
|
||||
|
||||
struct Input_data {
|
||||
int N, step_num;
|
||||
double t;
|
||||
std::vector<double> m;
|
||||
std::vector<double3> x, v;
|
||||
};
|
||||
|
||||
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, std::vector<double> &m, std::vector<double3> &x, std::vector<double3> &v);
|
||||
Input_data ascii_read(const std::string &file_name);
|
||||
|
||||
void ascii_write(const std::string file_name, const int step_num, const int N, const double t, const std::vector<double> &m, const std::vector<double3> &x, const std::vector<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[]);
|
||||
Input_data h5_read(const std::string &file_name);
|
||||
// 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 std::vector<double> &m, const std::vector<double3> &x, const std::vector<double3> &v, const std::vector<double> &pot, const std::vector<double3> &acc, const std::vector<double3> &jrk, const int extra_mode=0, const bool use_double_precision=true);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue