p4est 2.8.6
p4est is a software library for parallel adaptive mesh refinement.
p4est_io.h
Go to the documentation of this file.
1/*
2 This file is part of p4est.
3 p4est is a C library to manage a collection (a forest) of multiple
4 connected adaptive quadtrees or octrees in parallel.
5
6 Copyright (C) 2010 The University of Texas System
7 Additional copyright (C) 2011 individual authors
8 Written by Carsten Burstedde, Lucas C. Wilcox, and Tobin Isaac
9
10 p4est is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2 of the License, or
13 (at your option) any later version.
14
15 p4est is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with p4est; if not, write to the Free Software Foundation, Inc.,
22 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23*/
24
35#ifndef P4EST_IO_H
36#define P4EST_IO_H
37
38#include <p4est.h>
39
40SC_EXTERN_C_BEGIN;
41
51#ifdef P4EST_ENABLE_FILE_DEPRECATED
52
53#define P4EST_FILE_MAGIC_NUMBER "p4data0"
54#define P4EST_FILE_METADATA_BYTES 96
55#define P4EST_FILE_MAGIC_BYTES 8
56#define P4EST_FILE_VERSION_STR_BYTES 24
57#define P4EST_FILE_ARRAY_METADATA_BYTES 14
58/* subtract 2 for '\n' at the beginning and end of the array metadata */
59#define P4EST_FILE_ARRAY_METADATA_CHARS (P4EST_FILE_ARRAY_METADATA_BYTES - 2)
60#define P4EST_FILE_BYTE_DIV 16
61#define P4EST_FILE_MAX_NUM_PAD_BYTES (P4EST_FILE_BYTE_DIV + 1)
68#define P4EST_FILE_USER_STRING_BYTES 48
69#define P4EST_FILE_FIELD_HEADER_BYTES (2 + P4EST_FILE_ARRAY_METADATA_BYTES + P4EST_FILE_USER_STRING_BYTES)
71#define P4EST_FILE_MAX_GLOBAL_QUAD 9999999999999999
72#define P4EST_FILE_MAX_BLOCK_SIZE 9999999999999
73#define P4EST_FILE_MAX_FIELD_ENTRY_SIZE 9999999999999
75#endif /* P4EST_ENABLE_FILE_DEPRECATED */
76
88 sc_array_t ** data);
89
108p4est_t *p4est_inflate (sc_MPI_Comm mpicomm,
109 p4est_connectivity_t * connectivity,
110 const p4est_gloidx_t *
111 global_first_quadrant,
112 const p4est_gloidx_t * pertree,
113 sc_array_t * quadrants, sc_array_t * data,
114 void *user_pointer);
115
138p4est_t *p4est_inflate_null (sc_MPI_Comm mpicomm,
139 p4est_connectivity_t * connectivity,
140 const p4est_gloidx_t *
141 global_first_quadrant,
142 const p4est_gloidx_t * pertree,
143 sc_array_t * quadrants,
144 sc_array_t * data,
145 void *user_pointer);
146
147#ifdef P4EST_ENABLE_FILE_DEPRECATED
148
193typedef struct p4est_file_context p4est_file_context_t;
194
197typedef enum p4est_file_error
198{
199 P4EST_FILE_ERR_SUCCESS = sc_MPI_ERR_LASTCODE,
200 P4EST_FILE_ERR_FILE,
201 P4EST_FILE_ERR_NOT_SAME,
202 P4EST_FILE_ERR_AMODE,
203 P4EST_FILE_ERR_NO_SUCH_FILE,
204 P4EST_FILE_ERR_FILE_EXIST,
205 P4EST_FILE_ERR_BAD_FILE,
206 P4EST_FILE_ERR_ACCESS,
207 P4EST_FILE_ERR_NO_SPACE,
208 P4EST_FILE_ERR_QUOTA,
209 P4EST_FILE_ERR_READ_ONLY,
210 P4EST_FILE_ERR_IN_USE,
211 P4EST_FILE_ERR_IO,
212 P4EST_FILE_ERR_FORMAT,
213 P4EST_FILE_ERR_SECTION_TYPE,
214 P4EST_FILE_ERR_CONN,
215 P4EST_FILE_ERR_P4EST,
216 P4EST_FILE_ERR_IN_DATA,
217 P4EST_FILE_ERR_COUNT,
219 P4EST_FILE_ERR_UNKNOWN,
220 P4EST_FILE_ERR_LASTCODE
224}
225p4est_file_error_t;
226
270p4est_file_context_t *p4est_file_open_create
271 (p4est_t * p4est, const char *filename,
272 const char *user_string, int *errcode);
273
304p4est_file_context_t *p4est_file_open_read (p4est_t * p4est,
305 const char *filename,
306 char *user_string, int *errcode);
307
348p4est_file_context_t *p4est_file_write_block (p4est_file_context_t * fc,
349 size_t block_size,
350 sc_array_t * block_data,
351 const char *user_string,
352 int *errcode);
353
402p4est_file_context_t *p4est_file_read_block (p4est_file_context_t * fc,
403 size_t header_size,
404 sc_array_t * header_data,
405 char *user_string, int *errcode);
406
453p4est_file_context_t *p4est_file_write_field (p4est_file_context_t * fc,
454 size_t quadrant_size,
455 sc_array_t * quadrant_data,
456 const char *user_string,
457 int *errcode);
458
513p4est_file_context_t *p4est_file_read_field (p4est_file_context_t * fc,
514 size_t quadrant_size,
515 sc_array_t * quadrant_data,
516 char *user_string, int *errcode);
517
520typedef struct p4est_file_section_metadata
521{
522 char block_type;
523 size_t data_size;
525 char user_string[P4EST_FILE_USER_STRING_BYTES];
526}
527p4est_file_section_metadata_t;
528
574int p4est_file_info (p4est_t * p4est, const char *filename,
575 char *user_string,
576 sc_array_t * data_sections,
577 int *errcode);
578
588int p4est_file_error_string (int errclass,
589 char *string, int *resultlen);
590
631p4est_file_context_t *p4est_file_write_p4est (p4est_file_context_t * fc,
632 p4est_t * p4est,
633 const char *quad_string,
634 const char *quad_data_string,
635 int *errcode);
636
662p4est_file_context_t *p4est_file_read_p4est (p4est_file_context_t * fc,
664 size_t data_size,
665 p4est_t ** p4est,
666 char *quad_string,
667 char *quad_data_string,
668 int *errcode);
669
698p4est_file_context_t *p4est_file_write_connectivity (p4est_file_context_t *
699 fc,
701 conn,
702 const char *conn_string,
703 int *errcode);
704
726p4est_file_context_t *p4est_file_read_connectivity (p4est_file_context_t * fc,
728 conn, char *conn_string,
729 int *errcode);
730
745int p4est_file_close (p4est_file_context_t * fc,
746 int *errcode);
747
748#endif /* P4EST_ENABLE_FILE_DEPRECATED */
749
750SC_EXTERN_C_END;
751
752#endif /* !P4EST_IO_H */
The top-level 2D p4est interface.
int64_t p4est_gloidx_t
Typedef for globally unique indexing of quadrants.
Definition: p4est_base.h:118
sc_array_t * p4est_deflate_quadrants(p4est_t *p4est, sc_array_t **data)
This parallel data file format is deprecated since we plan to release an updated version of it soon.
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_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.
This structure holds the 2D inter-tree connectivity information.
Definition: p4est_connectivity.h:190
The p4est forest datatype.
Definition: p4est.h:136