Got rid of remaining manual allocations, moved some variable declarations to where they are needed
This commit is contained in:
parent
aef0f26878
commit
d9ed8e5131
8 changed files with 67 additions and 90 deletions
8
io.cpp
8
io.cpp
|
|
@ -146,7 +146,7 @@ void h5_read(const std::string file_name, int *step_num, int *N, double *t, doub
|
|||
#endif
|
||||
}
|
||||
|
||||
void h5_write(const std::string file_name, const int step_num, const int N, const double t, std::vector<double> &m, std::vector<double3> &x, std::vector<double3> &v, const std::vector<double> &pot, const double3 *acc, const double3 *jrk, const int extra_mode=0, const bool use_double_precision=true)
|
||||
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)
|
||||
{
|
||||
#ifdef HAS_HDF5
|
||||
hid_t file_id, group_id, attribute_id, dataspace_id;
|
||||
|
|
@ -174,7 +174,7 @@ void h5_write(const std::string file_name, const int step_num, const int N, cons
|
|||
H5Sclose(dataspace_id);
|
||||
};
|
||||
|
||||
write_dataset("MASS", 1, m.data());
|
||||
write_dataset("MASS", 1, (double*)m.data()); // casting away const...
|
||||
write_dataset("X", 2, (double*)x.data());
|
||||
write_dataset("V", 2, (double*)v.data());
|
||||
|
||||
|
|
@ -182,8 +182,8 @@ void h5_write(const std::string file_name, const int step_num, const int N, cons
|
|||
bool write_acc = (extra_mode >> 1) & 1;
|
||||
bool write_jrk = (extra_mode >> 2) & 1;
|
||||
if (write_pot) write_dataset("POT", 1, (double*)pot.data());
|
||||
if (write_acc) write_dataset("ACC", 2, (double*)acc);
|
||||
if (write_jrk) write_dataset("JRK", 2, (double*)jrk);
|
||||
if (write_acc) write_dataset("ACC", 2, (double*)acc.data());
|
||||
if (write_jrk) write_dataset("JRK", 2, (double*)jrk.data());
|
||||
|
||||
H5Gclose(group_id);
|
||||
H5Fclose(file_id);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue