Unverified Commit e52b46e0 authored by Graham, Aaron's avatar Graham, Aaron Committed by GitHub
Browse files

Hdf5 auto open (#330)

* auto-open HDF5 and use REQUIRE more

* Fix some formatting issues in HDF5

* Add vs code to gitignore

* Update HDF5 test
parent 799950fd
......@@ -18,3 +18,4 @@ fort.*
/.egdist
/.gitdist
*.sublime-*
.vscode
This diff is collapsed.
......@@ -74,11 +74,12 @@ CHARACTER(LEN=*),PARAMETER :: modName='MEMORYPROFILER'
CONTAINS
!
!-------------------------------------------------------------------------------
!> @brief the procudere to
!> @brief the procedure to intialize a memory profiler object
!> @param thisMP the memory profiler
!> @param params
!> @param pe the parallel environment
!> @param myLog the log file; optional
!> @param params the input parameter list; optional
!>
!TODO Need to get control rod movement passed in
SUBROUTINE init_MemProf(thisMP,pe,mylog,params)
CLASS(Memory_Profiler),INTENT(INOUT) :: thisMP
TYPE(ParallelEnvType),TARGET,INTENT(IN) :: pe
......
......@@ -57,7 +57,6 @@ CALL testHDF5FileTypeSetup()
CALL HDF5Open()
REGISTER_SUBTEST("Uninit",testHDF5FileTypeUninit)
REGISTER_SUBTEST("Init",testHDF5FileTypeCreateDelete)
REGISTER_SUBTEST("Error Checks",testHDF5FileTypeErrorCheck)
REGISTER_SUBTEST("%fread",testHDF5FileTypeRead)
IF(utest_nfail == 0) THEN
REGISTER_SUBTEST("%fwrite",testHDF5FileTypeWrite)
......@@ -354,8 +353,6 @@ SUBROUTINE testHDF5FileTypeCreateDelete()
CALL h5%fopen()
ASSERT(.NOT.(h5%isWrite()),'HDF object %isWrite() should be .FALSE.')
CALL h5%e%setStopOnError(.FALSE.)
CALL h5%mkdir('testGroup')
ASSERT_EQ(h5%e%getCounter(EXCEPTION_ERROR),1,'hdf5_filetype%init ''READ''')
CALL h5%fdelete()
ASSERT(h5%isinit,'HDF5 object still initialized after deletion.')
INQUIRE(FILE='createdeletetest.h5',EXIST=exists)
......@@ -373,243 +370,6 @@ SUBROUTINE testHDF5FileTypeCreateDelete()
ENDSUBROUTINE testHDF5FileTypeCreateDelete
!
!-------------------------------------------------------------------------------
SUBROUTINE testHDF5FileTypeErrorCheck()
TYPE(HDF5FileType) :: h5
INTEGER(SIK) :: tmpi
REAL(SDK),POINTER :: d4ptr(:,:,:,:)
d4ptr => NULL()
CALL h5%e%setQuietMode(.TRUE.)
!Adding the *2 for now to get the test passing. Since the simplification,
!the pre and post routines have two %isinit checks. All these checks are
!mostly redundant now though, one check checks the same code as all of them now.
CALL h5%fwrite('groupR->memD0',refD0)
tmpi=1
ASSERT_EQ(h5%e%getCounter(EXCEPTION_ERROR),tmpi*2,'%write_d0 %isinit check')
CALL h5%fwrite('groupR->memD1',refD1,SHAPE(refD1))
tmpi=tmpi+1
ASSERT_EQ(h5%e%getCounter(EXCEPTION_ERROR),tmpi*2,'%write_d1 %isinit check')
CALL h5%fwrite('groupR->memD2',refD2,SHAPE(refD2))
tmpi=tmpi+1
ASSERT_EQ(h5%e%getCounter(EXCEPTION_ERROR),tmpi*2,'%write_d2 %isinit check')
CALL h5%fwrite('groupR->memD3',refD3,SHAPE(refD3))
tmpi=tmpi+1
ASSERT_EQ(h5%e%getCounter(EXCEPTION_ERROR),tmpi*2,'%write_d3 %isinit check')
CALL h5%fwrite('groupR->memD4',refD4,SHAPE(refD4))
tmpi=tmpi+1
ASSERT_EQ(h5%e%getCounter(EXCEPTION_ERROR),tmpi*2,'%write_d4 %isinit check')
CALL h5%fwrite('groupR->memD5',refD5,SHAPE(refD5))
tmpi=tmpi+1
ASSERT_EQ(h5%e%getCounter(EXCEPTION_ERROR),tmpi*2,'%write_d5 %isinit check')
CALL h5%fwrite('groupR->memD6',refD6,SHAPE(refD6))
tmpi=tmpi+1
ASSERT_EQ(h5%e%getCounter(EXCEPTION_ERROR),tmpi*2,'%write_d6 %isinit check')
CALL h5%fwrite('groupR->memD7',refD7,SHAPE(refD7))
tmpi=tmpi+1
ASSERT_EQ(h5%e%getCounter(EXCEPTION_ERROR),tmpi*2,'%write_d7 %isinit check')
CALL h5%fwrite('groupR->memS0',refS0)
tmpi=tmpi+1
ASSERT_EQ(h5%e%getCounter(EXCEPTION_ERROR),tmpi*2,'%write_s0 %isinit check')
CALL h5%fwrite('groupR->memS1',refS1,SHAPE(refS1))
tmpi=tmpi+1
ASSERT_EQ(h5%e%getCounter(EXCEPTION_ERROR),tmpi*2,'%write_s1 %isinit check')
CALL h5%fwrite('groupR->memS2',refS2,SHAPE(refS2))
tmpi=tmpi+1
ASSERT_EQ(h5%e%getCounter(EXCEPTION_ERROR),tmpi*2,'%write_s2 %isinit check')
CALL h5%fwrite('groupR->memS3',refS3,SHAPE(refS3))
tmpi=tmpi+1
ASSERT_EQ(h5%e%getCounter(EXCEPTION_ERROR),tmpi*2,'%write_s3 %isinit check')
CALL h5%fwrite('groupR->memS4',refS4,SHAPE(refS4))
tmpi=tmpi+1
ASSERT_EQ(h5%e%getCounter(EXCEPTION_ERROR),tmpi*2,'%write_s4 %isinit check')
CALL h5%fwrite('groupR->memS5',refS5,SHAPE(refS5))
tmpi=tmpi+1
ASSERT_EQ(h5%e%getCounter(EXCEPTION_ERROR),tmpi*2,'%write_s5 %isinit check')
CALL h5%fwrite('groupR->memS6',refS6,SHAPE(refS6))
tmpi=tmpi+1
ASSERT_EQ(h5%e%getCounter(EXCEPTION_ERROR),tmpi*2,'%write_s6 %isinit check')
CALL h5%fwrite('groupR->memS7',refS7,SHAPE(refS7))
tmpi=tmpi+1
ASSERT_EQ(h5%e%getCounter(EXCEPTION_ERROR),tmpi*2,'%write_s7 %isinit check')
CALL h5%fwrite('groupI->memL0',refL0)
tmpi=tmpi+1
ASSERT_EQ(h5%e%getCounter(EXCEPTION_ERROR),tmpi*2,'%write_l0 %isinit check')
CALL h5%fwrite('groupI->memL1',refL1,SHAPE(refL1))
tmpi=tmpi+1
ASSERT_EQ(h5%e%getCounter(EXCEPTION_ERROR),tmpi*2,'%write_l1 %isinit check')
CALL h5%fwrite('groupI->memL2',refL2,SHAPE(refL2))
tmpi=tmpi+1
ASSERT_EQ(h5%e%getCounter(EXCEPTION_ERROR),tmpi*2,'%write_l2 %isinit check')
CALL h5%fwrite('groupI->memL3',refL3,SHAPE(refL3))
tmpi=tmpi+1
ASSERT_EQ(h5%e%getCounter(EXCEPTION_ERROR),tmpi*2,'%write_l3 %isinit check')
CALL h5%fwrite('groupI->memL4',refL4,SHAPE(refL4))
tmpi=tmpi+1
ASSERT_EQ(h5%e%getCounter(EXCEPTION_ERROR),tmpi*2,'%write_l4 %isinit check')
CALL h5%fwrite('groupI->memL5',refL5,SHAPE(refL5))
tmpi=tmpi+1
ASSERT_EQ(h5%e%getCounter(EXCEPTION_ERROR),tmpi*2,'%write_l5 %isinit check')
CALL h5%fwrite('groupI->memL6',refL6,SHAPE(refL6))
tmpi=tmpi+1
ASSERT_EQ(h5%e%getCounter(EXCEPTION_ERROR),tmpi*2,'%write_l6 %isinit check')
CALL h5%fwrite('groupI->memL7',refL7,SHAPE(refL7))
tmpi=tmpi+1
ASSERT_EQ(h5%e%getCounter(EXCEPTION_ERROR),tmpi*2,'%write_l7 %isinit check')
CALL h5%fwrite('groupI->memN0',refN0)
tmpi=tmpi+1
ASSERT_EQ(h5%e%getCounter(EXCEPTION_ERROR),tmpi*2,'%write_n0 %isinit check')
CALL h5%fwrite('groupI->memN1',refN1,SHAPE(refN1))
tmpi=tmpi+1
ASSERT_EQ(h5%e%getCounter(EXCEPTION_ERROR),tmpi*2,'%write_n1 %isinit check')
CALL h5%fwrite('groupI->memN2',refN2,SHAPE(refN2))
tmpi=tmpi+1
ASSERT_EQ(h5%e%getCounter(EXCEPTION_ERROR),tmpi*2,'%write_n2 %isinit check')
CALL h5%fwrite('groupI->memN3',refN3,SHAPE(refN3))
tmpi=tmpi+1
ASSERT_EQ(h5%e%getCounter(EXCEPTION_ERROR),tmpi*2,'%write_n3 %isinit check')
CALL h5%fwrite('groupI->memN4',refN4,SHAPE(refN4))
tmpi=tmpi+1
ASSERT_EQ(h5%e%getCounter(EXCEPTION_ERROR),tmpi*2,'%write_n4 %isinit check')
CALL h5%fwrite('groupI->memN5',refN5,SHAPE(refN5))
tmpi=tmpi+1
ASSERT_EQ(h5%e%getCounter(EXCEPTION_ERROR),tmpi*2,'%write_n5 %isinit check')
CALL h5%fwrite('groupI->memN6',refN6,SHAPE(refN6))
tmpi=tmpi+1
ASSERT_EQ(h5%e%getCounter(EXCEPTION_ERROR),tmpi*2,'%write_n6 %isinit check')
CALL h5%fwrite('groupI->memN7',refN7,SHAPE(refN7))
tmpi=tmpi+1
ASSERT_EQ(h5%e%getCounter(EXCEPTION_ERROR),tmpi*2,'%write_n7 %isinit check')
CALL h5%fwrite('groupB->memB0',refB0)
tmpi=tmpi+1
ASSERT_EQ(h5%e%getCounter(EXCEPTION_ERROR),tmpi*2,'%write_b0 %isinit check')
CALL h5%fwrite('groupB->memB1',refB1,SHAPE(refB1))
tmpi=tmpi+1
ASSERT_EQ(h5%e%getCounter(EXCEPTION_ERROR),tmpi*2,'%write_b1 %isinit check')
CALL h5%fwrite('groupB->memB2',refB2,SHAPE(refB2))
tmpi=tmpi+1
ASSERT_EQ(h5%e%getCounter(EXCEPTION_ERROR),tmpi*2,'%write_b2 %isinit check')
CALL h5%fwrite('groupB->memB3',refB3,SHAPE(refB3))
tmpi=tmpi+1
ASSERT_EQ(h5%e%getCounter(EXCEPTION_ERROR),tmpi*2,'%write_b3 %isinit check')
CALL h5%fwrite('groupST->CNULLCHAR0',refCNCHAR0)
tmpi=tmpi+1
ASSERT_EQ(h5%e%getCounter(EXCEPTION_ERROR),tmpi*2,'%write_st0 %isinit check')
CALL h5%fwrite('groupST->CNULLCHAR1',refCNCHAR1)
tmpi=tmpi+1
ASSERT_EQ(h5%e%getCounter(EXCEPTION_ERROR),tmpi*2,'%write_st1 %isinit check')
CALL h5%fwrite('groupST->CNULLCHAR2',refCNCHAR2)
tmpi=tmpi+1
ASSERT_EQ(h5%e%getCounter(EXCEPTION_ERROR),tmpi*2,'%write_st2 %isinit check')
CALL h5%fwrite('groupST->CNULLCHAR3',refCNCHAR3)
tmpi=tmpi+1
ASSERT_EQ(h5%e%getCounter(EXCEPTION_ERROR),tmpi*2,'%write_st3 %isinit check')
CALL h5%fwrite('groupST->memST0',refST0)
tmpi=tmpi+1
ASSERT_EQ(h5%e%getCounter(EXCEPTION_ERROR),tmpi*2,'%write_st0 %isinit check')
CALL h5%fwrite('groupST->memST1',refST1,SHAPE(refST1))
tmpi=tmpi+1
ASSERT_EQ(h5%e%getCounter(EXCEPTION_ERROR),tmpi*2,'%write_st1 %isinit check')
CALL h5%fwrite('groupST->memST2',refST2,SHAPE(refST2))
tmpi=tmpi+1
ASSERT_EQ(h5%e%getCounter(EXCEPTION_ERROR),tmpi*2,'%write_st2 %isinit check')
CALL h5%fwrite('groupST->memST3',refST3,SHAPE(refST3))
tmpi=tmpi+1
ASSERT_EQ(h5%e%getCounter(EXCEPTION_ERROR),tmpi*2,'%write_st3 %isinit check')
CALL h5%fwrite('groupC->memC1',refC1)
tmpi=tmpi+1
ASSERT_EQ(h5%e%getCounter(EXCEPTION_ERROR),tmpi*2,'%write_c1 %isinit check')
CALL h5%mkdir('groupI')
tmpi=tmpi+1
ASSERT_EQ(h5%e%getCounter(EXCEPTION_ERROR),tmpi*2-1,'%mkdir %isinit check')
CALL h5%ls('groupR',refST1)
ASSERT_EQ(h5%e%getCounter(EXCEPTION_ERROR),tmpi*2,'%ls %isinit check')
CALL h5%fread('groupR->memD0',refD0)
tmpi=tmpi+1
ASSERT_EQ(h5%e%getCounter(EXCEPTION_ERROR),tmpi*2,'%read_d0 %isinit check')
CALL h5%fread('groupR->memD1',refD1)
tmpi=tmpi+1
ASSERT_EQ(h5%e%getCounter(EXCEPTION_ERROR),tmpi*2,'%read_d1 %isinit check')
CALL h5%fread('groupR->memD2',refD2)
tmpi=tmpi+1
ASSERT_EQ(h5%e%getCounter(EXCEPTION_ERROR),tmpi*2,'%read_d2 %isinit check')
CALL h5%fread('groupR->memD3',refD3)
tmpi=tmpi+1
ASSERT_EQ(h5%e%getCounter(EXCEPTION_ERROR),tmpi*2,'%read_d3 %isinit check')
CALL h5%fread('groupR->memD4',refD4)
tmpi=tmpi+1
ASSERT_EQ(h5%e%getCounter(EXCEPTION_ERROR),tmpi*2,'%read_d4 %isinit check')
CALL h5%freadp('groupR->memD4',d4ptr)
tmpi=tmpi+1
ASSERT_EQ(h5%e%getCounter(EXCEPTION_ERROR),tmpi*2,'%read_d4 %isinit check')
CALL h5%fread('groupR->memS0',refS0)
tmpi=tmpi+1
ASSERT_EQ(h5%e%getCounter(EXCEPTION_ERROR),tmpi*2,'%read_s0 %isinit check')
CALL h5%fread('groupR->memS1',refS1)
tmpi=tmpi+1
ASSERT_EQ(h5%e%getCounter(EXCEPTION_ERROR),tmpi*2,'%read_s1 %isinit check')
CALL h5%fread('groupR->memS2',refS2)
tmpi=tmpi+1
ASSERT_EQ(h5%e%getCounter(EXCEPTION_ERROR),tmpi*2,'%read_s2 %isinit check')
CALL h5%fread('groupR->memS3',refS3)
tmpi=tmpi+1
ASSERT_EQ(h5%e%getCounter(EXCEPTION_ERROR),tmpi*2,'%read_s3 %isinit check')
CALL h5%fread('groupR->memS4',refS4)
tmpi=tmpi+1
ASSERT_EQ(h5%e%getCounter(EXCEPTION_ERROR),tmpi*2,'%read_s4 %isinit check')
CALL h5%fread('groupI->memL0',refL0)
tmpi=tmpi+1
ASSERT_EQ(h5%e%getCounter(EXCEPTION_ERROR),tmpi*2,'%read_l0 %isinit check')
CALL h5%fread('groupI->memL1',refL1)
tmpi=tmpi+1
ASSERT_EQ(h5%e%getCounter(EXCEPTION_ERROR),tmpi*2,'%read_l1 %isinit check')
CALL h5%fread('groupI->memL2',refL2)
tmpi=tmpi+1
ASSERT_EQ(h5%e%getCounter(EXCEPTION_ERROR),tmpi*2,'%read_l2 %isinit check')
CALL h5%fread('groupI->memL3',refL3)
tmpi=tmpi+1
ASSERT_EQ(h5%e%getCounter(EXCEPTION_ERROR),tmpi*2,'%read_l3 %isinit check')
CALL h5%fread('groupI->memN0',refN0)
tmpi=tmpi+1
ASSERT_EQ(h5%e%getCounter(EXCEPTION_ERROR),tmpi*2,'%read_n0 %isinit check')
CALL h5%fread('groupI->memN1',refN1)
tmpi=tmpi+1
ASSERT_EQ(h5%e%getCounter(EXCEPTION_ERROR),tmpi*2,'%read_n1 %isinit check')
CALL h5%fread('groupI->memN2',refN2)
tmpi=tmpi+1
ASSERT_EQ(h5%e%getCounter(EXCEPTION_ERROR),tmpi*2,'%read_n2 %isinit check')
CALL h5%fread('groupI->memN3',refN3)
tmpi=tmpi+1
ASSERT_EQ(h5%e%getCounter(EXCEPTION_ERROR),tmpi*2,'%read_n3 %isinit check')
CALL h5%fread('groupB->memB0',refB0)
tmpi=tmpi+1
ASSERT_EQ(h5%e%getCounter(EXCEPTION_ERROR),tmpi*2,'%read_b0 %isinit check')
CALL h5%fread('groupB->memB1',refB1)
tmpi=tmpi+1
ASSERT_EQ(h5%e%getCounter(EXCEPTION_ERROR),tmpi*2,'%read_b1 %isinit check')
CALL h5%fread('groupB->memB2',refB2)
tmpi=tmpi+1
ASSERT_EQ(h5%e%getCounter(EXCEPTION_ERROR),tmpi*2,'%read_b2 %isinit check')
CALL h5%fread('groupB->memB3',refB3)
tmpi=tmpi+1
ASSERT_EQ(h5%e%getCounter(EXCEPTION_ERROR),tmpi*2,'%read_b3 %isinit check')
CALL h5%fread('groupST->memST0',refST0)
tmpi=tmpi+1
ASSERT_EQ(h5%e%getCounter(EXCEPTION_ERROR),tmpi*2,'%read_st0 %isinit check')
CALL h5%fread('groupST->memST1',refST1)
tmpi=tmpi+1
ASSERT_EQ(h5%e%getCounter(EXCEPTION_ERROR),tmpi*2,'%read_st1 %isinit check')
CALL h5%fread('groupST->memST2',refST2)
tmpi=tmpi+1
ASSERT_EQ(h5%e%getCounter(EXCEPTION_ERROR),tmpi*2,'%read_st2 %isinit check')
CALL h5%fread('groupST->memST3',refST3)
tmpi=tmpi+1
ASSERT_EQ(h5%e%getCounter(EXCEPTION_ERROR),tmpi*2,'%read_st3 %isinit check')
CALL h5%clear(.TRUE.)
ENDSUBROUTINE testHDF5FileTypeErrorCheck
!
!-------------------------------------------------------------------------------
SUBROUTINE testHDF5FileTypeWrite()
TYPE(HDF5FileType) :: h5
REAL(SDK),ALLOCATABLE :: testD1(:),testD2(:,:),testD3(:,:,:),testD4(:,:,:,:)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment