9 integer,
allocatable:: buffer(:)
14 procedure,
private:: append_c
15 procedure,
private:: append_0
16 procedure,
private:: append_1
17 procedure,
private:: append_2
18 procedure,
private:: append_3
19 generic,
public:: append => append_c, append_1, append_2, append_3
20 procedure,
private:: read_c
21 procedure,
private:: read_0
22 procedure,
private:: read_1
23 procedure,
private:: read_2
24 procedure,
private:: read_3
25 generic,
public::
read => read_c, read_1, read_2, read_3
31 SUBROUTINE init (self, n, label)
34 character(len=*):: label
37 allocate (self%buffer(n))
39 call self%append (label)
45 SUBROUTINE reset (self)
55 SUBROUTINE append_c (self, label)
57 character(len=*):: label
58 character,
allocatable:: text(:)
67 self%buffer(self%position) = ni
68 self%position = self%position + 1
69 call mpi_buffer_copy (text, ni, self%buffer, self%position)
70 self%position = self%position + ni
73 END SUBROUTINE append_c
77 SUBROUTINE append_0 (self, a)
83 self%buffer(self%position) = 1
84 self%position = self%position + 1
85 call mpi_buffer_copy (a, 1, 1, self%buffer, self%position)
86 self%position = self%position + 1
88 END SUBROUTINE append_0
92 SUBROUTINE append_1 (self, a)
98 na = product(shape(a))
99 self%buffer(self%position) = na
100 self%position = self%position + 1
101 call mpi_buffer_copy (a, 1, 1, self%buffer, self%position)
102 self%position = self%position + na
104 END SUBROUTINE append_1
108 SUBROUTINE append_2 (self, a)
114 na = product(shape(a))
115 self%buffer(self%position) = na
116 self%position = self%position + 1
117 call mpi_buffer_copy (a, 1, na, self%buffer, self%position)
118 self%position = self%position + na
120 END SUBROUTINE append_2
124 SUBROUTINE append_3 (self, a)
130 na = product(shape(a))
131 self%buffer(self%position) = na
132 self%position = self%position + 1
133 call mpi_buffer_copy (a, 1, na, self%buffer, self%position)
134 self%position = self%position + na
136 END SUBROUTINE append_3
140 SUBROUTINE read_c (self, label)
142 character(len=*):: label
150 self%position = self%position + 1
152 self%position = self%position + ni
155 END SUBROUTINE read_c
159 SUBROUTINE read_0 (self, a)
165 self%position = self%position + 1
166 call mpi_buffer_copy (self%buffer, self%position, a, 1, 1)
167 self%position = self%position + 1
169 END SUBROUTINE read_0
173 SUBROUTINE read_1 (self, a)
179 na = product(shape(a))
180 self%position = self%position + 1
181 call mpi_buffer_copy (self%buffer, self%position, a, 1, na)
182 self%position = self%position + na
184 END SUBROUTINE read_1
188 SUBROUTINE read_2 (self, a)
194 na = product(shape(a))
195 self%buffer(self%position) = na
196 self%position = self%position + 1
197 call mpi_buffer_copy (self%buffer, self%position, a, 1, na)
198 self%position = self%position + na
200 END SUBROUTINE read_2
204 SUBROUTINE read_3 (self, a)
210 na = product(shape(a))
211 self%position = self%position + 1
212 call mpi_buffer_copy (self%buffer, self%position, a, 1, na)
213 self%position = self%position + na
215 END SUBROUTINE read_3
217 END MODULE mpi_buffer_mod
222 SUBROUTINE mpi_buffer_copy (a, n, b, o)
223 integer:: a(:), n, b(:), o
226 END SUBROUTINE mpi_buffer_copy