Tests.f90
Tests.f90 provides Fortran code examples for many XMDF APIs.
00001 MODULE TestDatasets
00002
00003 USE Xmdf
00004
00005 CHARACTER(LEN=*), PARAMETER :: DATASETS_LOCATION = 'Datasets'
00006 CHARACTER(LEN=*), PARAMETER :: SCALAR_A_LOCATION = 'Scalars/ScalarA'
00007 CHARACTER(LEN=*), PARAMETER :: SCALAR_A_LOCATION_FULL = 'Datasets/Scalars/ScalarA'
00008 CHARACTER(LEN=*), PARAMETER :: SCALAR_B_LOCATION = 'Scalars/ScalarB'
00009 CHARACTER(LEN=*), PARAMETER :: VECTOR2D_A_LOCATION = 'Vectors/Vector2D_A'
00010 CHARACTER(LEN=*), PARAMETER :: VECTOR2D_B_LOCATION = 'Vectors/Vector2D_B'
00011
00012 CONTAINS
00013
00014
00015
00016
00017
00018 SUBROUTINE TD_EDIT_SCALAR_A_VALUES(a_Filename, a_Compression, error)
00019 CHARACTER(LEN=*), INTENT(IN) :: a_Filename
00020 INTEGER, INTENT(IN) :: a_Compression
00021 INTEGER, INTENT(OUT) :: error
00022 INTEGER xFileId, xScalarId
00023 INTEGER, PARAMETER :: editNumValues = 3
00024 INTEGER editTimestep
00025 INTEGER, DIMENSION(editNumValues) :: indices
00026 REAL, DIMENSION(editNumValues) :: new_values
00027
00028 CALL TD_WRITE_SCALAR_A(a_Filename, a_Compression, error)
00029 if (error < 0) then
00030 return
00031 endif
00032
00033
00034 CALL XF_OPEN_FILE(a_Filename, .FALSE., xFileId, error)
00035 if (error < 0) then
00036 return
00037 endif
00038
00039 CALL XF_OPEN_GROUP(xFileId, SCALAR_A_LOCATION_FULL, xScalarId, error);
00040 if (error < 0) then
00041 CALL XF_CLOSE_FILE(xFileId, error)
00042 return
00043 endif
00044
00045
00046
00047 editTimestep = 1
00048 indices(1) = 1;
00049 indices(2) = 5;
00050 indices(3) = 10;
00051 new_values(1) = 4.0;
00052 new_values(2) = 40.0;
00053 new_values(3) = 400.0;
00054
00055 CALL XF_CHANGE_SCALAR_VALUES_TIMESTEP_FLOAT(xScalarId, editTimestep, editNumValues, &
00056 indices, new_values, error)
00057 if (error < 0) then
00058 CALL XF_CLOSE_GROUP(xScalarId, error)
00059 CALL XF_CLOSE_FILE(xFileId, error)
00060 return
00061 endif
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081 editTimestep = 2
00082 indices(1) = 2
00083 indices(2) = 3
00084 indices(3) = 9
00085 new_values(1) = -6.0
00086 new_values(2) = 60.0
00087 new_values(3) = 6000.0
00088
00089 CALL XF_CHANGE_SCALAR_VALUES_TIMESTEP_FLOAT(xScalarId, editTimestep, editNumValues, &
00090 indices, new_values, error)
00091 if (error < 0) then
00092 CALL XF_CLOSE_GROUP(xScalarId, error)
00093 CALL XF_CLOSE_FILE(xFileId, error)
00094 return
00095 endif
00096
00097 CALL XF_CLOSE_GROUP(xScalarId, error)
00098 CALL XF_CLOSE_FILE(xFileId, error)
00099
00100 return
00101 END SUBROUTINE
00102
00103
00104
00105
00106
00107
00108
00109 SUBROUTINE TD_READ_SCALAR_A_INDICES (a_Filename, a_nIndices, a_indices, error)
00110 CHARACTER(LEN=*), INTENT(IN) :: a_Filename
00111 INTEGER, INTENT(IN) :: a_nIndices
00112 INTEGER, DIMENSION(*), INTENT(IN) :: a_indices
00113 INTEGER, INTENT(OUT) :: error
00114 INTEGER xFileId, xDsetsId, xScalarAId
00115 INTEGER nTimesteps
00116 REAL, ALLOCATABLE, DIMENSION(:) :: fValues
00117 INTEGER nValues
00118 INTEGER id, i, j
00119
00120
00121 CALL XF_OPEN_FILE(a_Filename, .TRUE., xFileId, error)
00122 if (error < 0) then
00123 return
00124 endif
00125
00126
00127 CALL XF_OPEN_GROUP(xFileId, DATASETS_LOCATION, xDsetsId, error)
00128 if (error >= 0) then
00129 CALL XF_OPEN_GROUP(xDsetsId, SCALAR_A_LOCATION, xScalarAId, error)
00130 endif
00131 if (error < 0) then
00132 return
00133 endif
00134
00135
00136 CALL XF_GET_DATASET_NUM_TIMES(xScalarAId, nTimesteps, error)
00137 if (error < 0) then
00138 return
00139 endif
00140 if (nTimesteps < 1) then
00141 error = -1
00142 return
00143 endif
00144
00145
00146 nValues = nTimesteps*a_nIndices
00147 allocate(fValues(nValues))
00148 CALL XF_READ_SCALAR_VALUES_AT_INDICES_FLOAT(xScalarAId, a_nIndices, a_indices, 1, &
00149 nTimesteps, fValues, error)
00150 if (error < 0) then
00151 return
00152 endif
00153
00154
00155 WRITE(*,*) ''
00156 WRITE(*,*) 'Reading scalar A indices'
00157 id = 1;
00158 do i = 1, nTimesteps
00159 WRITE(*,*) 'Timestep: ', i
00160 do j = 1, a_nIndices
00161 WRITE(*,*) 'index:', a_indices(j), ' value: ', fValues(id)
00162 id = id + 1
00163 enddo
00164 enddo
00165 WRITE(*,*) ''
00166
00167 deallocate(fValues)
00168
00169 return
00170
00171 END SUBROUTINE
00172
00173
00174
00175
00176
00177
00178
00179
00180 RECURSIVE SUBROUTINE TD_READ_DATASETS (a_xGroupId, a_FileUnit, error)
00181 INTEGER, INTENT(IN) :: a_xGroupId
00182 INTEGER, INTENT(IN) :: a_FileUnit
00183 INTEGER, INTENT(OUT) :: error
00184 INTEGER nPaths, nMaxPathLength, j
00185 CHARACTER, ALLOCATABLE, DIMENSION(:) :: Paths
00186 CHARACTER(LEN=500) IndividualPath
00187 INTEGER nStatus, i
00188 INTEGER xScalarId, xVectorId, xMultiId
00189 INTEGER nMultiDatasets
00190
00191 xScalarId = NONE
00192 xVectorId = NONE
00193
00194 nMultiDatasets = 0
00195 nPaths = 0
00196 nMaxPathLength = 0
00197
00198
00199 call XF_GET_SCALAR_DATASETS_INFO(a_xGroupId, nPaths, nMaxPathLength, nStatus)
00200 if (nStatus >= 0 .AND. nPaths > 0) then
00201 allocate(Paths(nPaths*nMaxPathLength))
00202 call XF_GET_SCALAR_DATASET_PATHS(a_xGroupId, nPaths, nMaxPathLength, Paths, &
00203 error)
00204 endif
00205 if (nStatus < 0) then
00206 error = -1
00207 return
00208 endif
00209
00210
00211 WRITE(a_FileUnit,*) 'Number of Scalars ', nPaths
00212 do i=2, nPaths
00213 IndividualPath = ''
00214 do j=1, nMaxPathLength-1
00215 IndividualPath(j:j) = Paths((i-1)*nMaxPathLength+j)
00216 enddo
00217 WRITE(a_FileUnit,*) 'Reading scalar: ', IndividualPath(1:nMaxPathLength-1)
00218 call XF_OPEN_GROUP(a_xGroupId, IndividualPath(1:nMaxPathLength-1), &
00219 xScalarId, nStatus)
00220 if (nStatus < 0) then
00221 error = -1
00222 return
00223 endif
00224
00225 call TDI_READ_SCALAR(xScalarId, a_FileUnit, nStatus)
00226 call XF_CLOSE_GROUP(xScalarId, error)
00227 if (nStatus < 0) then
00228 WRITE(*,*) 'Error reading scalar dataset.'
00229 error = -1
00230 return
00231 endif
00232 enddo
00233
00234 if (allocated(Paths)) deallocate(Paths)
00235
00236 call XF_GET_VECTOR_DATASETS_INFO(a_xGroupId, nPaths, nMaxPathLength, nStatus)
00237 if (nStatus >= 0 .AND. nPaths > 0) then
00238 allocate(Paths(nPaths*nMaxPathLength))
00239 call XF_GET_VECTOR_DATASET_PATHS(a_xGroupId, nPaths, nMaxPathLength, Paths, error)
00240 endif
00241 if (nStatus < 0) then
00242 error = -1
00243 return
00244 endif
00245
00246
00247 WRITE(a_FileUnit,*) 'Number of Vectors ', nPaths
00248 do i=2, nPaths
00249 do j=1, nMaxPathLength-1
00250 IndividualPath(j:j) = Paths((i-1)*nMaxPathLength+j)
00251 enddo
00252 WRITE(a_FileUnit,*) 'Reading Vector: ', &
00253 IndividualPath(1:nMaxPathLength-1)
00254 call XF_OPEN_GROUP(a_xGroupId, IndividualPath(1:nMaxPathLength-1), &
00255 xVectorId, nStatus)
00256 if (nStatus < 0) then
00257 error = -1
00258 return
00259 endif
00260 call TDI_READ_VECTOR(xVectorId, a_FileUnit, nStatus)
00261 call XF_CLOSE_GROUP(xVectorId, error)
00262 if (nStatus < 0) then
00263 WRITE(*,*) 'Error reading vector dataset.'
00264 error = -1
00265 return
00266 endif
00267 enddo
00268
00269 if (allocated(Paths)) deallocate(Paths)
00270
00271
00272 call XF_GET_GRP_PTHS_SZ_MLT_DSETS(a_xGroupId, nMultiDatasets, &
00273 nMaxPathLength, nStatus)
00274 if (nStatus >= 0 .AND. nMultiDatasets > 0) then
00275 allocate(Paths(nMultiDatasets*nMaxPathLength))
00276 call XF_GET_ALL_GRP_PATHS_MLT_DSETS(a_xGroupId, nMultiDatasets, &
00277 nMaxPathLength, Paths, error)
00278 if (nStatus < 0) then
00279 error = -1
00280 return
00281 endif
00282
00283
00284 WRITE(a_FileUnit,*) 'Number of Multidatasets ', nMultiDatasets
00285 do i=2, nMultiDatasets
00286 IndividualPath = ''
00287 do j=1, nMaxPathLength-1
00288 IndividualPath(j:j) = Paths((i-1)*nMaxPathLength+j)
00289 enddo
00290 WRITE(a_FileUnit,*) 'Reading multidataset: ', &
00291 IndividualPath(1:nMaxPathLength-1)
00292 call XF_OPEN_GROUP(a_xGroupId, IndividualPath(1:nMaxPathLength-1), &
00293 xMultiId, nStatus)
00294 if (nStatus < 0) then
00295 error = -1
00296 return
00297 endif
00298
00299 call TD_READ_DATASETS(xMultiId, a_FileUnit, nStatus)
00300 call XF_CLOSE_GROUP(xMultiId, error)
00301 if (nStatus < 0) then
00302 WRITE(*,*) 'Error reading multidatasets.'
00303 error = -1
00304 return
00305 endif
00306 enddo
00307 endif
00308 if (allocated(Paths)) deallocate(Paths)
00309
00310 error = 1
00311 return
00312
00313 END SUBROUTINE
00314
00315
00316
00317
00318
00319
00320 SUBROUTINE TD_READ_ACTIVITY_SCALAR_A_INDEX(a_Filename, a_Index, error)
00321 CHARACTER(LEN=*), INTENT(IN) :: a_Filename
00322 INTEGER, INTENT(IN) :: a_Index
00323 INTEGER, INTENT(OUT) :: error
00324 INTEGER status
00325 INTEGER xFileId, xDsetsId, xScalarAId
00326 INTEGER nTimesteps, i
00327 INTEGER, ALLOCATABLE :: bActive(:)
00328
00329 xFileId = NONE
00330 xDsetsId = NONE
00331 xScalarAId = NONE
00332
00333
00334 call XF_OPEN_FILE(a_Filename, .TRUE., xFileId, status)
00335 if (status < 0) then
00336 error = -1
00337 return
00338 endif
00339
00340
00341 call XF_OPEN_GROUP(xFileId, DATASETS_LOCATION, xDsetsId, status)
00342 if (status >= 0) then
00343 call XF_OPEN_GROUP(xDsetsId, SCALAR_A_LOCATION, xScalarAId, status)
00344 endif
00345 if (status < 0) then
00346 error = status
00347 return
00348 endif
00349
00350
00351 CALL XF_GET_DATASET_NUM_TIMES(xScalarAId, nTimesteps, status)
00352 if (status < 0) then
00353 error = status
00354 return
00355 endif
00356
00357 if (nTimesteps < 1) then
00358 error = -1
00359 return
00360 endif
00361
00362
00363 allocate(bActive(nTimesteps))
00364 call XF_READ_ACTIVE_VALS_AT_INDEX(xScalarAId, a_Index, 1, nTimesteps, &
00365 bActive, status)
00366
00367 WRITE(*,*) ''
00368 WRITE(*,*) 'Reading activity for scalar A slice at index: ', a_Index
00369 do i=1, nTimesteps
00370 WRITE(*,*) bActive(i), ' '
00371 enddo
00372
00373 deallocate(bActive)
00374
00375 error = status
00376 return
00377
00378 END SUBROUTINE
00379
00380
00381
00382
00383
00384
00385
00386 SUBROUTINE TD_READ_SCALAR_A_INDEX (a_Filename, a_Index, error)
00387 CHARACTER(LEN=*), INTENT(IN) :: a_Filename
00388 INTEGER, INTENT(IN) :: a_Index
00389 INTEGER, INTENT(OUT) :: error
00390 INTEGER status
00391 INTEGER xFileId, xDsetsId, xScalarAId
00392 INTEGER nTimesteps, i
00393 REAL, ALLOCATABLE :: fValues(:)
00394
00395 xFileId = NONE
00396 xDsetsId = NONE
00397 xScalarAId = NONE
00398
00399
00400 call XF_OPEN_FILE(a_Filename, .TRUE., xFileId, status)
00401 if (status < 0) then
00402 error = -1
00403 return
00404 endif
00405
00406
00407 call XF_OPEN_GROUP(xFileId, DATASETS_LOCATION, xDsetsId, status)
00408 if (status >= 0) then
00409 call XF_OPEN_GROUP(xDsetsId, SCALAR_A_LOCATION, xScalarAId, status)
00410 endif
00411 if (status < 0) then
00412 error = status
00413 return
00414 endif
00415
00416
00417 call XF_GET_DATASET_NUM_TIMES(xScalarAId, nTimesteps, status)
00418 if (status < 0) then
00419 error = status
00420 return
00421 endif
00422
00423 if (nTimesteps < 1) then
00424 error = -1
00425 return
00426 endif
00427
00428
00429 allocate (fValues(nTimesteps))
00430 call XF_READ_SCALAR_VALUES_AT_INDEX(xScalarAId, a_Index, 1, nTimesteps, &
00431 fValues, status)
00432
00433
00434 WRITE(*,*) ''
00435 WRITE(*,*) 'Reading scalar A slice at index: ', a_Index
00436 do i=1, nTimesteps
00437 WRITE(*,*) fValues(i), ' '
00438 enddo
00439
00440 deallocate(fValues)
00441
00442 error = status
00443 return
00444
00445 END SUBROUTINE
00446
00447
00448
00449
00450
00451
00452
00453
00454
00455
00456
00457
00458 SUBROUTINE TD_WRITE_SCALAR_A (a_Filename, a_Compression, error)
00459 CHARACTER(LEN=*), INTENT(IN) :: a_Filename
00460 INTEGER, INTENT(IN) :: a_Compression
00461 INTEGER, INTENT(OUT) :: error
00462 INTEGER xFileId, xDsetsId, xScalarAId, xCoordId
00463 INTEGER nValues, nTimes, nActive
00464 REAL(DOUBLE) dTime, dJulianReftime
00465 INTEGER iTimestep, iActive, iHpgnZone
00466 REAL fValues(10)
00467 INTEGER*1 bActivity(10)
00468 INTEGER i, status
00469
00470
00471 nValues = 10
00472 nTimes = 3
00473 nActive = 8
00474 dTime = 0.0
00475
00476
00477 do iActive = 1, nActive
00478 bActivity(iActive) = 1
00479 enddo
00480 bActivity(6) = 0
00481
00482
00483
00484 call XF_CREATE_FILE(a_Filename, .TRUE., xFileId, error)
00485 if (error .LT. 0) then
00486
00487 call XF_CLOSE_FILE(xFileId, error)
00488 return
00489 endif
00490
00491
00492 call XF_CREATE_GENERIC_GROUP(xFileId, DATASETS_LOCATION, xDsetsId, status)
00493 if (status < 0) then
00494 call XF_CLOSE_FILE(xFileId, error)
00495 error = -1
00496 return
00497 endif
00498
00499
00500 call XF_CREATE_SCALAR_DATASET(xDsetsId, SCALAR_A_LOCATION, 'mg/L', &
00501 TS_HOURS, a_Compression, xScalarAId, status)
00502 if (status .LT. 0) then
00503
00504 call XF_CLOSE_GROUP(xScalarAId, error)
00505 call XF_CLOSE_GROUP(xDsetsId, error)
00506 call XF_CLOSE_FILE(xFileId, error)
00507 error = status
00508 return
00509 endif
00510
00511
00512
00513 dJulianReftime = 2452822.0;
00514 call XF_WRITE_REFTIME(xScalarAId, dJulianReftime, status)
00515 if (status < 0) then
00516 call XF_CLOSE_GROUP(xScalarAId, error)
00517 call XF_CLOSE_GROUP(xDsetsId, error)
00518 call XF_CLOSE_FILE(xFileId, error)
00519 endif
00520
00521
00522 do iTimestep = 1, nTimes
00523
00524 dTime = iTimestep * 0.5
00525
00526 fValues(1) = dTime
00527 do i = 2, nValues
00528 fValues(i) = fValues(i-1)*2.5
00529 end do
00530
00531
00532 call XF_WRITE_SCALAR_TIMESTEP(xScalarAId, dTime, nValues, fValues, error)
00533 if (error .GE. 0) then
00534
00535 call XF_WRITE_ACTIVITY_TIMESTEP(xScalarAId, nActive, bActivity, error)
00536 end if
00537 enddo
00538
00539
00540
00541 call XF_CREATE_COORDINATE_GROUP(xFileId, xCoordId, status)
00542 if (status < 0) then
00543 call XF_CLOSE_GROUP(xScalarAId, error)
00544 call XF_CLOSE_GROUP(xDsetsId, error)
00545 call XF_CLOSE_FILE(xFileId, error)
00546 error = -1
00547 return
00548 endif
00549
00550
00551 iHpgnZone = 29
00552
00553 call XF_SET_HORIZ_DATUM(xCoordId, HORIZ_DATUM_GEOGRAPHIC_HPGN, error)
00554 call XF_SET_HORIZ_UNITS(xCoordId, COORD_UNITS_METERS, error)
00555 call XF_SET_VERT_DATUM(xCoordId, VERT_DATUM_LOCAL, error)
00556 call XF_SET_VERT_UNITS(xCoordId, COORD_UNITS_METERS, error)
00557
00558
00559 call XF_SET_HPGN_AREA(xCoordId, iHpgnZone, error)
00560
00561 call XF_CLOSE_GROUP(xCoordId, error)
00562 xCoordId = 0;
00563
00564
00565 call XF_CLOSE_GROUP(xScalarAId, error)
00566 call XF_CLOSE_GROUP(xDsetsId, error)
00567 call XF_CLOSE_FILE(xFileId, error)
00568
00569 return
00570 END SUBROUTINE
00571
00572
00573
00574
00575
00576
00577
00578
00579
00580
00581
00582
00583 SUBROUTINE TD_WRITE_SCALAR_A_PIECES (a_Filename, a_Compression, error)
00584 CHARACTER(LEN=*), INTENT(IN) :: a_Filename
00585 INTEGER, INTENT(IN) :: a_Compression
00586 INTEGER, INTENT(OUT) :: error
00587 INTEGER xFileId, xDsetsId, xScalarAId, xCoordId
00588 INTEGER nValues, nTimes, nActive
00589 REAL(DOUBLE) dTime, dJulianReftime
00590 INTEGER iTimestep, iActive, iHpgnZone
00591 REAL fValues(10)
00592 INTEGER*1 bActivity(10)
00593 INTEGER i, status
00594 REAL minvalue, maxvalue
00595 INTEGER timestepId
00596 INTEGER activeTs
00597
00598
00599 nValues = 10
00600 nTimes = 3
00601 nActive = 8
00602 dTime = 0.0
00603
00604
00605 do iActive = 1, nActive
00606 bActivity(iActive) = 1
00607 enddo
00608 bActivity(6) = 0
00609
00610
00611
00612 call XF_CREATE_FILE(a_Filename, .TRUE., xFileId, error)
00613 if (error .LT. 0) then
00614
00615 call XF_CLOSE_FILE(xFileId, error)
00616 return
00617 endif
00618
00619
00620 call XF_CREATE_GENERIC_GROUP(xFileId, DATASETS_LOCATION, xDsetsId, status)
00621 if (status < 0) then
00622 call XF_CLOSE_FILE(xFileId, error)
00623 error = -1
00624 return
00625 endif
00626
00627
00628 call XF_CREATE_SCALAR_DATASET(xDsetsId, SCALAR_A_LOCATION, 'mg/L', &
00629 TS_HOURS, a_Compression, xScalarAId, status)
00630 if (status .LT. 0) then
00631
00632 call XF_CLOSE_GROUP(xScalarAId, error)
00633 call XF_CLOSE_GROUP(xDsetsId, error)
00634 call XF_CLOSE_FILE(xFileId, error)
00635 error = status
00636 return
00637 endif
00638
00639
00640
00641 dJulianReftime = 2452822.0;
00642 call XF_WRITE_REFTIME(xScalarAId, dJulianReftime, status)
00643 if (status < 0) then
00644 call XF_CLOSE_GROUP(xScalarAId, error)
00645 call XF_CLOSE_GROUP(xDsetsId, error)
00646 call XF_CLOSE_FILE(xFileId, error)
00647 endif
00648
00649
00650 do iTimestep = 1, nTimes
00651
00652 dTime = iTimestep * 0.5
00653
00654 fValues(1) = dTime
00655 minvalue = fValues(1)
00656 maxvalue = fValues(1)
00657 do i = 2, nValues
00658 fValues(i) = fValues(i-1)*2.5
00659 minvalue = min(minvalue, fValues(i))
00660 maxvalue = max(maxvalue, fValues(i))
00661 end do
00662
00663
00664 call XF_INITIALIZE_SCALAR_TIMESTEP(xScalarAId, dTime, nValues, minvalue, &
00665 maxvalue, timestepId, error)
00666
00667
00668 do i = 1, nValues, +2
00669 call XF_WRITE_SCALAR_TIMESTEP_PORTION(xScalarAId, timestepId, 2, i, &
00670 fValues(i), error)
00671 enddo
00672
00673 if (error .GE. 0) then
00674
00675 call XF_INITIALIZE_ACTIVITY_TIMESTEP(xScalarAId, nActive, activeTs, error)
00676
00677 do i = 1, nActive, +2
00678 call XF_WRITE_ACTIVITY_TIMESTEP_PORTION(xScalarAId, activeTs, 2, &
00679 i, bActivity(i), error)
00680 enddo
00681
00682 end if
00683 enddo
00684
00685
00686
00687 call XF_CREATE_COORDINATE_GROUP(xFileId, xCoordId, status)
00688 if (status < 0) then
00689 call XF_CLOSE_GROUP(xScalarAId, error)
00690 call XF_CLOSE_GROUP(xDsetsId, error)
00691 call XF_CLOSE_FILE(xFileId, error)
00692 error = -1
00693 return
00694 endif
00695
00696
00697 iHpgnZone = 29
00698
00699 call XF_SET_HORIZ_DATUM(xCoordId, HORIZ_DATUM_GEOGRAPHIC_HPGN, error)
00700 call XF_SET_HORIZ_UNITS(xCoordId, COORD_UNITS_METERS, error)
00701 call XF_SET_VERT_DATUM(xCoordId, VERT_DATUM_LOCAL, error)
00702 call XF_SET_VERT_UNITS(xCoordId, COORD_UNITS_METERS, error)
00703
00704
00705 call XF_SET_HPGN_AREA(xCoordId, iHpgnZone, error)
00706
00707 call XF_CLOSE_GROUP(xCoordId, error)
00708 xCoordId = 0;
00709
00710
00711 call XF_CLOSE_GROUP(xScalarAId, error)
00712 call XF_CLOSE_GROUP(xDsetsId, error)
00713 call XF_CLOSE_FILE(xFileId, error)
00714
00715 return
00716 END SUBROUTINE
00717
00718
00719
00720
00721
00722
00723
00724
00725
00726
00727
00728
00729 SUBROUTINE TD_WRITE_SCALAR_B (a_Filename, a_Compression, a_Overwrite, error)
00730 CHARACTER(LEN=*), INTENT(IN) :: a_Filename
00731 INTEGER, INTENT(IN) :: a_Compression
00732 LOGICAL, INTENT(IN) :: a_Overwrite
00733 INTEGER, INTENT(OUT) :: error
00734 INTEGER xFileId, xDsetsId, xScalarBId, xCoordId
00735 INTEGER nValues, nTimes, nActive
00736 REAL(DOUBLE) dTime, dJulianReftime
00737 INTEGER iTimestep, iActive
00738 REAL fValues(10)
00739 INTEGER*1 bActivity(10)
00740 INTEGER i, status
00741
00742
00743 nValues = 10
00744 nTimes = 3
00745 nActive = 8
00746 dTime = 0.0
00747 i = 0
00748
00749
00750 do iActive = 1, nActive
00751 bActivity(iActive) = 1
00752 enddo
00753 bActivity(6) = 0
00754
00755 if (a_Overwrite) then
00756
00757 call XF_OPEN_FILE(a_Filename, .FALSE., xFileId, status)
00758 if (status < 0) then
00759 error = -1
00760 return
00761 endif
00762
00763 call XF_OPEN_GROUP(xFileId, DATASETS_LOCATION, xDsetsId, status)
00764 if (status < 0) then
00765 call XF_CLOSE_FILE(xFileId, error)
00766 error = -1
00767 return
00768 endif
00769 else
00770
00771 call XF_CREATE_FILE(a_Filename, .TRUE., xFileId, error)
00772 if (error .LT. 0) then
00773
00774 call XF_CLOSE_FILE(xFileId, error)
00775 return
00776 endif
00777
00778
00779 call XF_CREATE_GENERIC_GROUP(xFileId, DATASETS_LOCATION, xDsetsId, status)
00780 if (status < 0) then
00781 call XF_CLOSE_FILE(xFileId, error)
00782 error = -1
00783 return
00784 endif
00785 endif
00786
00787
00788 call XF_CREATE_SCALAR_DATASET(xDsetsId, SCALAR_B_LOCATION, 'mg/L', &
00789 TS_HOURS, a_Compression, xScalarBId, status)
00790 if (status < 0) then
00791
00792 call XF_CLOSE_GROUP(xScalarBId, error)
00793 call XF_CLOSE_GROUP(xDsetsId, error)
00794 call XF_CLOSE_FILE(xFileId, error)
00795 error = status
00796 return
00797 endif
00798
00799
00800
00801 dJulianReftime = 2452822.0;
00802 call XF_WRITE_REFTIME(xScalarBId, dJulianReftime, status)
00803 if (status < 0) then
00804 call XF_CLOSE_GROUP(xScalarBId, error)
00805 call XF_CLOSE_GROUP(xDsetsId, error)
00806 call XF_CLOSE_FILE(xFileId, error)
00807 endif
00808
00809 if (.NOT. a_Overwrite) then
00810
00811 do iTimestep = 1, nTimes
00812
00813 dTime = iTimestep * 0.5
00814
00815 fValues(1) = dTime
00816 do i = 2, nValues
00817 fValues(i) = fValues(i-1)*2.5
00818 end do
00819
00820
00821 call XF_WRITE_SCALAR_TIMESTEP(xScalarBId, dTime, nValues, fValues, error)
00822 if (error .GE. 0) then
00823
00824 call XF_WRITE_ACTIVITY_TIMESTEP(xScalarBId, nActive, bActivity, error)
00825 end if
00826 if (error < 0) then
00827 call XF_CLOSE_GROUP(xScalarBId, error)
00828 call XF_CLOSE_GROUP(xDsetsId, error)
00829 call XF_CLOSE_FILE(xFileId, error)
00830 endif
00831 enddo
00832 else
00833
00834 do iTimestep = 1, nTimes
00835
00836 dTime = iTimestep * 1.5
00837
00838 fValues(1) = dTime
00839 do i = 2, nValues
00840 fValues(i) = fValues(i-1)*1.5
00841 end do
00842
00843
00844 call XF_WRITE_SCALAR_TIMESTEP(xScalarBId, dTime, nValues, fValues, error)
00845 if (error .GE. 0) then
00846
00847 call XF_WRITE_ACTIVITY_TIMESTEP(xScalarBId, nActive, bActivity, error)
00848 end if
00849 if (error < 0) then
00850 call XF_CLOSE_GROUP(xScalarBId, error)
00851 call XF_CLOSE_GROUP(xDsetsId, error)
00852 call XF_CLOSE_FILE(xFileId, error)
00853 endif
00854 enddo
00855 endif
00856
00857 if (.NOT. a_Overwrite) then
00858
00859
00860 call XF_CREATE_COORDINATE_GROUP(xFileId, xCoordId, status)
00861 if (status < 0) then
00862 call XF_CLOSE_GROUP(xScalarBId, error)
00863 call XF_CLOSE_GROUP(xDsetsId, error)
00864 call XF_CLOSE_FILE(xFileId, error)
00865 error = -1
00866 return
00867 endif
00868
00869
00870 call XF_SET_HORIZ_DATUM(xCoordId, HORIZ_DATUM_UTM, error)
00871 call XF_SET_HORIZ_UNITS(xCoordId, COORD_UNITS_METERS, error)
00872
00873 call XF_SET_VERT_DATUM(xCoordId, VERT_DATUM_LOCAL, error)
00874 call XF_SET_VERT_UNITS(xCoordId, COORD_UNITS_METERS, error)
00875
00876
00877 call XF_SET_UTM_ZONE(xCoordId, UTM_ZONE_MAX, error)
00878
00879 call XF_CLOSE_GROUP(xCoordId, error)
00880 xCoordId = 0
00881 endif
00882
00883
00884 call XF_CLOSE_GROUP(xScalarBId, error)
00885 call XF_CLOSE_GROUP(xDsetsId, error)
00886 call XF_CLOSE_FILE(xFileId, error)
00887
00888 error = 1
00889 return
00890 END SUBROUTINE
00891
00892
00893
00894
00895
00896
00897 SUBROUTINE TD_WRITE_COORDS_TO_MULTI (a_xFileId, error)
00898 INTEGER, INTENT(IN) :: a_xFileId
00899 INTEGER, INTENT(OUT) :: error
00900 INTEGER xCoordId
00901 INTEGER status
00902
00903
00904
00905 call XF_CREATE_COORDINATE_GROUP(a_xFileId, xCoordId, status)
00906 if (status < 0) then
00907 error = status
00908 return
00909 endif
00910
00911
00912 call XF_SET_HORIZ_DATUM(xCoordId, HORIZ_DATUM_UTM, error)
00913 call XF_SET_HORIZ_UNITS(xCoordId, COORD_UNITS_METERS, error)
00914
00915 call XF_SET_VERT_DATUM(xCoordId, VERT_DATUM_LOCAL, error)
00916 call XF_SET_VERT_UNITS(xCoordId, COORD_UNITS_METERS, error)
00917
00918
00919 call XF_SET_UTM_ZONE(xCoordId, UTM_ZONE_MAX, error)
00920
00921 call XF_CLOSE_GROUP(xCoordId, error)
00922 xCoordId = 0
00923
00924 return
00925 END SUBROUTINE
00926
00927
00928
00929
00930
00931
00932
00933
00934
00935
00936
00937 SUBROUTINE TD_WRITE_SCALAR_A_TO_MULTI (a_GroupID, status)
00938
00939
00940
00941 INTEGER xFileId, xDsetsId, xScalarAId
00942 INTEGER a_GroupID
00943 INTEGER nValues, nTimes, nActive
00944 REAL(DOUBLE) dTime, dJulianReftime
00945 INTEGER iTimestep, iActive
00946 REAL fValues(10)
00947 INTEGER*1 bActivity(10)
00948 INTEGER i, status
00949
00950
00951 nValues = 10
00952 nTimes = 3
00953 nActive = 8
00954 dTime = 0.0
00955
00956
00957 do iActive = 1, nActive
00958 bActivity(iActive) = 1
00959 enddo
00960 bActivity(6) = 0
00961
00962
00963 call XF_CREATE_SCALAR_DATASET(a_GroupID, SCALAR_A_LOCATION, 'mg/L', &
00964 TS_HOURS, NONE, xScalarAId, status)
00965 if (status .LT. 0) then
00966
00967 call XF_CLOSE_GROUP(xScalarAId, status)
00968 call XF_CLOSE_GROUP(xDsetsId, status)
00969 call XF_CLOSE_FILE(xFileId, status)
00970 return
00971 endif
00972
00973
00974
00975 dJulianReftime = 2452822.0;
00976 call XF_WRITE_REFTIME(xScalarAId, dJulianReftime, status)
00977 if (status < 0) then
00978 call XF_CLOSE_GROUP(xScalarAId, status)
00979 call XF_CLOSE_GROUP(xDsetsId, status)
00980 call XF_CLOSE_FILE(xFileId, status)
00981 endif
00982
00983
00984 do iTimestep = 1, nTimes
00985
00986 dTime = iTimestep * 0.5
00987
00988 fValues(1) = dTime
00989 do i = 2, nValues
00990 fValues(i) = fValues(i-1)*2.5
00991 end do
00992
00993
00994 call XF_WRITE_SCALAR_TIMESTEP(xScalarAId, dTime, nValues, fValues, status)
00995 if (status .GE. 0) then
00996
00997 call XF_WRITE_ACTIVITY_TIMESTEP(xScalarAId, nActive, bActivity, status)
00998 end if
00999 enddo
01000
01001
01002 call XF_CLOSE_GROUP(xScalarAId, status)
01003
01004
01005
01006 return
01007 END SUBROUTINE
01008
01009
01010
01011
01012
01013
01014 SUBROUTINE TD_READ_VECTOR2D_A_INDEX (a_Filename, a_Index, error)
01015 CHARACTER(LEN=*), INTENT(IN) :: a_Filename
01016 INTEGER, INTENT(IN) :: a_Index
01017 INTEGER, INTENT(OUT) :: error
01018 INTEGER status
01019 INTEGER xFileId, xDsetsId, xVector2DA
01020 INTEGER nTimesteps, i
01021 REAL, ALLOCATABLE :: fValues(:)
01022
01023 xFileId = NONE
01024 xDsetsId = NONE
01025 xVector2DA = NONE
01026
01027
01028 call XF_OPEN_FILE(a_Filename, .TRUE., xFileId, status)
01029 if (status < 0) then
01030 error = -1
01031 return
01032 endif
01033
01034
01035 call XF_OPEN_GROUP(xFileId, DATASETS_LOCATION, xDsetsId, status)
01036 if (status >= 0) then
01037 call XF_OPEN_GROUP(xDsetsId, VECTOR2D_A_LOCATION, xVector2DA, status)
01038 endif
01039 if (status < 0) then
01040 error = status
01041 return
01042 endif
01043
01044
01045 call XF_GET_DATASET_NUM_TIMES(xVector2DA, nTimesteps, status)
01046 if (status < 0) then
01047 error = status
01048 return
01049 endif
01050
01051 if (nTimesteps < 1) then
01052 error = -1
01053 return
01054 endif
01055
01056
01057 allocate(fValues(nTimesteps*2))
01058 call XF_READ_VECTOR_VALUES_AT_INDEX(xVector2DA, a_Index, 1, nTimesteps, 2, &
01059 fValues, status)
01060
01061
01062 WRITE(*,*) ''
01063 WRITE(*,*) 'Reading vector 2D A slice at index: ', a_Index
01064 do i=1, nTimesteps
01065 WRITE(*,*) fValues(i*2-1), ' ', fValues(i*2)
01066 enddo
01067 WRITE(*,*) ''
01068
01069 deallocate(fValues)
01070
01071 error = status
01072 return
01073
01074 END SUBROUTINE
01075
01076
01077
01078
01079
01080
01081
01082
01083
01084
01085
01086
01087 SUBROUTINE TD_WRITE_VECTOR2D_A (a_Filename, a_Compression, error)
01088 CHARACTER(LEN=*), INTENT(IN) :: a_Filename
01089 INTEGER, INTENT(IN) :: a_Compression
01090 INTEGER, INTENT(OUT) :: error
01091 INTEGER xFileId, xDsetsId, xVector2D_A, xCoordId
01092 INTEGER nValues, nTimes, nComponents, nActive
01093 REAL(DOUBLE) dTime
01094 INTEGER iTimestep, iActive
01095 REAL, DIMENSION(2, 100) :: fValues
01096 INTEGER*1 bActivity(100)
01097 INTEGER i, j, status
01098 INTEGER iHpgnZone
01099
01100
01101 nComponents = 2
01102 nValues = 100
01103 nTimes = 6
01104 nActive = 75
01105 dTime = 0.0
01106
01107
01108 bActivity(1) = 0
01109 do iActive = 2, nActive
01110 if (mod(iActive-1, 3) == 0) then
01111 bActivity(iActive) = 0
01112 else
01113 bActivity(iActive) = 1
01114 endif
01115 enddo
01116
01117
01118 call XF_CREATE_FILE(a_Filename, .TRUE., xFileId, error)
01119 if (error .LT. 0) then
01120
01121 call XF_CLOSE_FILE(xFileId, error)
01122 return
01123 endif
01124
01125
01126 call XF_CREATE_GENERIC_GROUP(xFileId, DATASETS_LOCATION, xDsetsId, status)
01127 if (status < 0) then
01128 call XF_CLOSE_FILE(xFileId, error)
01129 error = -1
01130 return
01131 endif
01132
01133
01134 call XF_CREATE_VECTOR_DATASET(xDsetsId, VECTOR2D_A_LOCATION, 'ft/s', &
01135 TS_SECONDS, a_Compression, xVector2D_A, status)
01136 if (status .LT. 0) then
01137
01138 call XF_CLOSE_GROUP(xVector2D_A, error)
01139 call XF_CLOSE_GROUP(xDsetsId, error)
01140 call XF_CLOSE_FILE(xFileId, error)
01141 error = status
01142 return
01143 endif
01144
01145
01146 do iTimestep = 1, nTimes
01147
01148 dTime = iTimestep * 0.5
01149
01150 do i = 1, nValues
01151 do j = 1, nComponents
01152 fValues(j,i) = ((i-1)*nComponents + j)*dTime
01153 end do
01154 end do
01155
01156
01157 call XF_WRITE_VECTOR_TIMESTEP(xVector2D_A, dTime, nValues, nComponents, &
01158 fValues, error)
01159 if (error .GE. 0) then
01160
01161 call XF_WRITE_ACTIVITY_TIMESTEP(xVector2D_A, nActive, bActivity, error)
01162 end if
01163 enddo
01164
01165
01166
01167 call XF_CREATE_COORDINATE_GROUP(xFileId, xCoordId, status)
01168 if (status < 0) then
01169 call XF_CLOSE_GROUP(xVector2D_A, error)
01170 call XF_CLOSE_GROUP(xDsetsId, error)
01171 call XF_CLOSE_FILE(xFileId, error)
01172 error = -1
01173 return
01174 endif
01175
01176
01177 iHpgnZone = 29
01178
01179 call XF_SET_HORIZ_DATUM(xCoordId, HORIZ_DATUM_GEOGRAPHIC_HPGN, error)
01180 call XF_SET_HORIZ_UNITS(xCoordId, COORD_UNITS_METERS, error)
01181 call XF_SET_VERT_DATUM(xCoordId, VERT_DATUM_LOCAL, error)
01182 call XF_SET_VERT_UNITS(xCoordId, COORD_UNITS_METERS, error)
01183
01184
01185 call XF_SET_HPGN_AREA(xCoordId, iHpgnZone, error)
01186
01187 call XF_CLOSE_GROUP(xCoordId, error)
01188 xCoordId = 0
01189
01190
01191 call XF_CLOSE_GROUP(xVector2D_A, error)
01192 call XF_CLOSE_GROUP(xDsetsId, error)
01193 call XF_CLOSE_FILE(xFileId, error)
01194
01195 return
01196 END SUBROUTINE
01197
01198
01199
01200
01201
01202
01203
01204
01205
01206
01207
01208
01209 SUBROUTINE TD_WRITE_VECTOR2D_A_PIECES (a_Filename, a_Compression, error)
01210 CHARACTER(LEN=*), INTENT(IN) :: a_Filename
01211 INTEGER, INTENT(IN) :: a_Compression
01212 INTEGER, INTENT(OUT) :: error
01213 INTEGER xFileId, xDsetsId, xVector2D_A, xCoordId
01214 INTEGER nValues, nTimes, nComponents, nActive
01215 REAL(DOUBLE) dTime
01216 INTEGER iTimestep, iActive
01217 REAL*4, DIMENSION(2, 100) :: fValues
01218 INTEGER*1 bActivity(100)
01219 INTEGER i, j, status
01220 INTEGER iHpgnZone
01221 INTEGER nValuesToWrite, nComponentsToWrite, startComponent
01222 REAL*4 minvalue, maxvalue
01223 INTEGER timeId
01224 REAL*8 mag
01225
01226
01227 nComponents = 2
01228 nValues = 100
01229 nTimes = 6
01230 nActive = 75
01231 dTime = 0.0
01232
01233
01234 bActivity(1) = 0
01235 do iActive = 2, nActive
01236 if (mod(iActive-1, 3) == 0) then
01237 bActivity(iActive) = 0
01238 else
01239 bActivity(iActive) = 1
01240 endif
01241 enddo
01242
01243
01244 call XF_CREATE_FILE(a_Filename, .TRUE., xFileId, error)
01245 if (error .LT. 0) then
01246
01247 call XF_CLOSE_FILE(xFileId, error)
01248 return
01249 endif
01250
01251
01252 call XF_CREATE_GENERIC_GROUP(xFileId, DATASETS_LOCATION, xDsetsId, status)
01253 if (status < 0) then
01254 call XF_CLOSE_FILE(xFileId, error)
01255 error = -1
01256 return
01257 endif
01258
01259
01260 call XF_CREATE_VECTOR_DATASET(xDsetsId, VECTOR2D_A_LOCATION, 'ft/s', &
01261 TS_SECONDS, a_Compression, xVector2D_A, status)
01262 if (status .LT. 0) then
01263
01264 call XF_CLOSE_GROUP(xVector2D_A, error)
01265 call XF_CLOSE_GROUP(xDsetsId, error)
01266 call XF_CLOSE_FILE(xFileId, error)
01267 error = status
01268 return
01269 endif
01270
01271
01272 do iTimestep = 1, nTimes
01273
01274 dTime = iTimestep * 0.5
01275
01276 do i = 1, nValues
01277 do j = 1, nComponents
01278 fValues(j,i) = ((i-1)*nComponents + j)*dTime
01279 end do
01280 end do
01281
01282 minvalue = 99999.0
01283 maxvalue = 0.0
01284 do i = 1, nValues
01285 mag = 0.0
01286 do j = 1, nComponents
01287 mag = mag + fValues(j, i)**2
01288 end do
01289 mag = mag**0.5
01290
01291 minvalue = min(minvalue, mag)
01292 maxvalue = max(maxvalue, mag)
01293 end do
01294
01295
01296 call XF_INITIALIZE_VECTOR_TIMESTEP(xVector2D_A, dTime, nValues, nComponents, &
01297 minvalue, maxvalue, timeId, error)
01298
01299 nValuesToWrite = 2
01300 nComponentsToWrite = 2
01301 startComponent = 1
01302
01303 do i = 1, nValues, +2
01304 call XF_WRITE_VECTOR_TIMESTEP_PORTION(xVector2D_A, timeId, nValuesToWrite, &
01305 nComponentsToWrite, i, startComponent, fValues(1, i), error)
01306 enddo
01307
01308 if (error .GE. 0) then
01309
01310 call XF_WRITE_ACTIVITY_TIMESTEP(xVector2D_A, nActive, bActivity, error)
01311 end if
01312 enddo
01313
01314
01315
01316 call XF_CREATE_COORDINATE_GROUP(xFileId, xCoordId, status)
01317 if (status < 0) then
01318 call XF_CLOSE_GROUP(xVector2D_A, error)
01319 call XF_CLOSE_GROUP(xDsetsId, error)
01320 call XF_CLOSE_FILE(xFileId, error)
01321 error = -1
01322 return
01323 endif
01324
01325
01326 iHpgnZone = 29
01327
01328 call XF_SET_HORIZ_DATUM(xCoordId, HORIZ_DATUM_GEOGRAPHIC_HPGN, error)
01329 call XF_SET_HORIZ_UNITS(xCoordId, COORD_UNITS_METERS, error)
01330 call XF_SET_VERT_DATUM(xCoordId, VERT_DATUM_LOCAL, error)
01331 call XF_SET_VERT_UNITS(xCoordId, COORD_UNITS_METERS, error)
01332
01333
01334 call XF_SET_HPGN_AREA(xCoordId, iHpgnZone, error)
01335
01336 call XF_CLOSE_GROUP(xCoordId, error)
01337 xCoordId = 0
01338
01339
01340 call XF_CLOSE_GROUP(xVector2D_A, error)
01341 call XF_CLOSE_GROUP(xDsetsId, error)
01342 call XF_CLOSE_FILE(xFileId, error)
01343
01344 return
01345 END SUBROUTINE
01346
01347
01348
01349
01350
01351
01352
01353
01354
01355
01356
01357
01358 SUBROUTINE TD_WRITE_VECTOR2D_B (a_Filename, a_Compression, a_Overwrite, error)
01359 CHARACTER(LEN=*), INTENT(IN) :: a_Filename
01360 INTEGER, INTENT(IN) :: a_Compression
01361 LOGICAL, INTENT(IN) :: a_Overwrite
01362 INTEGER, INTENT(OUT) :: error
01363 INTEGER xFileId, xDsetsId, xVector2D_B, xCoordId
01364 INTEGER nValues, nTimes, nComponents, nActive
01365 REAL(DOUBLE) dTime
01366 INTEGER iTimestep, iActive
01367 REAL, DIMENSION(2, 100) :: fValues
01368 INTEGER*1 bActivity(100)
01369 INTEGER i, j, status
01370
01371
01372 nComponents = 2
01373 nValues = 100
01374 nTimes = 6
01375 nActive = 75
01376 dTime = 0.0
01377
01378
01379 bActivity(1) = 0
01380 do iActive = 2, nActive
01381 if (mod(iActive-1, 3) == 0) then
01382 bActivity(iActive) = 0
01383 else
01384 bActivity(iActive) = 1
01385 endif
01386 enddo
01387
01388 if (a_Overwrite) then
01389
01390 call XF_OPEN_FILE(a_Filename, .FALSE., xFileId, status)
01391 if (status < 0) then
01392 error = -1
01393 return
01394 endif
01395
01396 call XF_OPEN_GROUP(xFileId, DATASETS_LOCATION, xDsetsId, status)
01397 if (status < 0) then
01398 call XF_CLOSE_FILE(xFileId, error)
01399 error = -1
01400 return
01401 endif
01402 else
01403
01404 call XF_CREATE_FILE(a_Filename, .TRUE., xFileId, error)
01405 if (error .LT. 0) then
01406
01407 call XF_CLOSE_FILE(xFileId, error)
01408 return
01409 endif
01410
01411
01412 call XF_CREATE_GENERIC_GROUP(xFileId, DATASETS_LOCATION, xDsetsId, status)
01413 if (status < 0) then
01414 call XF_CLOSE_FILE(xFileId, error)
01415 error = -1
01416 return
01417 endif
01418 endif
01419
01420
01421 call XF_CREATE_VECTOR_DATASET(xDsetsId, VECTOR2D_B_LOCATION, 'ft/s', &
01422 TS_SECONDS, a_Compression, xVector2D_B, status)
01423 if (status .LT. 0) then
01424
01425 call XF_CLOSE_GROUP(xVector2D_B, error)
01426 call XF_CLOSE_GROUP(xDsetsId, error)
01427 call XF_CLOSE_FILE(xFileId, error)
01428 error = status
01429 return
01430 endif
01431
01432 if (.NOT. a_Overwrite) then
01433
01434 do iTimestep = 1, nTimes
01435
01436 dTime = iTimestep * 0.5
01437 do i = 1, nValues
01438 do j = 1, nComponents
01439 fValues(j,i) = ((i-1)*nComponents + j)*dTime
01440 end do
01441 end do
01442
01443 call XF_WRITE_VECTOR_TIMESTEP(xVector2D_B, dTime, nValues, nComponents, &
01444 fValues, error)
01445 if (error .GE. 0) then
01446
01447 call XF_WRITE_ACTIVITY_TIMESTEP(xVector2D_B, nActive, bActivity, error)
01448 end if
01449 if (error < 0) then
01450 call XF_CLOSE_GROUP(xVector2D_B, error)
01451 call XF_CLOSE_GROUP(xDsetsId, error)
01452 call XF_CLOSE_FILE(xFileId, error)
01453 endif
01454 enddo
01455 else
01456
01457 do iTimestep = 1, nTimes
01458
01459 dTime = iTimestep * 1.5
01460 do i = 1, nValues
01461 do j = 1, nComponents
01462 fValues(j,i) = ((i-1)*nComponents + j)*dTime
01463 end do
01464 end do
01465
01466 call XF_WRITE_VECTOR_TIMESTEP(xVector2D_B, dTime, nValues, nComponents, &
01467 fValues, error)
01468 if (error .GE. 0) then
01469
01470 call XF_WRITE_ACTIVITY_TIMESTEP(xVector2D_B, nActive, bActivity, error)
01471 end if
01472 if (error < 0) then
01473 call XF_CLOSE_GROUP(xVector2D_B, error)
01474 call XF_CLOSE_GROUP(xDsetsId, error)
01475 call XF_CLOSE_FILE(xFileId, error)
01476 endif
01477 enddo
01478 endif
01479
01480 if (.NOT. a_Overwrite) then
01481
01482
01483 call XF_CREATE_COORDINATE_GROUP(xFileId, xCoordId, status)
01484 if (status < 0) then
01485 call XF_CLOSE_GROUP(xVector2D_B, error)
01486 call XF_CLOSE_GROUP(xDsetsId, error)
01487 call XF_CLOSE_FILE(xFileId, error)
01488 error = -1
01489 return
01490 endif
01491
01492
01493 call XF_SET_HORIZ_DATUM(xCoordId, HORIZ_DATUM_UTM, error)
01494 call XF_SET_HORIZ_UNITS(xCoordId, COORD_UNITS_METERS, error)
01495 call XF_SET_VERT_DATUM(xCoordId, VERT_DATUM_LOCAL, error)
01496 call XF_SET_VERT_UNITS(xCoordId, COORD_UNITS_METERS, error)
01497
01498
01499 call XF_SET_UTM_ZONE(xCoordId, UTM_ZONE_MAX, error)
01500
01501 call XF_CLOSE_GROUP(xCoordId, error)
01502 xCoordId = 0
01503 endif
01504
01505
01506 call XF_CLOSE_GROUP(xVector2D_B, error)
01507 call XF_CLOSE_GROUP(xDsetsId, error)
01508 call XF_CLOSE_FILE(xFileId, error)
01509
01510 return
01511 END SUBROUTINE
01512
01513
01514
01515
01516
01517
01518
01519
01520
01521
01522
01523
01524 SUBROUTINE TD_WRITE_VECTOR2D_A_TO_MULTI (a_FileID, a_GroupID, status)
01525 INTEGER xVector2D_A
01526 INTEGER a_FileID, a_GroupID
01527 INTEGER nValues, nTimes, nComponents, nActive
01528 REAL(DOUBLE) dTime
01529 INTEGER iTimestep, iActive
01530 REAL, DIMENSION(2, 100) :: fValues
01531 INTEGER*1 bActivity(100)
01532 INTEGER i, j, status
01533
01534
01535 nComponents = 2
01536 nValues = 100
01537 nTimes = 6
01538 nActive = 75
01539 dTime = 0.0
01540
01541
01542 bActivity(1) = 0
01543 do iActive = 2, nActive
01544 if (mod(iActive-1, 3) == 0) then
01545 bActivity(iActive) = 0
01546 else
01547 bActivity(iActive) = 1
01548 endif
01549 enddo
01550
01551
01552 call XF_CREATE_VECTOR_DATASET(a_GroupID, VECTOR2D_A_LOCATION, 'ft/s', &
01553 TS_SECONDS, NONE, xVector2D_A, status)
01554 if (status .LT. 0) then
01555
01556 call XF_CLOSE_GROUP(xVector2D_A, status)
01557 call XF_CLOSE_GROUP(a_GroupID, status)
01558 call XF_CLOSE_FILE(a_FileID, status)
01559 return
01560 endif
01561
01562
01563 do iTimestep = 1, nTimes
01564
01565 dTime = iTimestep * 0.5
01566
01567 do i = 1, nValues
01568 do j = 1, nComponents
01569 fValues(j,i) = ((i-1)*nComponents + j)*dTime
01570 end do
01571 end do
01572
01573
01574 call XF_WRITE_VECTOR_TIMESTEP(xVector2D_A, dTime, nValues, nComponents, &
01575 fValues, status)
01576 if (status .GE. 0) then
01577
01578 call XF_WRITE_ACTIVITY_TIMESTEP(xVector2D_A, nActive, bActivity, status)
01579 end if
01580 enddo
01581
01582
01583 call XF_CLOSE_GROUP(xVector2D_A, status)
01584 return
01585 END SUBROUTINE
01586
01587
01588
01589
01590
01591
01592
01593 SUBROUTINE TDI_READ_SCALAR (a_xScalarId, FileUnit, error)
01594 INTEGER, INTENT(IN) :: a_xScalarId
01595 INTEGER, INTENT(IN) :: FileUnit
01596 INTEGER, INTENT(OUT) :: error
01597 INTEGER nTimes, nValues, nActive
01598 LOGICAL*2 bUseReftime
01599 INTEGER iTime
01600 CHARACTER(LEN=100) TimeUnits
01601 REAL(DOUBLE), ALLOCATABLE :: Times(:)
01602 REAL, ALLOCATABLE :: Values(:), Minimums(:), Maximums(:)
01603 INTEGER, ALLOCATABLE :: Active(:)
01604 REAL(DOUBLE) Reftime
01605 nTimes = NONE
01606 nValues = NONE
01607 nActive = None
01608
01609
01610 call XF_GET_DATASET_TIME_UNITS(a_xScalarId, TimeUnits, error)
01611 if (error < 0) return
01612
01613 WRITE(FileUnit,*) 'Time units: ', TimeUnits(1:LEN_TRIM(TimeUnits))
01614
01615
01616 call XF_USE_REFTIME (a_xScalarId, bUseReftime, error)
01617 if (error < 0) then
01618 return
01619 endif
01620 if (bUseReftime) then
01621 call XF_READ_REFTIME (a_xScalarId, Reftime, error)
01622 if (error < 0) then
01623 return
01624 endif
01625 WRITE(FileUnit,*) 'Reftime: ', Reftime
01626 endif
01627
01628
01629 call XF_GET_DATASET_NUMVALS(a_xScalarId, nValues, error)
01630 if (error .GE. 0) then
01631 call XF_GET_DATASET_NUMACTIVE(a_xScalarId, nActive, error)
01632 endif
01633 if (error .LT. 0) return
01634
01635 if (nValues <= 0) then
01636 WRITE(FileUnit, *) 'No data to read in.'
01637 error = -1
01638 return
01639 endif
01640
01641
01642 call XF_GET_DATASET_NUM_TIMES(a_xScalarId, nTimes, error)
01643 if (error < 0) then
01644 return
01645 endif
01646
01647
01648 allocate(Times(nTimes))
01649
01650 call XF_GET_DATASET_TIMES(a_xScalarId, nTimes, Times, error)
01651 if (error < 0) return
01652
01653
01654 allocate(Minimums(nTimes))
01655 allocate(Maximums(nTimes))
01656
01657 call XF_GET_DATASET_MINS(a_xScalarId, nTimes, Minimums, error)
01658 if (error >= 0) then
01659 call XF_GET_DATASET_MAXS(a_xScalarId, nTimes, Maximums, error)
01660 endif
01661 if (error < 0) then
01662 deallocate(Times)
01663 deallocate(Minimums)
01664 deallocate(Maximums)
01665 return
01666 endif
01667
01668 allocate(Values(nValues))
01669 if (nActive .GT. 0) then
01670 allocate(Active(nActive))
01671 endif
01672
01673 WRITE(FileUnit,*) 'Number Timesteps: ', nTimes
01674 WRITE(FileUnit,*) 'Number Values: ', nValues
01675 WRITE(FileUnit,*) 'Number Active: ', nActive
01676 WRITE(FileUnit,*) ''
01677
01678
01679
01680 do iTime = 1, nTimes
01681 call XF_READ_SCALAR_VALUES_TIMESTEP(a_xScalarId, iTime, nValues, Values, error)
01682 if (error >= 0 .AND. nActive > 0) then
01683 call XF_READ_ACTIVITY_TIMESTEP(a_xScalarId, iTime, nActive, Active, error)
01684 endif
01685
01686
01687
01688 WRITE(FileUnit,*) 'Timestep at ', Times(iTime)
01689 WRITE(FileUnit,*) 'Min: ', Minimums(iTime)
01690 WRITE(FileUnit,*) 'Max: ', Maximums(iTime)
01691
01692 WRITE(FileUnit,*) 'Values:'
01693 WRITE(FileUnit,*) Values(1:nValues)
01694 WRITE(FileUnit,*) ''
01695
01696 WRITE(FileUnit,*) 'Activity:'
01697 WRITE(FileUnit,*) Active(1:nActive)
01698 WRITE(FileUnit,*) ''
01699 end do
01700
01701 if (allocated(Times)) then
01702 deallocate(Times)
01703 endif
01704
01705 if (allocated(Minimums)) then
01706 deallocate(Minimums)
01707 endif
01708
01709 if (allocated(Maximums)) then
01710 deallocate(Maximums)
01711 endif
01712
01713 if (allocated(Values)) then
01714 deallocate(Values)
01715 endif
01716
01717 if (allocated(Active)) then
01718 deallocate(Active)
01719 endif
01720
01721 return
01722 END SUBROUTINE
01723
01724
01725
01726
01727
01728
01729
01730
01731 SUBROUTINE TDI_READ_VECTOR (a_xVectorId, FileUnit, error)
01732 INTEGER, INTENT(IN) :: a_xVectorId
01733 INTEGER, INTENT(IN) :: FileUnit
01734 INTEGER, INTENT(OUT) :: error
01735 INTEGER nTimes, nValues, nActive, nComponents
01736 INTEGER iTime, i
01737 LOGICAL*2 bUseReftime
01738 CHARACTER(LEN=100) TimeUnits
01739 REAL(DOUBLE), ALLOCATABLE :: Times(:)
01740 REAL, ALLOCATABLE, DIMENSION (:, :) :: Values
01741 REAL, ALLOCATABLE :: Minimums(:), Maximums(:)
01742 INTEGER, ALLOCATABLE :: Active(:)
01743 REAL(DOUBLE) Reftime
01744
01745 nTimes = NONE
01746 nValues = NONE
01747 nActive = NONE
01748 nComponents = NONE
01749
01750
01751 call XF_GET_DATASET_TIME_UNITS(a_xVectorId, TimeUnits, error)
01752 if (error < 0) return
01753
01754 WRITE(FileUnit,*) 'Time units: ', TimeUnits(1:LEN_TRIM(TimeUnits))
01755
01756
01757 call XF_USE_REFTIME (a_xVectorId, bUseReftime, error)
01758 if (error < 0) then
01759 return
01760 endif
01761 if (bUseReftime) then
01762 call XF_READ_REFTIME (a_xVectorId, Reftime, error)
01763 if (error < 0) then
01764 return
01765 endif
01766 WRITE(FileUnit,*) 'Reftime: ', Reftime
01767 endif
01768
01769
01770 call XF_GET_DATASET_NUMVALS(a_xVectorId, nValues, error)
01771 if (error .GE. 0) then
01772 call XF_GET_DATASET_NUMCOMPONENTS(a_xVectorId, nComponents, error)
01773 if (error .GE. 0) then
01774 call XF_GET_DATASET_NUMACTIVE(a_xVectorId, nActive, error)
01775 endif
01776 endif
01777 if (error .LT. 0) return
01778
01779 if (nValues <= 0) then
01780 WRITE(FileUnit, *) 'No data to read in.'
01781 error = -1
01782 return
01783 endif
01784
01785
01786 call XF_GET_DATASET_NUM_TIMES(a_xVectorId, nTimes, error)
01787 if (error < 0) then
01788 return
01789 endif
01790
01791
01792 allocate(Times(nTimes))
01793
01794 call XF_GET_DATASET_TIMES(a_xVectorId, nTimes, Times, error)
01795 if (error < 0) return
01796
01797
01798 allocate(Minimums(nTimes))
01799 allocate(Maximums(nTimes))
01800
01801 call XF_GET_DATASET_MINS(a_xVectorId, nTimes, Minimums, error)
01802 if (error >= 0) then
01803 call XF_GET_DATASET_MAXS(a_xVectorId, nTimes, Maximums, error)
01804 endif
01805 if (error < 0) then
01806 deallocate(Times)
01807 deallocate(Minimums)
01808 deallocate(Maximums)
01809 return
01810 endif
01811
01812 allocate(Values(nComponents, nValues))
01813 if (nActive .GT. 0) then
01814 allocate(Active(nActive))
01815 endif
01816
01817 WRITE(FileUnit,*) 'Number Timesteps: ', nTimes
01818 WRITE(FileUnit,*) 'Number Values: ', nValues
01819 WRITE(FileUnit,*) 'Number Components: ', nComponents
01820 WRITE(FileUnit,*) 'Number Active: ', nActive
01821
01822
01823
01824 do iTime = 1, nTimes
01825 call XF_READ_VECTOR_VALUES_TIMESTEP(a_xVectorId, iTime, nValues, &
01826 nComponents, Values, error)
01827 if (error >= 0 .AND. nActive > 0) then
01828 call XF_READ_ACTIVITY_TIMESTEP(a_xVectorId, iTime, nActive, Active, error)
01829 endif
01830
01831
01832
01833 WRITE(FileUnit,*) ''
01834 WRITE(FileUnit,*) 'Timestep at ', Times(iTime)
01835 WRITE(FileUnit,*) 'Min: ', Minimums(iTime)
01836 WRITE(FileUnit,*) 'Max: ', Maximums(iTime)
01837
01838 WRITE(FileUnit,*) 'Values:'
01839 do i=1, nValues
01840 WRITE(FileUnit,*) Values(1:nComponents,i:i)
01841 enddo
01842 WRITE(FileUnit,*) ''
01843
01844 WRITE(FileUnit,*) 'Activity:'
01845 WRITE(FileUnit,*) Active(1:nActive)
01846 WRITE(FileUnit,*) ''
01847 WRITE(FileUnit,*) ''
01848
01849 end do
01850
01851 if (allocated(Times)) then
01852 deallocate(Times)
01853 endif
01854
01855 if (allocated(Minimums)) then
01856 deallocate(Minimums)
01857 endif
01858
01859 if (allocated(Maximums)) then
01860 deallocate(Maximums)
01861 endif
01862
01863 if (allocated(Values)) then
01864 deallocate(Values)
01865 endif
01866
01867 if (allocated(Active)) then
01868 deallocate(Active)
01869 endif
01870
01871 return
01872 END SUBROUTINE
01873
01874
01875 END MODULE TestDatasets
TestDatasets.f90 tests datasets
00001 MODULE TestGeomPaths
00002
00003 USE TestDatasets
00004 USE Xmdf
00005 USE ErrorDefinitions
00006 USE XmdfDefs
00007
00008 CONTAINS
00009
00010 SUBROUTINE TM_READ_TEST_PATHS(Filename, OutFilename, error)
00011 CHARACTER(LEN=*), INTENT(IN) :: Filename, OutFilename
00012 INTEGER, INTENT(OUT) :: error
00013 INTEGER OutUnit
00014 INTEGER :: xFileId, xGroupId
00015 INTEGER nGroups, nMaxPathLength, nDims, nPaths, nTimes
00016 INTEGER i, j, nStatus
00017 CHARACTER,ALLOCATABLE :: Paths(:)
00018 REAL(DOUBLE), ALLOCATABLE :: times(:), locs(:)
00019 REAL(DOUBLE) Nullval
00020 CHARACTER(LEN=BIG_STRING_SIZE) :: IndividualPath
00021 INTEGER StartLoc
00022 INTEGER, DIMENSION(2) :: PathIndices
00023 INTEGER iTime, iPath
00024
00025
00026 CALL XF_OPEN_FILE(Filename, .FALSE., xFileId, nStatus)
00027 if (nStatus < 0) then
00028 WRITE(*) 'Unable to open XMDF file TM_READ_TEST_PATHS.'
00029 error = nStatus;
00030 return
00031 endif
00032
00033
00034 OutUnit = 79
00035 OPEN(UNIT=OutUnit, FILE=OutFilename, STATUS='REPLACE', ACTION='WRITE', &
00036 IOSTAT = error)
00037 if (OutUnit == 0) then
00038 call XF_CLOSE_FILE(xFileId, error)
00039 error = -1
00040 return
00041 endif
00042
00043
00044
00045 CALL XF_GRP_PTHS_SZ_FOR_GEOM_PTHS(xFileId, nGroups, &
00046 nMaxPathLength, nStatus)
00047 if (nStatus >= 0 .AND. nGroups > 0) then
00048 allocate (Paths(nMaxPathLength*nGroups))
00049 CALL XF_GRP_PTHS_FOR_GEOM_PTHS(xFileId, nGroups, &
00050 nMaxPathLength, Paths, nStatus)
00051 endif
00052 if (nStatus < 0) then
00053 CALL XF_CLOSE_FILE(xFileId, nStatus)
00054 error = -1
00055 return
00056 endif
00057
00058 WRITE(OutUnit,*) 'Number of geometric paths in file: ', nGroups
00059
00060 do i = 1, nGroups
00061 StartLoc = (i-1)*nMaxPathLength + 1
00062 IndividualPath = ''
00063 do j = 1, nMaxPathLength - 1
00064 IndividualPath(j:j) = Paths(StartLoc+j-1)
00065 enddo
00066 WRITE(OutUnit,*) 'Reading particles in group: ', &
00067 IndividualPath(1:LEN_TRIM(IndividualPath))
00068
00069 CALL XF_OPEN_GROUP(xFileId, IndividualPath, xGroupId, nStatus)
00070 if (nStatus >= 0) then
00071
00072 CALL XF_GET_PATH_DIMENSIONALITY(xGroupId, nDims, nStatus)
00073 if (nStatus >= 0) then
00074 WRITE(OutUnit,*) 'Group dimensionality:', nDims
00075
00076 CALL XF_GET_NUMBER_OF_PATHS(xGroupId, nPaths, nStatus)
00077 if (nStatus >= 0) then
00078 WRITE(OutUnit,*) 'Number of paths in group:', nPaths
00079
00080 CALL XF_GET_NUMBER_OF_TIMES(xGroupId, nTimes, nStatus)
00081 if (nStatus >= 0) then
00082 WRITE(OutUnit,*) 'Number of timesteps in group:', nTimes
00083
00084 allocate(times(nTimes))
00085 CALL XF_GET_PATH_TIMES_ARRAY(xGroupId, nTimes, times, nStatus)
00086 if (nStatus >= 0) then
00087
00088 allocate(locs(nPaths*nDims))
00089
00090 CALL XF_GET_PATH_NULL_VAL(xGroupId, NullVal, nStatus)
00091 if (nStatus >= 0) then
00092 WRITE(OutUnit,*) 'Null value:', NullVal
00093 do iTime=1, nTimes
00094 WRITE(OutUnit,*) 'Timestep: ', times(iTime)
00095
00096 CALL XF_READ_PATH_LOCATIONS_AT_TIME(xGroupId, iTime, &
00097 1, nPaths, locs, nStatus)
00098 if (nStatus >= 0) then
00099
00100 WRITE(OutUnit,*) ' X Y'
00101 if (nDims == 3) then
00102 WRITE(OutUnit,*) ' Z'
00103 endif
00104 WRITE(OutUnit,*) ''
00105 do j=1, nPaths
00106 if (locs(j*nDims) == NullVal) then
00107 WRITE(OutUnit,*) 'Particle not active yet'
00108 else
00109 WRITE(OutUnit,*) locs((j-1)*nDims+1), ' ', locs((j-1)*nDims+2)
00110 if (nDims == 3) then
00111 WRITE(OutUnit,*) ' ', locs((j-1)*nDims+3)
00112 endif
00113 WRITE(OutUnit,*) ''
00114 endif
00115 enddo
00116 endif
00117 enddo
00118 endif
00119 if (allocated(locs)) deallocate (locs)
00120 endif
00121
00122
00123 allocate(locs(nTimes*nDims))
00124 do iPath=1, nPaths
00125
00126 CALL XF_READ_PATH_LOCS_FOR_PART(xGroupId, iPath, &
00127 1, nTimes, locs, nStatus)
00128 if (nStatus >= 0) then
00129
00130 WRITE(OutUnit,*) 'Time X Y'
00131 if (nDims == 3) then
00132 WRITE(OutUnit,*) ' Z'
00133 endif
00134 WRITE(OutUnit, *) ''
00135 do j=1, nTimes
00136 if (locs((j-1)*nDims+1) .NE. NullVal) then
00137 WRITE(OutUnit,*) times(j), ' ', locs((j-1)*nDims + 1), ' ', &
00138 locs((j-1)*nDims+2)
00139 if (nDims == 3) then
00140 WRITE(OutUnit,*) ' ', locs((j-1)*nDims+3)
00141 endif
00142 WRITE(OutUnit,*) ''
00143 endif
00144 enddo
00145 endif
00146 enddo
00147 if (allocated(locs)) deallocate(locs)
00148 endif
00149
00150
00151 allocate(locs(nTimes*nDims*2))
00152 PathIndices(1) = 1
00153 PathIndices(2) = nPaths
00154 CALL XF_READ_PATH_LOCS_FOR_PARTS(xGroupId, 2, &
00155 PathIndices, 1, nTimes, locs, nStatus)
00156 if (nStatus >= 0) then
00157
00158 if (nDims == 3) then
00159 WRITE(OutUnit,*) 'Timestep X1 Y1 Z1 Xn Yn Zn'
00160 else
00161 WRITE(OutUnit,*) 'Timestep X1 Y1 Xn Yn'
00162 endif
00163 do j=1, nTimes
00164 if (nDims == 3) then
00165 WRITE(OutUnit,*) times(j), ' ', locs((j-1)*2*nDims+1), ' ', &
00166 locs((j-1)*2*nDims+2),' ', locs((j-1)*2*nDims+3),' ', &
00167 locs((j-1)*2*nDims+4), locs((j-1)*2*nDims+5), ' ',locs((j-1)*2*nDims+6)
00168 else
00169 WRITE(OutUnit,*) times(j),' ', locs((j-1)*2*nDims + 1), ' ', &
00170 locs((j-1)*2*nDims+2), ' ',locs((j-1)*2*nDims+3)
00171 endif
00172 enddo
00173 else
00174 WRITE(*,*) 'Error reading path locations for multiple particles'
00175 endif
00176 endif
00177 if (allocated(locs)) deallocate(locs)
00178 if (allocated(times)) deallocate(times)
00179 CALL XF_CLOSE_GROUP(xGroupId, nStatus)
00180 if (nStatus < 0) then
00181 WRITE(*)'Error reading geometric paths..'
00182 endif
00183 endif
00184 endif
00185 enddo
00186
00187 if (allocated(Paths)) deallocate(Paths)
00188
00189 close(OutUnit)
00190 CALL XF_CLOSE_FILE(xFileId, nStatus)
00191 error = nStatus;
00192 return
00193
00194 END SUBROUTINE
00195
00196
00197 SUBROUTINE TM_WRITE_TEST_PATHS(Filename, Compression, error)
00198 CHARACTER(LEN=*), INTENT(IN) :: Filename
00199 INTEGER, INTENT(IN) :: Compression
00200 INTEGER, INTENT(OUT) :: error
00201 INTEGER nPaths
00202 REAL(DOUBLE), DIMENSION(6) :: pLocs
00203 REAL, DIMENSION(2) :: pSpeeds
00204 REAL(DOUBLE) NullVal
00205
00206 REAL NullValSinglePrec
00207 INTEGER xFileId, xPathGroupId, xSpeedId, xPropGroupId
00208 INTEGER status
00209 REAL(DOUBLE) Timeval
00210
00211 nPaths = 0
00212 NullVal = -99999.9d0
00213 NullValSinglePrec = -99999.9
00214
00215
00216 call XF_CREATE_FILE(Filename, .TRUE., xFileId, status)
00217 if (status < 0) then
00218 error = -1
00219 return
00220 endif
00221
00222
00223 call XF_CREATE_GEOMETRIC_PATH_GROUP(xFileId, "particles", &
00224 'abcdefglasdfjoaieur', Compression, xPathGroupId, NullVal, status)
00225 if (status < 0) then
00226 error = -1
00227 return
00228 endif
00229
00230
00231 call XF_CREATE_SCALAR_DSET_EXTNDBL(xPathGroupId, 'Vmag', 'm/s', &
00232 TS_SECONDS, NullValSinglePrec, Compression, xSpeedId, status)
00233 if (status < 0) then
00234 error = -1
00235 return
00236 endif
00237
00238 call XF_CREATE_PROPERTY_GROUP(xSpeedId, xPropGroupId, status)
00239 if (status < 0) then
00240 call XF_CLOSE_GROUP(xSpeedId, status)
00241 error = -1
00242 return
00243 endif
00244 call XF_WRITE_PROPERTY_FLOAT(xPropGroupId, PROP_NULL_VALUE, 1, &
00245 NullValSinglePrec, -1, status)
00246 call XF_CLOSE_GROUP(xPropGroupId, status)
00247
00248
00249
00250 nPaths = 1
00251 pLocs(1) = 1.0
00252 pLocs(2) = 2.0
00253 pLocs(3) = 3.0
00254
00255
00256 Timeval = 0.0
00257 call XF_WRITE_PARTICLE_TIMESTEP(xPathGroupId, 3, Timeval, nPaths, pLocs, status)
00258 if (status < 0) then
00259 error = -1
00260 return
00261 endif
00262
00263 pSpeeds(1) = 1.1
00264 Timeval = 0.0
00265 call XF_WRITE_SCALAR_TIMESTEP(xSpeedId, Timeval, 1, pSpeeds, status)
00266 if (status < 0) then
00267 error = -1
00268 return
00269 endif
00270
00271
00272
00273 pLocs(1) = 4.0
00274 pLocs(2) = 5.0
00275 pLocs(3) = 6.0
00276
00277
00278 Timeval = 1.0
00279 call XF_WRITE_PARTICLE_TIMESTEP(xPathGroupId, 3, Timeval, nPaths, pLocs, status)
00280 if (status < 0) then
00281 error = -1
00282 return
00283 endif
00284
00285
00286 pSpeeds(1) = 1.2
00287 call XF_WRITE_SCALAR_TIMESTEP(xSpeedId, Timeval, 1, pSpeeds, status)
00288 if (status < 0) then
00289 error = -1
00290 return
00291 endif
00292
00293
00294
00295 nPaths = 2
00296 pLocs(1) = 7.0
00297 pLocs(2) = 8.0
00298 pLocs(3) = 9.0
00299 pLocs(4) = -1.0
00300 pLocs(5) = -2.0
00301 pLocs(6) = -3.0
00302
00303
00304 Timeval = 2.0
00305 call XF_WRITE_PARTICLE_TIMESTEP(xPathGroupId, 3, Timeval, nPaths, pLocs, status)
00306 if (status < 0) then
00307 error = -1
00308 return
00309 endif
00310
00311
00312 call XF_EXTEND_SCALAR_DATASET(xSpeedId, 2, status)
00313 if (status < 0) then
00314 error = -1
00315 return
00316 endif
00317
00318
00319 pSpeeds(1) = 1.3
00320 pSpeeds(2) = 2.1
00321 call XF_WRITE_SCALAR_TIMESTEP(xSpeedId, Timeval, 2, pSpeeds, status)
00322 if (status < 0) then
00323 error = -1
00324 return
00325 endif
00326
00327
00328
00329 pLocs(1) = 7.0
00330 pLocs(2) = 8.0
00331 pLocs(3) = 9.0
00332 pLocs(4) = -4.0
00333 pLocs(5) = -5.0
00334 pLocs(6) = -6.0
00335
00336
00337 Timeval = 3.0
00338 call XF_WRITE_PARTICLE_TIMESTEP(xPathGroupId, 3, Timeval, nPaths, pLocs, status)
00339 if (status < 0) then
00340 error = -1
00341 return
00342 endif
00343
00344
00345 pSpeeds(1) = NullVal
00346 pSpeeds(2) = 2.2
00347 call XF_WRITE_SCALAR_TIMESTEP(xSpeedId, Timeval, 2, pSpeeds, status)
00348 if (status < 0) then
00349 error = -1
00350 return
00351 endif
00352
00353
00354 call XF_CLOSE_GROUP(xSpeedId, status)
00355 call XF_CLOSE_GROUP(xPathGroupId, status)
00356 call XF_CLOSE_FILE(xFileId, status)
00357
00358 error = 1
00359 return
00360 END SUBROUTINE
00361
00362 END MODULE TestGeomPaths
TestGeomPaths.f90 tests geometry paths
00001 MODULE TestGrid
00002
00003 USE ErrorDefinitions
00004 USE XmdfDefs
00005 USE Xmdf
00006
00007 CHARACTER(LEN=*),PARAMETER :: GRID_CART2D_GROUP_NAME = 'Grid Cart2D Group'
00008 CHARACTER(LEN=*),PARAMETER :: GRID_CURV2D_GROUP_NAME = 'Grid Curv2D Group'
00009 CHARACTER(LEN=*),PARAMETER :: GRID_CART3D_GROUP_NAME = 'Grid Cart3D Group'
00010
00011 CONTAINS
00012
00013
00014
00015
00016
00017
00018
00019 SUBROUTINE TG_READ_GRID(a_Id, a_Outfile, error)
00020 INTEGER, INTENT(IN) :: a_Id
00021 INTEGER, INTENT(IN) :: a_Outfile
00022 INTEGER, INTENT(OUT) :: error
00023 INTEGER nGridType, nExtrudeType, nDims, nCellsI, nCellsJ
00024 INTEGER nCellsK, nLayers, nOrientation, nValsI, nValsJ
00025 INTEGER nValsK, nExtrudeVals, nCompOrigin, nUDir
00026 CHARACTER(265) strGridType, strExtrudeType
00027 LOGICAL*2 bDefined
00028 REAL(DOUBLE) dOrigin(3), dBearing, dDip, dRoll
00029 REAL(DOUBLE), ALLOCATABLE :: dExtrudeVals(:), dCoordI(:), dCoordJ(:)
00030 REAL(DOUBLE), ALLOCATABLE :: dCoordK(:)
00031 INTEGER i
00032
00033 nGridType = 0
00034 nExtrudeType = 0
00035 nDims = 0
00036 nCellsI = 0
00037 nCellsJ = 0
00038 nCellsK = 0
00039 nLayers = 0
00040 nOrientation = 0
00041 nValsI = 0
00042 nValsJ = 0
00043 nValsK = 0
00044 nExtrudeVals = 0
00045 nCompOrigin = 1
00046 nUDir = 1
00047 bDefined = .FALSE.
00048 dBearing = 0.0
00049 dDip = 0.0
00050 dRoll =0.0
00051 i = 0
00052 error = 1
00053
00054
00055 call XF_GET_GRID_TYPE(a_Id, nGridType, error)
00056 if (error < 0) then
00057 return
00058 endif
00059 SELECT CASE (nGridType)
00060 CASE (GRID_TYPE_CARTESIAN)
00061 strGridType = 'Cartesian'
00062 CASE (GRID_TYPE_CURVILINEAR)
00063 strGridType = 'Curvilinear'
00064 CASE (GRID_TYPE_CARTESIAN_EXTRUDED)
00065 strGridType = 'Cartesian extruded'
00066 CASE (GRID_TYPE_CURVILINEAR_EXTRUDED)
00067 strGridType = 'Curvilinear extruded'
00068 CASE DEFAULT
00069 WRITE(*,*) 'Invalid grid type'
00070 error = -1
00071 END SELECT
00072 WRITE(a_Outfile,*) 'The grid type is: ', strGridType(1:LEN_TRIM(strGridType))
00073
00074
00075 call XF_GET_NUMBER_OF_DIMENSIONS(a_Id, nDims, error)
00076 if (error .LT. 0) then
00077 return
00078 endif
00079 if (nDims == 2) then
00080 WRITE(a_Outfile,*) 'The grid is two-dimensional'
00081 elseif (nDims == 3) then
00082 WRITE(a_Outfile,*) 'The grid is three-dimensional'
00083 else
00084 WRITE(*,*) 'The grid dimensions are invalid'
00085 error = -1
00086 endif
00087
00088
00089 if (nGridType .EQ. GRID_TYPE_CARTESIAN_EXTRUDED .OR. &
00090 nGridType .EQ. GRID_TYPE_CURVILINEAR_EXTRUDED) then
00091 call XF_GET_EXTRUSION_TYPE(a_Id, nExtrudeType, error)
00092 if (error < 0) then
00093 return
00094 endif
00095 SELECT CASE (nExtrudeType)
00096 case (EXTRUDE_SIGMA)
00097 strExtrudeType = 'Sigma stretch'
00098 case (EXTRUDE_CARTESIAN)
00099 strExtrudeType = 'Cartesian'
00100 case (EXTRUDE_CURV_AT_CORNERS)
00101 strExtrudeType = 'Curvilinear at Corners'
00102 case (EXTRUDE_CURV_AT_CELLS)
00103 strExtrudeType = 'Curvilinear at Cells'
00104 END SELECT
00105 WRITE(a_Outfile,*) 'The grid is extruding using: ', &
00106 strExtrudeType(1:LEN_TRIM(strExtrudeType))
00107 endif
00108
00109
00110 call XF_ORIGIN_DEFINED(a_Id, bDefined, error)
00111 if (error < 0) then
00112 return
00113 endif
00114 if (bDefined) then
00115 call XF_GET_ORIGIN(a_Id, dOrigin(1), dOrigin(2), dOrigin(3), error)
00116 if (error < 0) then
00117 return
00118 endif
00119 WRITE(a_Outfile,*) 'The grid origin is ', dOrigin(1), ' ',&
00120 dOrigin(2), ' ', dOrigin(3)
00121 endif
00122
00123
00124 call XF_GET_ORIENTATION(a_Id, nOrientation, error)
00125 if (error < 0) then
00126 return
00127 endif
00128 if (nOrientation == ORIENTATION_RIGHT_HAND) then
00129 WRITE(a_Outfile,*) 'The grid has a right hand orientation'
00130 elseif (nOrientation == ORIENTATION_LEFT_HAND) then
00131 WRITE(a_Outfile,*) 'The grid has a left hand orientation'
00132 else
00133 WRITE(*,*) 'Invalid grid orientation';
00134 error = -1
00135 return
00136 endif
00137
00138
00139 call XF_BEARING_DEFINED(a_Id, bDefined, error)
00140 if (error < 0) then
00141 return
00142 endif
00143 if (bDefined) then
00144 call XF_GET_BEARING(a_Id, dBearing, error)
00145 if (error < 0) then
00146 return
00147 endif
00148 WRITE(a_Outfile,*) 'The grid bearing is ', dBearing
00149 endif
00150
00151
00152 call XF_DIP_DEFINED(a_Id, bDefined, error)
00153 if (error < 0) then
00154 return
00155 endif
00156 if (bDefined) then
00157 call XF_GET_DIP(a_Id, dDip, error)
00158 if (error < 0) then
00159 return
00160 endif
00161 WRITE(a_Outfile,*) 'The grid Dip is ', dDip
00162 endif
00163
00164 if (nDims == 3) then
00165
00166 call XF_ROLL_DEFINED(a_Id, bDefined, error)
00167 if (error < 0) then
00168 return
00169 endif
00170 if (bDefined) then
00171 call XF_GET_ROLL(a_Id, dRoll, error)
00172 if (error < 0) then
00173 return
00174 endif
00175 WRITE(a_Outfile,*) 'The grid Roll is ', dRoll
00176 endif
00177 endif
00178
00179
00180 call XF_COMPUTATIONAL_ORIGIN_DEFINED(a_Id, bDefined, error)
00181 if (error < 0) then
00182 return
00183 endif
00184 if (bDefined) then
00185 call XF_GET_COMPUTATIONAL_ORIGIN(a_Id, nCompOrigin, error)
00186 if (error < 0) then
00187 return
00188 endif
00189 WRITE(a_Outfile,*) 'The grid Computational Origin is ', nCompOrigin
00190 else
00191 WRITE(a_Outfile,*) 'The grid Computational Origin is not defined';
00192 endif
00193
00194
00195
00196 call XF_GET_U_DIRECTION_DEFINED(a_Id, bDefined, error)
00197 if (error < 0) then
00198 return
00199 endif
00200 if (bDefined) then
00201 call XF_GET_U_DIRECTION(a_Id, nUDir, error)
00202 if (error < 0) then
00203 return
00204 endif
00205 WRITE(a_Outfile,*) 'The grid U Direction is ', nUDir
00206 else
00207 WRITE(a_Outfile,*) 'The grid U Direction is not defined'
00208 endif
00209
00210
00211 call XF_GET_NUMBER_CELLS_IN_I(a_Id, nCellsI, error)
00212 if (error >= 0) then
00213 call XF_GET_NUMBER_CELLS_IN_J(a_Id, nCellsJ, error)
00214 if ((error >= 0) .AND. (nDims == 3)) then
00215 call XF_GET_NUMBER_CELLS_IN_K(a_Id, nCellsK, error)
00216 endif
00217 endif
00218 if (error < 0) then
00219 return
00220 endif
00221 WRITE(a_Outfile,*) 'Number of cells in I ', nCellsI
00222 WRITE(a_Outfile,*) 'Number of cells in J ', nCellsJ
00223 if (nDims == 3) then
00224 WRITE(a_Outfile,*) 'Number of cells in K ', nCellsK
00225 endif
00226
00227
00228 if (nGridType == GRID_TYPE_CARTESIAN .OR. &
00229 nGridType == GRID_TYPE_CARTESIAN_EXTRUDED) then
00230 nValsI = nCellsI
00231 nValsJ = nCellsJ
00232 if (nDims == 3) then
00233 nValsK = nCellsK
00234 endif
00235 elseif (nGridType == GRID_TYPE_CURVILINEAR .OR. &
00236 nGridType == GRID_TYPE_CURVILINEAR_EXTRUDED) then
00237 if (nDims == 3) then
00238
00239 nValsK = (nCellsI + 1) * (nCellsJ + 1) * (nCellsK + 1)
00240 nValsJ = nValsK
00241 nValsI = nValsJ
00242 else
00243
00244 nValsJ = (nCellsI + 1) * (nCellsJ + 1)
00245 nValsI = nValsJ
00246 endif
00247 else
00248 WRITE(*,*) 'Invalid grid type'
00249 error = -1
00250 return
00251 endif
00252
00253 ALLOCATE(dCoordI(nValsI))
00254 ALLOCATE(dCoordJ(nValsJ))
00255 if (nDims == 3) then
00256 ALLOCATE(dCoordK(nValsK))
00257 endif
00258
00259 call XF_GET_GRID_COORDS_I(a_Id, nValsI, dCoordI, error)
00260 if (error >= 0) then
00261 call XF_GET_GRID_COORDS_J(a_Id, nValsJ, dCoordJ, error)
00262 if ((error >= 0) .AND. (nDims == 3)) then
00263 call XF_GET_GRID_COORDS_K(a_Id, nValsK, dCoordK, error)
00264 endif
00265 endif
00266 if (error < 0) then
00267 WRITE(*,*) 'Error reading coordinates'
00268 error = -1
00269 return
00270 endif
00271
00272 WRITE(a_Outfile,*) 'The Coordinates in direction I:'
00273 do i = 1, nValsI
00274 if (mod(i,5) == 0) then
00275 WRITE(a_Outfile,*) ''
00276 endif
00277 WRITE(a_Outfile,*) dCoordI(i)
00278 enddo
00279 WRITE(a_Outfile,*) ''
00280
00281 WRITE(a_Outfile,*) 'The Coordinates in direction J:'
00282 do i = 1, nValsJ
00283 if (mod(i,5) == 0) then
00284 WRITE(a_Outfile,*) ''
00285 endif
00286 WRITE(a_Outfile,*) dCoordJ(i)
00287 enddo
00288 WRITE(a_Outfile,*) ''
00289
00290 if (nDims == 3) then
00291 WRITE(a_Outfile,*) 'The Coordinates in direction K:'
00292 do i = 1, nValsK
00293 if (mod(i,5) == 0) then
00294 WRITE(a_Outfile,*) ''
00295 endif
00296 WRITE(a_Outfile,*) dCoordK(i)
00297 enddo
00298 endif
00299 WRITE(a_Outfile,*) ''
00300
00301 if (ALLOCATED(dCoordI)) DEALLOCATE(dCoordI)
00302 if (ALLOCATED(dCoordJ)) DEALLOCATE(dCoordJ)
00303 if (ALLOCATED(dCoordK)) DEALLOCATE(dCoordK)
00304
00305
00306 if (nGridType .EQ. GRID_TYPE_CARTESIAN_EXTRUDED .OR. &
00307 nGridType .EQ. GRID_TYPE_CURVILINEAR_EXTRUDED) then
00308 call XF_GET_EXTRUDE_NUM_LAYERS(a_Id, nLayers, error)
00309 if (error < 0) then
00310 return
00311 endif
00312
00313 SELECT CASE(nExtrudeType)
00314 case (EXTRUDE_SIGMA)
00315 nExtrudeVals = nLayers
00316 case (EXTRUDE_CURV_AT_CORNERS)
00317 nExtrudeVals = (nCellsI + 1) * (nCellsJ + 1) * nLayers
00318 case (EXTRUDE_CURV_AT_CELLS)
00319 nExtrudeVals = nCellsI * nCellsJ * nLayers
00320 END SELECT
00321
00322 ALLOCATE(dExtrudeVals(nExtrudeVals))
00323
00324 call XF_GET_EXTRUDE_VALUES(a_Id, nExtrudeVals, dExtrudeVals, error)
00325 if (error < 0) then
00326 return
00327 endif
00328
00329 WRITE(*,*) 'The extrude values are:'
00330 do i = 1, nExtrudeVals
00331 if (mod(i,5) == 0) then
00332 WRITE(a_Outfile,*) ''
00333 endif
00334 WRITE(a_Outfile,*) dExtrudeVals(i)
00335 enddo
00336 if (ALLOCATED(dExtrudeVals)) DEALLOCATE(dExtrudeVals)
00337 endif
00338
00339 return
00340
00341 END SUBROUTINE TG_READ_GRID
00342
00343
00344
00345
00346
00347
00348
00349
00350 SUBROUTINE TG_WRITE_TEST_GRID_CART_2D(Filename, error)
00351 CHARACTER(LEN=*), INTENT(IN) :: Filename
00352 INTEGER, INTENT(OUT) :: error
00353 INTEGER nDimensions
00354 INTEGER nCellsI, nCellsJ
00355 INTEGER nGridType
00356 INTEGER nCompOrigin, nUDir
00357 REAL(DOUBLE) dOriginX, dOriginY, dOriginZ
00358 INTEGER nOrientation
00359 REAL(DOUBLE) dBearing
00360 REAL(DOUBLE) PlanesI(5), PlanesJ(5)
00361 INTEGER i, j, iSpcZone
00362 INTEGER xFileId, xGridId, xCoordId
00363 INTEGER status
00364 INTEGER tmpOut1, tmpOut2
00365
00366 nDimensions = 2
00367 nCellsI = 5
00368 nCellsJ = 5
00369 nGridType = GRID_TYPE_CARTESIAN
00370 nCompOrigin = 4
00371 nUDir = -2
00372 dOriginX = 10.0
00373 dOriginY = 10.0
00374 dOriginZ = 0.0
00375 nOrientation = ORIENTATION_RIGHT_HAND
00376 dBearing = 45.0
00377 xFileId = NONE
00378 xGridId = NONE
00379
00380
00381 do i = 1, nCellsI
00382 PlanesI(i) = i*30.0
00383 enddo
00384 do j = 1, nCellsJ
00385 PlanesJ(j) = j*30.0
00386 enddo
00387
00388
00389 call XF_CREATE_FILE(Filename, .TRUE., xFileId, status)
00390 if (status < 0) then
00391 error = -1
00392 return
00393 endif
00394
00395
00396 call XF_CREATE_GROUP_FOR_GRID(xFileId, GRID_CART2D_GROUP_NAME, xGridId, status)
00397 if (status < 0) then
00398 call XF_CLOSE_FILE(xFileId, error)
00399 error = -1
00400 return
00401 endif
00402
00403
00404 call XF_SET_GRID_TYPE(xGridId, nGridType, tmpOut1)
00405 call XF_SET_NUMBER_OF_DIMENSIONS(xGridId, nDimensions, tmpOut2)
00406
00407 if ((tmpOut1 < 0) .OR. (tmpOut2 < 0)) then
00408 call XF_CLOSE_GROUP(xGridId, error)
00409 call XF_CLOSE_FILE(xFileId, error)
00410 error = -1
00411 return
00412 endif
00413
00414
00415 call XF_SET_ORIGIN(xGridId, dOriginX, dOriginY, dOriginZ, tmpOut1)
00416 call XF_SET_ORIENTATION(xGridId, nOrientation, tmpOut2)
00417
00418 if ((tmpOut1 < 0) .OR. (tmpOut2 .LT. 0)) then
00419 call XF_CLOSE_GROUP(xGridId, error)
00420 call XF_CLOSE_FILE(xFileId, error)
00421 error = -1
00422 return
00423 endif
00424
00425
00426 call XF_SET_BEARING(xGridId, dBearing, tmpOut1)
00427 if (tmpOut1 < 0) then
00428 call XF_CLOSE_GROUP(xGridId, error)
00429 call XF_CLOSE_FILE(xFileId, error)
00430 error = -1
00431 return
00432 endif
00433
00434
00435 call XF_SET_COMPUTATIONAL_ORIGIN(xGridId, nCompOrigin, tmpOut1)
00436 if (tmpOut1 < 0) then
00437 call XF_CLOSE_GROUP(xGridId, error)
00438 call XF_CLOSE_FILE(xFileId, error)
00439 error = -1
00440 return
00441 endif
00442
00443
00444 call XF_SET_U_DIRECTION(xGridId, nUDir, tmpOut1)
00445 if (tmpOut1 < 0) then
00446 call XF_CLOSE_GROUP(xGridId, error)
00447 call XF_CLOSE_FILE(xFileId, error)
00448 error = -1
00449 return
00450 endif
00451
00452
00453
00454 call XF_SET_NUMBER_CELLS_IN_I(xGridId, nCellsI, tmpOut1)
00455 call XF_SET_NUMBER_CELLS_IN_J(xGridId, nCellsJ, tmpOut2)
00456 if ((tmpOut1 < 0) .OR. (tmpOut2 < 0)) then
00457 call XF_CLOSE_GROUP(xGridId, error)
00458 call XF_CLOSE_FILE(xFileId, error)
00459 error = -1
00460 return
00461 endif
00462
00463
00464 call XF_SET_GRID_COORDS_I(xGridId, nCellsI, PlanesI, tmpOut1)
00465 call XF_SET_GRID_COORDS_J(xGridId, nCellsJ, PlanesJ, tmpOut2)
00466 if ((tmpOut1 < 0) .OR. (tmpOut2 < 0)) then
00467 call XF_CLOSE_GROUP(xGridId, error)
00468 call XF_CLOSE_FILE(xFileId, error)
00469 error = -1
00470 return
00471 endif
00472
00473
00474
00475 call XF_CREATE_COORDINATE_GROUP(xFileId, xCoordId, status)
00476 if (status < 0) then
00477 call XF_CLOSE_GROUP(xGridId, error)
00478 call XF_CLOSE_FILE(xFileId, error)
00479 error = status
00480 return
00481 endif
00482
00483 iSpcZone = 3601
00484
00485 call XF_SET_HORIZ_DATUM(xCoordId, HORIZ_DATUM_STATE_PLANE_NAD27, error)
00486 call XF_SET_HORIZ_UNITS(xCoordId, COORD_UNITS_US_FEET, error)
00487
00488 call XF_SET_VERT_DATUM(xCoordId, VERT_DATUM_LOCAL, error)
00489 call XF_SET_VERT_UNITS(xCoordId, COORD_UNITS_US_FEET, error)
00490
00491
00492 call XF_SET_SPC_ZONE(xCoordId, iSpcZone, error)
00493
00494 call XF_CLOSE_GROUP(xCoordId, error)
00495 xCoordId = 0
00496
00497
00498 call XF_CLOSE_GROUP(xGridId, error)
00499 call XF_CLOSE_FILE(xFileId, error)
00500 return
00501
00502 END SUBROUTINE TG_WRITE_TEST_GRID_CART_2D
00503
00504
00505
00506
00507
00508
00509
00510
00511 SUBROUTINE TG_WRITE_TEST_GRID_CURV_2D(Filename, Compression, error)
00512 CHARACTER(LEN=*), INTENT(IN) :: Filename
00513 INTEGER, INTENT(IN) :: Compression
00514 INTEGER, INTENT(OUT) :: error
00515 INTEGER nDimensions
00516 INTEGER nCompOrigin, nUDir
00517 INTEGER nCellsI, nCellsJ
00518 INTEGER nCells
00519 INTEGER nCorners
00520 INTEGER nGridType
00521 REAL(DOUBLE) xVals(16), yVals(16)
00522 INTEGER i
00523 INTEGER xFileId, xGridId, xPropId, xDatasetsId, xScalarId
00524 INTEGER xCoordId
00525 REAL(DOUBLE) dNullValue(1)
00526 INTEGER nOrientation
00527 REAL fDsetCellVals(6)
00528 REAL fDsetCornerVals(12)
00529 REAL(DOUBLE) tempdouble, dCppLat, dCppLon
00530 INTEGER*1 bDsetCellActive(6)
00531 INTEGER*1 bDsetCornerActive(12)
00532 INTEGER status
00533 INTEGER tmpOut1, tmpOut2
00534
00535 nDimensions = 2
00536 nCompOrigin = 1
00537 nUDir = 1;
00538 nCellsI = 2
00539 nCellsJ = 3
00540 nCells = nCellsI*nCellsJ
00541 nCorners = (nCellsI + 1)*(nCellsJ + 1)
00542 nGridType = GRID_TYPE_CURVILINEAR
00543 xFileId = NONE
00544 xGridId = NONE
00545 xPropId = NONE
00546 xDatasetsId = NONE
00547 xScalarId = NONE
00548 dNullValue(1) = -999.0
00549 nOrientation = ORIENTATION_RIGHT_HAND
00550
00551
00552
00553
00554
00555 xVals(1) = 0.0
00556 xVals(2) = 7.5
00557 xVals(3) = 15.0
00558 xVals(4) = 2.5
00559 xVals(5) = 10.0
00560 xVals(6) = 17.5
00561 xVals(7) = 3.5
00562 xVals(8) = 11.0
00563 xVals(9) = 18.5
00564 xVals(10) = 0.0
00565 xVals(11) = 7.5
00566 xVals(12) = dNullValue(1)
00567
00568
00569 yVals(1) = 0.0
00570 yVals(2) = 0.0
00571 yVals(3) = 0.0
00572 yVals(4) = 10.0
00573 yVals(5) = 10.0
00574 yVals(6) = 10.0
00575 yVals(7) = 20.0
00576 yVals(8) = 20.0
00577 yVals(9) = 20.0
00578 yVals(10) = 30.0
00579 yVals(11) = 30.0
00580 yVals(12) = dNullValue(1)
00581
00582
00583 fDsetCellVals(1) = 2.1
00584 fDsetCellVals(2) = 2.0
00585 fDsetCellVals(3) = 1.9
00586 fDsetCellVals(4) = 2.3
00587 fDsetCellVals(5) = 2.5
00588 fDsetCellVals(6) = dNullValue(1)
00589
00590
00591 do i = 1, nCells
00592 bDsetCellActive(i) = 1
00593 enddo
00594 bDsetCellActive(nCells) = 0
00595
00596
00597 fDsetCornerVals(1) = 1.0
00598 fDsetCornerVals(2) = 0.8
00599 fDsetCornerVals(3) = 1.2
00600 fDsetCornerVals(4) = 1.4
00601 fDsetCornerVals(5) = 1.8
00602 fDsetCornerVals(6) = 2.2
00603 fDsetCornerVals(7) = 1.8
00604 fDsetCornerVals(8) = 1.4
00605 fDsetCornerVals(9) = 2.0
00606 fDsetCornerVals(10) = 1.0
00607 fDsetCornerVals(11) = 1.8
00608 fDsetCornerVals(12) = 2.2
00609
00610
00611 do i = 1, nCorners
00612 bDsetCornerActive(i) = 1
00613 enddo
00614 bDsetCornerActive(nCorners) = 0
00615
00616
00617 call XF_CREATE_FILE(Filename, .TRUE., xFileId, status)
00618 if (status < 0) then
00619 error = -1
00620 return
00621 endif
00622
00623
00624 call XF_CREATE_GROUP_FOR_GRID(xFileId, GRID_CURV2D_GROUP_NAME, xGridId, status)
00625 if (status < 0) then
00626 call XF_CLOSE_FILE(xFileId, error)
00627 error = -1
00628 return
00629 endif
00630
00631
00632 call XF_SET_GRID_TYPE(xGridId, nGridType, tmpOut1)
00633 call XF_SET_NUMBER_OF_DIMENSIONS(xGridId, nDimensions, tmpOut2)
00634 if ((tmpOut1 < 0) .OR. (tmpOut2 < 0)) then
00635 call XF_CLOSE_GROUP(xGridId, error)
00636 call XF_CLOSE_FILE(xFileId, error)
00637 error = -1
00638 return
00639 endif
00640
00641
00642 call XF_SET_ORIENTATION(xGridId, nOrientation, tmpOut1)
00643 if (tmpOut1 < 0 ) then
00644 call XF_CLOSE_GROUP(xGridId, error)
00645 call XF_CLOSE_FILE(xFileId, error)
00646 error = -1
00647 return
00648 endif
00649
00650
00651 call XF_SET_COMPUTATIONAL_ORIGIN(xGridId, nCompOrigin, tmpOut1)
00652 if (tmpOut1 < 0 ) then
00653 call XF_CLOSE_GROUP(xGridId, error)
00654 call XF_CLOSE_FILE(xFileId, error)
00655 error = -1
00656 return
00657 endif
00658
00659
00660 call XF_SET_U_DIRECTION(xGridId, nUDir, tmpOut1)
00661 if (tmpOut1 < 0 ) then
00662 call XF_CLOSE_GROUP(xGridId, error)
00663 call XF_CLOSE_FILE(xFileId, error)
00664 error = -1
00665 return
00666 endif
00667
00668
00669
00670 call XF_SET_NUMBER_CELLS_IN_I(xGridId, nCellsI, tmpOut1)
00671 call XF_SET_NUMBER_CELLS_IN_J(xGridId, nCellsJ, tmpOut2)
00672 if ((tmpOut1 < 0) .OR. (tmpOut2 < 0)) then
00673 call XF_CLOSE_GROUP(xGridId, error)
00674 call XF_CLOSE_FILE(xFileId, error)
00675 error = -1
00676 return
00677 endif
00678
00679
00680
00681 call XF_CREATE_GRID_PROPERTY_GROUP(xGridId, xPropId, tmpOut1)
00682 if (xPropId < 0) then
00683 call XF_CLOSE_GROUP(xGridId, error)
00684 call XF_CLOSE_FILE(xFileId, error)
00685 error = -1
00686 return
00687 endif
00688
00689 call XF_WRITE_PROPERTY_DOUBLE(xPropId, PROP_NULL_VALUE, 1, dNullValue, NONE, &
00690 tmpOut1)
00691 if (tmpOut1 < 0) then
00692 call XF_CLOSE_GROUP(xPropId, error)
00693 call XF_CLOSE_GROUP(xGridId, error)
00694 call XF_CLOSE_FILE(xFileId, error)
00695 error = -1
00696 return
00697 endif
00698 call XF_CLOSE_GROUP(xPropId, error)
00699
00700
00701 call XF_SET_GRID_COORDS_I(xGridId, nCorners, xVals, tmpOut1)
00702 call XF_SET_GRID_COORDS_J(xGridId, nCorners, yVals, tmpOut2)
00703 if ((tmpOut1 < 0) .OR. (tmpOut2 < 0)) then
00704 call XF_CLOSE_GROUP(xGridId, error)
00705 call XF_CLOSE_FILE(xFileId, error)
00706 error = -1
00707 return
00708 endif
00709
00710
00711 call XF_CREATE_GENERIC_GROUP(xGridId, 'Datasets', xDatasetsId, tmpOut1)
00712 if (tmpOut1 < 0) then
00713 call XF_CLOSE_GROUP(xGridId, error)
00714 call XF_CLOSE_FILE(xFileId, error)
00715 error = -1
00716 return
00717 endif
00718
00719
00720 call XF_CREATE_SCALAR_DATASET(xDatasetsId, 'Velocity Mag', 'ft/s', TS_MINUTES, &
00721 Compression, xScalarId, tmpOut1)
00722 if (tmpOut1 < 0) then
00723 call XF_CLOSE_GROUP(xDatasetsId, error)
00724 call XF_CLOSE_GROUP(xGridId, error)
00725 call XF_CLOSE_FILE(xFileId, error)
00726 error = -1
00727 return
00728 endif
00729
00730
00731 call XF_SCALAR_DATA_LOCATION(xScalarId, GRID_LOC_CENTER, tmpOut1)
00732 if (tmpOut1 < 0) then
00733 call XF_CLOSE_GROUP(xScalarId, error)
00734 call XF_CLOSE_GROUP(xDatasetsId, error)
00735 call XF_CLOSE_GROUP(xGridId, error)
00736 call XF_CLOSE_FILE(xFileId, error)
00737 error = -1
00738 return
00739 endif
00740
00741
00742
00743 tempdouble = 0.0
00744 call XF_WRITE_SCALAR_TIMESTEP(xScalarId, tempdouble, nCells, fDsetCellVals, tmpOut1)
00745 call XF_WRITE_ACTIVITY_TIMESTEP(xScalarId, nCells, bDsetCellActive, tmpOut2)
00746 if ((tmpOut1 < 0) .OR. (tmpOut1 < 0)) then
00747 call XF_CLOSE_GROUP(xScalarId, error)
00748 call XF_CLOSE_GROUP(xDatasetsId, error)
00749 call XF_CLOSE_GROUP(xGridId, error)
00750 call XF_CLOSE_FILE(xFileId, error)
00751 error = -1
00752 return
00753 endif
00754
00755
00756 call XF_CLOSE_GROUP(xScalarId, error)
00757
00758
00759 call XF_CREATE_SCALAR_DATASET(xDatasetsId, 'elevation', 'ft', TS_MINUTES, &
00760 Compression, xScalarId, tmpOut1)
00761 if (tmpOut1 < 0) then
00762 call XF_CLOSE_GROUP(xDatasetsId, error)
00763 call XF_CLOSE_GROUP(xGridId, error)
00764 call XF_CLOSE_FILE(xFileId, error)
00765 error = -1
00766 return
00767 endif
00768
00769
00770 call XF_SCALAR_DATA_LOCATION(xScalarId, GRID_LOC_CORNER, tmpOut1)
00771 if (tmpOut1 < 0) then
00772 call XF_CLOSE_GROUP(xScalarId, error)
00773 call XF_CLOSE_GROUP(xDatasetsId, error)
00774 call XF_CLOSE_GROUP(xGridId, error)
00775 call XF_CLOSE_FILE(xFileId, error)
00776 error = -1
00777 return
00778 endif
00779
00780
00781
00782 tempdouble = 0.0
00783 call XF_WRITE_SCALAR_TIMESTEP(xScalarId, tempdouble, nCorners, fDsetCornerVals, tmpOut1)
00784 call XF_WRITE_ACTIVITY_TIMESTEP(xScalarId, nCorners, bDsetCornerActive, tmpOut2)
00785 if ((tmpOut1 < 0) .OR. (tmpOut2 < 0)) then
00786 call XF_CLOSE_GROUP(xScalarId, error)
00787 call XF_CLOSE_GROUP(xDatasetsId, error)
00788 call XF_CLOSE_GROUP(xGridId, error)
00789 call XF_CLOSE_FILE(xFileId, error)
00790 error = -1
00791 return
00792 endif
00793
00794
00795
00796
00797 call XF_CREATE_COORDINATE_GROUP(xFileId, xCoordId, status)
00798 if (status < 0) then
00799 call XF_CLOSE_GROUP(xScalarId, error)
00800 call XF_CLOSE_GROUP(xDatasetsId, error)
00801 call XF_CLOSE_GROUP(xGridId, error)
00802 call XF_CLOSE_FILE(xFileId, error)
00803 error = status
00804 return
00805 endif
00806
00807 dCppLat = 56.0;
00808 dCppLon = 23.0;
00809
00810 call XF_SET_HORIZ_DATUM(xCoordId, HORIZ_DATUM_CPP, error)
00811 call XF_SET_HORIZ_UNITS(xCoordId, COORD_UNITS_METERS, error)
00812
00813 call XF_SET_VERT_DATUM(xCoordId, VERT_DATUM_LOCAL, error)
00814 call XF_SET_VERT_UNITS(xCoordId, COORD_UNITS_METERS, error)
00815
00816
00817 call XF_SET_CPP_LAT(xCoordId, dCppLat, error)
00818 call XF_SET_CPP_LON(xCoordId, dCppLon, error)
00819
00820 call XF_CLOSE_GROUP(xCoordId, error)
00821 xCoordId = 0
00822
00823
00824 call XF_CLOSE_GROUP(xScalarId, error)
00825 call XF_CLOSE_GROUP(xDatasetsId, error)
00826 call XF_CLOSE_GROUP(xGridId, error)
00827 call XF_CLOSE_FILE(xFileId, error)
00828 return
00829
00830 END SUBROUTINE TG_WRITE_TEST_GRID_CURV_2D
00831
00832
00833
00834
00835
00836
00837
00838
00839 SUBROUTINE TG_WRITE_TEST_GRID_CART_3D(Filename, Compression, error)
00840 CHARACTER(LEN=*), INTENT(IN) :: Filename
00841 INTEGER, INTENT(IN) :: Compression
00842 INTEGER, INTENT(OUT) :: error
00843 INTEGER nDimensions
00844 INTEGER nCompOrigin, nUDir
00845 INTEGER nCellsI, nCellsJ, nCellsK
00846 INTEGER nGridType
00847 REAL(DOUBLE) dOriginX, dOriginY, dOriginZ
00848 INTEGER nOrientation
00849 REAL(DOUBLE) dBearing, dDip, dRoll
00850 REAL(DOUBLE) PlanesI(5), PlanesJ(5), PlanesK(3)
00851 INTEGER i, j, status, iSpcZone
00852 INTEGER xFileId, xGridId, xPropId, xCoordId
00853 INTEGER nCells
00854 INTEGER Active(75)
00855 INTEGER tmpOut1, tmpOut2, tmpOut3
00856
00857 nDimensions = 3
00858 nCompOrigin = 8
00859 nUDir = -2
00860 nCellsI = 5
00861 nCellsJ = 5
00862 nCellsK = 3
00863 nGridType = GRID_TYPE_CARTESIAN
00864 dOriginX = 10.0
00865 dOriginY = 10.0
00866 dOriginZ = 0.0
00867 nOrientation = ORIENTATION_RIGHT_HAND
00868 dBearing = 45.0
00869 dDip = 0.0
00870 dRoll = 0.0
00871 xFileId = NONE
00872 xGridId = NONE
00873 xPropId = NONE
00874 nCells = nCellsI * nCellsJ * nCellsK
00875
00876
00877 do i = 1, nCellsI
00878 PlanesI(i) = i*30.0
00879 enddo
00880 do j = 1, nCellsJ
00881 PlanesJ(j) = j*30.0
00882 enddo
00883 do j = 1, nCellsK
00884 PlanesK(j) = j*30.0
00885 enddo
00886
00887
00888
00889 do i = 1, nCells
00890 Active(i) = 1
00891 enddo
00892
00893
00894
00895 Active(1) = 0
00896 Active(4*nCellsJ*nCellsK+4*nCellsK+1) = 0
00897
00898
00899 call XF_CREATE_FILE(Filename, .TRUE., xFileId, tmpOut1)
00900 if (tmpOut1 < 0) then
00901 error = -1
00902 return
00903 endif
00904
00905
00906 call XF_CREATE_GROUP_FOR_GRID(xFileId, GRID_CART3D_GROUP_NAME, xGridId, tmpOut1)
00907 if (tmpOut1 < 0) then
00908 call XF_CLOSE_FILE(xFileId, error)
00909 error = -1
00910 return
00911 endif
00912
00913
00914 call XF_SET_GRID_TYPE(xGridId, nGridType, tmpOut1)
00915 call XF_SET_NUMBER_OF_DIMENSIONS(xGridId, nDimensions, tmpOut2)
00916 if ((tmpOut1 < 0) .OR. (tmpOut2 < 0)) then
00917 call XF_CLOSE_GROUP(xGridId, error)
00918 call XF_CLOSE_FILE(xFileId, error)
00919 error = -1
00920 return
00921 endif
00922
00923
00924 call XF_SET_ORIGIN(xGridId, dOriginX, dOriginY, dOriginZ, tmpOut1)
00925 call XF_SET_ORIENTATION(xGridId, nOrientation, tmpOut2)
00926 if ((tmpOut1 < 0) .OR. (tmpOut2 < 0)) then
00927 call XF_CLOSE_GROUP(xGridId, error)
00928 call XF_CLOSE_FILE(xFileId, error)
00929 error = -1
00930 return
00931 endif
00932
00933
00934 call XF_SET_BEARING(xGridId, dBearing, tmpOut1)
00935 call XF_SET_DIP(xGridId, dDip, tmpOut2)
00936 call XF_SET_ROLL(xGridId, dRoll, tmpOut3)
00937 if ((tmpOut1 < 0) .OR. (tmpOut2 < 0) .OR. (tmpOut3 < 0)) then
00938 call XF_CLOSE_GROUP(xGridId, error)
00939 call XF_CLOSE_FILE(xFileId, error)
00940 error = -1
00941 return
00942 endif
00943
00944
00945 call XF_SET_COMPUTATIONAL_ORIGIN(xGridId, nCompOrigin, tmpOut1)
00946 if (tmpOut1 < 0) then
00947 call XF_CLOSE_GROUP(xGridId, error)
00948 call XF_CLOSE_FILE(xFileId, error)
00949 error = -1
00950 return
00951 endif
00952
00953
00954 call XF_SET_U_DIRECTION(xGridId, nUDir, tmpOut1)
00955 if (tmpOut1 < 0) then
00956 call XF_CLOSE_GROUP(xGridId, error)
00957 call XF_CLOSE_FILE(xFileId, error)
00958 error = -1
00959 return
00960 endif
00961
00962
00963
00964 call XF_SET_NUMBER_CELLS_IN_I(xGridId, nCellsI, tmpOut1)
00965 call XF_SET_NUMBER_CELLS_IN_J(xGridId, nCellsJ, tmpOut2)
00966 call XF_SET_NUMBER_CELLS_IN_K(xGridId, nCellsK, tmpOut3)
00967 if ((tmpOut1 < 0) .OR. (tmpOut2 < 0) .OR. (tmpOut3 < 0)) then
00968 call XF_CLOSE_GROUP(xGridId, error)
00969 call XF_CLOSE_FILE(xFileId, error)
00970 error = -1
00971 return
00972 endif
00973
00974
00975 call XF_SET_GRID_COORDS_I(xGridId, nCellsI, PlanesI, tmpOut1)
00976 call XF_SET_GRID_COORDS_J(xGridId, nCellsJ, PlanesJ, tmpOut2)
00977 call XF_SET_GRID_COORDS_K(xGridId, nCellsK, PlanesK, tmpOut3)
00978
00979 if ((tmpOut1 < 0) .OR. (tmpOut2 < 0) .OR. (tmpOut3 < 0)) then
00980 call XF_CLOSE_GROUP(xGridId, error)
00981 call XF_CLOSE_FILE(xFileId, error)
00982 error = -1
00983 return
00984 endif
00985
00986
00987 call XF_CREATE_GRID_CELL_PROP_GRP(xGridId, xPropId, tmpOut1)
00988 if (xPropId < 0) then
00989 call XF_CLOSE_GROUP(xGridId, error)
00990 call XF_CLOSE_FILE(xFileId, error)
00991 error = -1
00992 return
00993 endif
00994
00995 call XF_WRITE_PROPERTY_INT(xPropId, PROP_ACTIVITY, nCells, Active, &
00996 Compression, tmpOut1)
00997
00998 if (tmpOut1 < 0) then
00999 call XF_CLOSE_GROUP(xPropId, error)
01000 call XF_CLOSE_GROUP(xGridId, error)
01001 call XF_CLOSE_FILE(xFileId, error)
01002 error = -1
01003 return
01004 endif
01005
01006 call XF_CLOSE_GROUP(xPropId, error)
01007
01008
01009
01010 call XF_CREATE_COORDINATE_GROUP(xFileId, xCoordId, status)
01011 if (status < 0) then
01012 call XF_CLOSE_GROUP(xGridId, error)
01013 call XF_CLOSE_FILE(xFileId, error)
01014 error = status
01015 endif
01016
01017 iSpcZone = 3601;
01018
01019 call XF_SET_HORIZ_DATUM(xCoordId, HORIZ_DATUM_STATE_PLANE_NAD27, error)
01020 call XF_SET_HORIZ_UNITS(xCoordId, COORD_UNITS_US_FEET, error)
01021
01022 call XF_SET_VERT_DATUM(xCoordId, VERT_DATUM_LOCAL, error)
01023 call XF_SET_VERT_UNITS(xCoordId, COORD_UNITS_US_FEET, error)
01024
01025
01026 call XF_SET_SPC_ZONE(xCoordId, iSpcZone, error)
01027
01028 call XF_CLOSE_GROUP(xCoordId, error)
01029 xCoordId = 0
01030
01031
01032 call XF_CLOSE_GROUP(xGridId, error)
01033 call XF_CLOSE_FILE(xFileId, error)
01034 return
01035
01036 END SUBROUTINE TG_WRITE_TEST_GRID_CART_3D
01037
01038 END MODULE TestGrid
TestGrid.f90 tests grids
00001 MODULE TestMesh
00002
00003 USE TestDatasets
00004 USE Xmdf
00005 USE ErrorDefinitions
00006 USE XmdfDefs
00007
00008 CHARACTER(LEN=*), PARAMETER :: MESH_A_GROUP_NAME = 'MeshA Group'
00009 CHARACTER(LEN=*), PARAMETER :: MESH_B_GROUP_NAME = 'MeshB Group'
00010
00011
00012 CONTAINS
00013
00014
00015
00016
00017
00018
00019
00020 SUBROUTINE TM_READ_MESH (xGroupId, a_OutFile, error)
00021 INTEGER, INTENT(IN) :: xGroupId
00022 INTEGER, INTENT(IN) :: a_OutFile
00023 INTEGER, INTENT(OUT) :: error
00024 INTEGER nElems, nNodes, nNodesPerElem, nElemType, nNodeId
00025 LOGICAL*2 ElementsOneType
00026 INTEGER status, i, j
00027 INTEGER StrType, UIntType, IntType, DblType, FloatType
00028 INTEGER xPropGroupId
00029 INTEGER, ALLOCATABLE :: ElemTypes(:), NodesInElem(:)
00030 REAL(DOUBLE), ALLOCATABLE :: XNodeLocs(:), YNodeLocs(:), ZNodeLocs(:)
00031
00032
00033 call XF_GET_NUMBER_OF_ELEMENTS (xGroupId, nElems, status)
00034 if (status >= 0) then
00035 call XF_GET_NUMBER_OF_NODES (xGroupId, nNodes, status)
00036 if (status >= 0) then
00037 call XF_GET_MAX_NODES_IN_ELEM (xGroupId, nNodesPerElem, status)
00038 endif
00039 endif
00040
00041 if (status < 0) then
00042 error = -1
00043 return
00044 endif
00045
00046
00047 WRITE(a_OutFile,*) 'Number of Elements: ', nElems
00048
00049
00050 call XF_ARE_ALL_ELEMS_SAME_TYPE (xGroupId, ElementsOneType, status)
00051 if (status < 0) then
00052 error = -1
00053 return
00054 endif
00055
00056 if (ElementsOneType) then
00057 call XF_READ_ELEM_TYPES_SINGLE_VALUE (xGroupId, nElemType, status)
00058 WRITE(a_OutFile,*) 'All elements are type ', nElemType
00059 else
00060 allocate (ElemTypes(nElems))
00061 call XF_READ_ELEM_TYPES (xGroupId, nElems, ElemTypes, status)
00062 if (status < 0) then
00063 error = -1
00064 return
00065 endif
00066 WRITE(a_OutFile,*) 'Element Types:'
00067 do i=1, nElems
00068 WRITE(a_OutFile,*) 'Elem ', i, ', ', 'Type ', ElemTypes(i)
00069 enddo
00070 deallocate (ElemTypes)
00071 endif
00072
00073
00074 allocate (NodesInElem(nElems*nNodesPerElem))
00075 call XF_READ_ELEM_NODE_IDS (xGroupId, nElems, nNodesPerElem, NodesInElem, error)
00076 if (error < 0) then
00077 WRITE (*,*) 'Error reading mesh'
00078 return
00079 endif
00080
00081 do i=1, nElems
00082 WRITE(a_OutFile,*) 'Elem: ', i, ' - '
00083 do j=1, nNodesPerElem
00084 nNodeId = NodesInElem((i-1)*nNodesPerElem + j)
00085 if (nNodeId > 0) then
00086 WRITE(a_OutFile,*) nNodeId, ' '
00087 endif
00088 enddo
00089 WRITE (a_OutFile,*) ''
00090 enddo
00091
00092 if (allocated(NodesInElem)) deallocate (NodesInElem)
00093
00094
00095 allocate (XNodeLocs(nNodes))
00096 allocate (YNodeLocs(nNodes))
00097 allocate (ZNodeLocs(nNodes))
00098
00099 call XF_READ_X_NODE_LOCATIONS (xGroupId, nNodes, XNodeLocs, status)
00100 if (status >= 0) then
00101 call XF_READ_Y_NODE_LOCATIONS (xGroupId, nNodes, YNodeLocs, status)
00102 if (status >= 0) then
00103 call XF_READ_Z_NODE_LOCATIONS (xGroupId, nNodes, ZNodeLocs, status)
00104 endif
00105 endif
00106
00107 WRITE(a_OutFile,*) 'Node Locations:'
00108 do i=1, nNodes
00109 WRITE(a_OutFile,*) 'Node: ', i, ' Location: ', XNodeLocs(i), ' ', &
00110 YNodeLocs(i), ' ', ZNodeLocs(i)
00111 enddo
00112
00113 deallocate (XNodeLocs)
00114 deallocate (YNodeLocs)
00115 deallocate (ZNodeLocs)
00116
00117
00118 call XF_OPEN_GROUP(xGroupId, 'PROPERTIES', xPropGroupId, status)
00119 if (status < 0) then
00120 WRITE(a_OutFile,*) ''
00121 WRITE(a_OutFile,*) 'Properties Group not found'
00122 WRITE(a_OutFile,*) ''
00123 error = -1
00124 return
00125 endif
00126
00127 call XF_GET_PROPERTY_TYPE(xPropGroupId, 'String', StrType, status)
00128 call XF_GET_PROPERTY_TYPE(xPropGroupId, 'UInt', UIntType, status)
00129 call XF_GET_PROPERTY_TYPE(xPropGroupId, 'Int', IntType, status)
00130 call XF_GET_PROPERTY_TYPE(xPropGroupId, 'Double', DblType, status)
00131 call XF_GET_PROPERTY_TYPE(xPropGroupId, 'Float', FloatType, status)
00132
00133
00134 WRITE(a_OutFile,*) ''
00135 if (StrType == XF_TYPE_STRING) then
00136 WRITE(a_OutFile,*) 'String Property Type Read Correctly'
00137 else
00138 WRITE(a_OutFile,*) 'Error in Getting String Property Type'
00139 endif
00140 if (UIntType == XF_TYPE_UINT) then
00141 WRITE(a_OutFile,*) 'Unsigned Integer Property Type Read Correctly'
00142 else
00143 WRITE(a_OutFile,*) 'Error in Getting Unsigned Integer Property Type'
00144 endif
00145 if (IntType == XF_TYPE_INT) then
00146 WRITE(a_OutFile,*) 'Integer Property Type Read Correctly'
00147 else
00148 WRITE(a_OutFile,*) 'Error in Getting Integer Property Type'
00149 endif
00150 if (DblType == XF_TYPE_DOUBLE) then
00151 WRITE(a_OutFile,*) 'Double Property Type Read Correctly'
00152 else
00153 WRITE(a_OutFile,*) 'Error in Getting Double Property Type'
00154 endif
00155 if (FloatType == XF_TYPE_FLOAT) then
00156 WRITE(a_OutFile,*) 'Float Property Type Read Correctly'
00157 else
00158 WRITE(a_OutFile,*) 'Error in Getting Float Property Type'
00159 endif
00160 WRITE(a_OutFile,*) ''
00161
00162 error = 0
00163 return
00164
00165 END SUBROUTINE
00166
00167
00168
00169
00170
00171
00172
00173
00174 SUBROUTINE TM_WRITE_TEST_MESH_A (Filename, Compression, error)
00175 CHARACTER(LEN=*), INTENT(IN) :: Filename
00176 INTEGER, INTENT(IN) :: Compression
00177 INTEGER, INTENT(OUT) :: error
00178 INTEGER nElements, nNodes
00179 INTEGER xFileId, xMeshId, xPropGroupId, xCoordId
00180 REAL(DOUBLE), DIMENSION(5) :: dNodeLocsX
00181 REAL(DOUBLE), DIMENSION(5) :: dNodeLocsY
00182 REAL(DOUBLE), DIMENSION(5) :: dNodeLocsZ
00183 INTEGER, DIMENSION(3,3) :: iElementNodes
00184 INTEGER status, ElemType, propint(1), iEllipse
00185 CHARACTER(LEN=BIG_STRING_SIZE) propstring
00186 INTEGER propuint(1)
00187 REAL(DOUBLE) propdouble(1), dMajorR, dMinorR
00188 REAL propfloat
00189
00190
00191 ElemType = EL_TYPE_TRI_LINEAR
00192
00193 nElements = 3
00194 nNodes = 5
00195 xFileId = NONE
00196 xMeshId = NONE
00197
00198
00199
00200 dNodeLocsX(1) = 0.0
00201 dNodeLocsX(2) = 5.0
00202 dNodeLocsX(3) = 0.0
00203 dNodeLocsX(4) = 5.0
00204 dNodeLocsX(5) = 7.5
00205
00206 dNodeLocsY(1) = 5.0
00207 dNodeLocsY(2) = 5.0
00208 dNodeLocsY(3) = 0.0
00209 dNodeLocsY(4) = 0.0
00210 dNodeLocsY(5) = 2.5
00211
00212 dNodeLocsZ(1) = 0.0
00213 dNodeLocsZ(2) = 0.0
00214 dNodeLocsZ(3) = 0.0
00215 dNodeLocsZ(4) = 0.0
00216 dNodeLocsZ(5) = 0.0
00217
00218
00219 iElementNodes(1,1) = 1
00220 iElementNodes(2,1) = 3
00221 iElementNodes(3,1) = 2
00222
00223 iElementNodes(1,2) = 2
00224 iElementNodes(2,2) = 3
00225 iElementNodes(3,2) = 4
00226
00227 iElementNodes(1,3) = 5
00228 iElementNodes(2,3) = 2
00229 iElementNodes(3,3) = 4
00230
00231
00232 call XF_CREATE_FILE (Filename, .TRUE., xFileId, status)
00233 if (status < 0) then
00234
00235 call XF_CLOSE_FILE (xFileId, error)
00236 error = -1
00237 return
00238 endif
00239
00240
00241 call XF_CREATE_GROUP_FOR_MESH (xFileId, MESH_A_GROUP_NAME, xMeshId, status)
00242 if (status < 0) then
00243
00244 call XF_CLOSE_GROUP (xMeshId, error)
00245 call XF_CLOSE_FILE (xFileId, error)
00246 error = -1
00247 return
00248 endif
00249
00250
00251 call XF_SET_ALL_ELEMS_SAME_TYPE (xMeshId, ElemType, status)
00252 if (status < 0) then
00253
00254 call XF_CLOSE_GROUP (xMeshId, error)
00255 call XF_CLOSE_FILE (xFileId, error)
00256 error = -1
00257 return
00258 endif
00259
00260
00261 call XF_SET_NUMBER_OF_NODES (xMeshId, nNodes, status)
00262 if (status < 0) then
00263
00264 call XF_CLOSE_GROUP (xMeshId, error)
00265 call XF_CLOSE_FILE (xFileId, error)
00266 error = -1
00267 return
00268 endif
00269
00270 call XF_WRITE_X_NODE_LOCATIONS (xMeshId, nNodes, dNodeLocsX, Compression, status)
00271 if (status < 0) then
00272
00273 call XF_CLOSE_GROUP (xMeshId, error)
00274 call XF_CLOSE_FILE (xFileId, error)
00275 error = -1
00276 return
00277 endif
00278
00279 call XF_WRITE_Y_NODE_LOCATIONS (xMeshId, nNodes, dNodeLocsY, status)
00280 if (status < 0) then
00281
00282 call XF_CLOSE_GROUP (xMeshId, error)
00283 call XF_CLOSE_FILE (xFileId, error)
00284 error = -1
00285 return
00286 endif
00287
00288 call XF_WRITE_Z_NODE_LOCATIONS (xMeshId, nNodes, dNodeLocsZ, status)
00289 if (status < 0) then
00290
00291 call XF_CLOSE_GROUP (xMeshId, error)
00292 call XF_CLOSE_FILE (xFileId, error)
00293 error = -1
00294 return
00295 endif
00296
00297
00298 call XF_SET_NUMBER_OF_ELEMENTS (xMeshId, nElements, status)
00299 if (status < 0) then
00300
00301 call XF_CLOSE_GROUP (xMeshId, error)
00302 call XF_CLOSE_FILE (xFileId, error)
00303 error = -1
00304 return
00305 endif
00306
00307
00308 call XF_WRITE_ELEM_NODE_IDS (xMeshId, nElements, 3, iElementNodes, &
00309 Compression, status)
00310 if (status < 0) then
00311
00312 call XF_CLOSE_GROUP (xMeshId, error)
00313 call XF_CLOSE_FILE (xFileId, error)
00314 error = -1
00315 return
00316 endif
00317
00318
00319 call XF_CREATE_MESH_PROPERTY_GROUP(xMeshId, xPropGroupId, status)
00320 if (status < 0) then
00321 call XF_CLOSE_GROUP(xMeshId, error)
00322 call XF_CLOSE_FILE(xFileId, error)
00323 error = -1
00324 return
00325 endif
00326
00327 propstring = 'Property String'
00328 propuint = 5
00329 propint = -5
00330 propdouble = 5.6789012345d0
00331 propfloat = 5.6789
00332
00333 call XF_WRITE_PROPERTY_STRING(xPropGroupId, 'String', propstring, status)
00334 call XF_WRITE_PROPERTY_UINT(xPropGroupId, 'UInt', 1, propuint, NONE, status)
00335 call XF_WRITE_PROPERTY_INT(xPropGroupId, 'Int', 1, propint, NONE, status)
00336 call XF_WRITE_PROPERTY_DOUBLE(xPropGroupId, 'Double', 1, &
00337 propdouble, NONE, status)
00338 call XF_WRITE_PROPERTY_FLOAT(xPropGroupId, 'Float', 1, &
00339 propfloat, NONE, status)
00340
00341
00342
00343
00344 call XF_CREATE_COORDINATE_GROUP(xFileId, xCoordId, status)
00345 if (status < 0) then
00346 call XF_CLOSE_GROUP (xPropGroupId, error)
00347 call XF_CLOSE_GROUP (xMeshId, error)
00348 call XF_CLOSE_FILE (xFileId, error)
00349 error = status
00350 return
00351 endif
00352
00353
00354 iEllipse = 32
00355 dMajorR = 45.0
00356 dMinorR = 32.0
00357
00358 call XF_SET_HORIZ_DATUM(xCoordId, HORIZ_DATUM_GEOGRAPHIC, error)
00359 call XF_SET_HORIZ_UNITS(xCoordId, COORD_UNITS_US_FEET, error)
00360
00361 call XF_SET_VERT_DATUM(xCoordId, VERT_DATUM_LOCAL, error)
00362 call XF_SET_VERT_UNITS(xCoordId, COORD_UNITS_US_FEET, error)
00363
00364
00365 call XF_SET_ELLIPSE(xCoordId, iEllipse, error)
00366 call XF_SET_LAT(xCoordId, LATITUDE_NORTH, error)
00367 call XF_SET_LON(xCoordId, LONGITUDE_EAST, error)
00368 call XF_SET_MAJOR_R(xCoordId, dMajorR, error)
00369 call XF_SET_MINOR_R(xCoordId, dMinorR, error)
00370
00371 call XF_CLOSE_GROUP(xCoordId, error)
00372 xCoordId = 0
00373
00374
00375 call XF_CLOSE_GROUP (xPropGroupId, error)
00376 call XF_CLOSE_GROUP (xMeshId, error)
00377 call XF_CLOSE_FILE (xFileId, error)
00378
00379 return
00380
00381 END SUBROUTINE
00382
00383
00384
00385
00386
00387
00388
00389
00390 SUBROUTINE TM_WRITE_TEST_MESH_B (Filename, Compression, error)
00391 CHARACTER(LEN=*), INTENT(IN) :: Filename
00392 INTEGER, INTENT(IN) :: Compression
00393 INTEGER, INTENT(OUT) :: error
00394 INTEGER nElements, nNodes, nMaxNodePerElem
00395 INTEGER xFileId, xMeshId, xPropGroupId, xCoordId
00396 REAL(DOUBLE), DIMENSION(5) :: dNodeLocsX
00397 REAL(DOUBLE), DIMENSION(5) :: dNodeLocsY
00398 REAL(DOUBLE), DIMENSION(5) :: dNodeLocsZ
00399 INTEGER, DIMENSION(4,2) :: iElementNodes
00400 INTEGER, DIMENSION(2) :: iElementTypes
00401 INTEGER status, propint(1), iEllipse
00402 CHARACTER(LEN=BIG_STRING_SIZE) propstring
00403 INTEGER propuint(1)
00404 REAL(DOUBLE) propdouble(1)
00405 REAL propfloat
00406
00407 nElements = 2
00408 nNodes = 5
00409 nMaxNodePerElem = 4
00410 xFileId = NONE
00411 xMeshId = NONE
00412
00413
00414
00415 dNodeLocsX(1) = 0.0
00416 dNodeLocsX(2) = 5.0
00417 dNodeLocsX(3) = 0.0
00418 dNodeLocsX(4) = 5.0
00419 dNodeLocsX(5) = 7.5
00420
00421 dNodeLocsY(1) = 5.0
00422 dNodeLocsY(2) = 5.0
00423 dNodeLocsY(3) = 0.0
00424 dNodeLocsY(4) = 0.0
00425 dNodeLocsY(5) = 2.5
00426
00427 dNodeLocsZ(1) = 0.0
00428 dNodeLocsZ(2) = 0.0
00429 dNodeLocsZ(3) = 0.0
00430 dNodeLocsZ(4) = 0.0
00431 dNodeLocsZ(5) = 0.0
00432
00433
00434 iElementNodes(1,1) = 1
00435 iElementNodes(2,1) = 3
00436 iElementNodes(3,1) = 4
00437 iElementNodes(4,1) = 2
00438
00439 iElementNodes(1,2) = 2
00440 iElementNodes(2,2) = 4
00441 iElementNodes(3,2) = 5
00442 iElementNodes(4,2) = NONE;
00443
00444 iElementTypes(1) = EL_TYPE_QUADRILATERAL_LINEAR;
00445 iElementTypes(2) = EL_TYPE_TRI_LINEAR;
00446
00447
00448 call XF_CREATE_FILE (Filename, .TRUE., xFileId, status)
00449 if (status < 0) then
00450
00451 call XF_CLOSE_FILE (xFileId, error)
00452 error = -1
00453 return
00454 endif
00455
00456
00457 call XF_CREATE_GROUP_FOR_MESH (xFileId, MESH_B_GROUP_NAME, xMeshId, status)
00458 if (status < 0) then
00459
00460 call XF_CLOSE_GROUP (xMeshId, error)
00461 call XF_CLOSE_FILE (xFileId, error)
00462 error = -1
00463 return
00464 endif
00465
00466
00467 call XF_SET_NUMBER_OF_NODES (xMeshId, nNodes, status)
00468 if (status < 0) then
00469
00470 call XF_CLOSE_GROUP (xMeshId, error)
00471 call XF_CLOSE_FILE (xFileId, error)
00472 error = -1
00473 return
00474 endif
00475
00476 call XF_WRITE_X_NODE_LOCATIONS (xMeshId, nNodes, dNodeLocsX, &
00477 Compression, status)
00478 if (status < 0) then
00479
00480 call XF_CLOSE_GROUP (xMeshId, error)
00481 call XF_CLOSE_FILE (xFileId, error)
00482 error = -1
00483 return
00484 endif
00485
00486 call XF_WRITE_Y_NODE_LOCATIONS (xMeshId, nNodes, dNodeLocsY, status)
00487 if (status < 0) then
00488
00489 call XF_CLOSE_GROUP (xMeshId, error)
00490 call XF_CLOSE_FILE (xFileId, error)
00491 error = -1
00492 return
00493 endif
00494
00495 call XF_WRITE_Z_NODE_LOCATIONS (xMeshId, nNodes, dNodeLocsZ, status)
00496 if (status < 0) then
00497
00498 call XF_CLOSE_GROUP (xMeshId, error)
00499 call XF_CLOSE_FILE (xFileId, error)
00500 error = -1
00501 return
00502 endif
00503
00504
00505 call XF_SET_NUMBER_OF_ELEMENTS (xMeshId, nElements, status)
00506 if (status < 0) then
00507
00508 call XF_CLOSE_GROUP (xMeshId, error)
00509 call XF_CLOSE_FILE (xFileId, error)
00510 error = -1
00511 return
00512 endif
00513
00514
00515 call XF_WRITE_ELEM_TYPES (xMeshId, nElements, iElementTypes, &
00516 Compression, status)
00517 if (status < 0) then
00518
00519 call XF_CLOSE_GROUP (xMeshId, error)
00520 call XF_CLOSE_FILE (xFileId, error)
00521 error = -1
00522 return
00523 endif
00524
00525
00526 call XF_WRITE_ELEM_NODE_IDS (xMeshId, nElements, nMaxNodePerElem, &
00527 iElementNodes, Compression, status)
00528 if (status < 0) then
00529
00530 call XF_CLOSE_GROUP (xMeshId, error)
00531 call XF_CLOSE_FILE (xFileId, error)
00532 error = -1
00533 return
00534 endif
00535
00536
00537 call XF_CREATE_MESH_PROPERTY_GROUP(xMeshId, xPropGroupId, status)
00538 if (status < 0) then
00539 call XF_CLOSE_GROUP(xMeshId, error)
00540 call XF_CLOSE_GROUP(xFileId, error)
00541 error = -1
00542 return
00543 endif
00544
00545 propstring = 'String Property'
00546 propuint = 2
00547 propint = -2
00548 propdouble = 2.3456789012d0
00549 propfloat = 2.3456
00550
00551 call XF_WRITE_PROPERTY_STRING(xPropGroupId, 'String', propstring, status)
00552 call XF_WRITE_PROPERTY_UINT(xPropGroupId, 'UInt', 1, propuint, NONE, status)
00553 call XF_WRITE_PROPERTY_INT(xPropGroupId, 'Int', 1, propint, NONE, status)
00554 call XF_WRITE_PROPERTY_DOUBLE(xPropGroupId, 'Double', 1, &
00555 propdouble, NONE, status)
00556 call XF_WRITE_PROPERTY_FLOAT(xPropGroupId, 'Float', 1, &
00557 propfloat, NONE, status)
00558
00559
00560
00561
00562 call XF_CREATE_COORDINATE_GROUP(xFileId, xCoordId, status)
00563 if (status < 0) then
00564 call XF_CLOSE_GROUP (xPropGroupId, error)
00565 call XF_CLOSE_GROUP (xMeshId, error)
00566 call XF_CLOSE_FILE (xFileId, error)
00567 error = status
00568 return
00569 endif
00570
00571
00572 iEllipse = 21
00573
00574 call XF_SET_HORIZ_DATUM(xCoordId, HORIZ_DATUM_GEOGRAPHIC, error)
00575 call XF_SET_HORIZ_UNITS(xCoordId, COORD_UNITS_METERS, error)
00576
00577 call XF_SET_VERT_DATUM(xCoordId, VERT_DATUM_NGVD_88, error)
00578 call XF_SET_VERT_UNITS(xCoordId, COORD_UNITS_METERS, error)
00579
00580
00581 call XF_SET_ELLIPSE(xCoordId, iEllipse, error)
00582 call XF_SET_LAT(xCoordId, LATITUDE_SOUTH, error)
00583 call XF_SET_LON(xCoordId, LONGITUDE_WEST, error)
00584
00585 call XF_CLOSE_GROUP(xCoordId, error)
00586 xCoordId = 0
00587
00588
00589 call XF_CLOSE_GROUP (xPropGroupId, error)
00590 call XF_CLOSE_GROUP (xMeshId, error)
00591 call XF_CLOSE_FILE (xFileId, error)
00592
00593 return
00594
00595 END SUBROUTINE
00596
00597 END MODULE TestMesh
TestMesh.f90 tests meshes
00001 MODULE TestTimestep
00002
00003 USE Xmdf
00004
00005 CHARACTER(LEN=*), PARAMETER :: DATASETS_LOCATION = 'Datasets'
00006 CHARACTER(LEN=*), PARAMETER :: SCALAR_A_LOCATION = 'Scalars/ScalarA'
00007 CHARACTER(LEN=*), PARAMETER :: SCALAR_B_LOCATION = 'Scalars/ScalarB'
00008 CHARACTER(LEN=*), PARAMETER :: VECTOR2D_A_LOCATION = 'Vectors/Vector2D_A'
00009 CHARACTER(LEN=*), PARAMETER :: VECTOR2D_B_LOCATION = 'Vectors/Vector2D_B'
00010
00011 CONTAINS
00012
00013
00014
00015
00016
00017
00018 RECURSIVE SUBROUTINE TTI_Test_Num_Times (a_DatasetId, a_Itimestep, error)
00019 INTEGER, INTENT(IN) :: a_DatasetId
00020 INTEGER, INTENT(IN) :: a_Itimestep
00021 INTEGER, INTENT(OUT) :: error
00022 INTEGER NumTimes
00023 INTEGER Itimestep
00024
00025 error = 1
00026
00027
00028 Itimestep = a_Itimestep - 1
00029
00030
00031 if (1 == Itimestep .OR. 3 == Itimestep .OR. 5 == Itimestep) then
00032
00033 call XF_SET_DATASET_NUM_TIMES( a_DatasetId, Itimestep + 2, error )
00034 if (error >= 0) then
00035 WRITE(*,*) 'ERROR1: XF_SET_DATASET_NUM_TIMES must return ERROR.'
00036 endif
00037
00038 if (1 == Itimestep) then
00039 Itimestep = 1;
00040 endif
00041 if (3 == Itimestep) then
00042 Itimestep = 2;
00043 endif
00044 if (5 == Itimestep) then
00045 Itimestep = 3;
00046 endif
00047
00048
00049 call XF_SET_DATASET_NUM_TIMES( a_DatasetId, Itimestep, error )
00050 if (error < 0) then
00051 WRITE(*,*) 'ERROR2: xfSetDatasetNumTimes must NOT return error.'
00052 endif
00053
00054
00055 call XF_SET_DATASET_NUM_TIMES( a_DatasetId, Itimestep + 1, error )
00056 if (error >= 0) then
00057 WRITE(*,*) 'ERROR3: xfSetDatasetNumTimes must return ERROR.'
00058 endif
00059
00060
00061 call XF_GET_DATASET_NUM_TIMES( a_DatasetId, NumTimes, error )
00062 if (error < 0) then
00063 WRITE(*,*) 'ERROR4: xfSetDatasetNumTimes must NOT return error.'
00064 endif
00065 if (NumTimes .NE. Itimestep) then
00066 WRITE(*,*) 'ERROR5: xfGetDatasetNumTimes must return CORRECT NumTimes.'
00067 endif
00068 endif
00069
00070 return
00071
00072 END SUBROUTINE
00073
00074
00075
00076
00077
00078
00079
00080 RECURSIVE SUBROUTINE TT_READ_DATASETS (a_xGroupId, a_FileUnit, error)
00081 INTEGER, INTENT(IN) :: a_xGroupId
00082 INTEGER, INTENT(IN) :: a_FileUnit
00083 INTEGER, INTENT(OUT) :: error
00084 INTEGER nPaths, nMaxPathLength, j
00085 CHARACTER, ALLOCATABLE, DIMENSION(:) :: Paths
00086 CHARACTER(LEN=500) IndividualPath
00087 INTEGER nStatus, i
00088 INTEGER xScalarId, xVectorId, xMultiId
00089 INTEGER nMultiDatasets
00090
00091 xScalarId = NONE
00092 xVectorId = NONE
00093
00094 nMultiDatasets = 0
00095 nPaths = 0
00096 nMaxPathLength = 0
00097
00098
00099 call XF_GET_SCALAR_DATASETS_INFO(a_xGroupId, nPaths, nMaxPathLength, nStatus)
00100 if (nStatus >= 0 .AND. nPaths > 0) then
00101 allocate(Paths(nPaths*nMaxPathLength))
00102 call XF_GET_SCALAR_DATASET_PATHS(a_xGroupId, nPaths, nMaxPathLength, Paths, &
00103 error)
00104 endif
00105 if (nStatus < 0) then
00106 error = -1
00107 return
00108 endif
00109
00110
00111 WRITE(a_FileUnit,*) 'Number of Scalars ', nPaths
00112 do i=2, nPaths
00113 IndividualPath = ''
00114 do j=1, nMaxPathLength-1
00115 IndividualPath(j:j) = Paths((i-1)*nMaxPathLength+j)
00116 enddo
00117 WRITE(a_FileUnit,*) 'Reading scalar: ', IndividualPath(1:nMaxPathLength-1)
00118 call XF_OPEN_GROUP(a_xGroupId, IndividualPath(1:nMaxPathLength-1), &
00119 xScalarId, nStatus)
00120 if (nStatus < 0) then
00121 error = -1
00122 return
00123 endif
00124
00125 call TTI_READ_SCALAR(xScalarId, a_FileUnit, nStatus)
00126 call XF_CLOSE_GROUP(xScalarId, error)
00127 if (nStatus < 0) then
00128 WRITE(*,*) 'Error reading scalar dataset.'
00129 error = -1
00130 return
00131 endif
00132 enddo
00133
00134 if (allocated(Paths)) deallocate(Paths)
00135
00136 call XF_GET_VECTOR_DATASETS_INFO(a_xGroupId, nPaths, nMaxPathLength, nStatus)
00137 if (nStatus >= 0 .AND. nPaths > 0) then
00138 allocate(Paths(nPaths*nMaxPathLength))
00139 call XF_GET_VECTOR_DATASET_PATHS(a_xGroupId, nPaths, nMaxPathLength, Paths, error)
00140 endif
00141 if (nStatus < 0) then
00142 error = -1
00143 return
00144 endif
00145
00146
00147 WRITE(a_FileUnit,*) 'Number of Vectors ', nPaths
00148 do i=2, nPaths
00149 do j=1, nMaxPathLength-1
00150 IndividualPath(j:j) = Paths((i-1)*nMaxPathLength+j)
00151 enddo
00152 WRITE(a_FileUnit,*) 'Reading Vector: ', &
00153 IndividualPath(1:nMaxPathLength-1)
00154 call XF_OPEN_GROUP(a_xGroupId, IndividualPath(1:nMaxPathLength-1), &
00155 xVectorId, nStatus)
00156 if (nStatus < 0) then
00157 error = -1
00158 return
00159 endif
00160 call TTI_READ_VECTOR(xVectorId, a_FileUnit, nStatus)
00161 call XF_CLOSE_GROUP(xVectorId, error)
00162 if (nStatus < 0) then
00163 WRITE(*,*) 'Error reading vector dataset.'
00164 error = -1
00165 return
00166 endif
00167 enddo
00168
00169 if (allocated(Paths)) deallocate(Paths)
00170
00171
00172 call XF_GET_GRP_PTHS_SZ_MLT_DSETS(a_xGroupId, nMultiDatasets, &
00173 nMaxPathLength, nStatus)
00174 if (nStatus >= 0 .AND. nMultiDatasets > 0) then
00175 allocate(Paths(nMultiDatasets*nMaxPathLength))
00176 call XF_GET_ALL_GRP_PATHS_MLT_DSETS(a_xGroupId, nMultiDatasets, &
00177 nMaxPathLength, Paths, error)
00178 if (nStatus < 0) then
00179 error = -1
00180 return
00181 endif
00182
00183
00184 WRITE(a_FileUnit,*) 'Number of Multidatasets ', nMultiDatasets
00185 do i=2, nMultiDatasets
00186 IndividualPath = ''
00187 do j=1, nMaxPathLength-1
00188 IndividualPath(j:j) = Paths((i-1)*nMaxPathLength+j)
00189 enddo
00190 WRITE(a_FileUnit,*) 'Reading multidataset: ', &
00191 IndividualPath(1:nMaxPathLength-1)
00192 call XF_OPEN_GROUP(a_xGroupId, IndividualPath(1:nMaxPathLength-1), &
00193 xMultiId, nStatus)
00194 if (nStatus < 0) then
00195 error = -1
00196 return
00197 endif
00198
00199 call TT_READ_DATASETS(xMultiId, a_FileUnit, nStatus)
00200 call XF_CLOSE_GROUP(xMultiId, error)
00201 if (nStatus < 0) then
00202 WRITE(*,*) 'Error reading multidatasets.'
00203 error = -1
00204 return
00205 endif
00206 enddo
00207 endif
00208 if (allocated(Paths)) deallocate(Paths)
00209
00210 error = 1
00211 return
00212
00213 END SUBROUTINE
00214
00215
00216
00217
00218
00219
00220 SUBROUTINE TT_READ_ACTIVITY_SCALAR_A_INDEX(a_Filename, a_Index, error)
00221 CHARACTER(LEN=*), INTENT(IN) :: a_Filename
00222 INTEGER, INTENT(IN) :: a_Index
00223 INTEGER, INTENT(OUT) :: error
00224 INTEGER status
00225 INTEGER xFileId, xDsetsId, xScalarAId
00226 INTEGER nTimesteps, i
00227 INTEGER, ALLOCATABLE :: bActive(:)
00228
00229 xFileId = NONE
00230 xDsetsId = NONE
00231 xScalarAId = NONE
00232
00233
00234 call XF_OPEN_FILE(a_Filename, .TRUE., xFileId, status)
00235 if (status < 0) then
00236 error = -1
00237 return
00238 endif
00239
00240
00241 call XF_OPEN_GROUP(xFileId, DATASETS_LOCATION, xDsetsId, status)
00242 if (status >= 0) then
00243 call XF_OPEN_GROUP(xDsetsId, SCALAR_A_LOCATION, xScalarAId, status)
00244 endif
00245 if (status < 0) then
00246 error = status
00247 return
00248 endif
00249
00250
00251 CALL XF_GET_DATASET_NUM_TIMES(xScalarAId, nTimesteps, status)
00252 if (status < 0) then
00253 error = status
00254 return
00255 endif
00256
00257 if (nTimesteps < 1) then
00258 error = -1
00259 return
00260 endif
00261
00262
00263 allocate(bActive(nTimesteps))
00264 call XF_READ_ACTIVE_VALS_AT_INDEX(xScalarAId, a_Index, 1, nTimesteps, &
00265 bActive, status)
00266
00267 WRITE(*,*) ''
00268 WRITE(*,*) 'Reading activity for scalar A slice at index: ', a_Index
00269 do i=1, nTimesteps
00270 WRITE(*,*) bActive(i), ' '
00271 enddo
00272
00273 deallocate(bActive)
00274
00275 error = status
00276 return
00277
00278 END SUBROUTINE
00279
00280
00281
00282
00283
00284
00285
00286 SUBROUTINE TT_READ_SCALAR_A_INDEX (a_Filename, a_Index, error)
00287 CHARACTER(LEN=*), INTENT(IN) :: a_Filename
00288 INTEGER, INTENT(IN) :: a_Index
00289 INTEGER, INTENT(OUT) :: error
00290 INTEGER status
00291 INTEGER xFileId, xDsetsId, xScalarAId
00292 INTEGER nTimesteps, i
00293 REAL, ALLOCATABLE :: fValues(:)
00294
00295 xFileId = NONE
00296 xDsetsId = NONE
00297 xScalarAId = NONE
00298
00299
00300 call XF_OPEN_FILE(a_Filename, .TRUE., xFileId, status)
00301 if (status < 0) then
00302 error = -1
00303 return
00304 endif
00305
00306
00307 call XF_OPEN_GROUP(xFileId, DATASETS_LOCATION, xDsetsId, status)
00308 if (status >= 0) then
00309 call XF_OPEN_GROUP(xDsetsId, SCALAR_A_LOCATION, xScalarAId, status)
00310 endif
00311 if (status < 0) then
00312 error = status
00313 return
00314 endif
00315
00316
00317 call XF_GET_DATASET_NUM_TIMES(xScalarAId, nTimesteps, status)
00318 if (status < 0) then
00319 error = status
00320 return
00321 endif
00322
00323 if (nTimesteps < 1) then
00324 error = -1
00325 return
00326 endif
00327
00328
00329 allocate (fValues(nTimesteps))
00330 call XF_READ_SCALAR_VALUES_AT_INDEX(xScalarAId, a_Index, 1, nTimesteps, &
00331 fValues, status)
00332
00333
00334 WRITE(*,*) ''
00335 WRITE(*,*) 'Reading scalar A slice at index: ', a_Index
00336 do i=1, nTimesteps
00337 WRITE(*,*) fValues(i), ' '
00338 enddo
00339
00340 deallocate(fValues)
00341
00342 error = status
00343 return
00344
00345 END SUBROUTINE
00346
00347
00348
00349
00350
00351
00352
00353
00354
00355
00356
00357
00358 SUBROUTINE TT_WRITE_SCALAR_A (a_Filename, a_Compression, error)
00359 CHARACTER(LEN=*), INTENT(IN) :: a_Filename
00360 INTEGER, INTENT(IN) :: a_Compression
00361 INTEGER, INTENT(OUT) :: error
00362 INTEGER xFileId, xDsetsId, xScalarAId, xCoordId
00363 INTEGER nValues, nTimes, nActive
00364 REAL(DOUBLE) dTime, dJulianReftime
00365 INTEGER iTimestep, iActive, iHpgnZone
00366 REAL fValues(10)
00367 INTEGER*1 bActivity(10)
00368 INTEGER i, status
00369
00370
00371 nValues = 10
00372 nTimes = 3
00373 nActive = 8
00374 dTime = 0.0
00375
00376
00377 do iActive = 1, nActive
00378 bActivity(iActive) = 1
00379 enddo
00380 bActivity(6) = 0
00381
00382
00383
00384 call XF_CREATE_FILE(a_Filename, .TRUE., xFileId, error)
00385 if (error .LT. 0) then
00386
00387 call XF_CLOSE_FILE(xFileId, error)
00388 return
00389 endif
00390
00391
00392 call XF_CREATE_GENERIC_GROUP(xFileId, DATASETS_LOCATION, xDsetsId, status)
00393 if (status < 0) then
00394 call XF_CLOSE_FILE(xFileId, error)
00395 error = -1
00396 return
00397 endif
00398
00399
00400 call XF_CREATE_SCALAR_DATASET(xDsetsId, SCALAR_A_LOCATION, 'mg/L', &
00401 TS_HOURS, a_Compression, xScalarAId, status)
00402 if (status .LT. 0) then
00403
00404 call XF_CLOSE_GROUP(xScalarAId, error)
00405 call XF_CLOSE_GROUP(xDsetsId, error)
00406 call XF_CLOSE_FILE(xFileId, error)
00407 error = status
00408 return
00409 endif
00410
00411
00412
00413 dJulianReftime = 2452822.0;
00414 call XF_WRITE_REFTIME(xScalarAId, dJulianReftime, status)
00415 if (status < 0) then
00416 call XF_CLOSE_GROUP(xScalarAId, error)
00417 call XF_CLOSE_GROUP(xDsetsId, error)
00418 call XF_CLOSE_FILE(xFileId, error)
00419 endif
00420
00421
00422 do iTimestep = 1, nTimes
00423
00424 dTime = iTimestep * 0.5
00425
00426 fValues(1) = dTime
00427 do i = 2, nValues
00428 fValues(i) = fValues(i-1)*2.5
00429 end do
00430
00431
00432 call XF_WRITE_SCALAR_TIMESTEP(xScalarAId, dTime, nValues, fValues, error)
00433 if (error .GE. 0) then
00434
00435 call XF_WRITE_ACTIVITY_TIMESTEP(xScalarAId, nActive, bActivity, error)
00436 end if
00437
00438 call TTI_Test_Num_Times(xScalarAid, iTimestep, error)
00439 enddo
00440
00441
00442
00443 call XF_CREATE_COORDINATE_GROUP(xFileId, xCoordId, status)
00444 if (status < 0) then
00445 call XF_CLOSE_GROUP(xScalarAId, error)
00446 call XF_CLOSE_GROUP(xDsetsId, error)
00447 call XF_CLOSE_FILE(xFileId, error)
00448 error = -1
00449 return
00450 endif
00451
00452
00453 iHpgnZone = 29
00454
00455 call XF_SET_HORIZ_DATUM(xCoordId, HORIZ_DATUM_GEOGRAPHIC_HPGN, error)
00456 call XF_SET_HORIZ_UNITS(xCoordId, COORD_UNITS_METERS, error)
00457 call XF_SET_VERT_DATUM(xCoordId, VERT_DATUM_LOCAL, error)
00458 call XF_SET_VERT_UNITS(xCoordId, COORD_UNITS_METERS, error)
00459
00460
00461 call XF_SET_HPGN_AREA(xCoordId, iHpgnZone, error)
00462
00463 call XF_CLOSE_GROUP(xCoordId, error)
00464 xCoordId = 0;
00465
00466
00467 call XF_CLOSE_GROUP(xScalarAId, error)
00468 call XF_CLOSE_GROUP(xDsetsId, error)
00469 call XF_CLOSE_FILE(xFileId, error)
00470
00471 return
00472 END SUBROUTINE
00473
00474
00475
00476
00477
00478
00479
00480
00481
00482
00483
00484
00485 SUBROUTINE TT_WRITE_SCALAR_B (a_Filename, a_Compression, a_Overwrite, error)
00486 CHARACTER(LEN=*), INTENT(IN) :: a_Filename
00487 INTEGER, INTENT(IN) :: a_Compression
00488 LOGICAL, INTENT(IN) :: a_Overwrite
00489 INTEGER, INTENT(OUT) :: error
00490 INTEGER xFileId, xDsetsId, xScalarBId, xCoordId
00491 INTEGER nValues, nTimes, nActive
00492 REAL(DOUBLE) dTime, dJulianReftime
00493 INTEGER iTimestep, iActive
00494 REAL fValues(10)
00495 INTEGER*1 bActivity(10)
00496 INTEGER i, status
00497
00498
00499 nValues = 10
00500 nTimes = 3
00501 nActive = 8
00502 dTime = 0.0
00503 i = 0
00504
00505
00506 do iActive = 1, nActive
00507 bActivity(iActive) = 1
00508 enddo
00509 bActivity(6) = 0
00510
00511 if (a_Overwrite) then
00512
00513 call XF_OPEN_FILE(a_Filename, .FALSE., xFileId, status)
00514 if (status < 0) then
00515 error = -1
00516 return
00517 endif
00518
00519 call XF_OPEN_GROUP(xFileId, DATASETS_LOCATION, xDsetsId, status)
00520 if (status < 0) then
00521 call XF_CLOSE_FILE(xFileId, error)
00522 error = -1
00523 return
00524 endif
00525 else
00526
00527 call XF_CREATE_FILE(a_Filename, .TRUE., xFileId, error)
00528 if (error .LT. 0) then
00529
00530 call XF_CLOSE_FILE(xFileId, error)
00531 return
00532 endif
00533
00534
00535 call XF_CREATE_GENERIC_GROUP(xFileId, DATASETS_LOCATION, xDsetsId, status)
00536 if (status < 0) then
00537 call XF_CLOSE_FILE(xFileId, error)
00538 error = -1
00539 return
00540 endif
00541 endif
00542
00543
00544 call XF_CREATE_SCALAR_DATASET(xDsetsId, SCALAR_B_LOCATION, 'mg/L', &
00545 TS_HOURS, a_Compression, xScalarBId, status)
00546 if (status < 0) then
00547
00548 call XF_CLOSE_GROUP(xScalarBId, error)
00549 call XF_CLOSE_GROUP(xDsetsId, error)
00550 call XF_CLOSE_FILE(xFileId, error)
00551 error = status
00552 return
00553 endif
00554
00555
00556
00557 dJulianReftime = 2452822.0;
00558 call XF_WRITE_REFTIME(xScalarBId, dJulianReftime, status)
00559 if (status < 0) then
00560 call XF_CLOSE_GROUP(xScalarBId, error)
00561 call XF_CLOSE_GROUP(xDsetsId, error)
00562 call XF_CLOSE_FILE(xFileId, error)
00563 endif
00564
00565 if (.NOT. a_Overwrite) then
00566
00567 do iTimestep = 1, nTimes
00568
00569 dTime = iTimestep * 0.5
00570
00571 fValues(1) = dTime
00572 do i = 2, nValues
00573 fValues(i) = fValues(i-1)*2.5
00574 end do
00575
00576
00577 call XF_WRITE_SCALAR_TIMESTEP(xScalarBId, dTime, nValues, fValues, error)
00578 if (error .GE. 0) then
00579
00580 call XF_WRITE_ACTIVITY_TIMESTEP(xScalarBId, nActive, bActivity, error)
00581 end if
00582 if (error < 0) then
00583 call XF_CLOSE_GROUP(xScalarBId, error)
00584 call XF_CLOSE_GROUP(xDsetsId, error)
00585 call XF_CLOSE_FILE(xFileId, error)
00586 endif
00587 enddo
00588 else
00589
00590 do iTimestep = 1, nTimes
00591
00592 dTime = iTimestep * 1.5
00593
00594 fValues(1) = dTime
00595 do i = 2, nValues
00596 fValues(i) = fValues(i-1)*1.5
00597 end do
00598
00599
00600 call XF_WRITE_SCALAR_TIMESTEP(xScalarBId, dTime, nValues, fValues, error)
00601 if (error .GE. 0) then
00602
00603 call XF_WRITE_ACTIVITY_TIMESTEP(xScalarBId, nActive, bActivity, error)
00604 end if
00605 if (error < 0) then
00606 call XF_CLOSE_GROUP(xScalarBId, error)
00607 call XF_CLOSE_GROUP(xDsetsId, error)
00608 call XF_CLOSE_FILE(xFileId, error)
00609 endif
00610 enddo
00611 endif
00612
00613 if (.NOT. a_Overwrite) then
00614
00615
00616 call XF_CREATE_COORDINATE_GROUP(xFileId, xCoordId, status)
00617 if (status < 0) then
00618 call XF_CLOSE_GROUP(xScalarBId, error)
00619 call XF_CLOSE_GROUP(xDsetsId, error)
00620 call XF_CLOSE_FILE(xFileId, error)
00621 error = -1
00622 return
00623 endif
00624
00625
00626 call XF_SET_HORIZ_DATUM(xCoordId, HORIZ_DATUM_UTM, error)
00627 call XF_SET_HORIZ_UNITS(xCoordId, COORD_UNITS_METERS, error)
00628
00629 call XF_SET_VERT_DATUM(xCoordId, VERT_DATUM_LOCAL, error)
00630 call XF_SET_VERT_UNITS(xCoordId, COORD_UNITS_METERS, error)
00631
00632
00633 call XF_SET_UTM_ZONE(xCoordId, UTM_ZONE_MAX, error)
00634
00635 call XF_CLOSE_GROUP(xCoordId, error)
00636 xCoordId = 0
00637 endif
00638
00639
00640 call XF_CLOSE_GROUP(xScalarBId, error)
00641 call XF_CLOSE_GROUP(xDsetsId, error)
00642 call XF_CLOSE_FILE(xFileId, error)
00643
00644 error = 1
00645 return
00646 END SUBROUTINE
00647
00648
00649
00650
00651
00652
00653 SUBROUTINE TT_WRITE_COORDS_TO_MULTI (a_xFileId, error)
00654 INTEGER, INTENT(IN) :: a_xFileId
00655 INTEGER, INTENT(OUT) :: error
00656 INTEGER xCoordId
00657 INTEGER status
00658
00659
00660
00661 call XF_CREATE_COORDINATE_GROUP(a_xFileId, xCoordId, status)
00662 if (status < 0) then
00663 error = status
00664 return
00665 endif
00666
00667
00668 call XF_SET_HORIZ_DATUM(xCoordId, HORIZ_DATUM_UTM, error)
00669 call XF_SET_HORIZ_UNITS(xCoordId, COORD_UNITS_METERS, error)
00670
00671 call XF_SET_VERT_DATUM(xCoordId, VERT_DATUM_LOCAL, error)
00672 call XF_SET_VERT_UNITS(xCoordId, COORD_UNITS_METERS, error)
00673
00674
00675 call XF_SET_UTM_ZONE(xCoordId, UTM_ZONE_MAX, error)
00676
00677 call XF_CLOSE_GROUP(xCoordId, error)
00678 xCoordId = 0
00679
00680 return
00681 END SUBROUTINE
00682
00683
00684
00685
00686
00687
00688
00689
00690
00691
00692
00693 SUBROUTINE TT_WRITE_SCALAR_A_TO_MULTI (a_GroupID, status)
00694
00695
00696
00697 INTEGER xFileId, xDsetsId, xScalarAId
00698 INTEGER a_GroupID
00699 INTEGER nValues, nTimes, nActive
00700 REAL(DOUBLE) dTime, dJulianReftime
00701 INTEGER iTimestep, iActive
00702 REAL fValues(10)
00703 INTEGER*1 bActivity(10)
00704 INTEGER i, status
00705
00706
00707 nValues = 10
00708 nTimes = 3
00709 nActive = 8
00710 dTime = 0.0
00711
00712
00713 do iActive = 1, nActive
00714 bActivity(iActive) = 1
00715 enddo
00716 bActivity(6) = 0
00717
00718
00719 call XF_CREATE_SCALAR_DATASET(a_GroupID, SCALAR_A_LOCATION, 'mg/L', &
00720 TS_HOURS, NONE, xScalarAId, status)
00721 if (status .LT. 0) then
00722
00723 call XF_CLOSE_GROUP(xScalarAId, status)
00724 call XF_CLOSE_GROUP(xDsetsId, status)
00725 call XF_CLOSE_FILE(xFileId, status)
00726 return
00727 endif
00728
00729
00730
00731 dJulianReftime = 2452822.0;
00732 call XF_WRITE_REFTIME(xScalarAId, dJulianReftime, status)
00733 if (status < 0) then
00734 call XF_CLOSE_GROUP(xScalarAId, status)
00735 call XF_CLOSE_GROUP(xDsetsId, status)
00736 call XF_CLOSE_FILE(xFileId, status)
00737 endif
00738
00739
00740 do iTimestep = 1, nTimes
00741
00742 dTime = iTimestep * 0.5
00743
00744 fValues(1) = dTime
00745 do i = 2, nValues
00746 fValues(i) = fValues(i-1)*2.5
00747 end do
00748
00749
00750 call XF_WRITE_SCALAR_TIMESTEP(xScalarAId, dTime, nValues, fValues, status)
00751 if (status .GE. 0) then
00752
00753 call XF_WRITE_ACTIVITY_TIMESTEP(xScalarAId, nActive, bActivity, status)
00754 end if
00755
00756 call TTI_Test_Num_Times(xScalarAId, iTimestep, status)
00757 enddo
00758
00759
00760 call XF_CLOSE_GROUP(xScalarAId, status)
00761
00762
00763
00764 return
00765 END SUBROUTINE
00766
00767
00768
00769
00770
00771
00772 SUBROUTINE TT_READ_VECTOR2D_A_INDEX (a_Filename, a_Index, error)
00773 CHARACTER(LEN=*), INTENT(IN) :: a_Filename
00774 INTEGER, INTENT(IN) :: a_Index
00775 INTEGER, INTENT(OUT) :: error
00776 INTEGER status
00777 INTEGER xFileId, xDsetsId, xVector2DA
00778 INTEGER nTimesteps, i
00779 REAL, ALLOCATABLE :: fValues(:)
00780
00781 xFileId = NONE
00782 xDsetsId = NONE
00783 xVector2DA = NONE
00784
00785
00786 call XF_OPEN_FILE(a_Filename, .TRUE., xFileId, status)
00787 if (status < 0) then
00788 error = -1
00789 return
00790 endif
00791
00792
00793 call XF_OPEN_GROUP(xFileId, DATASETS_LOCATION, xDsetsId, status)
00794 if (status >= 0) then
00795 call XF_OPEN_GROUP(xDsetsId, VECTOR2D_A_LOCATION, xVector2DA, status)
00796 endif
00797 if (status < 0) then
00798 error = status
00799 return
00800 endif
00801
00802
00803 call XF_GET_DATASET_NUM_TIMES(xVector2DA, nTimesteps, status)
00804 if (status < 0) then
00805 error = status
00806 return
00807 endif
00808
00809 if (nTimesteps < 1) then
00810 error = -1
00811 return
00812 endif
00813
00814
00815 allocate(fValues(nTimesteps*2))
00816 call XF_READ_VECTOR_VALUES_AT_INDEX(xVector2DA, a_Index, 1, nTimesteps, 2, &
00817 fValues, status)
00818
00819
00820 WRITE(*,*) ''
00821 WRITE(*,*) 'Reading vector 2D A slice at index: ', a_Index
00822 do i=1, nTimesteps
00823 WRITE(*,*) fValues(i*2-1), ' ', fValues(i*2)
00824 enddo
00825 WRITE(*,*) ''
00826
00827 deallocate(fValues)
00828
00829 error = status
00830 return
00831
00832 END SUBROUTINE
00833
00834
00835
00836
00837
00838
00839
00840
00841
00842
00843
00844
00845 SUBROUTINE TT_WRITE_VECTOR2D_A (a_Filename, a_Compression, error)
00846 CHARACTER(LEN=*), INTENT(IN) :: a_Filename
00847 INTEGER, INTENT(IN) :: a_Compression
00848 INTEGER, INTENT(OUT) :: error
00849 INTEGER xFileId, xDsetsId, xVector2D_A, xCoordId
00850 INTEGER nValues, nTimes, nComponents, nActive
00851 REAL(DOUBLE) dTime
00852 INTEGER iTimestep, iActive
00853 REAL, DIMENSION(2, 100) :: fValues
00854 INTEGER*1 bActivity(100)
00855 INTEGER i, j, status
00856 INTEGER iHpgnZone
00857
00858
00859 nComponents = 2
00860 nValues = 100
00861 nTimes = 6
00862 nActive = 75
00863 dTime = 0.0
00864
00865
00866 bActivity(1) = 0
00867 do iActive = 2, nActive
00868 if (mod(iActive-1, 3) == 0) then
00869 bActivity(iActive) = 0
00870 else
00871 bActivity(iActive) = 1
00872 endif
00873 enddo
00874
00875
00876 call XF_CREATE_FILE(a_Filename, .TRUE., xFileId, error)
00877 if (error .LT. 0) then
00878
00879 call XF_CLOSE_FILE(xFileId, error)
00880 return
00881 endif
00882
00883
00884 call XF_CREATE_GENERIC_GROUP(xFileId, DATASETS_LOCATION, xDsetsId, status)
00885 if (status < 0) then
00886 call XF_CLOSE_FILE(xFileId, error)
00887 error = -1
00888 return
00889 endif
00890
00891
00892 call XF_CREATE_VECTOR_DATASET(xDsetsId, VECTOR2D_A_LOCATION, 'ft/s', &
00893 TS_SECONDS, a_Compression, xVector2D_A, status)
00894 if (status .LT. 0) then
00895
00896 call XF_CLOSE_GROUP(xVector2D_A, error)
00897 call XF_CLOSE_GROUP(xDsetsId, error)
00898 call XF_CLOSE_FILE(xFileId, error)
00899 error = status
00900 return
00901 endif
00902
00903
00904 do iTimestep = 1, nTimes
00905
00906 dTime = iTimestep * 0.5
00907
00908 do i = 1, nValues
00909 do j = 1, nComponents
00910 fValues(j,i) = ((i-1)*nComponents + j)*dTime
00911 end do
00912 end do
00913
00914
00915 call XF_WRITE_VECTOR_TIMESTEP(xVector2D_A, dTime, nValues, nComponents, &
00916 fValues, error)
00917 if (error .GE. 0) then
00918
00919 call XF_WRITE_ACTIVITY_TIMESTEP(xVector2D_A, nActive, bActivity, error)
00920 end if
00921
00922 call TTI_Test_Num_Times(xVector2d_A, iTimestep, error)
00923 enddo
00924
00925
00926
00927 call XF_CREATE_COORDINATE_GROUP(xFileId, xCoordId, status)
00928 if (status < 0) then
00929 call XF_CLOSE_GROUP(xVector2D_A, error)
00930 call XF_CLOSE_GROUP(xDsetsId, error)
00931 call XF_CLOSE_FILE(xFileId, error)
00932 error = -1
00933 return
00934 endif
00935
00936
00937 iHpgnZone = 29
00938
00939 call XF_SET_HORIZ_DATUM(xCoordId, HORIZ_DATUM_GEOGRAPHIC_HPGN, error)
00940 call XF_SET_HORIZ_UNITS(xCoordId, COORD_UNITS_METERS, error)
00941 call XF_SET_VERT_DATUM(xCoordId, VERT_DATUM_LOCAL, error)
00942 call XF_SET_VERT_UNITS(xCoordId, COORD_UNITS_METERS, error)
00943
00944
00945 call XF_SET_HPGN_AREA(xCoordId, iHpgnZone, error)
00946
00947 call XF_CLOSE_GROUP(xCoordId, error)
00948 xCoordId = 0
00949
00950
00951 call XF_CLOSE_GROUP(xVector2D_A, error)
00952 call XF_CLOSE_GROUP(xDsetsId, error)
00953 call XF_CLOSE_FILE(xFileId, error)
00954
00955 return
00956 END SUBROUTINE
00957
00958
00959
00960
00961
00962
00963
00964
00965
00966
00967
00968
00969 SUBROUTINE TT_WRITE_VECTOR2D_B (a_Filename, a_Compression, a_Overwrite, error)
00970 CHARACTER(LEN=*), INTENT(IN) :: a_Filename
00971 INTEGER, INTENT(IN) :: a_Compression
00972 LOGICAL, INTENT(IN) :: a_Overwrite
00973 INTEGER, INTENT(OUT) :: error
00974 INTEGER xFileId, xDsetsId, xVector2D_B, xCoordId
00975 INTEGER nValues, nTimes, nComponents, nActive
00976 REAL(DOUBLE) dTime
00977 INTEGER iTimestep, iActive
00978 REAL, DIMENSION(2, 100) :: fValues
00979 INTEGER*1 bActivity(100)
00980 INTEGER i, j, status
00981
00982
00983 nComponents = 2
00984 nValues = 100
00985 nTimes = 6
00986 nActive = 75
00987 dTime = 0.0
00988
00989
00990 bActivity(1) = 0
00991 do iActive = 2, nActive
00992 if (mod(iActive-1, 3) == 0) then
00993 bActivity(iActive) = 0
00994 else
00995 bActivity(iActive) = 1
00996 endif
00997 enddo
00998
00999 if (a_Overwrite) then
01000
01001 call XF_OPEN_FILE(a_Filename, .FALSE., xFileId, status)
01002 if (status < 0) then
01003 error = -1
01004 return
01005 endif
01006
01007 call XF_OPEN_GROUP(xFileId, DATASETS_LOCATION, xDsetsId, status)
01008 if (status < 0) then
01009 call XF_CLOSE_FILE(xFileId, error)
01010 error = -1
01011 return
01012 endif
01013 else
01014
01015 call XF_CREATE_FILE(a_Filename, .TRUE., xFileId, error)
01016 if (error .LT. 0) then
01017
01018 call XF_CLOSE_FILE(xFileId, error)
01019 return
01020 endif
01021
01022
01023 call XF_CREATE_GENERIC_GROUP(xFileId, DATASETS_LOCATION, xDsetsId, status)
01024 if (status < 0) then
01025 call XF_CLOSE_FILE(xFileId, error)
01026 error = -1
01027 return
01028 endif
01029 endif
01030
01031
01032 call XF_CREATE_VECTOR_DATASET(xDsetsId, VECTOR2D_B_LOCATION, 'ft/s', &
01033 TS_SECONDS, a_Compression, xVector2D_B, status)
01034 if (status .LT. 0) then
01035
01036 call XF_CLOSE_GROUP(xVector2D_B, error)
01037 call XF_CLOSE_GROUP(xDsetsId, error)
01038 call XF_CLOSE_FILE(xFileId, error)
01039 error = status
01040 return
01041 endif
01042
01043 if (.NOT. a_Overwrite) then
01044
01045 do iTimestep = 1, nTimes
01046
01047 dTime = iTimestep * 0.5
01048 do i = 1, nValues
01049 do j = 1, nComponents
01050 fValues(j,i) = ((i-1)*nComponents + j)*dTime
01051 end do
01052 end do
01053
01054 call XF_WRITE_VECTOR_TIMESTEP(xVector2D_B, dTime, nValues, nComponents, &
01055 fValues, error)
01056 if (error .GE. 0) then
01057
01058 call XF_WRITE_ACTIVITY_TIMESTEP(xVector2D_B, nActive, bActivity, error)
01059 end if
01060 if (error < 0) then
01061 call XF_CLOSE_GROUP(xVector2D_B, error)
01062 call XF_CLOSE_GROUP(xDsetsId, error)
01063 call XF_CLOSE_FILE(xFileId, error)
01064 endif
01065 enddo
01066 else
01067
01068 do iTimestep = 1, nTimes
01069
01070 dTime = iTimestep * 1.5
01071 do i = 1, nValues
01072 do j = 1, nComponents
01073 fValues(j,i) = ((i-1)*nComponents + j)*dTime
01074 end do
01075 end do
01076
01077 call XF_WRITE_VECTOR_TIMESTEP(xVector2D_B, dTime, nValues, nComponents, &
01078 fValues, error)
01079 if (error .GE. 0) then
01080
01081 call XF_WRITE_ACTIVITY_TIMESTEP(xVector2D_B, nActive, bActivity, error)
01082 end if
01083 if (error < 0) then
01084 call XF_CLOSE_GROUP(xVector2D_B, error)
01085 call XF_CLOSE_GROUP(xDsetsId, error)
01086 call XF_CLOSE_FILE(xFileId, error)
01087 endif
01088 enddo
01089 endif
01090
01091 if (.NOT. a_Overwrite) then
01092
01093
01094 call XF_CREATE_COORDINATE_GROUP(xFileId, xCoordId, status)
01095 if (status < 0) then
01096 call XF_CLOSE_GROUP(xVector2D_B, error)
01097 call XF_CLOSE_GROUP(xDsetsId, error)
01098 call XF_CLOSE_FILE(xFileId, error)
01099 error = -1
01100 return
01101 endif
01102
01103
01104 call XF_SET_HORIZ_DATUM(xCoordId, HORIZ_DATUM_UTM, error)
01105 call XF_SET_HORIZ_UNITS(xCoordId, COORD_UNITS_METERS, error)
01106 call XF_SET_VERT_DATUM(xCoordId, VERT_DATUM_LOCAL, error)
01107 call XF_SET_VERT_UNITS(xCoordId, COORD_UNITS_METERS, error)
01108
01109
01110 call XF_SET_UTM_ZONE(xCoordId, UTM_ZONE_MAX, error)
01111
01112 call XF_CLOSE_GROUP(xCoordId, error)
01113 xCoordId = 0
01114 endif
01115
01116
01117 call XF_CLOSE_GROUP(xVector2D_B, error)
01118 call XF_CLOSE_GROUP(xDsetsId, error)
01119 call XF_CLOSE_FILE(xFileId, error)
01120
01121 return
01122 END SUBROUTINE
01123
01124
01125
01126
01127
01128
01129
01130
01131
01132
01133
01134
01135 SUBROUTINE TT_WRITE_VECTOR2D_A_TO_MULTI (a_FileID, a_GroupID, status)
01136 INTEGER xVector2D_A
01137 INTEGER a_FileID, a_GroupID
01138 INTEGER nValues, nTimes, nComponents, nActive
01139 REAL(DOUBLE) dTime
01140 INTEGER iTimestep, iActive
01141 REAL, DIMENSION(2, 100) :: fValues
01142 INTEGER*1 bActivity(100)
01143 INTEGER i, j, status
01144
01145
01146 nComponents = 2
01147 nValues = 100
01148 nTimes = 6
01149 nActive = 75
01150 dTime = 0.0
01151
01152
01153 bActivity(1) = 0
01154 do iActive = 2, nActive
01155 if (mod(iActive-1, 3) == 0) then
01156 bActivity(iActive) = 0
01157 else
01158 bActivity(iActive) = 1
01159 endif
01160 enddo
01161
01162
01163 call XF_CREATE_VECTOR_DATASET(a_GroupID, VECTOR2D_A_LOCATION, 'ft/s', &
01164 TS_SECONDS, NONE, xVector2D_A, status)
01165 if (status .LT. 0) then
01166
01167 call XF_CLOSE_GROUP(xVector2D_A, status)
01168 call XF_CLOSE_GROUP(a_GroupID, status)
01169 call XF_CLOSE_FILE(a_FileID, status)
01170 return
01171 endif
01172
01173
01174 do iTimestep = 1, nTimes
01175
01176 dTime = iTimestep * 0.5
01177
01178 do i = 1, nValues
01179 do j = 1, nComponents
01180 fValues(j,i) = ((i-1)*nComponents + j)*dTime
01181 end do
01182 end do
01183
01184
01185 call XF_WRITE_VECTOR_TIMESTEP(xVector2D_A, dTime, nValues, nComponents, &
01186 fValues, status)
01187 if (status .GE. 0) then
01188
01189 call XF_WRITE_ACTIVITY_TIMESTEP(xVector2D_A, nActive, bActivity, status)
01190 end if
01191
01192 call TTI_Test_Num_Times(xVector2D_A, iTimestep, status)
01193 enddo
01194
01195
01196 call XF_CLOSE_GROUP(xVector2D_A, status)
01197 return
01198 END SUBROUTINE
01199
01200
01201
01202
01203
01204
01205
01206 SUBROUTINE TTI_READ_SCALAR (a_xScalarId, FileUnit, error)
01207 INTEGER, INTENT(IN) :: a_xScalarId
01208 INTEGER, INTENT(IN) :: FileUnit
01209 INTEGER, INTENT(OUT) :: error
01210 INTEGER nTimes, nValues, nActive
01211 LOGICAL*2 bUseReftime
01212 INTEGER iTime
01213 CHARACTER(LEN=100) TimeUnits
01214 REAL(DOUBLE), ALLOCATABLE :: Times(:)
01215 REAL, ALLOCATABLE :: Values(:), Minimums(:), Maximums(:)
01216 INTEGER, ALLOCATABLE :: Active(:)
01217 REAL(DOUBLE) Reftime
01218 nTimes = NONE
01219 nValues = NONE
01220 nActive = None
01221
01222
01223 call XF_GET_DATASET_TIME_UNITS(a_xScalarId, TimeUnits, error)
01224 if (error < 0) return
01225
01226 WRITE(FileUnit,*) 'Time units: ', TimeUnits(1:LEN_TRIM(TimeUnits))
01227
01228
01229 call XF_USE_REFTIME (a_xScalarId, bUseReftime, error)
01230 if (error < 0) then
01231 return
01232 endif
01233 if (bUseReftime) then
01234 call XF_READ_REFTIME (a_xScalarId, Reftime, error)
01235 if (error < 0) then
01236 return
01237 endif
01238 WRITE(FileUnit,*) 'Reftime: ', Reftime
01239 endif
01240
01241
01242 call XF_GET_DATASET_NUMVALS(a_xScalarId, nValues, error)
01243 if (error .GE. 0) then
01244 call XF_GET_DATASET_NUMACTIVE(a_xScalarId, nActive, error)
01245 endif
01246 if (error .LT. 0) return
01247
01248 if (nValues <= 0) then
01249 WRITE(FileUnit, *) 'No data to read in.'
01250 error = -1
01251 return
01252 endif
01253
01254
01255 call XF_GET_DATASET_NUM_TIMES(a_xScalarId, nTimes, error)
01256 if (error < 0) then
01257 return
01258 endif
01259
01260
01261 allocate(Times(nTimes))
01262
01263 call XF_GET_DATASET_TIMES(a_xScalarId, nTimes, Times, error)
01264 if (error < 0) return
01265
01266
01267 allocate(Minimums(nTimes))
01268 allocate(Maximums(nTimes))
01269
01270 call XF_GET_DATASET_MINS(a_xScalarId, nTimes, Minimums, error)
01271 if (error >= 0) then
01272 call XF_GET_DATASET_MAXS(a_xScalarId, nTimes, Maximums, error)
01273 endif
01274 if (error < 0) then
01275 deallocate(Times)
01276 deallocate(Minimums)
01277 deallocate(Maximums)
01278 return
01279 endif
01280
01281 allocate(Values(nValues))
01282 if (nActive .GT. 0) then
01283 allocate(Active(nActive))
01284 endif
01285
01286 WRITE(FileUnit,*) 'Number Timesteps: ', nTimes
01287 WRITE(FileUnit,*) 'Number Values: ', nValues
01288 WRITE(FileUnit,*) 'Number Active: ', nActive
01289 WRITE(FileUnit,*) ''
01290
01291
01292
01293 do iTime = 1, nTimes
01294 call XF_READ_SCALAR_VALUES_TIMESTEP(a_xScalarId, iTime, nValues, Values, error)
01295 if (error >= 0 .AND. nActive > 0) then
01296 call XF_READ_ACTIVITY_TIMESTEP(a_xScalarId, iTime, nActive, Active, error)
01297 endif
01298
01299
01300
01301 WRITE(FileUnit,*) 'Timestep at ', Times(iTime)
01302 WRITE(FileUnit,*) 'Min: ', Minimums(iTime)
01303 WRITE(FileUnit,*) 'Max: ', Maximums(iTime)
01304
01305 WRITE(FileUnit,*) 'Values:'
01306 WRITE(FileUnit,*) Values(1:nValues)
01307 WRITE(FileUnit,*) ''
01308
01309 WRITE(FileUnit,*) 'Activity:'
01310 WRITE(FileUnit,*) Active(1:nActive)
01311 WRITE(FileUnit,*) ''
01312 end do
01313
01314 if (allocated(Times)) then
01315 deallocate(Times)
01316 endif
01317
01318 if (allocated(Minimums)) then
01319 deallocate(Minimums)
01320 endif
01321
01322 if (allocated(Maximums)) then
01323 deallocate(Maximums)
01324 endif
01325
01326 if (allocated(Values)) then
01327 deallocate(Values)
01328 endif
01329
01330 if (allocated(Active)) then
01331 deallocate(Active)
01332 endif
01333
01334 return
01335 END SUBROUTINE
01336
01337
01338
01339
01340
01341
01342
01343
01344 SUBROUTINE TTI_READ_VECTOR (a_xVectorId, FileUnit, error)
01345 INTEGER, INTENT(IN) :: a_xVectorId
01346 INTEGER, INTENT(IN) :: FileUnit
01347 INTEGER, INTENT(OUT) :: error
01348 INTEGER nTimes, nValues, nActive, nComponents
01349 INTEGER iTime, i
01350 LOGICAL*2 bUseReftime
01351 CHARACTER(LEN=100) TimeUnits
01352 REAL(DOUBLE), ALLOCATABLE :: Times(:)
01353 REAL, ALLOCATABLE, DIMENSION (:, :) :: Values
01354 REAL, ALLOCATABLE :: Minimums(:), Maximums(:)
01355 INTEGER, ALLOCATABLE :: Active(:)
01356 REAL(DOUBLE) Reftime
01357
01358 nTimes = NONE
01359 nValues = NONE
01360 nActive = NONE
01361 nComponents = NONE
01362
01363
01364 call XF_GET_DATASET_TIME_UNITS(a_xVectorId, TimeUnits, error)
01365 if (error < 0) return
01366
01367 WRITE(FileUnit,*) 'Time units: ', TimeUnits(1:LEN_TRIM(TimeUnits))
01368
01369
01370 call XF_USE_REFTIME (a_xVectorId, bUseReftime, error)
01371 if (error < 0) then
01372 return
01373 endif
01374 if (bUseReftime) then
01375 call XF_READ_REFTIME (a_xVectorId, Reftime, error)
01376 if (error < 0) then
01377 return
01378 endif
01379 WRITE(FileUnit,*) 'Reftime: ', Reftime
01380 endif
01381
01382
01383 call XF_GET_DATASET_NUMVALS(a_xVectorId, nValues, error)
01384 if (error .GE. 0) then
01385 call XF_GET_DATASET_NUMCOMPONENTS(a_xVectorId, nComponents, error)
01386 if (error .GE. 0) then
01387 call XF_GET_DATASET_NUMACTIVE(a_xVectorId, nActive, error)
01388 endif
01389 endif
01390 if (error .LT. 0) return
01391
01392 if (nValues <= 0) then
01393 WRITE(FileUnit, *) 'No data to read in.'
01394 error = -1
01395 return
01396 endif
01397
01398
01399 call XF_GET_DATASET_NUM_TIMES(a_xVectorId, nTimes, error)
01400 if (error < 0) then
01401 return
01402 endif
01403
01404
01405 allocate(Times(nTimes))
01406
01407 call XF_GET_DATASET_TIMES(a_xVectorId, nTimes, Times, error)
01408 if (error < 0) return
01409
01410
01411 allocate(Minimums(nTimes))
01412 allocate(Maximums(nTimes))
01413
01414 call XF_GET_DATASET_MINS(a_xVectorId, nTimes, Minimums, error)
01415 if (error >= 0) then
01416 call XF_GET_DATASET_MAXS(a_xVectorId, nTimes, Maximums, error)
01417 endif
01418 if (error < 0) then
01419 deallocate(Times)
01420 deallocate(Minimums)
01421 deallocate(Maximums)
01422 return
01423 endif
01424
01425 allocate(Values(nComponents, nValues))
01426 if (nActive .GT. 0) then
01427 allocate(Active(nActive))
01428 endif
01429
01430 WRITE(FileUnit,*) 'Number Timesteps: ', nTimes
01431 WRITE(FileUnit,*) 'Number Values: ', nValues
01432 WRITE(FileUnit,*) 'Number Components: ', nComponents
01433 WRITE(FileUnit,*) 'Number Active: ', nActive
01434
01435
01436
01437 do iTime = 1, nTimes
01438 call XF_READ_VECTOR_VALUES_TIMESTEP(a_xVectorId, iTime, nValues, &
01439 nComponents, Values, error)
01440 if (error >= 0 .AND. nActive > 0) then
01441 call XF_READ_ACTIVITY_TIMESTEP(a_xVectorId, iTime, nActive, Active, error)
01442 endif
01443
01444
01445
01446 WRITE(FileUnit,*) ''
01447 WRITE(FileUnit,*) 'Timestep at ', Times(iTime)
01448 WRITE(FileUnit,*) 'Min: ', Minimums(iTime)
01449 WRITE(FileUnit,*) 'Max: ', Maximums(iTime)
01450
01451 WRITE(FileUnit,*) 'Values:'
01452 do i=1, nValues
01453 WRITE(FileUnit,*) Values(1:nComponents,i:i)
01454 enddo
01455 WRITE(FileUnit,*) ''
01456
01457 WRITE(FileUnit,*) 'Activity:'
01458 WRITE(FileUnit,*) Active(1:nActive)
01459 WRITE(FileUnit,*) ''
01460 WRITE(FileUnit,*) ''
01461
01462 end do
01463
01464 if (allocated(Times)) then
01465 deallocate(Times)
01466 endif
01467
01468 if (allocated(Minimums)) then
01469 deallocate(Minimums)
01470 endif
01471
01472 if (allocated(Maximums)) then
01473 deallocate(Maximums)
01474 endif
01475
01476 if (allocated(Values)) then
01477 deallocate(Values)
01478 endif
01479
01480 if (allocated(Active)) then
01481 deallocate(Active)
01482 endif
01483
01484 return
01485 END SUBROUTINE
01486
01487
01488 END MODULE TestTimestep
TestTimestep.f90 tests timesteps
00001 MODULE TestDefs
00002
00003 INTEGER, PARAMETER :: NUMTIMES1 = 5
00004 INTEGER, PARAMETER :: NUMVALUES1 = 5
00005 INTEGER, PARAMETER :: NUMACTIVE1 = 3
00006 INTEGER, PARAMETER :: NUMTIMESADD = 1
00007
00008 CHARACTER(LEN=*), PARAMETER :: XMDF_VERSION_OUT_F = 'XMDF_Version_f.txt'
00009 CHARACTER(LEN=*), PARAMETER :: MESH_A_FILE_F = 'mesh_a_file_f.h5'
00010 CHARACTER(LEN=*), PARAMETER :: MESH_B_FILE_F = 'mesh_b_file_f.h5'
00011 CHARACTER(LEN=*), PARAMETER :: MESH_A_OUT_F = 'mesh_a_file_f.txt'
00012 CHARACTER(LEN=*), PARAMETER :: MESH_B_OUT_F = 'mesh_b_file_f.txt'
00013
00014 CHARACTER(LEN=*), PARAMETER :: GRID_CART2D_A_FILE_F = 'grid_cart2d_a_file_f.h5'
00015 CHARACTER(LEN=*), PARAMETER :: GRID_CURV2D_A_FILE_F = 'grid_curv2d_a_file_f.h5'
00016 CHARACTER(LEN=*), PARAMETER :: GRID_CART3D_A_FILE_F = 'grid_cart3d_a_file_f.h5'
00017
00018 CHARACTER(LEN=*), PARAMETER :: GRID_CART2D_A_OUT_F = 'grid_cart2d_a_out_f.txt'
00019 CHARACTER(LEN=*), PARAMETER :: GRID_CURV2D_A_OUT_F = 'grid_curv2d_a_out_f.txt'
00020 CHARACTER(LEN=*), PARAMETER :: GRID_CART3D_A_OUT_F = 'grid_cart3d_a_out_f.txt'
00021
00022 CHARACTER(LEN=*), PARAMETER :: MULTIDATASET_FILE_F = 'MultiDataSet_f.h5'
00023 CHARACTER(LEN=*), PARAMETER :: MULTIDATASET_TEXT_F = 'MultiDataSet_f.txt'
00024
00025 CHARACTER(LEN=*), PARAMETER :: SCALAR_A_FILE_F = 'ScalarA_f.h5'
00026 CHARACTER(LEN=*), PARAMETER :: SCALAR_A_TEXT_F = 'ScalarA_f.txt'
00027 CHARACTER(LEN=*), PARAMETER :: SCALAR_A_PIECES_FILE_F = 'ScalarA_Pieces_f.h5'
00028 CHARACTER(LEN=*), PARAMETER :: SCALAR_A_EDITED_FILE_F = 'ScalarA_edited_f.h5'
00029 CHARACTER(LEN=*), PARAMETER :: SCALAR_A_EDITED_TEXT_F = 'ScalarA_edited_f.txt'
00030 CHARACTER(LEN=*), PARAMETER :: SCALAR_B_FILE_F = 'ScalarB_f.h5'
00031 CHARACTER(LEN=*), PARAMETER :: SCALAR_B_TEXT_F = 'ScalarB_f.txt'
00032 CHARACTER(LEN=*), PARAMETER :: VECTOR2D_A_FILE_F = 'Vector2D_A_f.h5'
00033 CHARACTER(LEN=*), PARAMETER :: VECTOR2D_A_TEXT_F = 'Vector2D_A_f.txt'
00034 CHARACTER(LEN=*), PARAMETER :: VECTOR2D_A_PIECES_FILE_F = 'Vector2D_A_Pieces_f.h5'
00035 CHARACTER(LEN=*), PARAMETER :: VECTOR2D_B_FILE_F = 'Vector2D_B_f.h5'
00036 CHARACTER(LEN=*), PARAMETER :: VECTOR2D_B_TEXT_F = 'Vector2D_B_f.txt'
00037
00038 CHARACTER(LEN=*), PARAMETER :: MESH_A_FILE_C = 'mesh_a_file_c.h5'
00039 CHARACTER(LEN=*), PARAMETER :: MESH_B_FILE_C = 'mesh_b_file_c.h5'
00040 CHARACTER(LEN=*), PARAMETER :: MESH_A_OUT_CF = 'mesh_a_file_cf.txt'
00041 CHARACTER(LEN=*), PARAMETER :: MESH_B_OUT_CF = 'mesh_b_file_cf.txt'
00042
00043 CHARACTER(LEN=*), PARAMETER :: GRID_CART2D_A_FILE_C = 'grid_cart2d_a_file_c.h5'
00044 CHARACTER(LEN=*), PARAMETER :: GRID_CURV2D_A_FILE_C = 'grid_curv2d_a_file_c.h5'
00045 CHARACTER(LEN=*), PARAMETER :: GRID_CART3D_A_FILE_C = 'grid_cart3d_a_file_c.h5'
00046
00047 CHARACTER(LEN=*), PARAMETER :: GRID_CART2D_A_OUT_CF = 'grid_cart2d_a_out_cf.txt'
00048 CHARACTER(LEN=*), PARAMETER :: GRID_CURV2D_A_OUT_CF = 'grid_curv2d_a_out_cf.txt'
00049 CHARACTER(LEN=*), PARAMETER :: GRID_CART3D_A_OUT_CF = 'grid_cart3d_a_out_cf.txt'
00050
00051 CHARACTER(LEN=*), PARAMETER :: SCALAR_A_FILE_C = 'ScalarA_c.h5'
00052 CHARACTER(LEN=*), PARAMETER :: SCALAR_A_TEXT_CF = 'ScalarA_cf.txt'
00053 CHARACTER(LEN=*), PARAMETER :: SCALAR_B_FILE_C = 'ScalarB_c.h5'
00054 CHARACTER(LEN=*), PARAMETER :: SCALAR_B_TEXT_CF = 'ScalarB_cf.txt'
00055 CHARACTER(LEN=*), PARAMETER :: VECTOR2D_A_FILE_C = 'Vector2D_A_c.h5'
00056 CHARACTER(LEN=*), PARAMETER :: VECTOR2D_A_TEXT_CF = 'Vector2D_A_cf.txt'
00057 CHARACTER(LEN=*), PARAMETER :: VECTOR2D_B_FILE_C = 'Vector2D_B_c.h5'
00058 CHARACTER(LEN=*), PARAMETER :: VECTOR2D_B_TEXT_CF = 'Vector2D_B_cf.txt'
00059
00060 CHARACTER(LEN=*), PARAMETER :: CALENDAR_OUT_F = 'Calendar_f.txt'
00061
00062 CHARACTER(LEN=*), PARAMETER :: GEOMPATH_A_FILE_F = 'Geompath_a_file_f.h5'
00063 CHARACTER(LEN=*), PARAMETER :: GEOMPATH_A_FILE_F_OUT = 'Geompath_a_file_f_out.txt'
00064
00065 CHARACTER(LEN=*), PARAMETER :: TT_MULTIDATASET_FILE_F = 'TT_MultiDataSet_f.h5'
00066 CHARACTER(LEN=*), PARAMETER :: TT_SCALAR_A_FILE_F = 'TT_ScalarA_f.h5'
00067 CHARACTER(LEN=*), PARAMETER :: TT_SCALAR_A_TEXT_F = 'TT_ScalarA_f.txt'
00068 CHARACTER(LEN=*), PARAMETER :: TT_VECTOR2D_A_FILE_F = 'TT_Vector2D_A_f.h5'
00069
00070
00071
00072
00073
00074
00075 END MODULE TestDefs
00076
00077 MODULE TestsModule
00078
00079 USE XMDF
00080 USE XMDFDEFS
00081 USE TestTimestep
00082 USE TestDatasets
00083 USE TestMesh
00084 USE TestGrid
00085 USE TestDefs
00086 USE TestGeomPaths
00087
00088 CONTAINS
00089
00090
00091
00092
00093
00094
00095
00096 SUBROUTINE TXI_TEST_TIMESTEPS(error)
00097 INTEGER, INTENT(OUT) :: error
00098 INTEGER status, compression
00099 INTEGER MultiFileId, MultiGroupId
00100 INTEGER NumOpen
00101
00102 CHARACTER(LEN=37) SdoGuid
00103
00104 SdoGuid = '73289C80-6235-4fdc-9649-49E4F5AEB676'
00105
00106 status = 1
00107 compression = NONE
00108
00109 call XF_SETUP_TO_WRITE_DATASETS(TT_MULTIDATASET_FILE_F, 'Multidatasets','', &
00110 SdoGuid, XF_OVERWRITE_CLEAR_FILE, MultiFileId, MultiGroupId, error)
00111
00112
00113 call TT_WRITE_COORDS_TO_MULTI(MultiFileId, error)
00114
00115
00116 call TT_WRITE_SCALAR_A_TO_MULTI(MultiGroupId, error)
00117
00118 call TT_WRITE_VECTOR2D_A_TO_MULTI(MultiFileId, MultiGroupId, error)
00119
00120 call XF_CLOSE_GROUP(MultiGroupId, status)
00121 call XF_CLOSE_FILE(MultiFileId, status)
00122
00123 WRITE(*,*) 'Done writing multiple datasets...'
00124
00125
00126 call TT_WRITE_SCALAR_A(TT_SCALAR_A_FILE_F, compression, status)
00127 if (status < 0) then
00128 error = status
00129 return
00130 endif
00131
00132 WRITE(*,*) 'Done writing scalar datasets...'
00133
00134
00135 call TT_WRITE_VECTOR2D_A(TT_VECTOR2D_A_FILE_F, compression, status)
00136 if (status < 0) then
00137 WRITE(*,*) 'Error writing dataset vector2D_A.'
00138 error = status
00139 return
00140 endif
00141
00142 WRITE(*,*) 'Done writing vector datasets...'
00143
00144 WRITE(*,*) 'Write edited scalar datasets...'
00145 call TD_EDIT_SCALAR_A_VALUES(SCALAR_A_EDITED_FILE_F, compression, status);
00146 if (status < 0) then
00147 error = status
00148 return
00149 endif
00150
00151 WRITE(*,*) 'Done writing datasets...'
00152
00153
00154 call TXI_READ_X_FORMAT_FILE(TT_SCALAR_A_FILE_F, SCALAR_A_TEXT_F, status)
00155 if (status < 0) then
00156 WRITE(*,*) 'Error reading SCALAR A File (see TXI_READ_X_FORMAT_FILE)'
00157 error = status
00158 return
00159 endif
00160
00161 call TXI_READ_X_FORMAT_FILE(SCALAR_A_EDITED_FILE_F, SCALAR_A_EDITED_TEXT_F, status)
00162 if (status < 0) then
00163 WRITE(*,*) 'Error reading SCALAR A Edited File (see TXI_READ_X_FORMAT_FILE)'
00164 error = status
00165 return
00166 endif
00167
00168 call TXI_READ_X_FORMAT_FILE(TT_VECTOR2D_A_FILE_F, VECTOR2D_A_TEXT_F, status)
00169 if (status < 0) then
00170 WRITE(*,*) 'Error reading VECTOR A Format File'
00171 error = status
00172 return
00173 endif
00174
00175 call TXI_READ_X_FORMAT_FILE(TT_MULTIDATASET_FILE_F, MULTIDATASET_TEXT_F, status)
00176 if (status < 0) then
00177 WRITE(*,*) 'Error reading Multidataset File (see TXI_READ_X_FORMAT_FILE)'
00178 error = status
00179 return
00180 endif
00181
00182 WRITE(*,*) 'Done reading datasets...'
00183
00184 call XF_GET_NUM_OPEN_IDENTIFIERS(H5F_OBJ_ALL_F, NumOpen, error)
00185
00186 call XFI_CLOSE_OPEN_IDENTIFIERS(H5F_OBJ_ALL_F, error)
00187
00188 call XF_SETUP_TO_WRITE_DATASETS(TT_MULTIDATASET_FILE_F, 'Multidatasets','', &
00189 SdoGuid, XF_OVERWRITE_CLEAR_DATASET_GRP, MultiFileId, MultiGroupId, &
00190 error)
00191
00192 call TT_WRITE_SCALAR_A_TO_MULTI(MultiGroupId, error)
00193
00194 call XF_SETUP_TO_WRITE_DATASETS(TT_MULTIDATASET_FILE_F, 'Multidatasets','', &
00195 SdoGuid, XF_OVERWRITE_NONE, MultiFileId, MultiGroupId, error)
00196
00197 call TT_WRITE_VECTOR2D_A_TO_MULTI(MultiFileId, MultiGroupId, error)
00198
00199
00200 call TT_READ_SCALAR_A_INDEX(TT_SCALAR_A_FILE_F, 4, status)
00201 if (status < 0) then
00202 error = status
00203 return
00204 endif
00205
00206 WRITE(*,*) 'Done reading scalar data at index.'
00207
00208 call TT_READ_VECTOR2D_A_INDEX(TT_VECTOR2D_A_FILE_F, 6, status)
00209 if (status < 0) then
00210 error = status
00211 return
00212 endif
00213
00214 WRITE(*,*) 'Done reading vector data at index.'
00215
00216 call TT_READ_ACTIVITY_SCALAR_A_INDEX(TT_SCALAR_A_FILE_F, 6, status)
00217 if (status < 0) then
00218 error = status
00219 return
00220 endif
00221
00222 error = status
00223 return
00224
00225 END SUBROUTINE
00226
00227
00228
00229
00230
00231
00232
00233
00234 SUBROUTINE TXI_TEST_DATASETS(error)
00235 INTEGER, INTENT(OUT) :: error
00236 INTEGER status, compression
00237 INTEGER MultiFileId, MultiGroupId
00238 INTEGER NumOpen
00239 INTEGER, PARAMETER :: nIndices = 3
00240 INTEGER, DIMENSION(nIndices) :: indices
00241
00242 CHARACTER(LEN=37) SdoGuid
00243
00244 SdoGuid = '73289C80-6235-4fdc-9649-49E4F5AEB676'
00245
00246 status = 1
00247 compression = NONE
00248
00249 call XF_SETUP_TO_WRITE_DATASETS(MULTIDATASET_FILE_F, 'Multidatasets','', &
00250 SdoGuid, XF_OVERWRITE_CLEAR_FILE, MultiFileId, MultiGroupId, error)
00251
00252
00253 call TD_WRITE_COORDS_TO_MULTI(MultiFileId, error)
00254
00255
00256 call TD_WRITE_SCALAR_A_TO_MULTI(MultiGroupId, error)
00257
00258 call TD_WRITE_VECTOR2D_A_TO_MULTI(MultiFileId, MultiGroupId, error)
00259
00260 call XF_CLOSE_GROUP(MultiGroupId, status)
00261 call XF_CLOSE_FILE(MultiFileId, status)
00262
00263 WRITE(*,*) 'Done writing multiple datasets...'
00264
00265
00266 call TD_WRITE_SCALAR_A(SCALAR_A_FILE_F, compression, status)
00267 if (status < 0) then
00268 error = status
00269 return
00270 endif
00271
00272 call TD_WRITE_SCALAR_A_PIECES(SCALAR_A_PIECES_FILE_F, compression, status)
00273 if (status < 0) then
00274 error = status
00275 return
00276 endif
00277
00278 WRITE(*,*) 'Done writing scalar datasets...'
00279
00280
00281 call TD_WRITE_VECTOR2D_A(VECTOR2D_A_FILE_F, compression, status)
00282 if (status < 0) then
00283 WRITE(*,*) 'Error writing dataset vector2D_A.'
00284 error = status
00285 return
00286 endif
00287
00288 call TD_WRITE_VECTOR2D_A_PIECES(VECTOR2D_A_PIECES_FILE_F, compression, status)
00289 if (status < 0) then
00290 WRITE(*,*) 'Error writing dataset vector2D_A.'
00291 error = status
00292 return
00293 endif
00294
00295 WRITE(*,*) 'Done writing vector datasets...'
00296
00297 WRITE(*,*) 'Done writing datasets...'
00298
00299
00300 call TXI_READ_X_FORMAT_FILE(SCALAR_A_FILE_F, SCALAR_A_TEXT_F, status)
00301 if (status < 0) then
00302 WRITE(*,*) 'Error reading SCALAR A File (see TXI_READ_X_FORMAT_FILE)'
00303 error = status
00304 return
00305 endif
00306
00307 call TXI_READ_X_FORMAT_FILE(VECTOR2D_A_FILE_F, VECTOR2D_A_TEXT_F, status)
00308 if (status < 0) then
00309 WRITE(*,*) 'Error reading VECTOR A Format File'
00310 error = status
00311 return
00312 endif
00313
00314 call TXI_READ_X_FORMAT_FILE(MULTIDATASET_FILE_F, MULTIDATASET_TEXT_F, status)
00315 if (status < 0) then
00316 WRITE(*,*) 'Error reading Multidataset File (see TXI_READ_X_FORMAT_FILE)'
00317 error = status
00318 return
00319 endif
00320
00321 WRITE(*,*) 'Done reading datasets...'
00322
00323 call XF_GET_NUM_OPEN_IDENTIFIERS(H5F_OBJ_ALL_F, NumOpen, error)
00324
00325 call XFI_CLOSE_OPEN_IDENTIFIERS(H5F_OBJ_ALL_F, error)
00326
00327 call XF_SETUP_TO_WRITE_DATASETS(MULTIDATASET_FILE_F, 'Multidatasets','', &
00328 SdoGuid, XF_OVERWRITE_CLEAR_DATASET_GRP, MultiFileId, MultiGroupId, &
00329 error)
00330
00331 call TD_WRITE_SCALAR_A_TO_MULTI(MultiGroupId, error)
00332
00333 call XF_SETUP_TO_WRITE_DATASETS(MULTIDATASET_FILE_F, 'Multidatasets','', &
00334 SdoGuid, XF_OVERWRITE_NONE, MultiFileId, MultiGroupId, error)
00335
00336 call TD_WRITE_VECTOR2D_A_TO_MULTI(MultiFileId, MultiGroupId, error)
00337
00338
00339 call TD_READ_SCALAR_A_INDEX(SCALAR_A_FILE_F, 4, status)
00340 if (status < 0) then
00341 error = status
00342 return
00343 endif
00344
00345 WRITE(*,*) 'Done reading scalar data at index.'
00346
00347 call TD_READ_VECTOR2D_A_INDEX(VECTOR2D_A_FILE_F, 6, status)
00348 if (status < 0) then
00349 error = status
00350 return
00351 endif
00352
00353 WRITE(*,*) 'Done reading vector data at index.'
00354
00355 call TD_READ_ACTIVITY_SCALAR_A_INDEX(SCALAR_A_FILE_F, 6, status)
00356 if (status < 0) then
00357 error = status
00358 return
00359 endif
00360
00361
00362 indices(1) = 2;
00363 indices(2) = 3;
00364 indices(3) = 5;
00365 CALL TD_READ_SCALAR_A_INDICES(SCALAR_A_FILE_F, nIndices, indices, error)
00366
00367 error = status
00368 return
00369
00370 END SUBROUTINE
00371
00372
00373
00374
00375
00376
00377 SUBROUTINE TXI_TEST_OVERWRITE_DSETS(error)
00378 INTEGER, INTENT(OUT) :: error
00379 INTEGER status, compression
00380
00381 status = 1
00382 compression = NONE
00383
00384
00385 call TD_WRITE_SCALAR_B(SCALAR_B_FILE_F, compression, .FALSE., status)
00386 if (status < 0) then
00387 error = status
00388 return
00389 endif
00390
00391 call TD_WRITE_SCALAR_B(SCALAR_B_FILE_F, compression, .TRUE., status)
00392 if (status < 0) then
00393 error = status
00394 return
00395 endif
00396
00397
00398 call TD_WRITE_VECTOR2D_B(VECTOR2D_B_FILE_F, compression, .FALSE., status)
00399 if (status < 0) then
00400 WRITE(*,*) 'Error writing dataset vector2D_B.'
00401 error = status
00402 return
00403 endif
00404
00405 call TD_WRITE_VECTOR2D_B(VECTOR2D_B_FILE_F, compression, .TRUE., status)
00406 if (status < 0) then
00407 WRITE(*,*) 'Error writing dataset vector2D_B.'
00408 error = status
00409 return
00410 endif
00411
00412
00413 call TXI_READ_X_FORMAT_FILE(SCALAR_B_FILE_F, SCALAR_B_TEXT_F, status)
00414 if (status < 0) then
00415 WRITE(*,*) 'Error reading SCALAR B File'
00416 error = status
00417 return
00418 endif
00419
00420 call TXI_READ_X_FORMAT_FILE(VECTOR2D_B_FILE_F, VECTOR2D_B_TEXT_F, status)
00421 if (status < 0) then
00422 WRITE(*,*) 'Error reading VECTOR B Format File'
00423 error = status
00424 return
00425 endif
00426
00427 error = status
00428 return
00429
00430 END SUBROUTINE
00431
00432
00433
00434
00435
00436
00437 SUBROUTINE TXI_TEST_GRIDS (error)
00438 INTEGER, INTENT(OUT) :: error
00439 INTEGER compression
00440
00441 compression = NONE
00442
00443 WRITE(*,*) ''
00444 WRITE(*,*) ''
00445 WRITE(*,*) 'Writing grid data.'
00446 WRITE(*,*) ''
00447
00448 call TG_WRITE_TEST_GRID_CART_2D(GRID_CART2D_A_FILE_F, error)
00449 if (error < 0) then
00450 WRITE(*,*) 'Error writing grid Cartesian 2D A'
00451 endif
00452 WRITE(*,*) 'Finished writing grid Cartesian 2D A'
00453
00454 call TG_WRITE_TEST_GRID_CURV_2D(GRID_CURV2D_A_FILE_F, compression, error)
00455 if (error < 0) then
00456 WRITE(*,*) 'Error writing grid Curvilinear 2D A'
00457 endif
00458 WRITE(*,*) 'Finished writing grid Curvilinear 2D A'
00459
00460 call TG_WRITE_TEST_GRID_CART_3D(GRID_CART3D_A_FILE_F, compression, error)
00461 if (error < 0) then
00462 WRITE(*,*) 'Error writing grid Cartesian 3D A'
00463 endif
00464 WRITE(*,*) 'Finished writing grid Cartesian 3D A'
00465
00466 call TXI_READ_X_FORMAT_FILE(GRID_CART2D_A_FILE_F, GRID_CART2D_A_OUT_F, error)
00467 if (error < 0) then
00468 WRITE(*,*) 'Error reading grid Cartesian 2D A'
00469 endif
00470 WRITE(*,*) 'Finished reading grid Cartesian 2D A'
00471
00472 call TXI_READ_X_FORMAT_FILE(GRID_CURV2D_A_FILE_F, GRID_CURV2D_A_OUT_F, error)
00473 if (error < 0) then
00474 WRITE(*,*) 'Error reading grid Curvilinear 2D A'
00475 endif
00476 WRITE(*,*) 'Finished reading grid Curvilinear 2D A'
00477
00478 call TXI_READ_X_FORMAT_FILE(GRID_CART3D_A_FILE_F, GRID_CART3D_A_OUT_F, error)
00479 if (error < 0) then
00480 WRITE(*,*) 'Error reading grid Cartesian 3D A'
00481 endif
00482 WRITE(*,*) 'Finished reading grid Cartesian 3D A'
00483
00484 END SUBROUTINE
00485
00486
00487
00488
00489
00490
00491
00492 SUBROUTINE TXI_TEST_MESHS (error)
00493 INTEGER, INTENT(OUT) :: error
00494 INTEGER status
00495 INTEGER compression
00496
00497 status = 1
00498 compression = NONE
00499
00500 call TM_WRITE_TEST_MESH_A(MESH_A_FILE_F, compression, status)
00501 if (status < 0) then
00502 WRITE(*,*) 'Error writing TestMeshA'
00503 error = status
00504 return
00505 endif
00506
00507 call TM_WRITE_TEST_MESH_B(MESH_B_FILE_F, compression, status)
00508 if (status < 0) then
00509 WRITE(*,*) 'Error writing TestMeshB'
00510 error = status
00511 return
00512 endif
00513
00514 WRITE(*,*) 'Finished writing meshes.'
00515
00516
00517 call TXI_READ_X_FORMAT_FILE(MESH_A_FILE_F, MESH_A_OUT_F, status)
00518 if (status < 0) then
00519 WRITE(*,*) 'Error reading TestMeshA'
00520 error = status
00521 return
00522 endif
00523
00524
00525 call TXI_READ_X_FORMAT_FILE(MESH_B_FILE_F, MESH_B_OUT_F, status)
00526 if (status < 0) then
00527 WRITE(*,*) 'Error reading TestMeshB'
00528 error = status
00529 return
00530 endif
00531
00532 WRITE(*,*) 'Finished reading meshes.'
00533
00534 error = status
00535 return
00536
00537 END SUBROUTINE
00538
00539
00540
00541
00542
00543
00544
00545
00546 SUBROUTINE TXI_TEST_C (error)
00547 INTEGER, INTENT(OUT) :: error
00548 INTEGER nStatus
00549 INTEGER xFileId
00550
00551 error = 1
00552
00553
00554
00555
00556
00557 call XF_OPEN_FILE(SCALAR_A_FILE_C, .TRUE., xFileId, nStatus)
00558
00559 if (nStatus < 0) then
00560 call XF_CLOSE_FILE(xFileId, error)
00561
00562
00563 error = -1
00564 return
00565
00566 else
00567 call XF_CLOSE_FILE(xFileId, error)
00568
00569
00570 endif
00571
00572
00573 call TXI_READ_X_FORMAT_FILE(SCALAR_A_FILE_C, SCALAR_A_TEXT_CF, error)
00574 if (error < 0) then
00575 return
00576 endif
00577 call TXI_READ_X_FORMAT_FILE(SCALAR_B_FILE_C, SCALAR_B_TEXT_CF, error)
00578 if (error < 0) then
00579 return
00580 endif
00581
00582 call TXI_READ_X_FORMAT_FILE(VECTOR2D_A_FILE_C, VECTOR2D_A_TEXT_CF, error)
00583 if (error < 0) then
00584 return
00585 endif
00586 call TXI_READ_X_FORMAT_FILE(VECTOR2D_B_FILE_C, VECTOR2D_B_TEXT_CF, error)
00587 if (error < 0) then
00588 return
00589 endif
00590
00591 WRITE(*,*) 'Done reading C datasets...'
00592
00593 call TXI_READ_X_FORMAT_FILE(GRID_CART2D_A_FILE_C, GRID_CART2D_A_OUT_CF, error)
00594 if (error < 0) then
00595 WRITE(*,*) 'Error reading C grid Cartesian 2D A'
00596 endif
00597 WRITE(*,*) 'Finished reading C grid Cartesian 2D A'
00598
00599 call TXI_READ_X_FORMAT_FILE(GRID_CURV2D_A_FILE_C, GRID_CURV2D_A_OUT_CF, error)
00600 if (error < 0) then
00601 WRITE(*,*) 'Error reading C grid Curvilinear 2D A'
00602 endif
00603 WRITE(*,*) 'Finished reading C grid Curvilinear 2D A'
00604
00605 call TXI_READ_X_FORMAT_FILE(GRID_CART3D_A_FILE_C, GRID_CART3D_A_OUT_CF, error)
00606 if (error < 0) then
00607 WRITE(*,*) 'Error reading C grid Cartesian 3D A'
00608 endif
00609 WRITE(*,*) 'Finished reading C grid Cartesian 3D A'
00610
00611
00612 call TXI_READ_X_FORMAT_FILE(MESH_A_FILE_C, MESH_A_OUT_CF, error)
00613 if (error < 0) then
00614 WRITE(*,*) 'Error reading C TestMeshA'
00615 return
00616 endif
00617
00618
00619 call TXI_READ_X_FORMAT_FILE(MESH_B_FILE_C, MESH_B_OUT_CF, error)
00620 if (error < 0) then
00621 WRITE(*,*) 'Error reading C TestMeshB'
00622 return
00623 endif
00624
00625 WRITE(*,*) 'Finished reading C meshes.'
00626
00627 return
00628
00629 END SUBROUTINE
00630
00631
00632
00633
00634
00635
00636
00637 SUBROUTINE TXI_READ_X_FORMAT_FILE (a_XmdfFile, a_OutFile, error)
00638 CHARACTER(LEN=*), INTENT(IN) :: a_XmdfFile
00639 CHARACTER(LEN=*), INTENT(IN) :: a_OutFile
00640 INTEGER, INTENT(OUT) :: error
00641 CHARACTER(LEN=BIG_STRING_SIZE) :: IndividualPath
00642 CHARACTER,ALLOCATABLE :: Paths(:)
00643 INTEGER xFileId, xGroupId
00644 INTEGER nMeshGroups, nMaxPathLength, nGridGroups
00645 INTEGER FileUnit, StartLoc, nStatus, i, j
00646 REAL Version
00647
00648 xFileId = NONE
00649 xGroupId = NONE
00650
00651
00652 call XF_OPEN_FILE(a_XmdfFile, .TRUE., xFileId, nStatus)
00653 if (nStatus < 0) then
00654 call XF_CLOSE_FILE(xFileId, error)
00655 error = -1
00656 return
00657 endif
00658
00659
00660 FileUnit = 53
00661 OPEN(UNIT=FileUnit, FILE=a_OutFile, STATUS='REPLACE', ACTION='WRITE', &
00662 IOSTAT = error)
00663 if (FileUnit == 0) then
00664 call XF_CLOSE_FILE(xFileId, error)
00665 error = -1
00666 return
00667 endif
00668
00669 WRITE(FileUnit,*) 'File ', a_XmdfFile, ' opened.'
00670
00671
00672 call XF_GET_LIBRARY_VERSION_FILE(xFileId, Version, error)
00673 WRITE(FileUnit,*) 'XMDF Version: ', Version
00674 WRITE(FileUnit,*) ''
00675
00676
00677
00678 call TXI_TEST_COORD_SYSTEM(xFileId, FileUnit, nStatus)
00679 WRITE(FileUnit,*) ''
00680
00681
00682 call TD_READ_DATASETS(xFileId,FileUnit, nStatus)
00683 if (nStatus < 0) then
00684 call XF_CLOSE_FILE(xFileId, error)
00685 error = -1
00686 return
00687 endif
00688
00689
00690 call XF_GRP_PTHS_SZ_FOR_MESHES(xFileId, nMeshGroups, &
00691 nMaxPathLength, error)
00692 if (error >= 0 .AND. nMeshGroups > 0) then
00693 allocate (Paths(nMaxPathLength*nMeshGroups))
00694 call XF_GET_GROUP_PATHS_FOR_MESHES(xFileId, nMeshGroups, nMaxPathLength, &
00695 Paths, error)
00696 endif
00697
00698 if (error < 0) then
00699 call XF_CLOSE_FILE(xFileId, error)
00700 error = -1
00701 return
00702 endif
00703
00704
00705 WRITE(FileUnit,*) 'Number of meshes in file: ', nMeshGroups
00706 WRITE(FileUnit,*) 'Paths:'
00707 do i=1, nMeshGroups
00708 do j=1, nMaxPathLength-1
00709 IndividualPath(j:j) = Paths((i-1)*nMaxPathLength+j)
00710 enddo
00711 WRITE(FileUnit,*) IndividualPath(1:nMaxPathLength-1)
00712 enddo
00713
00714 WRITE(FileUnit,*) ''
00715
00716
00717
00718
00719 do i=1, nMeshGroups
00720
00721 StartLoc = (i-1)*nMaxPathLength + 1
00722 IndividualPath = ''
00723 do j = 1, nMaxPathLength - 1
00724 IndividualPath(j:j) = Paths(StartLoc+j-1)
00725 enddo
00726
00727 WRITE(FileUnit,*) 'Reading mesh in group: ', &
00728 IndividualPath(1:nMaxPathLength-1)
00729 call XF_OPEN_GROUP(xFileId, IndividualPath(1:LEN_TRIM(IndividualPath)), &
00730 xGroupId, nStatus)
00731 if (nStatus >= 0) then
00732 call TM_READ_MESH(xGroupId, FileUnit, nStatus)
00733 endif
00734 if (nStatus < 0) then
00735 WRITE(*,*) 'Error reading mesh..'
00736 endif
00737 enddo
00738
00739 if (allocated(Paths)) deallocate(Paths)
00740
00741
00742
00743 call XF_GRP_PTHS_SZ_FOR_GRIDS(xFileId, nGridGroups, &
00744 nMaxPathLength, nStatus)
00745 if (nStatus >= 0 .AND. nGridGroups > 0) then
00746 allocate (Paths(nMaxPathLength*nGridGroups))
00747 call XF_GET_GROUP_PATHS_FOR_GRIDS(xFileId, nGridGroups, &
00748 nMaxPathLength, Paths, nStatus)
00749 endif
00750 if (nStatus < 0) then
00751 call XF_CLOSE_FILE(xFileId, error)
00752 error = -1
00753 return
00754 endif
00755
00756
00757 WRITE(FileUnit,*) 'Number of grids in file: ', nGridGroups
00758 WRITE(FileUnit,*) 'Paths:'
00759 do i=1, nGridGroups
00760 do j=1, nMaxPathLength-1
00761 IndividualPath(j:j) = Paths((i-1)*nMaxPathLength+j)
00762 enddo
00763 WRITE(FileUnit,*) IndividualPath(1:LEN_TRIM(IndividualPath))
00764 enddo
00765
00766 WRITE(FileUnit,*) ''
00767
00768
00769
00770
00771 do i=1, nGridGroups
00772 do j = 1, nMaxPathLength - 1
00773 IndividualPath(j:j) = Paths((i-1)*nMaxPathLength+j)
00774 enddo
00775 WRITE(FileUnit,*) 'Reading grid in group: ', &
00776 IndividualPath(1:LEN_TRIM(IndividualPath))
00777 call XF_OPEN_GROUP(xFileId, IndividualPath(1:LEN_TRIM(IndividualPath)), &
00778 xGroupId, nStatus)
00779 if (nStatus >= 0) then
00780 call TG_READ_GRID(xGroupId, FileUnit, nStatus)
00781 endif
00782 if (nStatus < 0) then
00783 WRITE(FileUnit,*) 'Error reading grid..'
00784 endif
00785 enddo
00786
00787 if (allocated(Paths)) deallocate(Paths)
00788
00789
00790
00791
00792
00793 call XF_CLOSE_FILE(xFileId, error)
00794 CLOSE(FileUnit)
00795
00796 return
00797
00798 END SUBROUTINE
00799
00800
00801
00802
00803
00804
00805
00806 SUBROUTINE TXI_TEST_CALENDAR (error)
00807 INTEGER, INTENT(OUT) :: error
00808 INTEGER era1, yr1, mo1, day1, hr1, min1, sec1
00809 INTEGER era2, yr2, mo2, day2, hr2, min2, sec2
00810 INTEGER era3, yr3, mo3, day3, hr3, min3, sec3, FileUnit
00811 INTEGER era4, yr4, mo4, day4, hr4, min4, sec4, calendarworks
00812 DOUBLE PRECISION julian1, julian2, julian3, julian4
00813
00814 calendarworks = 0
00815 FileUnit = 53
00816 OPEN(UNIT=FileUnit, FILE=CALENDAR_OUT_F, STATUS='REPLACE', ACTION='WRITE', &
00817 IOSTAT = error)
00818
00819 WRITE(FileUnit,*) 'Calendar conversion:'
00820
00821 era1 = ERA_IS_BCE
00822 yr1 = 0
00823 mo1 = 0
00824 day1 = 0
00825 hr1 = 0
00826 min1 = 0
00827 sec1 = 0
00828 julian1 = 2655.5
00829 call XF_JULIAN_TO_CALENDAR(era1, yr1, mo1, day1, hr1, min1, sec1, julian1, error)
00830
00831 era2 = ERA_IS_BCE
00832 yr2 = 4706
00833 mo2 = 4
00834 day2 = 10
00835 hr2 = 0
00836 min2 = 0
00837 sec2 = 0
00838 julian2 = 0.0
00839 call XF_CALENDAR_TO_JULIAN(era2, yr2, mo2, day2, hr2, min2, sec2, julian2, error)
00840
00841 era3 = ERA_IS_CE
00842 yr3 = 2004
00843 mo3 = 6
00844 day3 = 3
00845 hr3 = 2
00846 min3 = 8
00847 sec3 = 32
00848 julian3 = 0.0
00849 call XF_CALENDAR_TO_JULIAN(era3, yr3, mo3, day3, hr3, min3, sec3, julian3, error)
00850
00851 era4 = ERA_IS_BCE
00852 yr4 = 0
00853 mo4 = 0
00854 day4 = 0
00855 hr4 = 0
00856 min4 = 0
00857 sec4 = 0
00858 julian4 = 2453159.58926_double
00859 call XF_JULIAN_TO_CALENDAR(era4, yr4, mo4, day4, hr4, min4, sec4, julian4, error)
00860
00861 WRITE(FileUnit,*) ''
00862 WRITE(FileUnit,*) 'Dates #1 & #2 were calculated with the same date:'
00863 WRITE(FileUnit,*) ''
00864 WRITE(FileUnit,*) era1, '/', yr1, '/', mo1, '/', day1
00865 WRITE(FileUnit,*) '', hr1, ':', min1, ':',sec1, '--- julian =',julian1
00866 WRITE(FileUnit,*) ''
00867 WRITE(FileUnit,*) era2, '/', yr2, '/', mo2, '/', day2
00868 WRITE(FileUnit,*) '', hr2, ':', min2, ':',sec2, '--- julian =',julian2
00869 WRITE(FileUnit,*) ''
00870 WRITE(FileUnit,*) 'Dates #3 & #4 were calculated with the same date:'
00871 WRITE(FileUnit,*) ''
00872 WRITE(FileUnit,*) era3, '/', yr3, '/', mo3, '/', day3
00873 WRITE(FileUnit,*) '', hr3, ':', min3, ':',sec3, '--- julian =',julian3
00874 WRITE(FileUnit,*) ''
00875 WRITE(FileUnit,*) era4, '/', yr4, '/', mo4, '/', day4
00876 WRITE(FileUnit,*) '', hr4, ':', min4, ':',sec4, '--- julian =',julian4
00877
00878 if (era1==era2 .AND. era3==era4) then
00879 if (yr1==yr2 .AND. yr3==yr4) then
00880 if (mo1==mo2 .AND. mo3==mo4) then
00881 if (day1==day2 .AND. day3==day4) then
00882 if (hr1==hr2 .AND. hr3==hr4) then
00883 if (min1==min2 .AND. min3==min4) then
00884 if (julian1==julian2 .AND. (julian3-.0000001)<julian4 .AND. (julian3+.0000001)>julian4) then
00885 WRITE(*,*) ''
00886 WRITE(*,*) 'Calendar conversion works correctly.'
00887 calendarworks = 1
00888 endif
00889 endif
00890 endif
00891 endif
00892 endif
00893 endif
00894 endif
00895 if (calendarworks .NE. 1) then
00896 WRITE(*,*) 'Calendar Stuff DOES NOT Work Correctly'
00897 error = -1
00898 else
00899 error = 1
00900 endif
00901 return
00902
00903 END SUBROUTINE
00904
00905
00906
00907
00908
00909 SUBROUTINE TXI_TEST_MULTI_DATASETS
00910
00911
00912
00913
00914
00915
00916
00917 END SUBROUTINE
00918
00919
00920
00921
00922
00923
00924 SUBROUTINE TXI_TEST_VERSION ()
00925 INTEGER error
00926 REAL Version
00927
00928 WRITE(*,*) ''
00929 call XF_GET_LIBRARY_VERSION(Version, error)
00930 WRITE(*,*) 'The current version of XMDF is: ', Version
00931 WRITE(*,*) ''
00932
00933 return
00934
00935 END SUBROUTINE
00936
00937
00938
00939
00940
00941
00942
00943 SUBROUTINE TXI_TEST_COORD_SYSTEM (xFileId, a_OutFile, error)
00944 INTEGER, INTENT(IN) :: xFileId
00945 INTEGER, INTENT(IN) :: a_OutFile
00946 INTEGER, INTENT(OUT) :: error
00947 INTEGER iHorizDatum, iHorizUnits, iVertDatum, iVertUnits
00948 INTEGER iLat, iLon, iUtmZone, iSpcZone, iHpgnArea, iEllipse
00949 INTEGER bHorizDatum, nStatus
00950 REAL(DOUBLE) dCppLat, dCppLon, dMajorR, dMinorR
00951 INTEGER xCoordId
00952 CHARACTER(LEN=BIG_STRING_SIZE) strHorizUnits, strVertDatum
00953 CHARACTER(LEN=BIG_STRING_SIZE) strVertUnits
00954
00955
00956
00957
00958
00959 call XF_OPEN_COORDINATE_GROUP(xFileId, xCoordId, nStatus)
00960 if (nStatus < 0) then
00961 WRITE(a_OutFile,*) ''
00962 WRITE(a_OutFile,*) 'Coordinate Group not found'
00963 WRITE(a_OutFile,*) ''
00964 error = nStatus
00965 return
00966 endif
00967
00968
00969 WRITE(a_OutFile,*) ''
00970 WRITE(a_OutFile,*) 'Coordinate System:'
00971
00972 call XF_GET_HORIZ_DATUM(xCoordId, iHorizDatum, bHorizDatum)
00973 call XF_GET_HORIZ_UNITS(xCoordId, iHorizUnits, error)
00974 call XF_GET_VERT_DATUM(xCoordId, iVertDatum, error)
00975 call XF_GET_VERT_UNITS(xCoordId, iVertUnits, error)
00976
00977
00978 if (iHorizUnits == 0) then
00979 strHorizUnits = 'Horizontal units = US Survey Feet (=0)'
00980 else if (iHorizUnits == 1) then
00981 strHorizUnits = 'Horizontal units = International Feet (=1)'
00982 else if (iHorizUnits == 2) then
00983 strHorizUnits = 'Horizontal units = Meters (=2)'
00984 else
00985 strHorizUnits = 'ERROR in reading Horizontal units'
00986 endif
00987
00988
00989 if (iVertDatum == 0) then
00990 strVertDatum = 'Vertical datum = Local (=0)'
00991 else if (iVertDatum == 1) then
00992 strVertDatum = 'Vertical datum = NGVD 29 (=1)'
00993 else if (iVertDatum == 2) then
00994 strVertDatum = 'Vertical datum = NGVD 88 (=2)'
00995 else
00996 strVertDatum = 'ERROR in reading the Vertical datum'
00997 endif
00998
00999
01000 if (iVertUnits == 0) then
01001 strVertUnits = 'Vertical units = US Survey Feet (=0)'
01002 else if (iVertUnits == 1) then
01003 strVertUnits = 'Vertical units = International Feet (=1)'
01004 else if (iVertUnits == 2) then
01005 strVertUnits = 'Vertical units = Meters (=2)'
01006 else
01007 strVertUnits = 'ERROR in reading the Vertical units'
01008 endif
01009
01010 if (bHorizDatum >= 0) then
01011 SELECT CASE (iHorizDatum)
01012 CASE (HORIZ_DATUM_GEOGRAPHIC)
01013 call XF_GET_ELLIPSE(xCoordId, iEllipse, error)
01014 call XF_GET_LAT(xCoordId, iLat, error)
01015 call XF_GET_LON(xCoordId, iLon, error)
01016
01017 WRITE(a_OutFile,*) 'Horizontal datum = Geographic'
01018 WRITE(a_OutFile,*) 'Horizontal units = ', strHorizUnits(1:LEN_TRIM(strHorizUnits))
01019 WRITE(a_OutFile,*) 'Vertical datum = ', strVertDatum(1:LEN_TRIM(strVertDatum))
01020 WRITE(a_OutFile,*) 'Vertical units = ', strVertUnits(1:LEN_TRIM(strVertUnits))
01021
01022 if (iLat == 0) then
01023 WRITE(a_OutFile,*) ' Latitude = North (=0)'
01024 else if (iLat == 1) then
01025 WRITE(a_OutFile,*) ' Latitude = South (=1)'
01026 else
01027 WRITE(a_OutFile,*) ' LATITUDE INFO INCORRECT'
01028 endif
01029
01030 if (iLon == 0) then
01031 WRITE(a_OutFile,*) ' Longitude = East (=0)'
01032 else if (iLon == 1) then
01033 WRITE(a_OutFile,*) ' Longitude = West (=1)'
01034 else
01035 WRITE(a_OutFile,*) ' LONGITUDE INFO INCORRECT'
01036 endif
01037
01038
01039 if (iEllipse == 32) then
01040 WRITE(a_OutFile,*) 'Ellipse = User-defined:'
01041 call XF_GET_MAJOR_R(xCoordId, dMajorR, error)
01042 call XF_GET_MINOR_R(xCoordId, dMinorR, error)
01043 WRITE(a_OutFile,*) ' MajorR = ', dMajorR
01044 WRITE(a_OutFile,*) ' MinorR = ', dMinorR
01045 else
01046 WRITE(a_OutFile,*) 'Ellipse = ', iEllipse
01047 endif
01048 WRITE(a_OutFile,*) ''
01049 CASE (HORIZ_DATUM_UTM)
01050 call XF_GET_UTM_ZONE(xCoordId, iUtmZone, error)
01051
01052 if (iHorizDatum == HORIZ_DATUM_UTM) then
01053 WRITE(a_OutFile,*) 'Horizontal datum = UTM'
01054 else if (iHorizDatum == HORIZ_DATUM_UTM_NAD27) then
01055 WRITE(a_OutFile,*) 'Horizontal datum = UTM NAD27 (US)'
01056 else
01057 WRITE(a_OutFile,*) 'Horizontal datum = UTM NAD83 (US)'
01058 endif
01059 WRITE(a_OutFile,*) 'Horizontal units = ', &
01060 strHorizUnits(1:LEN_TRIM(strHorizUnits))
01061 WRITE(a_OutFile,*) 'Vertical datum = ', &
01062 strVertDatum(1:LEN_TRIM(strVertDatum))
01063 WRITE(a_OutFile,*) 'Vertical units = ', &
01064 strVertUnits(1:LEN_TRIM(strVertUnits))
01065 WRITE(a_OutFile,*) 'UTM Zone = ', iUtmZone
01066 WRITE(a_OutFile,*) ''
01067
01068 CASE (HORIZ_DATUM_UTM_NAD27, HORIZ_DATUM_UTM_NAD83)
01069 call XF_GET_UTM_ZONE(xCoordId, iUtmZone, error)
01070
01071 if (iHorizDatum == HORIZ_DATUM_UTM) then
01072 WRITE(a_OutFile,*) 'Horizontal datum = UTM'
01073 else if (iHorizDatum == HORIZ_DATUM_UTM_NAD27) then
01074 WRITE(a_OutFile,*) 'Horizontal datum = UTM NAD27 (US)'
01075 else
01076 WRITE(a_OutFile,*) 'Horizontal datum = UTM NAD83 (US)'
01077 endif
01078 WRITE(a_OutFile,*) 'Horizontal units = ', &
01079 strHorizUnits(1:LEN_TRIM(strHorizUnits))
01080 WRITE(a_OutFile,*) 'Vertical datum = ', &
01081 strVertDatum(1:LEN_TRIM(strVertDatum))
01082 WRITE(a_OutFile,*) 'Vertical units = ', &
01083 strVertUnits(1:LEN_TRIM(strVertUnits))
01084 WRITE(a_OutFile,*) 'UTM Zone = ', iUtmZone
01085 WRITE(a_OutFile,*) ''
01086 CASE (HORIZ_DATUM_STATE_PLANE_NAD27, HORIZ_DATUM_STATE_PLANE_NAD83)
01087 call XF_GET_SPC_ZONE(xCoordId, iSpcZone, error)
01088
01089 if (iHorizDatum == HORIZ_DATUM_STATE_PLANE_NAD27) then
01090 WRITE(a_OutFile,*) 'Horizontal datum = State Plane NAD27 (US)'
01091 else
01092 WRITE(a_OutFile,*) 'Horizontal datum = State Plane NAD83 (US)'
01093 endif
01094 WRITE(a_OutFile,*) 'Horizontal units = ', &
01095 strHorizUnits(1:LEN_TRIM(strHorizUnits))
01096 WRITE(a_OutFile,*) 'Vertical datum = ', &
01097 strVertDatum(1:LEN_TRIM(strVertDatum))
01098 WRITE(a_OutFile,*) 'Vertical units = ', &
01099 strVertUnits(1:LEN_TRIM(strVertUnits))
01100 WRITE(a_OutFile,*) 'SPC Zone = ', iSpcZone
01101 WRITE(a_OutFile,*) ''
01102 CASE (HORIZ_DATUM_UTM_HPGN, HORIZ_DATUM_STATE_PLANE_HPGN, &
01103 HORIZ_DATUM_GEOGRAPHIC_HPGN)
01104 call XF_GET_HPGN_AREA(xCoordId, iHpgnArea, error)
01105 if (iHorizDatum == HORIZ_DATUM_UTM_HPGN) then
01106 WRITE(a_OutFile,*) 'Horizontal datum = UTM HPGN (US)'
01107 else if (iHorizDatum == HORIZ_DATUM_STATE_PLANE_HPGN) then
01108 WRITE(a_OutFile,*) 'Horizontal datum = State Plane HPGN (US)'
01109 else
01110 WRITE(a_OutFile,*) 'Horizontal datum = Geographic HPGN (US)'
01111 endif
01112 WRITE(a_OutFile,*) 'Horizontal units = ', &
01113 strHorizUnits(1:LEN_TRIM(strHorizUnits))
01114 WRITE(a_OutFile,*) 'Vertical datum = ', &
01115 strVertDatum(1:LEN_TRIM(strVertDatum))
01116 WRITE(a_OutFile,*) 'Vertical units = ', &
01117 strVertUnits(1:LEN_TRIM(strVertUnits))
01118 WRITE(a_OutFile,*) 'HPGN Area = ', iHpgnArea
01119 WRITE(a_OutFile,*) ''
01120 CASE (HORIZ_DATUM_CPP)
01121 call XF_GET_CPP_LAT(xCoordId, dCppLat, error)
01122 call XF_GET_CPP_LON(xCoordId, dCppLon, error)
01123 WRITE(a_OutFile,*) 'Horizontal datum = CPP (Carte Parallelo-Grammatique Projection)'
01124 WRITE(a_OutFile,*) 'Horizontal units = ', &
01125 strHorizUnits(1:LEN_TRIM(strHorizUnits))
01126 WRITE(a_OutFile,*) 'Vertical datum = ', &
01127 strVertDatum(1:LEN_TRIM(strVertDatum))
01128 WRITE(a_OutFile,*) 'Vertical units = ', &
01129 strVertUnits(1:LEN_TRIM(strVertUnits))
01130 WRITE(a_OutFile,*) 'CPP Latitude = ', dCppLat
01131 WRITE(a_OutFile,*) 'CPP Longitude = ', dCppLon
01132 WRITE(a_OutFile,*) ''
01133 CASE (HORIZ_DATUM_LOCAL, HORIZ_DATUM_GEOGRAPHIC_NAD27, &
01134 HORIZ_DATUM_GEOGRAPHIC_NAD83)
01135
01136 if (iHorizDatum == HORIZ_DATUM_LOCAL) then
01137 WRITE(a_OutFile,*) 'Horizontal datum = Local'
01138 else if (iHorizDatum == HORIZ_DATUM_GEOGRAPHIC_NAD27) then
01139 WRITE(a_OutFile,*) 'Horizontal datum = Geographic NAD27 (US)'
01140 else
01141 WRITE(a_OutFile,*) 'Horizontal datum = Geographic NAD83 (US)'
01142 endif
01143 WRITE(a_OutFile,*) 'Horizontal units = ', &
01144 strHorizUnits(1:LEN_TRIM(strHorizUnits))
01145 WRITE(a_OutFile,*) 'Vertical datum = ', &
01146 strVertDatum(1:LEN_TRIM(strVertDatum))
01147 WRITE(a_OutFile,*) 'Vertical units = ', &
01148 strVertUnits(1:LEN_TRIM(strVertUnits))
01149 WRITE(a_OutFile,*) ''
01150 CASE DEFAULT
01151 WRITE(a_OutFile,*) 'ERROR: The coordinate information is not found in the .h5 file'
01152 error = -1
01153 return
01154 END SELECT
01155 else
01156 WRITE(a_OutFile,*) 'Coordinate information in HDF5 file is incomplete.'
01157 WRITE(a_OutFile,*) ''
01158 endif
01159
01160 call XF_CLOSE_GROUP(xCoordId, error)
01161 xCoordId = 0
01162
01163 return
01164
01165 END SUBROUTINE
01166
01167 SUBROUTINE TXI_TEST_GEOMETRIC_PATHS(error)
01168 INTEGER, INTENT(OUT) :: error
01169 INTEGER compression
01170
01171 compression = -1
01172
01173
01174 WRITE(*,*)''
01175 WRITE(*,*)'Writing geometric path data'
01176 WRITE(*,*)''
01177
01178 call TM_WRITE_TEST_PATHS(GEOMPATH_A_FILE_F, compression, error);
01179 if (error < 0) then
01180 WRITE(*,*) 'Error writing geometric path data A'
01181 return
01182 endif
01183 WRITE(*,*) 'Finished writing geometric path data A'
01184
01185
01186 call TM_READ_TEST_PATHS(GEOMPATH_A_FILE_F, GEOMPATH_A_FILE_F_OUT, error)
01187
01188 return
01189
01190 END SUBROUTINE TXI_TEST_GEOMETRIC_PATHS
01191
01192
01193
01194 END MODULE TestsModule
01195
01196 PROGRAM TESTS
01197
01198 USE TestDatasets
01199 USE Xmdf
01200 USE TestMesh
01201 USE TestDefs
01202 USE TestsModule
01203
01204 INTEGER error
01205
01206 call XF_INITIALIZE(error)
01207
01208
01209 call TXI_TEST_TIMESTEPS(error)
01210 if (error < 0) then
01211 WRITE(*,*) 'Error in writing timesteps!'
01212 endif
01213
01214
01215 call TXI_TEST_DATASETS(error)
01216 if (error < 0) then
01217 WRITE(*,*) 'Error in writing datasets!'
01218 endif
01219
01220
01221 call TXI_TEST_OVERWRITE_DSETS(error)
01222 if (error < 0) then
01223 WRITE(*,*) 'Error in overwriting datasets!'
01224 else
01225 WRITE(*,*) 'Finished writing datasets...'
01226 endif
01227
01228
01229 call TXI_TEST_MESHS(error)
01230
01231
01232 call TXI_TEST_GRIDS(error)
01233
01234
01235 call TXI_TEST_C(error)
01236
01237
01238 call TXI_TEST_CALENDAR(error)
01239
01240
01241 call TXI_TEST_VERSION
01242
01243
01244 call TXI_TEST_GEOMETRIC_PATHS(error)
01245
01246 call XF_CLOSE (error)
01247
01248 PAUSE 'Press ENTER to exit...'
01249
01250 END PROGRAM