Skip to content

Commit

Permalink
Merge pull request #655 from williamfgc/f90setengine
Browse files Browse the repository at this point in the history
#654 added F90 adios2_set_engine subroutine
  • Loading branch information
williamfgc authored May 30, 2018
2 parents 34a152a + eae39aa commit bda700e
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 0 deletions.
17 changes: 17 additions & 0 deletions bindings/Fortran/f2c/adios2_f2c_io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,23 @@
#include <stdexcept>
#include <vector>

void FC_GLOBAL(adios2_set_engine_f2c,
ADIOS2_SET_ENGINE_F2C)(adios2_io **io, const char *engine_type,
int *ierr)
{
*ierr = 0;

try
{
adios2_set_engine(*io, engine_type);
}
catch (std::exception &e)
{
std::cerr << "ADIOS2 set_engine: " << e.what() << "\n";
*ierr = -1;
}
}

void FC_GLOBAL(adios2_set_parameter_f2c,
ADIOS2_SET_PARAMETER_F2C)(adios2_io **io, const char *key,
const char *value, int *ierr)
Expand Down
4 changes: 4 additions & 0 deletions bindings/Fortran/f2c/adios2_f2c_io.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
extern "C" {
#endif

void FC_GLOBAL(adios2_set_engine_f2c,
ADIOS2_SET_ENGINE_F2C)(adios2_io **io, const char *engine_type,
int *ierr);

void FC_GLOBAL(adios2_set_parameter_f2c,
ADIOS2_SET_PARAMETER_F2C)(adios2_io **io, const char *key,
const char *value, int *ierr);
Expand Down
10 changes: 10 additions & 0 deletions bindings/Fortran/modules/adios2_io_mod.f90
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,16 @@ module adios2_io_mod

contains

subroutine adios2_set_engine(io, engine_type, ierr)
type(adios2_io), intent(in) :: io
character*(*), intent(in) :: engine_type
integer, intent(out) :: ierr

call adios2_set_engine_f2c(io%f2c, &
TRIM(ADJUSTL(engine_type))//char(0), &
ierr)
end subroutine

subroutine adios2_set_parameter(io, key, value, ierr)
type(adios2_io), intent(in) :: io
character*(*), intent(in) :: key
Expand Down
2 changes: 2 additions & 0 deletions testing/adios2/bindings/fortran/TestBPWriteTypes.f90
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ program TestBPWriteTypes
! Declare an IO process configuration inside adios
call adios2_declare_io(ioWrite, adios, "ioWrite", ierr)

call adios2_set_engine(ioWrite, 'bpfile', ierr)

! Defines a variable to be written in bp format
call adios2_define_variable(variables(1), ioWrite, "var_I8", &
adios2_type_integer1, 1, &
Expand Down

0 comments on commit bda700e

Please sign in to comment.