4 #include "sion_cxx_mpi.hpp" 10 SIONFile::SIONFile() {
11 std::cerr <<
"At least name has to be given\n";
15 SIONFile::SIONFile(std::string sion_file_name, std::string mode,
int num_files,
16 int global_rank, MPI_Comm gComm, MPI_Comm lComm) {
18 size_t ncharacter = sion_file_name.length()+1;
19 const char * tmp_sion_file_name = sion_file_name.c_str();
20 _sion_file_name =
new char[ncharacter];
22 strncpy(_sion_file_name, tmp_sion_file_name, ncharacter);
25 _num_files = num_files;
31 _chunk_size = 2097152;
35 _new_sion_file_name =
new char[255];
39 SIONFile::~SIONFile() {
40 delete [] _sion_file_name;
41 _sion_file_name = NULL;
42 delete [] _new_sion_file_name;
43 _new_sion_file_name = NULL;
51 void SIONFile::setLocalCommunicator(MPI_Comm lComm) {
55 MPI_Comm SIONFile::getLocalCommunicator()
const {
59 void SIONFile::setGlobalCommunicator(MPI_Comm gComm) {
63 MPI_Comm SIONFile::getGlobalCommunicator()
const {
67 void SIONFile::setGlobalRank(
int global_rank) {
68 _global_rank = global_rank;
71 int SIONFile::getGlobalRank()
const {
75 char * SIONFile::getNewSionFileName()
const {
76 return _new_sion_file_name;
100 void SIONFile::open() {
102 _g_comm, &_l_comm, &_chunk_size, &_fs_blk_size,
103 &_global_rank, NULL, &_new_sion_file_name);
107 void SIONFile::close() {
119 void SIONFile::ensureFreeSpace(
long numbytes) {
123 void SIONFile::endOfFile() {
int sion_feof(int sid)
Function that indicates whether the end of file is reached for this task.
int sion_ensure_free_space(int sid, sion_int64 bytes)
Funtion to ensure that enough space is available for writing.
int sion_paropen_mpi(const char *fname, const char *file_mode, int *numFiles, MPI_Comm gComm, const MPI_Comm *lComm, sion_int64 *chunksize, sion_int32 *fsblksize, int *globalrank, FILE **fileptr, char **newfname)
Open a sion file using MPI.
int sion_parclose_mpi(int sid)
Close a sion file using MPI.