Skip to content

Commit d78f7a3

Browse files
committed
name/doc refactor for common with nc4fortran
1 parent 2da3020 commit d78f7a3

File tree

8 files changed

+37
-40
lines changed

8 files changed

+37
-40
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ __pycache__/
2222

2323
# Fortran module files
2424
*.mod
25+
*.smod
2526

2627
# Compiled Static libraries
2728
*.lai

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required (VERSION 3.13) # 3.13 for target_sources() absolute
1+
cmake_minimum_required(VERSION 3.13) # 3.13 for target_sources() absolute
22
if(NOT CMAKE_BUILD_TYPE)
33
set(CMAKE_BUILD_TYPE Release CACHE STRING "Debug or Release")
44
endif()
@@ -48,4 +48,4 @@ endif()
4848
# --- install
4949
if(PROJECT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
5050
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/install.cmake)
51-
endif()
51+
endif()

src/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
target_sources(h5fortran PRIVATE
2-
hdf5_interface.f90
2+
interface.f90
33
read.f90 reader.f90
44
write.f90 writer.f90
55
string_utils.f90)

src/hdf5_interface.f90 renamed to src/interface.f90

Lines changed: 29 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -404,40 +404,38 @@ subroutine hdf_initialize(self,filename,ierr, status,action,comp_lvl,chunk_size,
404404
laction = 'rw'
405405
if(present(action)) laction = toLower(action)
406406

407-
408407
select case(lstatus)
409-
case ('old', 'unknown')
410-
select case(laction)
411-
case('read','r') !< Open an existing file.
412-
inquire(file=filename, exist=exists)
413-
if (.not.exists) then
414-
write(stderr,*) 'ERROR: ' // filename // ' does not exist.'
415-
ierr = -1
416-
return
417-
endif
418-
call h5fopen_f(filename,H5F_ACC_RDONLY_F,self%lid,ierr)
419-
case('write','readwrite','w','rw', 'r+', 'append', 'a')
420-
inquire(file=filename, exist=exists)
421-
if(lstatus == 'unknown' .and. .not.exists) then
422-
call h5fcreate_f(filename, H5F_ACC_TRUNC_F, self%lid, ierr)
423-
if (check(ierr, 'ERROR: ' // filename // ' could not be created')) return
424-
else
425-
call h5fopen_f(filename, H5F_ACC_RDWR_F, self%lid, ierr)
426-
if (check(ierr, 'ERROR: ' // filename // ' could not be opened in read/write')) return
427-
endif
428-
case default
429-
write(stderr,*) 'Unsupported action -> ' // laction
430-
ierr = 128
431-
endselect
432-
case('new','replace')
433-
call h5fcreate_f(filename, H5F_ACC_TRUNC_F, self%lid, ierr)
434-
if (check(ierr, 'ERROR: ' // filename // ' could not be created')) return
435-
case default
436-
write(stderr,*) 'Unsupported status -> '// lstatus
437-
ierr = 128
408+
case ('old', 'unknown')
409+
select case(laction)
410+
case('read','r') !< Open an existing file.
411+
inquire(file=filename, exist=exists)
412+
if (.not.exists) then
413+
write(stderr,*) 'ERROR: ' // filename // ' does not exist.'
414+
ierr = -1
415+
return
416+
endif
417+
call h5fopen_f(filename,H5F_ACC_RDONLY_F,self%lid,ierr)
418+
case('write','readwrite','w','rw', 'r+', 'append', 'a')
419+
inquire(file=filename, exist=exists)
420+
if(lstatus == 'unknown' .and. .not.exists) then
421+
call h5fcreate_f(filename, H5F_ACC_TRUNC_F, self%lid, ierr)
422+
if (check(ierr, 'ERROR: ' // filename // ' could not be created')) return
423+
else
424+
call h5fopen_f(filename, H5F_ACC_RDWR_F, self%lid, ierr)
425+
if (check(ierr, 'ERROR: ' // filename // ' could not be opened in read/write')) return
426+
endif
427+
case default
428+
write(stderr,*) 'Unsupported action -> ' // laction
429+
ierr = 128
430+
endselect
431+
case('new','replace')
432+
call h5fcreate_f(filename, H5F_ACC_TRUNC_F, self%lid, ierr)
433+
if (check(ierr, 'ERROR: ' // filename // ' could not be created')) return
434+
case default
435+
write(stderr,*) 'Unsupported status -> '// lstatus
436+
ierr = 128
438437
endselect
439438

440-
441439
end subroutine hdf_initialize
442440

443441

src/meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
hdf5_src = files('hdf5_interface.f90',
1+
hdf5_src = files('interface.f90',
22
'read.f90', 'reader.f90',
33
'write.f90', 'writer.f90',
44
'string_utils.f90')

src/read.f90

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
!! This submodule is for reading HDF5, via child submodules
21
submodule (h5fortran) read
3-
2+
!! This submodule is for reading HDF5 via submodules
43
use hdf5, only : h5dopen_f, h5dread_f, h5dclose_f, h5dget_create_plist_f, &
54
h5pget_layout_f, H5D_CONTIGUOUS_F, H5D_CHUNKED_F
65
use H5LT, only : h5ltget_dataset_info_f, &

src/write.f90

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
!! This submodule is for writing HDF5 data via child submodules
21
submodule (h5fortran) write
3-
2+
!! This submodule is for writing HDF5 data via child submodules
43
use hdf5, only: &
54
h5screate_f, h5sclose_f, h5screate_simple_f, H5S_SCALAR_F, &
65
h5dopen_f, h5dcreate_f, h5dwrite_f, h5dclose_f, &

src/writer.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
!! This submodule is for writing 0-D..7-D data
21
submodule (h5fortran:write) writer
2+
!! This submodule is for writing 0-D..7-D data
33

44
use hdf5, only: H5_REAL_KIND, H5_INTEGER_KIND, H5S_SCALAR_F, H5KIND_TO_TYPE
55
implicit none

0 commit comments

Comments
 (0)