From f17cb9fc87e37879970c046d34fa9e0e6e2cad27 Mon Sep 17 00:00:00 2001
From: Matthieu Schaller <matthieu.schaller@durham.ac.uk>
Date: Sun, 17 Mar 2013 15:52:08 +0000
Subject: [PATCH] Renamed some of the arrays in the hdf5 i/o routines to match
 more closely the GADGET-2 code. The python scripts have been updated to take
 these changes into account.

Former-commit-id: 356938f92d393605897f717e02d33349eff00c8d
---
 examples/PertubedBox/makeIC.py | 11 +++++++++--
 examples/SedovBlast/makeIC.py  | 14 ++++++++++----
 examples/UniformBox/makeIC.py  | 13 ++++++++++---
 src/io.c                       |  8 ++++----
 4 files changed, 33 insertions(+), 13 deletions(-)

diff --git a/examples/PertubedBox/makeIC.py b/examples/PertubedBox/makeIC.py
index 8301b0f630..fe32c6f10a 100644
--- a/examples/PertubedBox/makeIC.py
+++ b/examples/PertubedBox/makeIC.py
@@ -77,6 +77,13 @@ file = h5py.File(fileName, 'w')
 # Header
 grp = file.create_group("/Header")
 grp.attrs["BoxSize"] = boxSize
+grp.attrs["NumPart_Total"] =  [numPart, 0, 0, 0, 0, 0]
+grp.attrs["NumPart_Total_HighWord"] = [0, 0, 0, 0, 0, 0]
+grp.attrs["NumPart_ThisFile"] = [numPart, 0, 0, 0, 0, 0]
+grp.attrs["Time"] = 0.0
+grp.attrs["NumFilesPerSnapshot"] = 1
+grp.attrs["MassTable"] = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
+grp.attrs["Flag_Entropy_ICs"] = [0, 0, 0, 0, 0, 0]
 grp.attrs["NumPart_Total"] = numPart
 
 #Runtime parameters
@@ -87,9 +94,9 @@ grp.attrs["PeriodicBoundariesOn"] = periodic
 grp = file.create_group("/PartType0")
 ds = grp.create_dataset('Coordinates', (numPart, 3), 'd')
 ds[()] = coords
-ds = grp.create_dataset('Velocity', (numPart, 3), 'f')
+ds = grp.create_dataset('Velocities', (numPart, 3), 'f')
 ds[()] = v
-ds = grp.create_dataset('Mass', (numPart,1), 'f')
+ds = grp.create_dataset('Masses', (numPart,1), 'f')
 ds[()] = m
 ds = grp.create_dataset('SmoothingLength', (numPart,1), 'f')
 ds[()] = h
diff --git a/examples/SedovBlast/makeIC.py b/examples/SedovBlast/makeIC.py
index 723b70396b..ab61d60b22 100644
--- a/examples/SedovBlast/makeIC.py
+++ b/examples/SedovBlast/makeIC.py
@@ -63,7 +63,7 @@ for i in range(L):
             coords[index,0] = x
             coords[index,1] = y
             coords[index,2] = z
-            v[index,0] = 0.1
+            v[index,0] = 0.
             v[index,1] = 0.
             v[index,2] = 0.
             m[index] = mass
@@ -85,7 +85,13 @@ file = h5py.File(fileName, 'w')
 # Header
 grp = file.create_group("/Header")
 grp.attrs["BoxSize"] = boxSize
-grp.attrs["NumPart_Total"] = numPart
+grp.attrs["NumPart_Total"] =  [numPart, 0, 0, 0, 0, 0]
+grp.attrs["NumPart_Total_HighWord"] = [0, 0, 0, 0, 0, 0]
+grp.attrs["NumPart_ThisFile"] = [numPart, 0, 0, 0, 0, 0]
+grp.attrs["Time"] = 0.0
+grp.attrs["NumFilesPerSnapshot"] = 1
+grp.attrs["MassTable"] = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
+grp.attrs["Flag_Entropy_ICs"] = [0, 0, 0, 0, 0, 0]
 
 #Runtime parameters
 grp = file.create_group("/RuntimePars")
@@ -95,9 +101,9 @@ grp.attrs["PeriodicBoundariesOn"] = periodic
 grp = file.create_group("/PartType0")
 ds = grp.create_dataset('Coordinates', (numPart, 3), 'd')
 ds[()] = coords
-ds = grp.create_dataset('Velocity', (numPart, 3), 'f')
+ds = grp.create_dataset('Velocities', (numPart, 3), 'f')
 ds[()] = v
