37#ifdef HAVE_ADIOS2_FORTRAN 
   47     integer(kind=i8), 
dimension(5) :: shape_dims, start_dims, count_dims
 
   48     real(kind=
dp), 
private, 
allocatable :: data_dp(:,:,:,:,:)
 
   49     real(kind=
sp), 
private, 
allocatable :: data_sp(:,:,:,:,:)
 
   53#ifdef HAVE_ADIOS2_FORTRAN 
   54     procedure :: define => buffer_4d_npar_define
 
   55     procedure :: inquire => buffer_4d_npar_inquire
 
   56     procedure :: write => buffer_4d_npar_write
 
   57     procedure :: read => buffer_4d_npar_read
 
 
   67    logical, 
intent(in) :: precision
 
   68    integer, 
intent(in) :: gdim, glb_nelv, offset_el, nelv, lx, ly, lz
 
   77    if (this%dp_precision) 
then 
   78       if (
allocated(this%data_dp)) 
then 
   79          deallocate(this%data_dp)
 
   81       allocate(this%data_dp(nelv, lx, ly, lz, 
npar))
 
   83       if (
allocated(this%data_sp)) 
then 
   84          deallocate(this%data_sp)
 
   86       allocate(this%data_sp(nelv, lx, ly, lz, 
npar))
 
   89    this%shape_dims = [int(glb_nelv, 
i8), int(lx, 
i8), int(ly, 
i8), &
 
   91    this%start_dims = [int(offset_el, 
i8), int(0, 
i8), int(0, 
i8), &
 
   92         int(0, 
i8), int(0, 
i8)]
 
   93    this%count_dims = [int(nelv, 
i8), int(lx, 
i8), int(ly, 
i8), &
 
 
  100    integer, 
intent(inout) :: n
 
  101    real(kind=
rp), 
intent(inout) :: x(n)
 
  102    integer :: i, j, k, l, nelv, lx, ly, lz, index
 
  107       nelv = this%count_dims(1)
 
  108       lx = this%count_dims(2)
 
  109       ly = this%count_dims(3)
 
  110       lz = this%count_dims(4)
 
  112       if (this%dp_precision) 
then 
  117                      index = (l-1) + lx*(k-1) + lx*ly*(j-1) + lx*ly*lz*(i-1) +1
 
  128                      index = (l-1) + lx*(k-1) + lx*ly*(j-1) + lx*ly*lz*(i-1) +1
 
 
  140#ifdef HAVE_ADIOS2_FORTRAN 
  142  subroutine buffer_4d_npar_define(this, variable, io, variable_name, ierr)
 
  144    type(adios2_variable), 
intent(inout) :: variable
 
  145    type(adios2_io), 
intent(inout) :: io
 
  146    character(len=*), 
intent(in) :: variable_name
 
  147    integer, 
intent(inout) :: ierr
 
  148    integer :: adios2_type
 
  150    if (this%dp_precision) 
then 
  151       adios2_type = adios2_type_dp
 
  153       adios2_type = adios2_type_real
 
  156    call adios2_inquire_variable(variable, io, trim(variable_name), ierr)
 
  157    if (.not.variable%valid) 
then 
  159       call adios2_define_variable(variable, io, variable_name, adios2_type, &
 
  160            size(this%shape_dims), this%shape_dims, this%start_dims, &
 
  161            this%count_dims, .false., ierr)
 
  163       call adios2_set_selection(variable, 
size(this%start_dims), &
 
  164            this%start_dims, this%count_dims, ierr)
 
  167  end subroutine buffer_4d_npar_define
 
  169  subroutine buffer_4d_npar_inquire(this, variable, io, variable_name, ierr)
 
  171    type(adios2_variable), 
intent(inout) :: variable
 
  172    type(adios2_io), 
intent(inout) :: io
 
  173    character(len=*), 
intent(in) :: variable_name
 
  174    integer, 
intent(inout) :: ierr
 
  176    call adios2_inquire_variable(variable, io, trim(variable_name), ierr)
 
  177    if (variable%valid) 
then 
  178       call adios2_set_selection(variable, 
size(this%start_dims), &
 
  179            this%start_dims, this%count_dims, ierr)
 
  182  end subroutine buffer_4d_npar_inquire
 
  184  subroutine buffer_4d_npar_write(this, engine, variable, ierr)
 
  186    type(adios2_engine), 
intent(in) :: engine
 
  187    type(adios2_variable), 
intent(in) :: variable
 
  188    integer, 
intent(inout) :: ierr
 
  190    if (this%dp_precision) 
then 
  191       call adios2_put(engine, variable, this%data_dp, adios2_mode_sync, ierr)
 
  193       call adios2_put(engine, variable, this%data_sp, adios2_mode_sync, ierr)
 
  196  end subroutine buffer_4d_npar_write
 
  198  subroutine buffer_4d_npar_read(this, engine, variable, ierr)
 
  200    type(adios2_engine), 
intent(in) :: engine
 
  201    type(adios2_variable), 
intent(in) :: variable
 
  202    integer, 
intent(inout) :: ierr
 
  204    if (this%dp_precision) 
then 
  205       call adios2_get(engine, variable, this%data_dp, adios2_mode_sync, ierr)
 
  207       call adios2_get(engine, variable, this%data_sp, adios2_mode_sync, ierr)
 
  210  end subroutine buffer_4d_npar_read
 
  217    integer :: i, j, k, l, nelv, lx, ly, lz, index
 
  222       nelv = this%count_dims(1)
 
  223       lx = this%count_dims(2)
 
  224       ly = this%count_dims(3)
 
  225       lz = this%count_dims(4)
 
  227       if (this%dp_precision) 
then 
  232                      index = (l-1) + lx*(k-1) + lx*ly*(j-1) + lx*ly*lz*(i-1) +1
 
  233                      x%x(index) = this%data_dp(i,l,k,j, 
nthpar)
 
  243                      index = (l-1) + lx*(k-1) + lx*ly*(j-1) + lx*ly*lz*(i-1) +1
 
  244                      x%x(index) = this%data_sp(i,l,k,j, 
nthpar)
 
 
Generic buffer that is extended with buffers of varying rank.
 
subroutine buffer_4d_npar_init(this, precision, gdim, glb_nelv, offset_el, nelv, lx, ly, lz)
 
subroutine buffer_4d_npar_fill(this, x, n)
 
subroutine buffer_4d_npar_copy(this, x)
 
Generic buffer that is extended with buffers of varying rank.
 
subroutine buffer_set_precision(this, precision)
 
integer, parameter, public i8
 
integer, parameter, public dp
 
integer, parameter, public sp
 
integer, parameter, public rp
Global precision used in computations.