next up previous contents index
Next: 5.6 Unit tests Up: 5.5 Compiler switches and Previous: 5.5.2 Compiler directives   Contents   Index

5.5.3 Compiler macros or switches

Compiler switches are used to (des)activate modules or compile alternative branches to improve performance. The default values are set in the header section of each file as, e.g., in:

!# /* -- Default values for some preprocessor macros ---------------------- */
!#
!# /* -- Number of additional quantities -- */
# ifndef rhd_box_quc01
#   define rhd_box_quc01 0
# endif
!#
!# /* -- Gravity correction: 0:'off0', 1:'default0', 2,3,4,5,6,11:'defaultn' -- */
# ifndef rhd_hyd_gravcorr_p01
#   define rhd_hyd_gravcorr_p01 5
# endif
!#
!# /* -- Method of entropy-fix calculation: 0, 1, 2 -- */
# ifndef rhd_hyd_entropyfix_p01
#   define rhd_hyd_entropyfix_p01 0
# endif
!#
!# /* -- Method of upwind calculation: 0 or 1 -- */
# ifndef rhd_hyd_upwind_p01
#   define rhd_hyd_upwind_p01 0
# endif
!#
!# /* -- Loop type for alpha value (amplitude) calculation: 0 (default), 1, 2, 3 -- */
# ifndef rhd_roe1d_flux_l01
#   define rhd_roe1d_flux_l01 1
# endif
!#
!# /* -- MPI activation -- */
# ifndef rhd_mpi_l01
#   define rhd_mpi_l01 0
# endif
!#
!# /* ---------------------------------------------- */

To document which switches were used to compile the code each module that uses compiler switches should contain a _SwitchInfo routine, that is called by the main program. It can look like:

!-----******************------------------------------------
subroutine rhd_hyd_SwitchInfo(ncp)
!--------------------------------------------------
! NAME:
!   rhd_hyd_SwitchInfo ('rhd_hydrodynamics_Switch_Information')
!
! PURPOSE:
!   Print information about used compiler switches.
!   
! CATEGORY:
!   Hydrodynamics
!
! CALLING SEQUENCE:
!   call rhd_hyd_SwitchInfo(ncp)
!
! INPUT:
!   ncp:          ('number_channel_print') integer with output channel number (usually 6)
!
! OUTPUT:
!   None
!
! LOCAL VARIABLES:
!
! ROUTINES:
!   None
!
! MODULES:
!   None
!
! SIDE EFFECTS:
!   Write to requested output channel.
!
! RESTRICTIONS:
!   If another compiler switch is used anywhere in the module it has to be explicitly
!   included in this routine.
!
! PROCEDURE:
!   Just print the value of all compiler switches used for the module.
!
! EXAMPLE:
!   call rhd_hyd_SwitchInfo(6)
!
! MODIFICATION HISTORY:
!   2002-08-12 (B.F.) Written
!--------------------------------------------------
implicit none
!
! -- I/O parameters --
integer,                   intent(in)   :: ncp
!
! -- Local variables --
character(len=*), parameter             :: defstr='  defined', undefstr='undefined'
!--------------------------------------------------
!
write(ncp,'(A)')    'Compiler switches: rhd_hyd_module .........................'
!
write(ncp,'(A,I6)') '  rhd' // '_hyd_gravcorr_p01:       ', rhd_hyd_gravcorr_p01
write(ncp,'(A,I6)') '  rhd' // '_hyd_entropyfix_p01:     ', rhd_hyd_entropyfix_p01
write(ncp,'(A,I6)') '  rhd' // '_hyd_upwind_p01:         ', rhd_hyd_upwind_p01
write(ncp,'(A,I6)') '  rhd' // '_roe1d_flux_l01:         ', rhd_roe1d_flux_l01
write(ncp,'(A,I6)') '  rhd' // '_mpi_l01:                ', rhd_mpi_l01
!
!#
# ifdef rhd_bound_t01
!#
write(ncp,'(A,A)' ) '  rhd' // '_bound_t01:           ', defstr
!#
# else
!#
write(ncp,'(A,A)' ) '  rhd' // '_bound_t01:           ', undefstr
!#
# endif
!#
!
!#
# ifdef rhd_roe1d_flux_t01
!#
write(ncp,'(A,A)' ) '  rhd' // '_roe1d_flux_t01:      ', defstr
!#
# else
!#
write(ncp,'(A,A)' ) '  rhd' // '_roe1d_flux_t01:      ', undefstr
!#
# endif
!#
!
!#
# ifdef rhd_roe1d_step_t01
!#
write(ncp,'(A,A)' ) '  rhd' // '_roe1d_step_t01:      ', defstr
!#
# else
!#
write(ncp,'(A,A)' ) '  rhd' // '_roe1d_step_t01:      ', undefstr
!#
# endif
!#
!
end subroutine rhd_hyd_SwitchInfo


next up previous contents index
Next: 5.6 Unit tests Up: 5.5 Compiler switches and Previous: 5.5.2 Compiler directives   Contents   Index