-ds = grp.create_dataset('Mass', (numPart,1), 'f')
+ds = grp.create_dataset('Masses', (numPart,1), 'f')
 ds[()] = m
 ds = grp.create_dataset('SmoothingLength', (numPart,1), 'f')
 ds[()] = h
diff --git a/examples/UniformBox/makeIC.py b/examples/UniformBox/makeIC.py
index e61106d30c..0fef11db62 100644
--- a/examples/UniformBox/makeIC.py
+++ b/examples/UniformBox/makeIC.py
@@ -75,7 +75,14 @@ file = h5py.File(fileName, 'w')
 # Header
 grp = file.create_group("/Header")
 grp.attrs["BoxSize"] = boxSize
-grp.attrs["NumPart_Total"] = numPart
+grp.attrs["NumPart_Total"] =  [numPart, 0, 0, 0, 0, 0]
+grp.attrs["NumPart_Total_HighWord"] = [0, 0, 0, 0, 0, 0]
+grp.attrs["NumPart_ThisFile"] = [numPart, 0, 0, 0, 0, 0]
+grp.attrs["Time"] = 0.0
+grp.attrs["NumFilesPerSnapshot"] = 1
+grp.attrs["MassTable"] = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
+grp.attrs["Flag_Entropy_ICs"] = [0, 0, 0, 0, 0, 0]
+
 
 #Runtime parameters
 grp = file.create_group("/RuntimePars")
@@ -85,9 +92,9 @@ grp.attrs["PeriodicBoundariesOn"] = periodic
 grp = file.create_group("/PartType0")
 ds = grp.create_dataset('Coordinates', (numPart, 3), 'd')
 ds[()] = coords
-ds = grp.create_dataset('Velocity', (numPart, 3), 'f')
+ds = grp.create_dataset('Velocities', (numPart, 3), 'f')
 ds[()] = v
-ds = grp.create_dataset('Mass', (numPart,1), 'f')
+ds = grp.create_dataset('Masses', (numPart,1), 'f')
 ds[()] = m
 ds = grp.create_dataset('SmoothingLength', (numPart,1), 'f')
 ds[()] = h
diff --git a/src/io.c b/src/io.c
index c3ae9af8b1..a6d3914411 100644
--- a/src/io.c
+++ b/src/io.c
@@ -331,8 +331,8 @@ void read_ic ( char* fileName, double dim[3], struct part **parts,  int* N, int*
 
   /* Read arrays */
   readArray(h_grp, "Coordinates", DOUBLE, *N, 3, *parts, x, COMPULSORY);
-  readArray(h_grp, "Velocity", FLOAT, *N, 3, *parts, v, COMPULSORY);
-  readArray(h_grp, "Mass", FLOAT, *N, 1, *parts, mass, COMPULSORY);
+  readArray(h_grp, "Velocities", FLOAT, *N, 3, *parts, v, COMPULSORY);
+  readArray(h_grp, "Masses", FLOAT, *N, 1, *parts, mass, COMPULSORY);
   readArray(h_grp, "SmoothingLength", FLOAT, *N, 1, *parts, h, COMPULSORY);
   readArray(h_grp, "InternalEnergy", FLOAT, *N, 1, *parts, u, COMPULSORY);
   readArray(h_grp, "ParticleIDs", ULONGLONG, *N, 1, *parts, id, COMPULSORY);
@@ -598,8 +598,8 @@ void write_output ( char* fileName, double dim[3], struct part *parts,  int N, i
 
   /* Write arrays */
   writeArray(h_grp, fileName, xmfFile, "Coordinates", DOUBLE, N, 3, parts, x);
-  writeArray(h_grp, fileName, xmfFile, "Velocity", FLOAT, N, 3, parts, v);
-  writeArray(h_grp, fileName, xmfFile, "Mass", FLOAT, N, 1, parts, mass);
+  writeArray(h_grp, fileName, xmfFile, "Velocities", FLOAT, N, 3, parts, v);
+  writeArray(h_grp, fileName, xmfFile, "Masses", FLOAT, N, 1, parts, mass);
   writeArray(h_grp, fileName, xmfFile, "SmoothingLength", FLOAT, N, 1, parts, h);
   writeArray(h_grp, fileName, xmfFile, "InternalEnergy", FLOAT, N, 1, parts, u);
   writeArray(h_grp, fileName, xmfFile, "ParticleIDs", ULONGLONG, N, 1, parts, id);
-- 
GitLab