lp-io.h 1.09 KB
Newer Older
1
/*
Philip Carns's avatar
Philip Carns committed
2
 * Copyright (C) 2013 University of Chicago.
3
 * See COPYRIGHT notice in top-level directory.
Philip Carns's avatar
Philip Carns committed
4
 *
5 6 7 8 9
 */

#ifndef LP_IO_H
#define LP_IO_H

Jonathan Jenkins's avatar
Jonathan Jenkins committed
10 11 12 13
#ifdef __cplusplus
extern "C" {
#endif

14 15 16 17 18 19 20 21 22 23 24 25 26 27
#include <ross.h>

typedef char* lp_io_handle;

#define LP_IO_UNIQ_SUFFIX 1

/* to be called (collectively) before running simulation to prepare the
 * output directory.
 */
int lp_io_prepare(char *directory, int flags, lp_io_handle* handle, MPI_Comm comm);

/* to be called within LPs to store a block of data */
int lp_io_write(tw_lpid gid, char* identifier, int size, void* buffer);

28
/* undo the immediately preceding write for the given LP */
29 30
int lp_io_write_rev(tw_lpid gid, char* identifier);

31 32 33 34 35 36 37 38 39
/* to be called (collectively) after tw_run() to flush data to disk */
int lp_io_flush(lp_io_handle handle, MPI_Comm comm);

/* retrieves the directory name for a handle */
static inline char* lp_io_handle_to_dir(lp_io_handle handle)
{
    return(strdup(handle));
}

Jonathan Jenkins's avatar
Jonathan Jenkins committed
40 41 42 43
#ifdef __cplusplus
}
#endif

44 45 46 47 48 49 50 51 52 53
#endif /* LP_IO_H */

/*
 * Local variables:
 *  c-indent-level: 4
 *  c-basic-offset: 4
 * End:
 *
 * vim: ft=c ts=8 sts=4 sw=4 expandtab
 */