GADGET-4
IO_Def Class Referenceabstract

#include <io.h>

Inherits io_streamcount, and setcomm.

Inherited by fof_io< partset >, and snap_io.

Public Member Functions

 IO_Def (MPI_Comm comm, int format)
 
virtual ~IO_Def ()
 
virtual void fill_file_header (int writeTask, int lastTask, long long *nloc_part, long long *npart)=0
 
virtual void read_file_header (const char *fname, int filenr, int readTask, int lastTask, long long *nloc_part, long long *npart, int *nstart)=0
 
virtual void get_datagroup_name (int grnr, char *gname)=0
 
virtual void write_header_fields (hid_t)=0
 
virtual void read_header_fields (const char *fname)=0
 
virtual void read_increase_numbers (int type, int n_for_this_task)=0
 
virtual int get_filenr_from_header (void)=0
 
virtual void set_filenr_in_header (int)=0
 
virtual void * get_base_address_of_structure (enum arrays array, int index)=0
 
virtual int get_type_of_element (int index)=0
 
virtual void set_type_of_element (int index, int type)=0
 
void init_field (const char *label, const char *datasetname, enum types_in_memory type_in_memory, enum types_in_file type_in_file_output, enum read_flags read_flag, int values_per_block, enum arrays array, void *pointer_to_field, void(*io_func)(IO_Def *, int, int, void *, int), int typelist_bitmask, int hasunits, double a, double h, double L, double M, double V, double c, bool compression_on=false)
 
int find_files (const char *fname, const char *fname_multiple)
 This function determines on how many files a given snapshot or group/desc catalogue is distributed. More...
 
void read_files_driver (const char *fname, int rep, int numfiles)
 
void write_multiple_files (char *fname, int numfilesperdump, int append_flag=0, int chunk_size=0)
 
void write_compile_time_options_in_hdf5 (hid_t handle)
 
void read_segment (const char *fname, int type, long long offset, long long count, int numfiles)
 
void read_single_file_segment (const char *fname, int filenr, int type, long long offset, unsigned long long count, long long storage_offset, int numfiles)
 
void alloc_and_read_ntype_in_files (const char *fname, int num_files)
 
- Public Member Functions inherited from io_streamcount
size_t my_fwrite (const void *ptr, size_t size, size_t nmemb, FILE *stream)
 A wrapper for the fwrite() function. More...
 
size_t my_fread (void *ptr, size_t size, size_t nmemb, FILE *stream)
 A wrapper for the fread() function. More...
 
void reset_io_byte_count (void)
 
long long get_io_byte_count (void)
 
- Public Member Functions inherited from setcomm
 setcomm (MPI_Comm Comm)
 
 setcomm (const char *str)
 
void initcomm (MPI_Comm Comm)
 
void mpi_printf (const char *fmt,...)
 
void determine_compute_nodes (void)
 

Public Attributes

int N_DataGroups = 0
 
int N_IO_Fields = 0
 
int Max_IO_Fields = 0
 
size_t header_size
 
void * header_buf
 
long long * ntype_in_files
 
char info [100]
 
enum file_contents type_of_file
 
- Public Attributes inherited from io_streamcount
long long byte_count = 0
 
- Public Attributes inherited from setcomm
MPI_Comm Communicator
 
int NTask
 
int ThisTask
 
int PTask
 
int ThisNode
 
int NumNodes = 0
 
int TasksInThisNode
 
int RankInThisNode
 
int MinTasksPerNode
 
int MaxTasksPerNode
 
long long MemoryOnNode
 
long long SharedMemoryOnNode
 

Detailed Description

Definition at line 128 of file io.h.

Constructor & Destructor Documentation

◆ IO_Def()

IO_Def ( MPI_Comm  comm,
int  format 
)
inline

Definition at line 131 of file io.h.

◆ ~IO_Def()

~IO_Def ( )
virtual

Definition at line 47 of file io.cc.

Member Function Documentation

◆ alloc_and_read_ntype_in_files()

void alloc_and_read_ntype_in_files ( const char *  fname,
int  num_files 
)

Definition at line 2439 of file io.cc.

◆ fill_file_header()

virtual void fill_file_header ( int  writeTask,
int  lastTask,
long long *  nloc_part,
long long *  npart 
)
pure virtual

Implemented in fof_io< partset >, and snap_io.

◆ find_files()

int find_files ( const char *  fname,
const char *  fname_multiple 
)

This function determines on how many files a given snapshot or group/desc catalogue is distributed.

Parameters
fnamefile name of the snapshot as given in the parameter file

Definition at line 132 of file io.cc.

◆ get_base_address_of_structure()

virtual void * get_base_address_of_structure ( enum arrays  array,
int  index 
)
pure virtual

Implemented in fof_io< partset >, and snap_io.

