63 lines
2.2 KiB
Fortran
63 lines
2.2 KiB
Fortran
program test_input_cclite_082
|
|
use sph_error, only: SPH_SUCCESS
|
|
use sph_api, only: sph_initialize, sph_finalize, sph_read_inp
|
|
use sph_database, only: cclite_worker_enabled, cclite_region_name, &
|
|
cclite_export_radius, cclite_export_sound_speed, &
|
|
cclite_accept_contact_state, cclite_accept_boundary_state
|
|
implicit none
|
|
|
|
integer :: ierr
|
|
|
|
call check_valid_cclite_keyword()
|
|
call check_invalid_cclite_keyword()
|
|
|
|
contains
|
|
|
|
subroutine check_valid_cclite_keyword()
|
|
call sph_initialize(ierr)
|
|
call assert_ok(ierr, 'initialize failed for CCLite input')
|
|
call sph_read_inp('tests/data/cclite_options_082.inp', ierr)
|
|
call assert_ok(ierr, 'read failed for CCLite input')
|
|
if (cclite_worker_enabled /= 1) call fail('CCLite worker flag mismatch')
|
|
if (trim(cclite_region_name) /= 'PRESSURE_CONTACT') then
|
|
call fail('CCLite region option mismatch')
|
|
end if
|
|
if (cclite_export_radius /= 0) call fail('CCLite radius flag mismatch')
|
|
if (cclite_export_sound_speed /= 1) then
|
|
call fail('CCLite sound speed flag mismatch')
|
|
end if
|
|
if (cclite_accept_contact_state /= 1) then
|
|
call fail('CCLite contact state flag mismatch')
|
|
end if
|
|
if (cclite_accept_boundary_state /= 0) then
|
|
call fail('CCLite boundary state flag mismatch')
|
|
end if
|
|
call sph_finalize(ierr)
|
|
call assert_ok(ierr, 'finalize failed for CCLite input')
|
|
end subroutine check_valid_cclite_keyword
|
|
|
|
subroutine check_invalid_cclite_keyword()
|
|
call sph_initialize(ierr)
|
|
call assert_ok(ierr, 'initialize failed for invalid CCLite input')
|
|
call sph_read_inp('tests/data/cclite_options_invalid_082.inp', ierr)
|
|
if (ierr == SPH_SUCCESS) call fail('invalid CCLite option did not fail')
|
|
call sph_finalize(ierr)
|
|
call assert_ok(ierr, 'finalize failed for invalid CCLite input')
|
|
end subroutine check_invalid_cclite_keyword
|
|
|
|
subroutine assert_ok(ierr_value, message)
|
|
integer, intent(in) :: ierr_value
|
|
character(len=*), intent(in) :: message
|
|
|
|
if (ierr_value /= SPH_SUCCESS) call fail(message)
|
|
end subroutine assert_ok
|
|
|
|
subroutine fail(message)
|
|
character(len=*), intent(in) :: message
|
|
|
|
write(*, '(A)') trim(message)
|
|
stop 1
|
|
end subroutine fail
|
|
|
|
end program test_input_cclite_082
|