Skip to content

Commit 6fcb5c1

Browse files
committed
same internal procedure names as h5fortran
1 parent 582052e commit 6fcb5c1

File tree

5 files changed

+90
-96
lines changed

5 files changed

+90
-96
lines changed

src/interface.f90

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ module h5mpi
5454
procedure, public :: is_open
5555
!! procedures without mapping
5656

57-
generic, public :: write => h5write_scalar,ph5write_1d, ph5write_2d, ph5write_3d, ph5write_4d, ph5write_5d, ph5write_6d, ph5write_7d
57+
generic, public :: write => h5write_scalar, h5write_1d, h5write_2d, h5write_3d, h5write_4d, h5write_5d, h5write_6d, h5write_7d
5858

59-
generic, public :: read => h5read_scalar, ph5read_1d, ph5read_2d, ph5read_3d, ph5read_4d, ph5read_5d, ph5read_6d, ph5read_7d
59+
generic, public :: read => h5read_scalar, h5read_1d, h5read_2d, h5read_3d, h5read_4d, h5read_5d, h5read_6d, h5read_7d
6060
!! mapped procedures
6161

6262
!> write attributes
@@ -67,9 +67,9 @@ module h5mpi
6767

6868
procedure, private :: writeattr_char, writeattr_num, readattr_char, readattr_num
6969

70-
procedure, private :: h5write_scalar, ph5write_1d, ph5write_2d, ph5write_3d, ph5write_4d, ph5write_5d, ph5write_6d, ph5write_7d
70+
procedure, private :: h5write_scalar, h5write_1d, h5write_2d, h5write_3d, h5write_4d, h5write_5d, h5write_6d, h5write_7d
7171

72-
procedure, private :: h5read_scalar, ph5read_1d, ph5read_2d, ph5read_3d, ph5read_4d, ph5read_5d, ph5read_6d, ph5read_7d
72+
procedure, private :: h5read_scalar, h5read_1d, h5read_2d, h5read_3d, h5read_4d, h5read_5d, h5read_6d, h5read_7d
7373
!! mapped procedures must be declared again like this
7474

7575
!> flush file to disk and close file if user forgets to do so.
@@ -144,75 +144,75 @@ module subroutine h5write_scalar(self, dname, value, compact)
144144
logical, intent(in), optional :: compact
145145
end subroutine h5write_scalar
146146

147-
module subroutine ph5write_1d(self, dname, value, dset_dims, istart, iend, chunk_size, compact)
147+
module subroutine h5write_1d(self, dname, value, dset_dims, istart, iend, chunk_size, compact)
148148
class(hdf5_file), intent(in) :: self
149149
character(*), intent(in) :: dname
150150
class(*), intent(in) :: value(:)
151151
class(*), intent(in), dimension(1), optional :: dset_dims !< integer or integer(HSIZE_T) full disk shape (not just per worker)
152152
integer(HSIZE_T), intent(in), dimension(1), optional :: istart, iend
153153
integer, intent(in), dimension(1), optional :: chunk_size
154154
logical, intent(in), optional :: compact
155-
end subroutine ph5write_1d
155+
end subroutine h5write_1d
156156

157-
module subroutine ph5write_2d(self, dname, value, dset_dims, istart, iend, chunk_size, compact)
157+
module subroutine h5write_2d(self, dname, value, dset_dims, istart, iend, chunk_size, compact)
158158
class(hdf5_file), intent(in) :: self
159159
character(*), intent(in) :: dname
160160
class(*), intent(in) :: value(:,:)
161161
class(*), intent(in), dimension(2), optional :: dset_dims
162162
integer(HSIZE_T), intent(in), dimension(2), optional :: istart, iend
163163
integer, intent(in), dimension(2), optional :: chunk_size
164164
logical, intent(in), optional :: compact
165-
end subroutine ph5write_2d
165+
end subroutine h5write_2d
166166