◆ get_datagroup_name()

virtual void get_datagroup_name ( int  grnr,
char *  gname 
)
pure virtual

Implemented in fof_io< partset >, and snap_io.

◆ get_filenr_from_header()

virtual int get_filenr_from_header ( void  )
pure virtual

Implemented in fof_io< partset >, and snap_io.

◆ get_type_of_element()

virtual int get_type_of_element ( int  index)
pure virtual

Implemented in fof_io< partset >, and snap_io.

◆ init_field()

void init_field ( const char *  label,
const char *  datasetname,
enum types_in_memory  type_in_memory,
enum types_in_file  type_in_file_output,
enum read_flags  read_flag,
int  values_per_block,
enum arrays  array,
void *  pointer_to_field,
void(*)(IO_Def *, int, int, void *, int)  io_func,
int  typelist_bitmask,
int  flagunit,
double  a,
double  h,
double  L,
double  M,
double  V,
double  c,
bool  compression_on = false 
)
Parameters
fieldSpecifies the field as an enumeration type iofields (io_private.h), e.g. IO_POS.
labelThe label of the dataset (4 characters, for obsolete old format=2)
datasetnameThe name of the hdf5 dataset (maximum 256 characters, for format=3)
type_in_memoryThe type of the field in the memory
type_in_file_outputThe output type in the file if it is written (upon read, the type found will be converted to the memory type)
read_flagThis flags whether the field should be ignored upon read on (use SKIP_ON_READ, else READ_IF_PRESENT).
values_per_blockThe number of values per field, e.g. 1 for mass, 3 for velocities
arrayThe array in which the value is stored
pointer_to_fieldA Pointer to the field in one of the global arrays, e.g. &SphP[0].Density, or &P[0].Vel[0]
io_funcAlternatively, if the value to output/input is not a simple field, you can define a function which handles i/o
typelist_bitmaskSpecifies for which particle type the field is present, e.g. 1+2+8 => field present for particle types 0,1,3 (or use ALL_TYPES, GAS_ONLY,...)

Definition at line 66 of file io.cc.

◆ read_file_header()

virtual void read_file_header ( const char *  fname,
int  filenr,
int  readTask,
int  lastTask,
long long *  nloc_part,
long long *  npart,
int *  nstart 
)
pure virtual

Implemented in fof_io< partset >, and snap_io.

◆ read_files_driver()

void read_files_driver ( const char *  fname,
int  rep,
int  numfiles 
)

Definition at line 227 of file io.cc.

◆ read_header_fields()

virtual void read_header_fields ( const char *  fname)
pure virtual

Implemented in fof_io< partset >, and snap_io.

◆ read_increase_numbers()

virtual void read_increase_numbers ( int  type,
int  n_for_this_task 
)
pure virtual

Implemented in fof_io< partset >, and snap_io.

◆ read_segment()

void read_segment ( const char *  fname,
int  type,
long long  offset,
long long  count,
int  numfiles 
)

Definition at line 2166 of file io.cc.

◆ read_single_file_segment()

void read_single_file_segment ( const char *  fname,
int  filenr,
int  type,
long long  offset,
unsigned long long  count,
long long  storage_offset,
int  numfiles 
)

Definition at line 2207 of file io.cc.

◆ set_filenr_in_header()

virtual void set_filenr_in_header ( int  )
pure virtual

Implemented in fof_io< partset >, and snap_io.

◆ set_type_of_element()

virtual void set_type_of_element ( int  index,
int  type 
)
pure virtual

Implemented in fof_io< partset >, and snap_io.

◆ write_compile_time_options_in_hdf5()

void write_compile_time_options_in_hdf5 ( hid_t  handle)

◆ write_header_fields()

virtual void write_header_fields ( hid_t  )
pure virtual

Implemented in fof_io< partset >, and snap_io.

◆ write_multiple_files()

void write_multiple_files ( char *  fname,
int  numfilesperdump,
int  append_flag = 0,
int  chunk_size = 0 
)

Definition at line 700 of file io.cc.

Member Data Documentation

◆ header_buf

void* header_buf

Definition at line 174 of file io.h.

◆ header_size

size_t header_size

Definition at line 173 of file io.h.

◆ info

char info[100]

Definition at line 177 of file io.h.

◆ Max_IO_Fields

int Max_IO_Fields = 0

Definition at line 141 of file io.h.

◆ N_DataGroups

int N_DataGroups = 0

Definition at line 139 of file io.h.

◆ N_IO_Fields

int N_IO_Fields = 0

Definition at line 140 of file io.h.

◆ ntype_in_files

long long* ntype_in_files

Definition at line 176 of file io.h.

◆ type_of_file

enum file_contents type_of_file

Definition at line 187 of file io.h.


The documentation for this class was generated from the following files: