Commit 6d91f7a0 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Pedro's comments

parent aaa1618b
......@@ -58,8 +58,9 @@
int main(int argc, char *argv[]) {
int c, icount, j, k, Ngas = 0, Ngpart = 0, periodic = 1;
long long N_total[2] = {0};
int c, icount, periodic = 1;
size_t Ngas = 0, Ngpart = 0;
long long N_total[2] = {0, 0};
int nr_threads = 1, nr_queues = -1;
int dump_tasks = 0;
int data[2];
......@@ -386,16 +387,16 @@ int main(int argc, char *argv[]) {
/* Apply h scaling */
if (scaling != 1.0)
for (k = 0; k < Ngas; k++) parts[k].h *= scaling;
for (size_t k = 0; k < Ngas; k++) parts[k].h *= scaling;
/* Apply shift */
if (shift[0] != 0 || shift[1] != 0 || shift[2] != 0) {
for (k = 0; k < Ngas; k++) {
for (size_t k = 0; k < Ngas; k++) {
parts[k].x[0] += shift[0];
parts[k].x[1] += shift[1];
parts[k].x[2] += shift[2];
}
for (k = 0; k < Ngpart; k++) {
for (size_t k = 0; k < Ngpart; k++) {
gparts[k].x[0] += shift[0];
gparts[k].x[1] += shift[1];
gparts[k].x[2] += shift[2];
......@@ -513,7 +514,7 @@ int main(int argc, char *argv[]) {
clocks_getunit());
/* Let loose a runner on the space. */
for (j = 0; !engine_is_done(&e); j++) {
for (int j = 0; !engine_is_done(&e); j++) {
/* Repartition the space amongst the nodes? */
#ifdef WITH_MPI
......
......@@ -122,8 +122,7 @@ void map_cellcheck(struct cell *c, void *data) {
p->x[2] > c->loc[2] + c->h[2]) {
printf(
"map_cellcheck: g-particle at [ %.16e %.16e %.16e ] outside of cell "
"[ "
"%.16e %.16e %.16e ] - [ %.16e %.16e %.16e ].\n",
"[ %.16e %.16e %.16e ] - [ %.16e %.16e %.16e ].\n",
p->x[0], p->x[1], p->x[2], c->loc[0], c->loc[1], c->loc[2],
c->loc[0] + c->h[0], c->loc[1] + c->h[1], c->loc[2] + c->h[2]);
error("g-particle out of bounds!");
......
......@@ -357,7 +357,7 @@ void writeArrayBackEnd(hid_t grp, char* fileName, FILE* xmfFile, char* name,
*
*/
void read_ic_parallel(char* fileName, double dim[3], struct part** parts,
int* N, int* periodic, int mpi_rank, int mpi_size,
size_t* N, int* periodic, int mpi_rank, int mpi_size,
MPI_Comm comm, MPI_Info info) {
hid_t h_file = 0, h_grp = 0;
double boxSize[3] = {
......
......@@ -32,7 +32,7 @@
#if defined(HAVE_HDF5) && defined(WITH_MPI) && defined(HAVE_PARALLEL_HDF5)
void read_ic_parallel(char* fileName, double dim[3], struct part** parts,
int* N, int* periodic, int mpi_rank, int mpi_size,
size_t* N, int* periodic, int mpi_rank, int mpi_size,
MPI_Comm comm, MPI_Info info);
void write_output_parallel(struct engine* e, struct UnitSystem* us,
......
......@@ -410,7 +410,7 @@ void writeArrayBackEnd(hid_t grp, char* fileName, FILE* xmfFile, char* name,
* Calls #error() if an error occurs.
*
*/
void read_ic_serial(char* fileName, double dim[3], struct part** parts, int* N,
void read_ic_serial(char* fileName, double dim[3], struct part** parts, size_t* N,
int* periodic, int mpi_rank, int mpi_size, MPI_Comm comm,
MPI_Info info) {
hid_t h_file = 0, h_grp = 0;
......
......@@ -31,7 +31,7 @@
#if defined(HAVE_HDF5) && defined(WITH_MPI) && !defined(HAVE_PARALLEL_HDF5)
void read_ic_serial(char* fileName, double dim[3], struct part** parts, int* N,
void read_ic_serial(char* fileName, double dim[3], struct part** parts, size_t* N,
int* periodic, int mpi_rank, int mpi_size, MPI_Comm comm,
MPI_Info info);
......
......@@ -322,14 +322,14 @@ void writeArrayBackEnd(hid_t grp, char* fileName, FILE* xmfFile, char* name,
*
*/
void read_ic_single(char* fileName, double dim[3], struct part** parts,
struct gpart** gparts, int* Ngas, int* Ngparts,
struct gpart** gparts, size_t* Ngas, size_t* Ngparts,
int* periodic) {
hid_t h_file = 0, h_grp = 0;
/* GADGET has only cubic boxes (in cosmological mode) */
double boxSize[3] = {0.0, -1.0, -1.0};
/* GADGET has 6 particle types. We only keep the type 0 & 1 for now...*/
int numParticles[6] = {0};
int Ndm;
size_t Ndm;
/* Open file */
/* message("Opening file '%s' as IC.", fileName); */
......@@ -391,7 +391,7 @@ void read_ic_single(char* fileName, double dim[3], struct part** parts,
/* Open SPH particles group */
/* message("Reading particle arrays..."); */
message("BoxSize = %lf", dim[0]);
message("NumPart = [%d, %d] Total = %d", *Ngas, Ndm, *Ngparts);
message("NumPart = [%zd, %zd] Total = %zd", *Ngas, Ndm, *Ngparts);
/* Loop over all particle types */
for (int ptype = 0; ptype < 6; ptype++) {
......@@ -457,8 +457,8 @@ void read_ic_single(char* fileName, double dim[3], struct part** parts,
void write_output_single(struct engine* e, struct UnitSystem* us) {
hid_t h_file = 0, h_grp = 0, h_grpsph = 0;
const int Ngas = e->s->nr_parts;
const int Ntot = e->s->nr_gparts;
const size_t Ngas = e->s->nr_parts;
const size_t Ntot = e->s->nr_gparts;
int periodic = e->s->periodic;
int numFiles = 1;
struct part* parts = e->s->parts;
......
......@@ -27,7 +27,7 @@
#if defined(HAVE_HDF5) && !defined(WITH_MPI)
void read_ic_single(char* fileName, double dim[3], struct part** parts,
struct gpart** gparts, int* Ngas, int* Ndm, int* periodic);
struct gpart** gparts, size_t* Ngas, size_t* Ndm, int* periodic);
void write_output_single(struct engine* e, struct UnitSystem* us);
......
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