167-
module subroutine ph5write_3d(self, dname, value, dset_dims, istart, iend, chunk_size, compact)
167+
module subroutine h5write_3d(self, dname, value, dset_dims, istart, iend, chunk_size, compact)
168168
class(hdf5_file), intent(in) :: self
169169
character(*), intent(in) :: dname
170170
class(*), intent(in) :: value(:,:,:)
171171
class(*), intent(in), dimension(3), optional :: dset_dims
172172
integer(HSIZE_T), intent(in), dimension(3), optional :: istart, iend
173173
integer, intent(in), dimension(3), optional :: chunk_size
174174
logical, intent(in), optional :: compact
175-
end subroutine ph5write_3d
175+
end subroutine h5write_3d
176176

177-
module subroutine ph5write_4d(self, dname, value, dset_dims, istart, iend, chunk_size, compact)
177+
module subroutine h5write_4d(self, dname, value, dset_dims, istart, iend, chunk_size, compact)
178178
class(hdf5_file), intent(in) :: self
179179
character(*), intent(in) :: dname
180180
class(*), intent(in) :: value(:,:,:,:)
181181
class(*), intent(in), dimension(4), optional :: dset_dims
182182
integer(HSIZE_T), intent(in), dimension(4), optional :: istart, iend
183183
integer, intent(in), dimension(4), optional :: chunk_size
184184
logical, intent(in), optional :: compact
185-
end subroutine ph5write_4d
185+
end subroutine h5write_4d
186186

187-
module subroutine ph5write_5d(self, dname, value, dset_dims, istart, iend, chunk_size, compact)
187+
module subroutine h5write_5d(self, dname, value, dset_dims, istart, iend, chunk_size, compact)
188188
class(hdf5_file), intent(in) :: self
189189
character(*), intent(in) :: dname
190190
class(*), intent(in) :: value(:,:,:,:,:)
191191
class(*), intent(in), dimension(5), optional :: dset_dims
192192
integer(HSIZE_T), intent(in), dimension(5), optional :: istart, iend
193193
integer, intent(in), dimension(5), optional :: chunk_size
194194
logical, intent(in), optional :: compact
195-
end subroutine ph5write_5d
195+
end subroutine h5write_5d
196196

197-
module subroutine ph5write_6d(self, dname, value, dset_dims, istart, iend, chunk_size, compact)
197+
module subroutine h5write_6d(self, dname, value, dset_dims, istart, iend, chunk_size, compact)
198198
class(hdf5_file), intent(in) :: self
199199
character(*), intent(in) :: dname
200200
class(*), intent(in) :: value(:,:,:,:,:,:)
201201
class(*), intent(in), dimension(6), optional :: dset_dims
202202
integer(HSIZE_T), intent(in), dimension(6), optional :: istart, iend
203203
integer, intent(in), dimension(6), optional :: chunk_size
204204
logical, intent(in), optional :: compact
205-
end subroutine ph5write_6d
205+
end subroutine h5write_6d
206206

207-
module subroutine ph5write_7d(self, dname, value, dset_dims, istart, iend, chunk_size, compact)
207+
module subroutine h5write_7d(self, dname, value, dset_dims, istart, iend, chunk_size, compact)
208208
class(hdf5_file), intent(in) :: self
209209
character(*), intent(in) :: dname
210210
class(*), intent(in) :: value(:,:,:,:,:,:,:)
211211
class(*), intent(in), dimension(7), optional :: dset_dims
212212
integer(HSIZE_T), intent(in), dimension(7), optional :: istart, iend
213213
integer, intent(in), dimension(7), optional :: chunk_size
214214
logical, intent(in), optional :: compact
215-
end subroutine ph5write_7d
215+
end subroutine h5write_7d
216216

217217
end interface
218218

@@ -290,54 +290,54 @@ module subroutine h5read_scalar(self, dname, value)
290290
class(*), intent(inout) :: value
291291
end subroutine h5read_scalar
292292

