libsc 2.8.5.210-64a7
The SC library provides support for parallel scientific applications.
sc_scda.h
Go to the documentation of this file.
1/*
2 This file is part of the SC Library.
3 The SC Library provides support for parallel scientific applications.
4
5 Copyright (C) 2010 The University of Texas System
6 Additional copyright (C) 2011 individual authors
7
8 The SC Library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Lesser General Public
10 License as published by the Free Software Foundation; either
11 version 2.1 of the License, or (at your option) any later version.
12
13 The SC Library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License for more details.
17
18 You should have received a copy of the GNU Lesser General Public
19 License along with the SC Library; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 02110-1301, USA.
22*/
23
166#ifndef SC_SCDA_H
167#define SC_SCDA_H
168
169#include <sc_containers.h>
170
171SC_EXTERN_C_BEGIN;
172
173#define SC_SCDA_HEADER_BYTES 128
174#define SC_SCDA_USER_STRING_BYTES 58
177typedef struct sc_scda_fcontext sc_scda_fcontext_t;
178
180typedef uint64_t sc_scda_ulong;
181
186typedef enum sc_scda_ferror
187{
232
237{
239}
290 const char *filename,
291 const char *user_string, size_t *len,
293 int *errcode);
294
337 const char *user_string,
338 size_t *len, sc_array_t * inline_data,
339 int root, int *errcode);
340
395 const char *user_string,
396 size_t *len, sc_array_t * block_data,
397 size_t block_size, int root,
398 int encode, int *errcode);
399
475 const char *user_string,
476 size_t *len, sc_array_t * array_data,
477 sc_array_t * elem_counts,
478 size_t elem_size,
479 int indirect, int encode,
480 int *errcode);
481
506int sc_scda_proc_sizes (sc_array_t *elem_sizes, sc_array_t *elem_counts,
507 sc_array_t *proc_sizes, int *errcode);
508
596 const char *user_string, size_t *len,
597 sc_array_t * array_data,
598 sc_array_t * elem_counts,
599 sc_array_t * elem_sizes,
600 sc_array_t * proc_sizes,
601 int indirect, int encode,
602 int *errcode);
603
643 const char *filename,
644 char *user_string, size_t *len,
646 int *errcode);
647
713 char *user_string,
714 size_t *len, char *type,
715 size_t *elem_count,
716 size_t *elem_size,
717 int *decode, int *errcode);
718
750 sc_array_t * data, int root,
751 int *errcode);
752
789 sc_array_t * block_data,
790 size_t block_size, int root,
791 int *errcode);
792
850 sc_array_t * array_data,
851 sc_array_t * elem_counts,
852 size_t elem_size,
853 int indirect, int *errcode);
854
900 sc_array_t * elem_sizes,
901 sc_array_t * elem_counts,
902 int *errcode);
903
976 sc_array_t * array_data,
977 sc_array_t * elem_counts,
978 sc_array_t * elem_sizes,
979 sc_array_t * proc_sizes,
980 int indirect, int *errcode);
981
993int sc_scda_ferror_string (int errcode, char *str, int *len);
994
1018int sc_scda_fclose (sc_scda_fcontext_t * fc, int *errcode);
1019
1020SC_EXTERN_C_END;
1021
1022#endif /* SC_SCDA_H */
Dynamic containers such as lists, arrays, and hash tables.
#define sc_MPI_ERR_LASTCODE
Emulate SC_MPI_ERR_LASTCODE.
Definition: sc_mpi.h:321
sc3_MPI_Comm_t sc_MPI_Comm
Emulate an MPI communicator.
Definition: sc_mpi.h:391
sc3_MPI_Info_t sc_MPI_Info
Emulate an MPI Info object.
Definition: sc_mpi.h:392
sc_scda_fcontext_t * sc_scda_fread_inline_data(sc_scda_fcontext_t *fc, sc_array_t *data, int root, int *errcode)
Read the data of an inline data section.
sc_scda_fcontext_t * sc_scda_fread_section_header(sc_scda_fcontext_t *fc, char *user_string, size_t *len, char *type, size_t *elem_count, size_t *elem_size, int *decode, int *errcode)
Read the next file section header.
sc_scda_ferror
Error values for scdafile functions.
Definition: sc_scda.h:187
@ SC_SCDA_FERR_LASTCODE
to define own error codes for a higher level application that is using sc_scda functions
Definition: sc_scda.h:226
@ SC_SCDA_FERR_FILE_EXIST
file exists already
Definition: sc_scda.h:193
@ SC_SCDA_FERR_COUNT
A byte count error that may occur transiently on writing or the file is short on reading.
Definition: sc_scda.h:223
@ SC_SCDA_FERR_FORMAT
File not conforming to the scda format.
Definition: sc_scda.h:202
@ SC_SCDA_FERR_IN_USE
file currently open by other process
Definition: sc_scda.h:199
@ SC_SCDA_FERR_ACCESS
permission denied
Definition: sc_scda.h:195
@ SC_SCDA_FERR_BAD_FILE
invalid file name
Definition: sc_scda.h:194
@ SC_SCDA_FERR_USAGE
Incorrect workflow of an scda reading function.
Definition: sc_scda.h:203
@ SC_SCDA_FERR_SUCCESS
successful function call
Definition: sc_scda.h:188
@ SC_SCDA_FERR_QUOTA
quota exceeded
Definition: sc_scda.h:197
@ SC_SCDA_FERR_FILE
invalid file handle
Definition: sc_scda.h:189
@ SC_SCDA_FERR_INPUT
An argument to a scda file function is invalid.
Definition: sc_scda.h:219
@ SC_SCDA_FERR_IO
other I/O error
Definition: sc_scda.h:200
@ SC_SCDA_FERR_NOT_SAME
collective argument not identical
Definition: sc_scda.h:190
@ SC_SCDA_FERR_AMODE
access mode error
Definition: sc_scda.h:191
@ SC_SCDA_FERR_NO_SUCH_FILE
file does not exist
Definition: sc_scda.h:192
@ SC_SCDA_FERR_DECODE
The decode parameter to sc_scda_fread_section_header is true but the file section header(s) encounter...
Definition: sc_scda.h:214
@ SC_SCDA_FERR_READ_ONLY
read only file (system)
Definition: sc_scda.h:198
@ SC_SCDA_FERR_UNKNOWN
unknown I/O error
Definition: sc_scda.h:201
@ SC_SCDA_FERR_NO_SPACE
not enough space
Definition: sc_scda.h:196
sc_scda_fcontext_t * sc_scda_fread_array_data(sc_scda_fcontext_t *fc, sc_array_t *array_data, sc_array_t *elem_counts, size_t elem_size, int indirect, int *errcode)
Read the data of a fixed-size array.
uint64_t sc_scda_ulong
Type for element counts and sizes.
Definition: sc_scda.h:180
sc_scda_fcontext_t * sc_scda_fread_varray_sizes(sc_scda_fcontext_t *fc, sc_array_t *elem_sizes, sc_array_t *elem_counts, int *errcode)
Read the element sizes of a variable-size array.
sc_scda_fcontext_t * sc_scda_fread_block_data(sc_scda_fcontext_t *fc, sc_array_t *block_data, size_t block_size, int root, int *errcode)
Read the data of a block of given size.
sc_scda_fcontext_t * sc_scda_fopen_read(sc_MPI_Comm mpicomm, const char *filename, char *user_string, size_t *len, sc_scda_fopen_options_t *opt, int *errcode)
Open a file for reading and read the file header from the file.
struct sc_scda_fopen_options sc_scda_fopen_options_t
An options struct for the functions sc_scda_fopen_write and sc_scda_fopen_read.
sc_scda_fcontext_t * sc_scda_fwrite_block(sc_scda_fcontext_t *fc, const char *user_string, size_t *len, sc_array_t *block_data, size_t block_size, int root, int encode, int *errcode)
Write a fixed-size block file section.
sc_scda_fcontext_t * sc_scda_fwrite_inline(sc_scda_fcontext_t *fc, const char *user_string, size_t *len, sc_array_t *inline_data, int root, int *errcode)
Write an inline data section.
enum sc_scda_ferror sc_scda_ferror_t
Error values for scdafile functions.
int sc_scda_proc_sizes(sc_array_t *elem_sizes, sc_array_t *elem_counts, sc_array_t *proc_sizes, int *errcode)
This is a collective function to determine the processor sizes.
sc_scda_fcontext_t * sc_scda_fopen_write(sc_MPI_Comm mpicomm, const char *filename, const char *user_string, size_t *len, sc_scda_fopen_options_t *opt, int *errcode)
Open a file for writing and write the file header to the file.
struct sc_scda_fcontext sc_scda_fcontext_t
Opaque context used for writing a libsc data file.
Definition: sc_scda.h:177
int sc_scda_fclose(sc_scda_fcontext_t *fc, int *errcode)
Close a file opened for parallel write/read and the free the file context.
int sc_scda_ferror_string(int errcode, char *str, int *len)
Translate a sc_scda error code to an error string.
sc_scda_fcontext_t * sc_scda_fread_varray_data(sc_scda_fcontext_t *fc, sc_array_t *array_data, sc_array_t *elem_counts, sc_array_t *elem_sizes, sc_array_t *proc_sizes, int indirect, int *errcode)
Read the data of a variable-size array.
sc_scda_fcontext_t * sc_scda_fwrite_varray(sc_scda_fcontext_t *fc, const char *user_string, size_t *len, sc_array_t *array_data, sc_array_t *elem_counts, sc_array_t *elem_sizes, sc_array_t *proc_sizes, int indirect, int encode, int *errcode)
Write a variable-size array file section.
sc_scda_fcontext_t * sc_scda_fwrite_array(sc_scda_fcontext_t *fc, const char *user_string, size_t *len, sc_array_t *array_data, sc_array_t *elem_counts, size_t elem_size, int indirect, int encode, int *errcode)
Write a fixed-size array file section.
The sc_array object provides a dynamic array of equal-size elements.
Definition: sc_containers.h:91
An options struct for the functions sc_scda_fopen_write and sc_scda_fopen_read.
Definition: sc_scda.h:237
sc_MPI_Info info
info that is passed to MPI_File_open
Definition: sc_scda.h:238