Skip to content
Snippets Groups Projects
Commit 0658c7dc authored by Luis Kornblueh's avatar Luis Kornblueh
Browse files

Added callback print functions.

parent affb0b66
No related branches found
No related tags found
No related merge requests found
......@@ -13,22 +13,25 @@ config/stamp-h1
libtool
Doxyfile.bak
doc/doxygen-doc
doc/Doxyfile
*~
*#
*.o
*.mod
*.lo
*.la
autom4te.cache
test/model_integration
test/time_calculus
test/example
test/duration
test/iconatm
test/iconoce
test/output_control
test/recurrence
test/repetitor
test/comp_weights
test/modulo
test/uniq
check/test_runner
\ No newline at end of file
examples/model_integration
examples/time_calculus
examples/example
examples/duration
examples/iconatm
examples/iconoce
examples/output_control
examples/recurrence
examples/repetitor
examples/comp_weights
examples/modulo
examples/uniq
examples/callback_test
test/test_runner
\ No newline at end of file
......@@ -13,6 +13,7 @@ bin_PROGRAMS = \
uniq \
modulo \
comp_weights \
callback_test \
iconatm \
iconoce
......@@ -60,6 +61,10 @@ modulo_SOURCES = modulo.c
modulo_LDADD = ../src/libmtime.la
modulo_LDFLAGS=
callback_test_SOURCES = callback_test.f90
callback_test_LDADD = ../src/libmtime.la
callback_test_LDFLAGS=
iconatm_SOURCES = iconatm.f90
iconatm_LDADD = ../src/libmtime.la
iconatm_LDFLAGS=
......
......@@ -92,7 +92,7 @@ bin_PROGRAMS = time_calculus$(EXEEXT) model_integration$(EXEEXT) \
example$(EXEEXT) duration$(EXEEXT) output_control$(EXEEXT) \
recurrence$(EXEEXT) repetitor$(EXEEXT) tas$(EXEEXT) \
uniq$(EXEEXT) modulo$(EXEEXT) comp_weights$(EXEEXT) \
iconatm$(EXEEXT) iconoce$(EXEEXT)
callback_test$(EXEEXT) iconatm$(EXEEXT) iconoce$(EXEEXT)
subdir = examples
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_prog_doxygen.m4 \
......@@ -109,13 +109,19 @@ CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
am__installdirs = "$(DESTDIR)$(bindir)"
PROGRAMS = $(bin_PROGRAMS)
am_comp_weights_OBJECTS = comp_weights.$(OBJEXT)
comp_weights_OBJECTS = $(am_comp_weights_OBJECTS)
comp_weights_DEPENDENCIES = ../src/libmtime.la
am_callback_test_OBJECTS = callback_test.$(OBJEXT)
callback_test_OBJECTS = $(am_callback_test_OBJECTS)
callback_test_DEPENDENCIES = ../src/libmtime.la
AM_V_lt = $(am__v_lt_@AM_V@)
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
am__v_lt_0 = --silent
am__v_lt_1 =
callback_test_LINK = $(LIBTOOL) $(AM_V_lt) --tag=FC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(FCLD) $(AM_FCFLAGS) $(FCFLAGS) \
$(callback_test_LDFLAGS) $(LDFLAGS) -o $@
am_comp_weights_OBJECTS = comp_weights.$(OBJEXT)
comp_weights_OBJECTS = $(am_comp_weights_OBJECTS)
comp_weights_DEPENDENCIES = ../src/libmtime.la
comp_weights_LINK = $(LIBTOOL) $(AM_V_lt) --tag=FC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(FCLD) $(AM_FCFLAGS) $(FCFLAGS) \
$(comp_weights_LDFLAGS) $(LDFLAGS) -o $@
......@@ -243,18 +249,18 @@ AM_V_FCLD = $(am__v_FCLD_@AM_V@)
am__v_FCLD_ = $(am__v_FCLD_@AM_DEFAULT_V@)
am__v_FCLD_0 = @echo " FCLD " $@;
am__v_FCLD_1 =
SOURCES = $(comp_weights_SOURCES) $(duration_SOURCES) \
$(example_SOURCES) $(iconatm_SOURCES) $(iconoce_SOURCES) \
$(model_integration_SOURCES) $(modulo_SOURCES) \
$(output_control_SOURCES) $(recurrence_SOURCES) \
$(repetitor_SOURCES) $(tas_SOURCES) $(time_calculus_SOURCES) \
$(uniq_SOURCES)
DIST_SOURCES = $(comp_weights_SOURCES) $(duration_SOURCES) \
$(example_SOURCES) $(iconatm_SOURCES) $(iconoce_SOURCES) \
$(model_integration_SOURCES) $(modulo_SOURCES) \
$(output_control_SOURCES) $(recurrence_SOURCES) \
$(repetitor_SOURCES) $(tas_SOURCES) $(time_calculus_SOURCES) \
$(uniq_SOURCES)
SOURCES = $(callback_test_SOURCES) $(comp_weights_SOURCES) \
$(duration_SOURCES) $(example_SOURCES) $(iconatm_SOURCES) \
$(iconoce_SOURCES) $(model_integration_SOURCES) \
$(modulo_SOURCES) $(output_control_SOURCES) \
$(recurrence_SOURCES) $(repetitor_SOURCES) $(tas_SOURCES) \
$(time_calculus_SOURCES) $(uniq_SOURCES)
DIST_SOURCES = $(callback_test_SOURCES) $(comp_weights_SOURCES) \
$(duration_SOURCES) $(example_SOURCES) $(iconatm_SOURCES) \
$(iconoce_SOURCES) $(model_integration_SOURCES) \
$(modulo_SOURCES) $(output_control_SOURCES) \
$(recurrence_SOURCES) $(repetitor_SOURCES) $(tas_SOURCES) \
$(time_calculus_SOURCES) $(uniq_SOURCES)
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
......@@ -469,6 +475,9 @@ uniq_LDFLAGS =
modulo_SOURCES = modulo.c
modulo_LDADD = ../src/libmtime.la
modulo_LDFLAGS =
callback_test_SOURCES = callback_test.f90
callback_test_LDADD = ../src/libmtime.la
callback_test_LDFLAGS =
iconatm_SOURCES = iconatm.f90
iconatm_LDADD = ../src/libmtime.la
iconatm_LDFLAGS =
......@@ -558,6 +567,10 @@ clean-binPROGRAMS:
echo " rm -f" $$list; \
rm -f $$list
callback_test$(EXEEXT): $(callback_test_OBJECTS) $(callback_test_DEPENDENCIES) $(EXTRA_callback_test_DEPENDENCIES)
@rm -f callback_test$(EXEEXT)
$(AM_V_FCLD)$(callback_test_LINK) $(callback_test_OBJECTS) $(callback_test_LDADD) $(LIBS)
comp_weights$(EXEEXT): $(comp_weights_OBJECTS) $(comp_weights_DEPENDENCIES) $(EXTRA_comp_weights_DEPENDENCIES)
@rm -f comp_weights$(EXEEXT)
$(AM_V_FCLD)$(comp_weights_LINK) $(comp_weights_OBJECTS) $(comp_weights_LDADD) $(LIBS)
......
module mo_exception
implicit none
private
public :: message
contains
subroutine message(leading_text, message_text)
character(len=*), intent(in) :: leading_text
character(len=*), intent(in) :: message_text
write (0,*) trim(leading_text)//': '//trim(message_text)
end subroutine message
end module mo_exception
module mo_mtime_message
use mtime
implicit none
private
public :: register_message_procedure
public :: print_mtime
abstract interface
subroutine registered_message_procedure(leading_text, message_text)
character(len=*), intent(in) :: leading_text
character(len=*), intent(in) :: message_text
end subroutine registered_message_procedure
end interface
procedure(registered_message_procedure), pointer :: print_message => null()
interface print_mtime
module procedure print_mtime_i
module procedure print_mtime_datetime
module procedure print_mtime_timedelta
module procedure print_mtime_r
end interface print_mtime
contains
subroutine register_message_procedure(message_procedure)
procedure(registered_message_procedure) :: message_procedure
print_message => message_procedure
end subroutine register_message_procedure
subroutine print_mtime_datetime(leading_text, message_text, this_datetime)
character(len=*), intent(in) :: leading_text
character(len=*), intent(in) :: message_text
type(datetime), pointer :: this_datetime
character(len=max_datetime_str_len) :: dstring
call datetimeToString(this_datetime, dstring)
call print_message(trim(leading_text), trim(message_text)//' '//trim(dstring))
end subroutine print_mtime_datetime
subroutine print_mtime_timedelta(leading_text, message_text, this_timedelta)
character(len=*), intent(in) :: leading_text
character(len=*), intent(in) :: message_text
type(timedelta), pointer :: this_timedelta
character(len=max_timedelta_str_len) :: tdstring
call timedeltaToString(this_timedelta, tdstring)
call print_message(trim(leading_text), trim(message_text)//' '//trim(tdstring))
end subroutine print_mtime_timedelta
subroutine print_mtime_i(leading_text, message_text, time)
character(len=*), intent(in) :: leading_text
character(len=*), intent(in) :: message_text
integer, intent(in) :: time
character(len=12) :: tmptime
write(tmptime,'(i0)') time
call print_message(trim(leading_text), trim(message_text)//' '//trim(tmptime))
end subroutine print_mtime_i
subroutine print_mtime_r(leading_text, message_text, time)
character(len=*), intent(in) :: leading_text
character(len=*), intent(in) :: message_text
real, intent(in) :: time
character(len=12) :: tmptime
write(tmptime,'(f5.2)') time
call print_message(trim(leading_text), trim(message_text)//trim(tmptime))
end subroutine print_mtime_r
end module mo_mtime_message
program callback_test
use mtime
use mo_exception
use mo_mtime_message
type(datetime), pointer :: current_date => null()
type(timedelta), pointer :: model_time_step => null()
call setCalendar(proleptic_gregorian)
call register_message_procedure(message)
current_date => newDatetime('1999-01-01T00:00:00')
call print_mtime('Message','Works as expected!', current_date)
model_time_step => newTimedelta('PT2H')
call print_mtime('Message','Works as expected!', model_time_step)
call print_mtime('Message','Works as expected!', 13)
call print_mtime('Message','Works as expected!', 2.5)
end program callback_test
......@@ -237,7 +237,7 @@ program iconoce
& couplingTimeInterval, &
& isRestart
open (file='test/iconoce.nml', newunit=iunit, iostat=ierror)
open (file='examples/iconoce.nml', newunit=iunit, iostat=ierror)
if (ierror /= 0) then
print *, 'ERROR: could not open namelist file.'
stop
......@@ -453,7 +453,7 @@ contains
write (filename,'(a,a,a)') 'restart_oce_', trim(dstring), '.dat'
open (file='test/'//trim(filename), newunit=iunit, iostat=ierror)
open (file='examples/'//trim(filename), newunit=iunit, iostat=ierror)
if (ierror /= 0) then
print *, 'ERROR: could not open restart file for writing.'
stop
......@@ -470,7 +470,7 @@ contains
!
ierror = 0
error_message = ''
call execute_command_line('rm -f test/restart_oce.dat', &
call execute_command_line('rm -f examples/restart_oce.dat', &
& cmdstat=ierror, cmdmsg=error_message)
if (ierror /= 0) then
print *, 'ERROR: could not remove previous soft link restart/checkpoint file.'
......@@ -481,7 +481,7 @@ contains
!
ierror = 0
error_message = ''
call execute_command_line('ln -s '//trim(filename)//' test/restart_oce.dat', &
call execute_command_line('ln -s '//trim(filename)//' examples/restart_oce.dat', &
& cmdstat=ierror, cmdmsg=error_message)
if (ierror /= 0) then
print *, 'ERROR: could not soft link restart/checkpoint file.'
......@@ -500,7 +500,7 @@ contains
integer :: iunit, ierror
open (file='test/restart_oce.dat', status='old', newunit=iunit, iostat=ierror)
open (file='examples/restart_oce.dat', status='old', newunit=iunit, iostat=ierror)
if (ierror /= 0) then
print *, 'ERROR: could not open restart file for reading'
print *, ' check isRestart in namelist.'
......
&timeControl
calendar = 'proleptic Gregorian'
calendar = '360 day year'
experimentReferenceDate = '1999-01-01T00:00:00'
experimentStartDate = '2000-01-01T00:00:00'
experimentEndDate = '2001-01-01T00:00:00'
experimentReferenceDate = '1999-01-01T00:00:00'
experimentStartDate = '2000-01-01T00:00:00'
experimentEndDate = '2002-01-01T00:00:00'
modelTimeStep = 'PT2H'
checkpointTimeInterval = 'R/P60D'
restartTimeInterval = 'R/P300D'
restartTimeInterval = 'R/P360D'
couplingTimeInterval = 'R/PT2H'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment