00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00149
00150
00151
00152
00153 subroutine ebf_demo
00154 USE ebf
00155 IMPLICIT NONE
00156
00157
00158 integer (kind=4),dimension(:),allocatable:: x0
00159 integer (kind=4),dimension(:),allocatable:: x1
00160 integer (kind=8),dimension(:,:),allocatable:: x2
00161 integer (kind=8),dimension(:,:,:),allocatable:: x3
00162
00163 real (kind=8),dimension(:),allocatable:: y0
00164 real (kind=8),dimension(:),allocatable:: y1
00165 real (kind=8),dimension(:,:),allocatable:: y2
00166 real (kind=8),dimension(:,:,:),allocatable:: y3
00167
00168
00169 type(ebfdatainfo):: dinfo
00170 type(ebffile)::efile
00171 integer (kind=8),dimension(2):: mydims
00172
00173 character (len=100)::temp,temp1
00174 integer(kind=4):: i,j,k,l
00175 logical unitok,unitop
00176
00177
00178
00179
00180 allocate(x0(100))
00181 DO i=1,size(x0)
00182 x0(i)=i
00183 end do
00184
00185
00186 allocate(x1(2))
00187 DO i=1,size(x1)
00188 x1(i)=i
00189 end do
00190
00191
00192 allocate(x2(2,3))
00193 l=1
00194 DO j=1,size(x2,2)
00195 DO i=1,size(x2,1)
00196 x2(i,j)=l
00197 l=l+1
00198 end do
00199 end do
00200
00201
00202 allocate(x3(2,3,4))
00203 l=1
00204 DO k=1,size(x3,3)
00205 DO j=1,size(x3,2)
00206 DO i=1,size(x3,1)
00207 x3(i,j,k)=l
00208 l=l+1
00209 end do
00210 end do
00211 end do
00212
00213
00214 call ebf_write("check.ebf","/x1",x1)
00215
00216 call ebf_write("check.ebf","/x2",x2,"a","m/s")
00217
00218 call ebf_write("check.ebf","/x3",x3,"a","100 km/s")
00219
00220
00221
00222 call ebf_read("check.ebf","/x1",y1,dinfo)
00223 print *,"y1 units:", dinfo%dataunit
00224 print *,"y1 data", y1
00225
00226
00227 if(ebf_containskey("check.ebf","/x1")) then
00228 call ebf_read("check.ebf","/x1",y1,dinfo)
00229 endif
00230
00231
00232 if(ebf_containskey("check.ebf","/x1",dinfo)) then
00233 print *,"y1 units:" , dinfo%dataunit
00234 print *,"y1 elements", dinfo%elements
00235 call ebf_read("check.ebf","/x1",y1,dinfo)
00236 endif
00237
00238
00239 call ebf_read("check.ebf","/x2",y2,dinfo)
00240 print *,"y2 units:", dinfo%dataunit
00241 print *,"y2 data", y2
00242
00243
00244 call ebf_read("check.ebf","/x3",y3,dinfo)
00245 print *,"y3 units:", dinfo%dataunit
00246 print *,"y3 data", y3
00247
00248
00249
00250
00251 call ebffile_open(efile,"check1.ebf","/test/x1","w",5,"m/s")
00252 call ebffile_write(efile,x1(1:10))
00253 call ebffile_write(efile,x2)
00254 call ebffile_close(efile)
00255
00256 mydims(1)=16
00257 mydims(2)=0
00258 print *,size(x1)
00259 call ebffile_open(efile,"check1.ebf","/test/x2","a",5,"m/s",mydims)
00260 call ebffile_write(efile,x1)
00261 call ebffile_close(efile)
00262
00263
00264 call ebf_info("check1.ebf")
00265 call ebf_info("check.ebf")
00266
00267
00268 call ebf_write("check.ebf","/x0",x0,"w","km/s")
00269
00270
00271 call ebffile_open(efile,"check.ebf","/x0")
00272 allocate(y0(ebfheader_elements(efile%ebfh)))
00273 call ebffile_read(efile,y1(21:25),int(11,kind=8))
00274 call ebffile_read(efile,y1(26:30))
00275 call ebffile_close(efile)
00276 print *,y1(21:30)
00277
00278 print *,"data units of /x0 are: ",efile%ebfh%dataunit
00279
00280
00281
00282
00283 call ebf_write('check.ebf','/xstr',"Hello, World!","a")
00284 call ebf_read('check.ebf','/xstr',temp)
00285 print *,'string is ',temp
00286
00287
00288 call ebf_info("check.ebf")
00289
00290
00291
00292
00293
00294
00295 end subroutine ebf_demo
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306