Load the definition of an acoustic pulse from a configuration Lua script.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(flu_State) | :: | conf | ||||
integer, | intent(in) | :: | thandle | |||
type(tem_acoustic_pulse_type), | intent(out) | :: | me |
subroutine tem_load_acoustic_pulse(conf, thandle, me)
type(flu_State) :: conf
integer, intent(in) :: thandle
type(tem_acoustic_pulse_type), intent(out) :: me
! -------------------------------------------------------------------- !
integer :: iError, vError(3)
! -------------------------------------------------------------------- !
write(logunit(1),*) 'Loading predefined function for acoustic pulse:'
call aot_get_val( L = conf, &
& thandle = thandle, &
& key = 'amplitude', &
& val = me%amplitude, &
& ErrCode = iError )
if (iError /= 0) then
write(logUnit(1),*) 'ERROR in tem_load_acoustic_pulse: not able '
write(logUnit(1),*) 'to read amplitude from config file.'
call tem_abort()
end if
write(logUnit(1),*) ' * amplitude =', me%amplitude
call aot_get_val( L = conf, &
& thandle = thandle, &
& key = 'halfwidth', &
& val = me%halfwidth, &
& ErrCode = iError )
if (iError /= 0) then
write(logUnit(1),*) 'ERROR in tem_load_acoustic_pulse: not able '
write(logUnit(1),*) 'to read halfwidth from config file.'
call tem_abort()
end if
write(logUnit(1),*) ' * halfwidth =', me%halfwidth
call aot_get_val( L = conf, &
& thandle = thandle, &
& key = 'speed_of_sound', &
& val = me%speed_of_sound, &
& ErrCode = iError )
if (iError /= 0) then
write(logUnit(1),*) 'ERROR in tem_load_acoustic_pulse: not able '
write(logUnit(1),*) 'to read speed_of_sound from config file.'
call tem_abort()
end if
write(logUnit(1),*) ' * speed_of_sound =', me%speed_of_sound
call aot_get_val( L = conf, &
& thandle = thandle, &
& key = 'center', &
& val = me%center, &
default = [0.0_rk, 0.0_rk, 0.0_rk], &
& ErrCode = vError )
if ( any(vError /= 0) ) then
write(logUnit(1),*) 'ERROR in tem_load_acoustic_pulse: not able '
write(logUnit(1),*) 'to read center from config file.'
call tem_abort()
end if
write(logUnit(1),*) ' * center =', me%center
call aot_get_val( L = conf, &
& thandle = thandle, &
& key = 'background', &
& val = me%background, &
default = 0.0_rk, &
& ErrCode = iError )
if (iError /= 0) then
write(logUnit(1),*) 'ERROR in tem_load_acoustic_pulse: not able '
write(logUnit(1),*) 'to read background from config file.'
call tem_abort()
end if
write(logUnit(1),*) ' * background =', me%background
end subroutine tem_load_acoustic_pulse