p4est 2.8.6
p4est is a software library for parallel adaptive mesh refinement.
p8est_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 P8EST_IO_H
36#define P8EST_IO_H
37
38#include <p8est.h>
39
40SC_EXTERN_C_BEGIN;
41
51#ifdef P4EST_ENABLE_FILE_DEPRECATED
52
53#define P8EST_FILE_MAGIC_NUMBER "p8data0"
54#define P8EST_FILE_METADATA_BYTES 96
55#define P8EST_FILE_MAGIC_BYTES 8
56#define P8EST_FILE_VERSION_STR_BYTES 24
57#define P8EST_FILE_ARRAY_METADATA_BYTES 14
58/* subtract 2 for '\n' at the beginning and end of the array metadata */
59#define P8EST_FILE_ARRAY_METADATA_CHARS (P8EST_FILE_ARRAY_METADATA_BYTES - 2)
60#define P8EST_FILE_BYTE_DIV 16
61#define P8EST_FILE_MAX_NUM_PAD_BYTES (P8EST_FILE_BYTE_DIV + 1)
68#define P8EST_FILE_USER_STRING_BYTES 48
69#define P8EST_FILE_FIELD_HEADER_BYTES (2 + P8EST_FILE_ARRAY_METADATA_BYTES + P8EST_FILE_USER_STRING_BYTES)
71#define P8EST_FILE_MAX_GLOBAL_QUAD 9999999999999999
72#define P8EST_FILE_MAX_BLOCK_SIZE 9999999999999
73#define P8EST_FILE_MAX_FIELD_ENTRY_SIZE 9999999999999
75#endif /* P4EST_ENABLE_FILE_DEPRECATED */
76
88 sc_array_t ** data);
89
108p8est_t *p8est_inflate (sc_MPI_Comm mpicomm,
109 p8est_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
138p8est_t *p8est_inflate_null (sc_MPI_Comm mpicomm,
139 p8est_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 p8est_file_context p8est_file_context_t;
194
197typedef enum p8est_file_error
198{
199 P8EST_FILE_ERR_SUCCESS = sc_MPI_ERR_LASTCODE,
200 P8EST_FILE_ERR_FILE,
201 P8EST_FILE_ERR_NOT_SAME,
202 P8EST_FILE_ERR_AMODE,
203 P8EST_FILE_ERR_NO_SUCH_FILE,
204 P8EST_FILE_ERR_FILE_EXIST,
205 P8EST_FILE_ERR_BAD_FILE,
206 P8EST_FILE_ERR_ACCESS,
207 P8EST_FILE_ERR_NO_SPACE,
208 P8EST_FILE_ERR_QUOTA,
209 P8EST_FILE_ERR_READ_ONLY,
210 P8EST_FILE_ERR_IN_USE,
211 P8EST_FILE_ERR_IO,
212 P8EST_FILE_ERR_FORMAT,
213 P8EST_FILE_ERR_SECTION_TYPE,
214 P8EST_FILE_ERR_CONN,
215 P8EST_FILE_ERR_P8EST,
216 P8EST_FILE_ERR_IN_DATA,
217 P8EST_FILE_ERR_COUNT,
219 P8EST_FILE_ERR_UNKNOWN,
220 P8EST_FILE_ERR_LASTCODE
224}
225p8est_file_error_t;
226
270p8est_file_context_t *p8est_file_open_create
271 (p8est_t * p8est, const char *filename,
272 const char *user_string, int *errcode);
273
304p8est_file_context_t *p8est_file_open_read (p8est_t * p8est,
305 const char *filename,
306 char *user_string, int *errcode);
307
348p8est_file_context_t *p8est_file_write_block (p8est_file_context_t * fc,
349 size_t block_size,
350 sc_array_t * block_data,
351 const char *user_string,
352 int *errcode);
353
402p8est_file_context_t *p8est_file_read_block (p8est_file_context_t * fc,
403 size_t header_size,
404 sc_array_t * header_data,
405 char *user_string, int *errcode);
406
455p8est_file_context_t *p8est_file_write_field (p8est_file_context_t * fc,
456 size_t quadrant_size,
457 sc_array_t * quadrant_data,
458 const char *user_string,
459 int *errcode);
460
514p8est_file_context_t *p8est_file_read_field (p8est_file_context_t * fc,
515 size_t quadrant_size,
516 sc_array_t * quadrant_data,
517 char *user_string, int *errcode);
518
521typedef struct p8est_file_section_metadata
522{
523 char block_type;
524 size_t data_size;
526 char user_string[P8EST_FILE_USER_STRING_BYTES];
527}
528p8est_file_section_metadata_t;
529
575int p8est_file_info (p8est_t * p8est, const char *filename,
576 char *user_string,
577 sc_array_t * data_sections,
578 int *errcode);
579
589int p8est_file_error_string (int errclass,
590 char *string, int *resultlen);
591
632p8est_file_context_t *p8est_file_write_p8est (p8est_file_context_t * fc,
633 p8est_t * p8est,
634 const char *quad_string,
635 const char *quad_data_string,
636 int *errcode);
637
663p8est_file_context_t *p8est_file_read_p8est (p8est_file_context_t * fc,
665 size_t data_size,
666 p8est_t ** p8est,
667 char *quad_string,
668 char *quad_data_string,
669 int *errcode);
670
699p8est_file_context_t *p8est_file_write_connectivity (p8est_file_context_t *
700 fc,
702 conn,
703 const char *conn_string,
704 int *errcode);
705
727p8est_file_context_t *p8est_file_read_connectivity (p8est_file_context_t * fc,
729 conn, char *conn_string,
730 int *errcode);
731
746int p8est_file_close (p8est_file_context_t * fc,
747 int *errcode);
748
749#endif /* P4EST_ENABLE_FILE_DEPRECATED */
750
751SC_EXTERN_C_END;
752
753#endif /* !P8EST_IO_H */
int64_t p4est_gloidx_t
Typedef for globally unique indexing of quadrants.
Definition: p4est_base.h:118
The top-level 3D p8est interface.
p8est_t * p8est_inflate(sc_MPI_Comm mpicomm, p8est_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.
p8est_t * p8est_inflate_null(sc_MPI_Comm mpicomm, p8est_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.
sc_array_t * p8est_deflate_quadrants(p8est_t *p8est, sc_array_t **data)
This parallel data file format is deprecated since we plan to release an updated version of it soon.
This structure holds the 3D inter-tree connectivity information.
Definition: p8est_connectivity.h:215
The p8est forest datatype.
Definition: p8est.h:132