MP-Gadget
5.0.1.dev1-76bc7d4726-dirty
|
#include <mpi.h>
#include "bigfile.h"
#include "utils/paramset.h"
#include "partmanager.h"
#include "slotsmanager.h"
#include "cosmology.h"
#include "physconst.h"
Go to the source code of this file.
Classes | |
struct | header_data |
struct | conversions |
struct | IOTableEntry |
struct | IOTable |
Macros | |
#define | PTYPE_FOF_GROUP 1024 |
#define | IO_REG(name, dtype, items, ptype, IOTable) io_register_io_block(# name, dtype, items, ptype, (property_getter) GT ## name , (property_setter) ST ## name, 1, IOTable) |
#define | IO_REG_TYPE(name, dtype, items, ptype, IOTable) io_register_io_block(# name, dtype, items, ptype, (property_getter) GT ## ptype ## name , (property_setter) ST ## ptype ## name, 0, IOTable) |
#define | IO_REG_WRONLY(name, dtype, items, ptype, IOTable) io_register_io_block(# name, dtype, items, ptype, (property_getter) GT ## name , NULL, 1, IOTable) |
#define | IO_REG_NONFATAL(name, dtype, items, ptype, IOTable) io_register_io_block(# name, dtype, items, ptype, (property_getter) GT ## name , (property_setter) ST ## name, 0, IOTable) |
#define | SIMPLE_GETTER(name, field, type, items, stype) |
#define | SIMPLE_SETTER(name, field, type, items, stype) |
Typedefs | |
typedef void(* | property_getter) (int i, void *result, void *baseptr, void *slotptr, const struct conversions *params) |
typedef void(* | property_setter) (int i, void *target, void *baseptr, void *slotptr, const struct conversions *params) |
typedef int(* | petaio_selection) (int i) |
typedef struct IOTableEntry | IOTableEntry |
Functions | |
char * | petaio_get_snapshot_fname (int num, const char *OutputDir) |
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) |
void | set_petaio_params (ParameterSet *ps) |
int | GetUsePeculiarVelocity (void) |
void | petaio_init () |
void | petaio_alloc_buffer (BigArray *array, IOTableEntry *ent, int64_t npartLocal) |
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_readout_buffer (BigArray *array, IOTableEntry *ent, struct conversions *conv, struct part_manager_type *PartManager, struct slots_manager_type *SlotsManager) |
void | petaio_destroy_buffer (BigArray *array) |
void | petaio_save_block (BigFile *bf, const char *blockname, BigArray *array, int verbose) |
int | petaio_read_block (BigFile *bf, const char *blockname, BigArray *array, int required) |
void | petaio_save_snapshot (const char *fname, struct IOTable *IOTable, int verbose, const double atime, const 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) |
struct header_data | petaio_read_header (int num, const char *OutputDir, Cosmology *CP) |
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 | 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) |
#define IO_REG | ( | name, | |
dtype, | |||
items, | |||
ptype, | |||
IOTable | |||
) | io_register_io_block(# name, dtype, items, ptype, (property_getter) GT ## name , (property_setter) ST ## name, 1, IOTable) |
#define IO_REG_NONFATAL | ( | name, | |
dtype, | |||
items, | |||
ptype, | |||
IOTable | |||
) | io_register_io_block(# name, dtype, items, ptype, (property_getter) GT ## name , (property_setter) ST ## name, 0, IOTable) |
#define IO_REG_TYPE | ( | name, | |
dtype, | |||
items, | |||
ptype, | |||
IOTable | |||
) | io_register_io_block(# name, dtype, items, ptype, (property_getter) GT ## ptype ## name , (property_setter) ST ## ptype ## name, 0, IOTable) |
#define IO_REG_WRONLY | ( | name, | |
dtype, | |||
items, | |||
ptype, | |||
IOTable | |||
) | io_register_io_block(# name, dtype, items, ptype, (property_getter) GT ## name , NULL, 1, IOTable) |
#define SIMPLE_GETTER | ( | name, | |
field, | |||
type, | |||
items, | |||
stype | |||
) |
#define SIMPLE_SETTER | ( | name, | |
field, | |||
type, | |||
items, | |||
stype | |||
) |
typedef struct IOTableEntry IOTableEntry |
typedef void(* property_getter) (int i, void *result, void *baseptr, void *slotptr, const struct conversions *params) |
typedef void(* property_setter) (int i, void *target, void *baseptr, void *slotptr, const struct conversions *params) |
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().
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.
void petaio_alloc_buffer | ( | BigArray * | array, |
IOTableEntry * | ent, | ||
int64_t | npartLocal | ||
) |
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 | ( | ) |
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().
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().
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().