293-
module subroutine ph5read_1d(self, dname, value, istart, iend)
293+
module subroutine h5read_1d(self, dname, value, istart, iend)
294294
class(hdf5_file), intent(in) :: self
295295
character(*), intent(in) :: dname
296296
class(*), intent(inout) :: value(:)
297297
integer(HSIZE_T), intent(in), dimension(1), optional :: istart, iend
298-
end subroutine ph5read_1d
298+
end subroutine h5read_1d
299299

300-
module subroutine ph5read_2d(self, dname, value, istart, iend)
300+
module subroutine h5read_2d(self, dname, value, istart, iend)
301301
class(hdf5_file), intent(in) :: self
302302
character(*), intent(in) :: dname
303303
class(*), intent(inout) :: value(:,:)
304304
integer(HSIZE_T), intent(in), dimension(2), optional :: istart, iend
305-
end subroutine ph5read_2d
305+
end subroutine h5read_2d
306306

307-
module subroutine ph5read_3d(self, dname, value, istart, iend)
307+
module subroutine h5read_3d(self, dname, value, istart, iend)
308308
class(hdf5_file), intent(in) :: self
309309
character(*), intent(in) :: dname
310310
class(*), intent(inout) :: value(:,:,:)
311311
integer(HSIZE_T), intent(in), dimension(3), optional :: istart, iend
312-
end subroutine ph5read_3d
312+
end subroutine h5read_3d
313313

314-
module subroutine ph5read_4d(self, dname, value, istart, iend)
314+
module subroutine h5read_4d(self, dname, value, istart, iend)
315315
class(hdf5_file), intent(in) :: self
316316
character(*), intent(in) :: dname
317317
class(*), intent(inout) :: value(:,:,:,:)
318318
integer(HSIZE_T), intent(in), dimension(4), optional :: istart, iend
319-
end subroutine ph5read_4d
319+
end subroutine h5read_4d
320320

321-
module subroutine ph5read_5d(self, dname, value, istart, iend)
321+
module subroutine h5read_5d(self, dname, value, istart, iend)
322322
class(hdf5_file), intent(in) :: self
323323
character(*), intent(in) :: dname
324324
class(*), intent(inout) :: value(:,:,:,:,:)
325325
integer(HSIZE_T), intent(in), dimension(5), optional :: istart, iend
326-
end subroutine ph5read_5d
326+
end subroutine h5read_5d
327327

328-
module subroutine ph5read_6d(self, dname, value, istart, iend)
328+
module subroutine h5read_6d(self, dname, value, istart, iend)
329329
class(hdf5_file), intent(in) :: self
330330
character(*), intent(in) :: dname
331331
class(*), intent(inout) :: value(:,:,:,:,:,:)
332332
integer(HSIZE_T), intent(in), dimension(6), optional :: istart, iend
333-
end subroutine ph5read_6d
333+
end subroutine h5read_6d
334334

335-
module subroutine ph5read_7d(self, dname, value, istart, iend)
335+
module subroutine h5read_7d(self, dname, value, istart, iend)
336336
class(hdf5_file), intent(in) :: self
337337
character(*), intent(in) :: dname
338338
class(*), intent(inout) :: value(:,:,:,:,:,:,:)
339339
integer(HSIZE_T), intent(in), dimension(7), optional :: istart, iend
340-
end subroutine ph5read_7d
340+
end subroutine h5read_7d
341341

342342
end interface
343343

@@ -354,7 +354,7 @@ end subroutine readattr_char
354354
module subroutine readattr_num(self, dname, attr, attrval)
355355
class(hdf5_file), intent(in) :: self
356356
character(*), intent(in) :: dname, attr
357-
class(*), intent(inout) :: attrval(:)
357+
class(*), intent(out) :: attrval(:)
358358
end subroutine readattr_num
359359

