Commit 9923d45e authored by Claudio Gheller's avatar Claudio Gheller
Browse files

HDF5 bugs fixed. Sorting for the moment commented out

parent d3f2e526
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -4,7 +4,8 @@ REDSHIFT 0.188 // redshift for IC cooling

## Input ##
#I_TXT                  // Input from ASCII fil
I_GADGET2              // Gadget Format 2 Input
I_HDF5
#I_GADGET2              // Gadget Format 2 Input
#I_NONE                  // Dummy Input 

## Output ##    
+2 −1
Original line number Diff line number Diff line
@@ -117,7 +117,8 @@ INCLFILES = common.h cosmo.h compress.h unit.h constants.h config.h sort.h \
INCL	= $(addprefix $(SRCDIR),$(INCLFILES))

LIBS = -lm -lgsl -lgslcblas  $(MPI_LIBS) $(GSL_LIBS) $(HDF5_LIBS) -lhdf5
CFLAGS = -std=c99  -fopenmp $(OPTIMIZE) $(GSL_INCL)
##############CFLAGS = -std=c99  -fopenmp $(OPTIMIZE) $(GSL_INCL)
CFLAGS = -std=c99 $(OPTIMIZE) $(GSL_INCL)


$(EXEC)	: $(OBJS)
+1 −1
Original line number Diff line number Diff line
#define REDSHIFT 0.188            // redshift for IC cooling
#define I_GADGET2              // Gadget Format 2 Input
#define I_HDF5
#define O_BINARY               // Output to Binary Data
#define READ_MORE_INFO			// Get more velocities from snap
#define VARIABLE_TIMESTEPS
+26 −20
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@
#include "../modules/modules.h"

#ifdef I_HDF5
double read_input()
double read_input(int ifile)
{

   hid_t file_id, dataset_id, dataspace_id, m_dataspace_id, memspace_id;
@@ -17,8 +17,7 @@ double read_input()
   hsize_t count[1];
   hsize_t offset[1];
   long totsize; 
   char infile1[] = "_tracers_103.hdf5";
   char infile2[] = "_tracers_104.hdf5";
   char infile1[1000];
   double * data1;
   float * data2;
   int idset;
@@ -28,6 +27,8 @@ double read_input()
   double VelocityConversionFactor;
   double * input_data;

   sprintf(infile1,"_tracers_%d_test.hdf5",ifile); 

   long long nRead[N_PART_TYPES] = { 0 }, nReadTot = 0;

   char dset[N_VARS][N_CHARS] =
@@ -54,7 +55,7 @@ double read_input()
    "Redshift"                  // 3
   };

   printf("Input files %s, %s, %d\n",infile1,infile2,Param.nrows);
   printf("Input file %s, %d\n",infile1,Param.nrows);

   // Get the size of a dataset
   file_id = H5Fopen(infile1, H5F_ACC_RDONLY, H5P_DEFAULT);
@@ -84,16 +85,16 @@ double read_input()
   dataset_id = H5Dopen2(file_id, metadset[0], H5P_DEFAULT);   
   status = H5Dread(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &DensityConversionFactor);
   status = H5Dclose(dataset_id); 
   dataset_id = H5Dopen2(file_id, metadset[1], H5P_DEFAULT);   
   dataset_id = H5Dopen2(file_id, metadset[2], H5P_DEFAULT);   
   status = H5Dread(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &Redshift);
   status = H5Dclose(dataset_id); 
   dataset_id = H5Dopen2(file_id, metadset[2], H5P_DEFAULT);   
   dataset_id = H5Dopen2(file_id, metadset[1], H5P_DEFAULT);   
   status = H5Dread(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &VelocityConversionFactor);
   status = H5Dclose(dataset_id); 
   printf("Metadata\n");
   printf("%e\n",DensityConversionFactor);
   printf("%e\n",Redshift);
   printf("%e\n",VelocityConversionFactor);
   printf("Redshift = %e\n",Redshift);
   printf("DensityConversionFactor = %e\n",DensityConversionFactor);
   printf("VelocityConversionFactor = %e\n",VelocityConversionFactor);

   // Read dataset

@@ -147,21 +148,26 @@ double read_input()
   {
       SphP[i].U = SphP[i].U * SphP[i].Rho;
       SphP[i].ID = i;
   }

   #ifdef DEBUG
   printf("======= %d ======\n",i);
   printf("Data\n");
   printf("%d\n",SphP[0].ID);
   printf("%e\n",SphP[0].Vel[0]);
   printf("%e\n",SphP[0].Vel[1]);
   printf("%e\n",SphP[0].Vel[2]);
   printf("%e\n",SphP[0].Rho);
   printf("%e\n",SphP[0].U);
   printf("%e\n",SphP[0].B);
   printf("%e\n",SphP[0].Mach);
   printf("%e\n",SphP[0].DivVel);
   printf("%e\n",SphP[0].CurlVel);
   printf("%d\n",SphP[i].ID);
   printf("%e\n",SphP[i].Vel[0]);
   printf("%e\n",SphP[i].Vel[1]);
   printf("%e\n",SphP[i].Vel[2]);
   printf("%e\n",SphP[i].Rho);
   printf("%e\n",SphP[i].U);
   printf("%e\n",SphP[i].B);
   printf("%e\n",SphP[i].Mach);
   printf("%e\n",SphP[i].DivVel);
   printf("%e\n",SphP[i].CurlVel);
   #endif
   }

//return Snap.Time;
   Snap.LastSnapNum = ifile-1;
   Snap.SnapNum = ifile;
   double SnapdotTime = 1.0/(1.0+Redshift);
   return SnapdotTime;

+1 −1
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@ extern void read_param_file(char *filename);
 * It should do so in parallel. It returns 0
 * if there is no more snapshot
 * */
extern double read_input();
extern double read_input(int);

/* This functions output one or more files in 
 * F77 binary containing the spectra sorted by
Loading