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
16
phigrape.cpp
16
phigrape.cpp
|
|
@ -276,19 +276,23 @@ int main(int argc, char *argv[])
|
|||
/* Print the Rank and the names of processors */
|
||||
printf("Rank of the processor %03d on %s \n", myRank, processor_name);
|
||||
|
||||
int diskstep, N;
|
||||
double time_cur;
|
||||
std::vector<double> m;
|
||||
std::vector<double3> x, v;
|
||||
Input_data input_data;
|
||||
if (is_hdf5(config.input_file_name)) {
|
||||
#ifndef HAS_HDF5
|
||||
fprintf(stderr, "ERROR: input file is in HDF5 format, but the code was compiled without HDF5 support\n");
|
||||
return -1;
|
||||
#endif
|
||||
h5_read(config.input_file_name, &diskstep, &N, &time_cur, m.data(), x.data(), v.data());
|
||||
input_data = h5_read(config.input_file_name);
|
||||
}
|
||||
else
|
||||
ascii_read(config.input_file_name, diskstep, N, time_cur, m, x, v);
|
||||
input_data = ascii_read(config.input_file_name);
|
||||
|
||||
int N = input_data.N;
|
||||
int diskstep = input_data.step_num;
|
||||
double time_cur = input_data.t;
|
||||
auto &m = input_data.m;
|
||||
auto &x = input_data.x;
|
||||
auto &v = input_data.v;
|
||||
|
||||
if (myRank == rootRank) {
|
||||
printf("\n");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue