From f012c4bc41e7a3da6aae64b90c26c6ab16122db5 Mon Sep 17 00:00:00 2001
From: Pedro Gonnet <pedro.gonnet@durham.ac.uk>
Date: Thu, 16 May 2013 22:25:11 +0000
Subject: [PATCH] forgot about empty cells, no super.

Former-commit-id: 6ea4f886f11c84f67197cc58a3b137f02be967f8
---
 src/engine.c | 2 +-
 src/io.c     | 8 +++-----
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/src/engine.c b/src/engine.c
index 1b6b188cb8..e8bacffd9b 100644
--- a/src/engine.c
+++ b/src/engine.c
@@ -320,7 +320,7 @@ void engine_collect_kick2 ( struct cell *c ) {
     struct cell *cp;
     
     /* If I am a super-cell, return immediately. */
-    if ( c->kick2 != NULL )
+    if ( c->kick2 != NULL || c->count == 0 )
         return;
         
     /* If this cell is not split, I'm in trouble. */
diff --git a/src/io.c b/src/io.c
index 199855a3af..bf25e55b5b 100644
--- a/src/io.c
+++ b/src/io.c
@@ -271,7 +271,7 @@ void readArrayBackEnd(hid_t grp, char* name, enum DATA_TYPE type, int N, int dim
 void read_ic ( char* fileName, double dim[3], struct part **parts,  int* N, int* periodic)
 {
   hid_t h_file=0, h_grp=0;
-  double boxSize[3]={0.,-1,-1};         /* GADGET has only cubic boxes (in cosmological mode) */
+  double boxSize[3]={0.0,-1.0,-1.0};         /* GADGET has only cubic boxes (in cosmological mode) */
   int numParticles[6]={0};   /* GADGET has 6 particle types. We only keep the type 0*/
 
   /* Open file */
@@ -308,10 +308,8 @@ void read_ic ( char* fileName, double dim[3], struct part **parts,  int* N, int*
 
   *N = numParticles[0];
   dim[0] = boxSize[0];
-  if ( boxSize[1] < 0 )
-    dim[1] = boxSize[0];
-  if ( boxSize[2] < 0 )
-    dim[2] = boxSize[0];
+  dim[1] = ( boxSize[1] < 0 ) ? boxSize[0] : boxSize[1];
+  dim[2] = ( boxSize[2] < 0 ) ? boxSize[0] : boxSize[2];
 
   /* printf("read_ic: Found %d particles in a %speriodic box of size [%f %f %f]\n",  */
   /* 	 *N, (periodic ? "": "non-"), dim[0], dim[1], dim[2]); */
-- 
GitLab