From 1cc3614c746bdbe7d6b9585f3b4476340f715ffb Mon Sep 17 00:00:00 2001 From: Achim Gsell Date: Fri, 15 Nov 2013 16:49:10 +0100 Subject: [PATCH] Fortran stubs added --- examples/H5Part/Makefile.am | 8 +++- examples/H5Part/read_canonicalviewf.f90 | 51 +++++++++++++++++++++++++ examples/H5Part/read_setnparticlesf.f90 | 51 +++++++++++++++++++++++++ examples/H5Part/read_setviewf.f90 | 51 +++++++++++++++++++++++++ examples/H5Part/read_stridedf.f90 | 51 +++++++++++++++++++++++++ examples/H5Part/write_core_vfdf.f90 | 36 +++++++++++++++++ 6 files changed, 247 insertions(+), 1 deletion(-) create mode 100644 examples/H5Part/read_canonicalviewf.f90 create mode 100644 examples/H5Part/read_setnparticlesf.f90 create mode 100644 examples/H5Part/read_setviewf.f90 create mode 100644 examples/H5Part/read_stridedf.f90 create mode 100644 examples/H5Part/write_core_vfdf.f90 diff --git a/examples/H5Part/Makefile.am b/examples/H5Part/Makefile.am index 4a66b9d..d589877 100644 --- a/examples/H5Part/Makefile.am +++ b/examples/H5Part/Makefile.am @@ -35,7 +35,7 @@ noinst_PROGRAMS += \ read_setnparticlesf \ read_setviewf \ read_stridedf \ - write_core_vfd \ + write_core_vfdf \ write_setnparticlesf \ write_setviewf \ write_stridedf @@ -43,6 +43,12 @@ endif EXTRA_PROGRAMS = +read_canonicalviewf_SOURCES = read_canonicalviewf.f90 +read_setnparticlesf_SOURCES = read_setnparticlesf.f90 +read_setviewf_SOURCES = read_setviewf.f90 +read_stridedf_SOURCES = read_stridedf.f90 +write_core_vfdf_SOURCES = write_core_vfdf.f90 +write_setnparticles_SOURCES = write_setnparticles.f90 write_setviewf_SOURCES = write_setviewf.f90 write_stridedf_SOURCES = write_stridedf.f90 diff --git a/examples/H5Part/read_canonicalviewf.f90 b/examples/H5Part/read_canonicalviewf.f90 new file mode 100644 index 0000000..234b075 --- /dev/null +++ b/examples/H5Part/read_canonicalviewf.f90 @@ -0,0 +1,51 @@ +! +! Copyright (c) 2006-2013, The Regents of the University of California, +! through Lawrence Berkeley National Laboratory (subject to receipt of any +! required approvals from the U.S. Dept. of Energy) and the Paul Scherrer +! Institut (Switzerland). All rights reserved.! +! +! License: see file COPYING in top level of source distribution. +! +include 'H5hut.f90' + +program read_canonicalview + use H5hut + implicit none + include 'mpif.h' + + ! the file name we want to read + character (len=*), parameter :: FNAME = "example_setnparticles.h5" + integer*8, parameter :: NPOINTS = 99 + + integer :: comm, rank, ierr + integer*8 :: file, i, status + integer*4, allocatable :: data(:) + + ! init MPI & H5hut + comm = MPI_COMM_WORLD + call mpi_init(ierr) + call mpi_comm_rank(comm, rank, ierr) + call h5_abort_on_error () + + ! create fake data + allocate (data (NPOINTS)) + do i = 1, NPOINTS + data (i) = i + NPOINTS*rank + enddo + + ! open the a file for parallel writing and ceate step #0 + file = h5_openfile (FNAME, H5_O_WRONLY, H5_PROP_DEFAULT) + status = h5_setstep(file, 0_8) + + ! set the size of the 1D array + status = h5pt_setnpoints (file, npoints) + + ! write the particles + status = h5pt_writedata_i4 (file, "data", data) + + ! cleanup + status = h5_closefile (file) + deallocate (data) + call mpi_finalize (ierr) + +end program write_setnparticles diff --git a/examples/H5Part/read_setnparticlesf.f90 b/examples/H5Part/read_setnparticlesf.f90 new file mode 100644 index 0000000..e4f4f96 --- /dev/null +++ b/examples/H5Part/read_setnparticlesf.f90 @@ -0,0 +1,51 @@ +! +! Copyright (c) 2006-2013, The Regents of the University of California, +! through Lawrence Berkeley National Laboratory (subject to receipt of any +! required approvals from the U.S. Dept. of Energy) and the Paul Scherrer +! Institut (Switzerland). All rights reserved.! +! +! License: see file COPYING in top level of source distribution. +! +include 'H5hut.f90' + +program write_setnparticles + use H5hut + implicit none + include 'mpif.h' + + ! the file name we want to read + character (len=*), parameter :: FNAME = "example_setnparticles.h5" + integer*8, parameter :: NPOINTS = 99 + + integer :: comm, rank, ierr + integer*8 :: file, i, status + integer*4, allocatable :: data(:) + + ! init MPI & H5hut + comm = MPI_COMM_WORLD + call mpi_init(ierr) + call mpi_comm_rank(comm, rank, ierr) + call h5_abort_on_error () + + ! create fake data + allocate (data (NPOINTS)) + do i = 1, NPOINTS + data (i) = i + NPOINTS*rank + enddo + + ! open the a file for parallel writing and ceate step #0 + file = h5_openfile (FNAME, H5_O_WRONLY, H5_PROP_DEFAULT) + status = h5_setstep(file, 0_8) + + ! set the size of the 1D array + status = h5pt_setnpoints (file, npoints) + + ! write the particles + status = h5pt_writedata_i4 (file, "data", data) + + ! cleanup + status = h5_closefile (file) + deallocate (data) + call mpi_finalize (ierr) + +end program write_setnparticles diff --git a/examples/H5Part/read_setviewf.f90 b/examples/H5Part/read_setviewf.f90 new file mode 100644 index 0000000..e4f4f96 --- /dev/null +++ b/examples/H5Part/read_setviewf.f90 @@ -0,0 +1,51 @@ +! +! Copyright (c) 2006-2013, The Regents of the University of California, +! through Lawrence Berkeley National Laboratory (subject to receipt of any +! required approvals from the U.S. Dept. of Energy) and the Paul Scherrer +! Institut (Switzerland). All rights reserved.! +! +! License: see file COPYING in top level of source distribution. +! +include 'H5hut.f90' + +program write_setnparticles + use H5hut + implicit none + include 'mpif.h' + + ! the file name we want to read + character (len=*), parameter :: FNAME = "example_setnparticles.h5" + integer*8, parameter :: NPOINTS = 99 + + integer :: comm, rank, ierr + integer*8 :: file, i, status + integer*4, allocatable :: data(:) + + ! init MPI & H5hut + comm = MPI_COMM_WORLD + call mpi_init(ierr) + call mpi_comm_rank(comm, rank, ierr) + call h5_abort_on_error () + + ! create fake data + allocate (data (NPOINTS)) + do i = 1, NPOINTS + data (i) = i + NPOINTS*rank + enddo + + ! open the a file for parallel writing and ceate step #0 + file = h5_openfile (FNAME, H5_O_WRONLY, H5_PROP_DEFAULT) + status = h5_setstep(file, 0_8) + + ! set the size of the 1D array + status = h5pt_setnpoints (file, npoints) + + ! write the particles + status = h5pt_writedata_i4 (file, "data", data) + + ! cleanup + status = h5_closefile (file) + deallocate (data) + call mpi_finalize (ierr) + +end program write_setnparticles diff --git a/examples/H5Part/read_stridedf.f90 b/examples/H5Part/read_stridedf.f90 new file mode 100644 index 0000000..e4f4f96 --- /dev/null +++ b/examples/H5Part/read_stridedf.f90 @@ -0,0 +1,51 @@ +! +! Copyright (c) 2006-2013, The Regents of the University of California, +! through Lawrence Berkeley National Laboratory (subject to receipt of any +! required approvals from the U.S. Dept. of Energy) and the Paul Scherrer +! Institut (Switzerland). All rights reserved.! +! +! License: see file COPYING in top level of source distribution. +! +include 'H5hut.f90' + +program write_setnparticles + use H5hut + implicit none + include 'mpif.h' + + ! the file name we want to read + character (len=*), parameter :: FNAME = "example_setnparticles.h5" + integer*8, parameter :: NPOINTS = 99 + + integer :: comm, rank, ierr + integer*8 :: file, i, status + integer*4, allocatable :: data(:) + + ! init MPI & H5hut + comm = MPI_COMM_WORLD + call mpi_init(ierr) + call mpi_comm_rank(comm, rank, ierr) + call h5_abort_on_error () + + ! create fake data + allocate (data (NPOINTS)) + do i = 1, NPOINTS + data (i) = i + NPOINTS*rank + enddo + + ! open the a file for parallel writing and ceate step #0 + file = h5_openfile (FNAME, H5_O_WRONLY, H5_PROP_DEFAULT) + status = h5_setstep(file, 0_8) + + ! set the size of the 1D array + status = h5pt_setnpoints (file, npoints) + + ! write the particles + status = h5pt_writedata_i4 (file, "data", data) + + ! cleanup + status = h5_closefile (file) + deallocate (data) + call mpi_finalize (ierr) + +end program write_setnparticles diff --git a/examples/H5Part/write_core_vfdf.f90 b/examples/H5Part/write_core_vfdf.f90 new file mode 100644 index 0000000..f2df484 --- /dev/null +++ b/examples/H5Part/write_core_vfdf.f90 @@ -0,0 +1,36 @@ +! +! Copyright (c) 2006-2013, The Regents of the University of California, +! through Lawrence Berkeley National Laboratory (subject to receipt of any +! required approvals from the U.S. Dept. of Energy) and the Paul Scherrer +! Institut (Switzerland). All rights reserved.! +! +! License: see file COPYING in top level of source distribution. +! +include 'H5hut.f90' + +program write_core_vfd + use H5hut + implicit none + include 'mpif.h' + + ! the file name we want to read + character (len=*), parameter :: FNAME = "example_core_vfd" + integer*8, parameter :: DIM = 99 + + integer :: comm, rank, ierr + integer*8 :: file, i, status + integer*4, allocatable :: data(:) + + ! init MPI & H5hut + comm = MPI_COMM_WORLD + call mpi_init(ierr) + call mpi_comm_rank(comm, rank, ierr) + call h5_abort_on_error () + + + ! cleanup + status = h5_closefile (file) + deallocate (data) + call mpi_finalize (ierr) + +end program write_core_vfd