Main Page | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

read_ic.c File Reference

Read initial conditions in one of Gadget's file formats. More...

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <mpi.h>
#include "allvars.h"
#include "proto.h"

Go to the source code of this file.


#define SKIP   {my_fread(&blksize1,sizeof(int),1,fd);}
#define SKIP2   {my_fread(&blksize2,sizeof(int),1,fd);}


void read_ic (char *fname)
void empty_read_buffer (enum iofields blocknr, int offset, int pc, int type)
void read_file (char *fname, int readTask, int lastTask)
int find_files (char *fname)
void distribute_file (int nfiles, int firstfile, int firsttask, int lasttask, int *filenr, int *master, int *last)
void read_header_attributes_in_hdf5 (char *fname)

Detailed Description

Read initial conditions in one of Gadget's file formats.

Definition in file read_ic.c.

Define Documentation

#define SKIP   {my_fread(&blksize1,sizeof(int),1,fd);}

#define SKIP2   {my_fread(&blksize2,sizeof(int),1,fd);}

Function Documentation

void distribute_file int  nfiles,
int  firstfile,
int  firsttask,
int  lasttask,
int *  filenr,
int *  master,
int *  last

This function assigns a certain number of files to processors, such that each processor is exactly assigned to one file, and the number of cpus per file is as homogenous as possible. The number of files may at most be equal to the number of processors.

Definition at line 725 of file read_ic.c.

References ThisTask.

Referenced by read_ic(), and savepositions().

void empty_read_buffer enum iofields  blocknr,
int  offset,
int  pc,
int  type

This function reads out the buffer that was filled with particle data, and stores it at the appropriate place in the particle structures.

Definition at line 168 of file read_ic.c.

References sph_particle_data::Density, sph_particle_data::Entropy, sph_particle_data::Hsml, particle_data::ID, IO_ACCEL, IO_DTENTR, IO_HSML, IO_ID, IO_MASS, IO_POS, IO_POT, IO_RHO, IO_TSTP, IO_U, IO_VEL, particle_data::Mass, P, particle_data::Pos, SphP, particle_data::Type, and particle_data::Vel.

Referenced by read_file().

int find_files char *  fname  ) 

This function determines onto how many files a given snapshot is distributed.

Definition at line 616 of file read_ic.c.

References All, endrun(), header, global_data_all_processes::ICFormat, io_header::num_files, read_header_attributes_in_hdf5(), and ThisTask.

Referenced by read_ic().

void read_file char *  fname,
int  readTask,
int  lastTask

This function reads a snapshot file and distributes the data it contains to tasks 'readTask' to 'lastTask'.

< total number of defined information blocks for snapshot files. Must be equal to the number of entries in "enum iofields"

Definition at line 244 of file read_ic.c.

References All, allocate_memory(), blockpresent(), global_data_all_processes::BufferSize, CommBuffer, empty_read_buffer(), endrun(), get_bytes_per_blockelement(), get_dataset_name(), get_datatype_in_block(), get_particles_in_block(), get_values_per_blockelement(), header, global_data_all_processes::ICFormat, iofields, io_header::mass, global_data_all_processes::MassTable, global_data_all_processes::MaxPart, global_data_all_processes::MaxPartSph, my_fread(), N_gas, io_header::npart, io_header::npartTotal, io_header::npartTotalHighWord, io_header::num_files, NumPart, P, global_data_all_processes::PartAllocFactor, read_header_attributes_in_hdf5(), RestartFlag, Tab_IO_Labels, TAG_HEADER, TAG_PDATA, ThisTask, io_header::time, global_data_all_processes::Time, global_data_all_processes::TimeBegin, global_data_all_processes::TotN_gas, and global_data_all_processes::TotNumPart.

Referenced by read_ic().

void read_header_attributes_in_hdf5 char *  fname  ) 

This function reads the header information in case the HDF5 file format is used.

Definition at line 765 of file read_ic.c.

References io_header::flag_entropy_instead_u, header, io_header::mass, io_header::npart, io_header::npartTotal, io_header::npartTotalHighWord, and io_header::num_files.

Referenced by find_files(), and read_file().

void read_ic char *  fname  ) 

This function reads initial conditions, in one of the three possible file formats currently supported by Gadget. Note: When a snapshot file is started from initial conditions (start-option 0), not all the information in the header is used, in particular, the STARTING TIME needs to be set in the parameterfile. Also, for gas particles, only the internal energy is read, the density and mean molecular weight will be recomputed by the code. When InitGasTemp>0 is given, the gas temperature will be initialzed to this value assuming a mean colecular weight either corresponding to complete neutrality, or full ionization.

However, when the code is started with start-option 2, then all the this data in the snapshot files is preserved, i.e. this is also the way to resume a simulation from a snapshot file in case a regular restart file is not available.

< adiabatic index of simulated gas

< mass fraction of hydrogen, relevant only for radiative cooling

< mass fraction of hydrogen, relevant only for radiative cooling

Definition at line 31 of file read_ic.c.

References All, BOLTZMANN, distribute_file(), dmax(), sph_particle_data::Entropy, fill_Tab_IO_Labels(), find_files(), global_data_all_processes::ICFormat, global_data_all_processes::InitGasTemp, particle_data::Mass, global_data_all_processes::MassTable, global_data_all_processes::MinEgySpec, N_gas, NTask, global_data_all_processes::NumFilesWrittenInParallel, NumPart, P, read_file(), RestartFlag, SphP, ThisTask, global_data_all_processes::TotNumPart, particle_data::Type, global_data_all_processes::UnitEnergy_in_cgs, and global_data_all_processes::UnitMass_in_g.

Referenced by init().

Generated on Sun May 22 17:33:30 2005 for GADGET-2 by  doxygen