Commit e48aa70d authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Implemented serial i/o reads

parent 1330a303
......@@ -359,7 +359,7 @@ int main(int argc, char *argv[]) {
read_ic_parallel(ICfileName, dim, &parts, &Ngas, &periodic, myrank, nr_nodes,
MPI_COMM_WORLD, MPI_INFO_NULL);
#else
read_ic_serial(ICfileName, dim, &parts, &Ngas, &periodic, myrank, nr_nodes,
read_ic_serial(ICfileName, dim, &parts, &gparts, &Ngas, &Ngpart, &periodic, myrank, nr_nodes,
MPI_COMM_WORLD, MPI_INFO_NULL);
#endif
#else
......
......@@ -70,6 +70,9 @@ enum PARTICLE_TYPE {
NUM_PARTICLE_TYPES
};
#define FILENAME_BUFFER_SIZE 150
#define PARTICLE_GROUP_BUFFER_SIZE 20
hid_t hdf5Type(enum DATA_TYPE type);
size_t sizeOfType(enum DATA_TYPE type);
......
......@@ -390,6 +390,9 @@ void writeArrayBackEnd(hid_t grp, char* fileName, FILE* xmfFile, char* name,
/* Import the right hydro definition */
#include "hydro_io.h"
/* Import the right gravity definition */
#include "gravity_io.h"
/**
* @brief Reads an HDF5 initial condition file (GADGET-3 type)
......@@ -499,7 +502,7 @@ void read_ic_serial(char* fileName, double dim[3], struct part** parts,
bzero(*parts, *Ngas * sizeof(struct part));
/* Allocate memory to store all particles */
Ndm = N[1];
const size_t Ndm = N[1];
*Ngparts = N[1] + N[0];
if (posix_memalign((void*)gparts, gpart_align, *Ngparts * sizeof(struct gpart)) != 0)
error("Error while allocating memory for gravity particles");
......
......@@ -32,7 +32,8 @@
#if defined(HAVE_HDF5) && defined(WITH_MPI) && !defined(HAVE_PARALLEL_HDF5)
void read_ic_serial(char* fileName, double dim[3], struct part** parts,
size_t* N, int* periodic, int mpi_rank, int mpi_size,
struct gpart** gparts, size_t* Ngas, size_t* Ngparts,
int* periodic, int mpi_rank, int mpi_size,
MPI_Comm comm, MPI_Info info);
void write_output_serial(struct engine* e, struct UnitSystem* us, int mpi_rank,
......
......@@ -39,9 +39,6 @@
#include "common_io.h"
#include "error.h"
#define FILENAME_BUFFER_SIZE 150
#define PARTICLE_GROUP_BUFFER_SIZE 20
/*-----------------------------------------------------------------------------
* Routines reading an IC file
*-----------------------------------------------------------------------------*/
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment