MP-Gadget
5.0.1.dev1-76bc7d4726-dirty
|
#include <mpi.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <stdarg.h>
#include <omp.h>
#include <bigfile-mpi.h>
#include "sfr_eff.h"
#include "cooling.h"
#include "timestep.h"
#include "petaio.h"
#include "slotsmanager.h"
#include "hydra.h"
#include "density.h"
#include "partmanager.h"
#include "config.h"
#include "neutrinos_lra.h"
#include "utils.h"
Go to the source code of this file.
Classes | |
struct | petaio_params |
Macros | |
#define | SIMPLE_PROPERTY(name, field, type, items) |
#define | SIMPLE_PROPERTY_TYPE(name, ptype, field, type, items) |
#define | SIMPLE_GETTER_PI(name, field, dtype, items, slottype) |
#define | SIMPLE_SETTER_PI(name, field, dtype, items, slottype) |
#define | SIMPLE_PROPERTY_PI(name, field, type, items, slottype) |
#define | SIMPLE_PROPERTY_TYPE_PI(name, ptype, field, type, items, slottype) |
Functions | |
void | set_petaio_params (ParameterSet *ps) |
int | GetUsePeculiarVelocity (void) |
static void | petaio_write_header (BigFile *bf, const double atime, const int64_t *NTotal, const Cosmology *CP, const struct header_data *data) |
static void | petaio_read_header_internal (BigFile *bf, Cosmology *CP, struct header_data *data) |
void | petaio_init (void) |
void | petaio_build_selection (int *selection, int *ptype_offset, int *ptype_count, const struct particle_data *Parts, const int NumPart, int(*select_func)(int i, const struct particle_data *Parts)) |
void | petaio_save_snapshot (const char *fname, struct IOTable *IOTable, int verbose, const double atime, const Cosmology *CP) |
char * | petaio_get_snapshot_fname (int num, const char *OutputDir) |
struct header_data | petaio_read_header (int num, const char *OutputDir, Cosmology *CP) |
void | petaio_read_snapshot (int num, const char *OutputDir, Cosmology *CP, struct header_data *header, struct part_manager_type *PartManager, struct slots_manager_type *SlotsManager, MPI_Comm Comm) |
static double | _get_attr_double (BigBlock *bh, const char *name, const double def) |
static int | _get_attr_int (BigBlock *bh, const char *name, const int def) |
void | petaio_alloc_buffer (BigArray *array, IOTableEntry *ent, int64_t localsize) |
void | petaio_readout_buffer (BigArray *array, IOTableEntry *ent, struct conversions *conv, struct part_manager_type *PartManager, struct slots_manager_type *SlotsManager) |
void | petaio_build_buffer (BigArray *array, IOTableEntry *ent, const int *selection, const int NumSelection, struct particle_data *Parts, struct slots_manager_type *SlotsManager, struct conversions *conv) |
void | petaio_destroy_buffer (BigArray *array) |
int | petaio_read_block (BigFile *bf, const char *blockname, BigArray *array, int required) |
void | petaio_save_block (BigFile *bf, const char *blockname, BigArray *array, int verbose) |
void | io_register_io_block (const char *name, const char *dtype, int items, int ptype, property_getter getter, property_setter setter, int required, struct IOTable *IOTable) |
static void | GTPosition (int i, double *out, void *baseptr, void *smanptr, const struct conversions *params) |
static void | STPosition (int i, double *out, void *baseptr, void *smanptr, const struct conversions *params) |
static void | GTVelocity (int i, float *out, void *baseptr, void *smanptr, const struct conversions *params) |
static void | STVelocity (int i, float *out, void *baseptr, void *smanptr, const struct conversions *params) |
static void | GTBlackholeMinPotPos (int i, double *out, void *baseptr, void *smanptr, const struct conversions *params) |
static void | GTNeutralHydrogenFraction (int i, float *out, void *baseptr, void *smanptr, const struct conversions *params) |
static void | GTHeliumIFraction (int i, float *out, void *baseptr, void *smanptr, const struct conversions *params) |
static void | GTHeliumIIFraction (int i, float *out, void *baseptr, void *smanptr, const struct conversions *params) |
static void | GTHeliumIIIFraction (int i, float *out, void *baseptr, void *smanptr, const struct conversions *params) |
static void | GTInternalEnergy (int i, float *out, void *baseptr, void *smanptr, const struct conversions *params) |
static void | STInternalEnergy (int i, float *out, void *baseptr, void *smanptr, const struct conversions *params) |
static void | GTHeIIIIonized (int i, unsigned char *out, void *baseptr, void *smanptr, const struct conversions *params) |
static void | STHeIIIIonized (int i, unsigned char *out, void *baseptr, void *smanptr, const struct conversions *params) |
static void | GTSwallowed (int i, unsigned char *out, void *baseptr, void *smanptr, const struct conversions *params) |
static void | STSwallowed (int i, unsigned char *out, void *baseptr, void *smanptr, const struct conversions *params) |
static int | order_by_type (const void *a, const void *b) |
void | register_io_blocks (struct IOTable *IOTable, int WriteGroupID, int MetalReturnOn) |
void | register_debug_io_blocks (struct IOTable *IOTable) |
void | destroy_io_blocks (struct IOTable *IOTable) |
Variables | |
static struct petaio_params | IO |
static struct header_data | Header |
#define SIMPLE_GETTER_PI | ( | name, | |
field, | |||
dtype, | |||
items, | |||
slottype | |||
) |
#define SIMPLE_PROPERTY | ( | name, | |
field, | |||
type, | |||
items | |||
) |
#define SIMPLE_PROPERTY_PI | ( | name, | |
field, | |||
type, | |||
items, | |||
slottype | |||
) |
#define SIMPLE_SETTER_PI | ( | name, | |
field, | |||
dtype, | |||
items, | |||
slottype | |||
) |
|
static |
Definition at line 407 of file petaio.c.
References name.
Referenced by petaio_read_header_internal().
|
static |
Definition at line 416 of file petaio.c.
References name.
Referenced by petaio_read_header_internal().
void destroy_io_blocks | ( | struct IOTable * | IOTable | ) |
Definition at line 1034 of file petaio.c.
References IOTable::allocated, IOTable::ent, and myfree.
Referenced by dump_snapshot(), fof_save_particles(), petaio_read_snapshot(), run_gravity_test(), and write_checkpoint().
int GetUsePeculiarVelocity | ( | void | ) |
Definition at line 79 of file petaio.c.
References IO, and petaio_params::UsePeculiarVelocity.
Referenced by fof_write_header(), and GTMassCenterVelocity().
|
static |
Definition at line 806 of file petaio.c.
References part_manager_type::BoxSize, part_manager_type::CurrentParticleOffset, bh_particle_data::MinPotPos, PartManager, particle_data::PI, and slot_info::ptr.
|
static |
|
static |
Definition at line 831 of file petaio.c.
References conversions::atime, get_helium_neutral_fraction_sfreff(), conversions::hubble, particle_data::PI, and slot_info::ptr.
|
static |
Definition at line 839 of file petaio.c.
References conversions::atime, get_helium_neutral_fraction_sfreff(), conversions::hubble, particle_data::PI, and slot_info::ptr.
|
static |
Definition at line 847 of file petaio.c.
References conversions::atime, get_helium_neutral_fraction_sfreff(), conversions::hubble, particle_data::PI, and slot_info::ptr.
|
static |
Definition at line 855 of file petaio.c.
References conversions::atime, sph_particle_data::Density, sph_particle_data::Entropy, GAMMA_MINUS1, and slot_info::ptr.
|
static |
Definition at line 822 of file petaio.c.
References get_neutral_fraction_sfreff(), particle_data::PI, and slot_info::ptr.
|
static |
Definition at line 685 of file petaio.c.
References part_manager_type::BoxSize, part_manager_type::CurrentParticleOffset, PartManager, and particle_data::Pos.
|
static |
|
static |
Definition at line 744 of file petaio.c.
References conversions::atime, IO, petaio_params::UsePeculiarVelocity, and particle_data::Vel.
void io_register_io_block | ( | const char * | name, |
const char * | dtype, | ||
int | items, | ||
int | ptype, | ||
property_getter | getter, | ||
property_setter | setter, | ||
int | required, | ||
struct IOTable * | IOTable | ||
) |
Definition at line 658 of file petaio.c.
References IOTable::allocated, IOTableEntry::dtype, IOTable::ent, IOTableEntry::getter, IOTableEntry::items, myrealloc, name, IOTableEntry::name, IOTableEntry::ptype, ptype, IOTableEntry::required, IOTableEntry::setter, IOTable::used, and IOTableEntry::zorder.
|
static |
Definition at line 892 of file petaio.c.
References IOTableEntry::ptype, and IOTableEntry::zorder.
Referenced by register_debug_io_blocks(), and register_io_blocks().
void petaio_alloc_buffer | ( | BigArray * | array, |
IOTableEntry * | ent, | ||
int64_t | localsize | ||
) |
Definition at line 491 of file petaio.c.
References IOTableEntry::dtype, IOTableEntry::items, and mymalloc.
Referenced by build_buffer_fof(), petaio_build_buffer(), and petaio_read_snapshot().
void petaio_build_buffer | ( | BigArray * | array, |
IOTableEntry * | ent, | ||
const int * | selection, | ||
const int | NumSelection, | ||
struct particle_data * | Parts, | ||
struct slots_manager_type * | SlotsManager, | ||
struct conversions * | conv | ||
) |
Definition at line 521 of file petaio.c.
References endrun(), IOTableEntry::getter, petaio_alloc_buffer(), IOTableEntry::ptype, SlotsManager, and particle_data::Type.
Referenced by fof_save_particles(), and petaio_save_snapshot().
void petaio_build_selection | ( | int * | selection, |
int * | ptype_offset, | ||
int * | ptype_count, | ||
const struct particle_data * | Parts, | ||
const int | NumPart, | ||
int(*)(int i, const struct particle_data *Parts) | select_func | ||
) |
Create a Selection array for the buffers. This array indirectly sort the particles by the type.
The offset for the starting of each type is stored in ptype_offset.
if select_func is provided, it shall return 1 for those that shall be included in the output.
Definition at line 113 of file petaio.c.
References P, ptype, and particle_data::Type.
Referenced by fof_save_particles(), and petaio_save_snapshot().
void petaio_destroy_buffer | ( | BigArray * | array | ) |
Definition at line 557 of file petaio.c.
References myfree.
Referenced by fof_save_particles(), petaio_read_snapshot(), and petaio_save_snapshot().
char* petaio_get_snapshot_fname | ( | int | num, |
const char * | OutputDir | ||
) |
Definition at line 207 of file petaio.c.
References fastpm_strdup_printf(), petaio_params::InitCondFile, IO, and petaio_params::SnapshotFileBase.
Referenced by petaio_read_snapshot(), and write_checkpoint().
void petaio_init | ( | void | ) |
Definition at line 88 of file petaio.c.
References petaio_params::AggregatedIOThreshold, petaio_params::EnableAggregatedIO, IO, message(), and petaio_params::NumWriters.
Referenced by begrun().
int petaio_read_block | ( | BigFile * | bf, |
const char * | blockname, | ||
BigArray * | array, | ||
int | required | ||
) |
Definition at line 562 of file petaio.c.
References endrun(), IO, and petaio_params::NumWriters.
Referenced by petaio_read_icnutransfer(), petaio_read_neutrinos(), and petaio_read_snapshot().
struct header_data petaio_read_header | ( | int | num, |
const char * | OutputDir, | ||
Cosmology * | CP | ||
) |
Definition at line 207 of file petaio.c.
Referenced by begrun().
|
static |
Definition at line 426 of file petaio.c.
References _get_attr_double(), _get_attr_int(), header_data::BoxSize, CP, endrun(), get_generations(), Header, Cosmology::HubbleParam, IO, header_data::MassTable, message(), header_data::NTotal, header_data::NTotalInit, Cosmology::OmegaBaryon, Cosmology::OmegaLambda, ptype, header_data::TimeIC, header_data::TimeSnapshot, header_data::UnitLength_in_cm, header_data::UnitMass_in_g, header_data::UnitVelocity_in_cm_per_s, and petaio_params::UsePeculiarVelocity.
void petaio_read_snapshot | ( | int | num, |
const char * | OutputDir, | ||
Cosmology * | CP, | ||
struct header_data * | header, | ||
struct part_manager_type * | PartManager, | ||
struct slots_manager_type * | SlotsManager, | ||
MPI_Comm | Comm | ||
) |
Definition at line 255 of file petaio.c.
References conversions::atime, part_manager_type::Base, CP, destroy_io_blocks(), endrun(), IOTable::ent, conversions::hubble, hubble_function(), IO, particle_data::Mass, Cosmology::MassiveNuLinRespOn, header_data::MassTable, message(), myfree, IOTableEntry::name, header_data::NLocal, header_data::NTotal, part_manager_type::NumPart, PartManager, petaio_alloc_buffer(), petaio_destroy_buffer(), petaio_get_snapshot_fname(), petaio_read_block(), petaio_read_icnutransfer(), petaio_read_neutrinos(), petaio_readout_buffer(), IOTableEntry::ptype, ptype, register_io_blocks(), IOTableEntry::required, IOTableEntry::setter, slots_setup_id(), SlotsManager, ThisTask, header_data::TimeSnapshot, particle_data::Type, IOTable::used, petaio_params::UsePeculiarVelocity, and particle_data::Vel.
Referenced by init().
void petaio_readout_buffer | ( | BigArray * | array, |
IOTableEntry * | ent, | ||
struct conversions * | conv, | ||
struct part_manager_type * | PartManager, | ||
struct slots_manager_type * | SlotsManager | ||
) |
Definition at line 506 of file petaio.c.
References part_manager_type::Base, PartManager, IOTableEntry::ptype, IOTableEntry::setter, SlotsManager, and particle_data::Type.
Referenced by petaio_read_snapshot().
void petaio_save_block | ( | BigFile * | bf, |
const char * | blockname, | ||
BigArray * | array, | ||
int | verbose | ||
) |
Definition at line 587 of file petaio.c.
References petaio_params::BytesPerFile, count_sum(), petaio_params::EnableAggregatedIO, endrun(), IO, message(), petaio_params::MinNumWriters, petaio_params::NumWriters, and petaio_params::WritersPerFile.
Referenced by fof_save_particles(), petaio_save_neutrinos(), and petaio_save_snapshot().
void petaio_save_snapshot | ( | const char * | fname, |
struct IOTable * | IOTable, | ||
int | verbose, | ||
const double | atime, | ||
const Cosmology * | CP | ||
) |
Definition at line 151 of file petaio.c.
References conversions::atime, CP, endrun(), IOTable::ent, Header, conversions::hubble, hubble_function(), Cosmology::MassiveNuLinRespOn, message(), myfree, mymalloc, IOTableEntry::name, header_data::NTotal, part_manager_type::NumPart, P, PartManager, petaio_build_buffer(), petaio_build_selection(), petaio_destroy_buffer(), petaio_save_block(), petaio_save_neutrinos(), petaio_write_header(), IOTableEntry::ptype, ptype, SlotsManager, sumup_large_ints(), ThisTask, and IOTable::used.
Referenced by dump_snapshot(), run_gravity_test(), and write_checkpoint().
|
static |
Definition at line 361 of file petaio.c.
References header_data::BoxSize, Cosmology::CMBTemperature, CP, endrun(), GADGET_COMPILER_SETTINGS, GADGET_VERSION, GetDensityKernelType(), hubble_function(), Cosmology::HubbleParam, IO, header_data::MassTable, header_data::NTotalInit, Cosmology::Omega0, Cosmology::OmegaBaryon, Cosmology::OmegaLambda, header_data::TimeIC, header_data::UnitLength_in_cm, header_data::UnitMass_in_g, header_data::UnitVelocity_in_cm_per_s, and petaio_params::UsePeculiarVelocity.
Referenced by petaio_save_snapshot().
void register_debug_io_blocks | ( | struct IOTable * | IOTable | ) |
Definition at line 1014 of file petaio.c.
References IOTable::ent, GravPM, IO, IO_REG_WRONLY, order_by_type(), petaio_params::OutputTimebins, ptype, qsort_openmp, and IOTable::used.
Referenced by dump_snapshot(), and write_checkpoint().
void register_io_blocks | ( | struct IOTable * | IOTable, |
int | WriteGroupID, | ||
int | MetalReturnOn | ||
) |
Definition at line 909 of file petaio.c.
References IOTable::allocated, DensityIndependentSphOn(), IOTable::ent, IO, IO_REG, IO_REG_NONFATAL, IO_REG_TYPE, IO_REG_WRONLY, mymalloc2, NMETALS, order_by_type(), petaio_params::OutputHeliumFractions, petaio_params::OutputPotential, petaio_params::OutputTimebins, qsort_openmp, and IOTable::used.
Referenced by dump_snapshot(), fof_save_particles(), petaio_read_snapshot(), run_gravity_test(), and write_checkpoint().
void set_petaio_params | ( | ParameterSet * | ps | ) |
Definition at line 57 of file petaio.c.
References petaio_params::AggregatedIOThreshold, petaio_params::BytesPerFile, petaio_params::EnableAggregatedIO, petaio_params::InitCondFile, IO, petaio_params::MinNumWriters, petaio_params::NumWriters, petaio_params::OutputHeliumFractions, petaio_params::OutputPotential, petaio_params::OutputTimebins, param_get_int(), param_get_string2(), petaio_params::SnapshotFileBase, ThisTask, petaio_params::UsePeculiarVelocity, and petaio_params::WritersPerFile.
Referenced by read_parameter_file().
|
static |
|
static |
Definition at line 863 of file petaio.c.
References conversions::atime, sph_particle_data::Density, sph_particle_data::Entropy, GAMMA_MINUS1, and slot_info::ptr.
|
static |
|
static |
|
static |
Definition at line 759 of file petaio.c.
References conversions::atime, IO, petaio_params::UsePeculiarVelocity, and particle_data::Vel.
|
static |
Definition at line 1 of file petaio.c.
Referenced by petaio_read_header_internal(), and petaio_save_snapshot().
|
static |
Referenced by GetUsePeculiarVelocity(), GTVelocity(), petaio_get_snapshot_fname(), petaio_init(), petaio_read_block(), petaio_read_header_internal(), petaio_read_snapshot(), petaio_save_block(), petaio_write_header(), register_debug_io_blocks(), register_io_blocks(), set_petaio_params(), and STVelocity().