360360
module subroutine writeattr_char(self, dname, attr, attrval)
@@ -384,9 +384,9 @@ module subroutine h5open(self, filename, action, mpi, comp_lvl, shuffle, fletche
384384

385385
class(hdf5_file), intent(inout) :: self
386386
character(*), intent(in) :: filename
387-
character(*), intent(in), optional :: action
387+
character(*), intent(in), optional :: action !< r, r+, rw, w, a
388388
logical, intent(in) :: mpi
389-
integer, intent(in), optional :: comp_lvl
389+
integer, intent(in), optional :: comp_lvl !< 0: no compression. 1-9: ZLIB compression, higher is more compressior
390390
logical, intent(in), optional :: shuffle
391391
logical, intent(in), optional :: fletcher32
392392
logical, intent(in), optional :: debug

src/read_scalar.f90

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,16 @@
2929
if(vector_scalar) then
3030
select type(value)
3131
type is (real(real32))
32-
call ph5read_1d(self, dname, buf_r32)
32+
call h5read_1d(self, dname, buf_r32)
3333
value = buf_r32(1)
3434
type is (real(real64))
35-
call ph5read_1d(self, dname, buf_r64)
35+
call h5read_1d(self, dname, buf_r64)
3636
value = buf_r64(1)
3737
type is (integer(int32))
38-
call ph5read_1d(self, dname, buf_i32)
38+
call h5read_1d(self, dname, buf_i32)
3939
value = buf_i32(1)
4040
type is (integer(int64))
41-
call ph5read_1d(self, dname, buf_i64)
41+
call h5read_1d(self, dname, buf_i64)
4242
value = buf_i64(1)
4343
class default
4444
error stop "h5fortran:read:vector_scalar: unknown memory variable type" // dname
@@ -113,17 +113,12 @@
113113
call h5sclose_f(space_id, ier)
114114
if(ier/=0) error stop "h5fortran:read:h5sclose " // dname // " in " // self%filename
115115
else
116-
!! H5T_STR_NULLTERM Null terminate (as C does).
117-
!! H5T_STR_NULLPAD Pad with zeros.
118-
!! H5T_STR_SPACEPAD Pad with spaces (as FORTRAN does).
119116
call H5Tget_strpad_f(type_id, pad_type, ier)
120117
if(ier/=0) error stop "h5fortran:read:h5tget_strpad " // dname // " in " // self%filename
121118

122119
call H5Tget_size_f(type_id, dsize, ier) !< only for non-variable
123120
if(ier/=0) error stop "h5fortran:read:h5tget_size " // dname // " in " // self%filename
124121

125-
if(pad_type == H5T_STR_NULLTERM_F) dsize = dsize - 1 !< for the trailing C_NULL_CHAR
126-
127122
if(dsize > len(value)) then
128123
write(stderr,'(a,i0,a3,i0,1x,a)') "h5fortran:read:string: buffer too small: ", dsize, " > ", len(value), &
129124
dname // " in " // self%filename

src/reader.f90

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,32 +18,32 @@
1818
end procedure h5exist
1919

2020

21-
module procedure ph5read_1d
21+
module procedure h5read_1d
2222
include "reader_template.inc"
23-
end procedure ph5read_1d
23+
end procedure h5read_1d
2424

25-
module procedure ph5read_2d
25+
module procedure h5read_2d
2626
include "reader_template.inc"
27-
end procedure ph5read_2d
27+
end procedure h5read_2d
2828

29-
module procedure ph5read_3d
29+
module procedure h5read_3d
3030
include "reader_template.inc"
31-
end procedure ph5read_3d
31+
end procedure h5read_3d
3232

33-
module procedure ph5read_4d
33+
module procedure h5read_4d
3434
include "reader_template.inc"
35-
end procedure ph5read_4d
35+
end procedure h5read_4d
3636

37-
module procedure ph5read_5d
37+
module procedure h5read_5d
3838
include "reader_template.inc"
39-
end procedure ph5read_5d
39+
end procedure h5read_5d
4040

41-
module procedure ph5read_6d
41+
module procedure h5read_6d
4242
include "reader_template.inc"
43-
end procedure ph5read_6d
43+
end procedure h5read_6d
4444

45-
module procedure ph5read_7d
45+
module procedure h5read_7d
4646
include "reader_template.inc"
47-
end procedure ph5read_7d
47+
end procedure h5read_7d
4848

4949
end submodule hdf5_reader

0 commit comments

Comments
 (0)