Commit d9d34e10 authored by Francois Tessier's avatar Francois Tessier

Write C bindings to be called from Fortran code

parent bdaaa67b
#include "tapioca.h"
#include "tapioca.hpp"
TAPIOCA* create_tapioca () {
fprintf ( stdout, "C API - create_tapioca\n" );
return new Tapioca ();
}
void delete_tapioca( TAPIOCA* tapioca ) {
fprintf ( stdout, "C API - delete_tapioca\n" );
delete tapioca;
}
void tapioca_finalize ( const TAPIOCA* tapioca ) {
}
void tapioca_mpi_info ( const TAPIOCA* tapioca, MPI_File fileHandle ) {
}
/*******************/
/* WRITE */
/*******************/
void tapioca_write_initialize ( const TAPIOCA* tapioca, char *filename, int64_t *chunkCount,
int *chunkSize, int64_t *chunkOffset, int nChunks,
int64_t offset, MEMORY_LAYOUT layout, MPI_Comm comm ) {
tapioca->WriteInitialize (filename, chunkCount, chunkSize, chunkOffset, nChunks, offset, layout, comm );
}
int tapioca_write ( const TAPIOCA* tapioca, MPI_File fileHandle, MPI_Offset offset,
void *buf, int count, MPI_Datatype datatype,
MPI_Status *status, int64_t bufOffset = 0 ) {
return tapioca->Write ( fileHandle, offset, buf, count, datatype, status );
}
/*******************/
/* READ */
/*******************/
void tapioca_read_initialize ( const TAPIOCA* tapioca, char *filename, int64_t *chunkCount,
int *chunkSize, int64_t *chunkOffset, int nChunks,
int64_t offset, MEMORY_LAYOUT layout, MPI_Comm comm ) {
tapioca->ReadInitialize (filename, chunkCount, chunkSize, chunkOffset, nChunks, offset, layout, comm );
}
int tapioca_read ( const TAPIOCA* tapioca, MPI_File fileHandle, MPI_Offset offset,
void *buf, int count, MPI_Datatype datatype,
MPI_Status *status, int64_t bufOffset = 0 ) {
return tapioca->Read ( fileHandle, offset, buf, count, datatype, status );
}
......@@ -69,7 +69,6 @@ class Tapioca
void MPIIOInfo (MPI_File fileHandle);
Topology topology;
private:
/***********************/
/* INITIALIZATION */
......@@ -115,6 +114,11 @@ class Tapioca
void HandleMPIError (int retval);
void PrintTime (double startTime, double endTime, char* func);
/***********************/
/* TOPOLOGY */
/***********************/
Topology topology;
/***********************/
/* VARIABLES */
/***********************/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment