42 #define P4EST_FILE_MAGIC_NUMBER "p4data0"
43 #define P4EST_FILE_METADATA_BYTES 96
44 #define P4EST_FILE_MAGIC_BYTES 8
45 #define P4EST_FILE_VERSION_STR_BYTES 24
46 #define P4EST_FILE_ARRAY_METADATA_BYTES 14
48 #define P4EST_FILE_ARRAY_METADATA_CHARS (P4EST_FILE_ARRAY_METADATA_BYTES - 2)
49 #define P4EST_FILE_BYTE_DIV 16
50 #define P4EST_FILE_MAX_NUM_PAD_BYTES (P4EST_FILE_BYTE_DIV + 1)
57 #define P4EST_FILE_USER_STRING_BYTES 48
58 #define P4EST_FILE_FIELD_HEADER_BYTES (2 + P4EST_FILE_ARRAY_METADATA_BYTES + P4EST_FILE_USER_STRING_BYTES)
60 #define P4EST_FILE_MAX_GLOBAL_QUAD 9999999999999999
61 #define P4EST_FILE_MAX_BLOCK_SIZE 9999999999999
62 #define P4EST_FILE_MAX_FIELD_ENTRY_SIZE 9999999999999
98 global_first_quadrant,
128 global_first_quadrant,
257 const char *user_string,
int *errcode);
290 const char *filename,
291 char *user_string,
int *errcode);
336 const char *user_string,
390 char *user_string,
int *errcode);
439 size_t quadrant_size,
441 const char *user_string,
499 size_t quadrant_size,
501 char *user_string,
int *errcode);
574 char *
string,
int *resultlen);
618 const char *quad_string,
619 const char *quad_data_string,
652 char *quad_data_string,
687 const char *conn_string,
713 conn,
char *conn_string,
The top-level 2D p4est interface.
int64_t p4est_gloidx_t
Typedef for globally unique indexing of quadrants.
Definition: p4est_base.h:118
int p4est_file_info(p4est_t *p4est, const char *filename, char *user_string, sc_array_t *data_sections, int *errcode)
Read metadata information of a file written by a matching forest.
p4est_file_context_t * p4est_file_write_connectivity(p4est_file_context_t *fc, p4est_connectivity_t *conn, const char *conn_string, int *errcode)
Write a connectivity to an opened file.
p4est_file_error
Error values for p4est_file functions.
Definition: p4est_io.h:183
@ P4EST_FILE_ERR_BAD_FILE
invalid file name
Definition: p4est_io.h:190
@ P4EST_FILE_ERR_IN_DATA
input data of file function is invalid
Definition: p4est_io.h:201
@ P4EST_FILE_ERR_QUOTA
quota exceeded
Definition: p4est_io.h:193
@ P4EST_FILE_ERR_IN_USE
file currently open by other process
Definition: p4est_io.h:195
@ P4EST_FILE_ERR_IO
other I/O error
Definition: p4est_io.h:196
@ P4EST_FILE_ERR_LASTCODE
to define own error codes for a higher level application that is using p4est_file functions
Definition: p4est_io.h:205
@ P4EST_FILE_ERR_SECTION_TYPE
a valid non-matching section type
Definition: p4est_io.h:198
@ P4EST_FILE_ERR_P4EST
invalid p4est data
Definition: p4est_io.h:200
@ P4EST_FILE_ERR_FORMAT
read file has a wrong format
Definition: p4est_io.h:197
@ P4EST_FILE_ERR_CONN
invalid serialized connectivity data
Definition: p4est_io.h:199
@ P4EST_FILE_ERR_FILE
invalid file handle
Definition: p4est_io.h:185
@ P4EST_FILE_ERR_AMODE
access mode error
Definition: p4est_io.h:187
@ P4EST_FILE_ERR_FILE_EXIST
file exists already
Definition: p4est_io.h:189
@ P4EST_FILE_ERR_COUNT
read or write count error that was not classified as a format error
Definition: p4est_io.h:202
@ P4EST_FILE_ERR_NOT_SAME
collective arg not identical
Definition: p4est_io.h:186
@ P4EST_FILE_ERR_READ_ONLY
read only file (system)
Definition: p4est_io.h:194
@ P4EST_FILE_ERR_UNKNOWN
unknown error
Definition: p4est_io.h:204
@ P4EST_FILE_ERR_NO_SPACE
not enough space
Definition: p4est_io.h:192
@ P4EST_FILE_ERR_SUCCESS
file function completed with success
Definition: p4est_io.h:184
@ P4EST_FILE_ERR_ACCESS
permission denied
Definition: p4est_io.h:191
@ P4EST_FILE_ERR_NO_SUCH_FILE
file does not exist
Definition: p4est_io.h:188
p4est_file_context_t * p4est_file_read_block(p4est_file_context_t *fc, size_t header_size, sc_array_t *header_data, char *user_string, int *errcode)
Read a header block from an opened file.
p4est_t * p4est_inflate_null(sc_MPI_Comm mpicomm, p4est_connectivity_t *connectivity, const p4est_gloidx_t *global_first_quadrant, const p4est_gloidx_t *pertree, sc_array_t *quadrants, sc_array_t *data, void *user_pointer)
Create a new p4est based on serialized data.
p4est_file_context_t * p4est_file_open_read(p4est_t *p4est, const char *filename, char *user_string, int *errcode)
Open a file for reading and read its user string on rank zero.
struct p4est_file_context p4est_file_context_t
p4est data file format All p4est data files have 64 bytes file header section at the beginning of the...
Definition: p4est_io.h:178
p4est_file_context_t * p4est_file_write_block(p4est_file_context_t *fc, size_t block_size, sc_array_t *block_data, const char *user_string, int *errcode)
Write a block section to an opened file.
p4est_file_context_t * p4est_file_open_create(p4est_t *p4est, const char *filename, const char *user_string, int *errcode)
Begin writing file header and saving data blocks into a parallel file.
p4est_file_context_t * p4est_file_write_field(p4est_file_context_t *fc, size_t quadrant_size, sc_array_t *quadrant_data, const char *user_string, int *errcode)
Write one (more) per-quadrant data set to a parallel output file.
p4est_file_context_t * p4est_file_write_p4est(p4est_file_context_t *fc, p4est_t *p4est, const char *quad_string, const char *quad_data_string, int *errcode)
Write a p4est to an opened file.
int p4est_file_close(p4est_file_context_t *fc, int *errcode)
Close a file opened for parallel write/read and free the context.
p4est_file_context_t * p4est_file_read_connectivity(p4est_file_context_t *fc, p4est_connectivity_t **conn, char *conn_string, int *errcode)
Read a connectivity from an opened file.
struct p4est_file_section_metadata p4est_file_section_metadata_t
A data type that encodes the metadata of one data block in a p4est data file.
p4est_t * p4est_inflate(sc_MPI_Comm mpicomm, p4est_connectivity_t *connectivity, const p4est_gloidx_t *global_first_quadrant, const p4est_gloidx_t *pertree, sc_array_t *quadrants, sc_array_t *data, void *user_pointer)
Create a new p4est based on serialized data.
p4est_file_context_t * p4est_file_read_field(p4est_file_context_t *fc, size_t quadrant_size, sc_array_t *quadrant_data, char *user_string, int *errcode)
Read one (more) per-quadrant data set from a parallel input file.
int p4est_file_error_string(int errclass, char *string, int *resultlen)
Turn p4est_file errcode into a string.
#define P4EST_FILE_USER_STRING_BYTES
number of user string bytes
Definition: p4est_io.h:57
sc_array_t * p4est_deflate_quadrants(p4est_t *p4est, sc_array_t **data)
Extract processor local quadrants' x y level data.
p4est_file_context_t * p4est_file_read_p4est(p4est_file_context_t *fc, p4est_connectivity_t *conn, size_t data_size, p4est_t **p4est, char *quad_string, char *quad_data_string, int *errcode)
Read a p4est to an opened file using the MPI communicator of fc.
enum p4est_file_error p4est_file_error_t
Error values for p4est_file functions.
#define sc_MPI_ERR_LASTCODE
sc3_MPI_Comm_t sc_MPI_Comm
This structure holds the 2D inter-tree connectivity information.
Definition: p4est_connectivity.h:153
The p4est forest datatype.
Definition: p4est.h:136