![]() ![]() ![]() ![]() Next: Fortran Example Up: Fortran Routines Previous: Variables Contents ParametersAll parameters defined in a thorn's param.ccl and all global parameters, appear as local variables of the corresponding CCTK data type in Fortran source code, i.e. Booleans and Integers appear as CCTK_INT types (with nonzero/zero values for boolean yes/no), Reals as CCTK_REAL, and Keywords and String parameters as CCTK_STRING (see also note below). These variables are read only, and changes should not be made to them. The effect of changing a parameter is undefined (at best). Any routine using Cactus parameters should include at the top of the file the header #include "cctk_Parameters.h" The parameters should be declared at the start of the routine using them with the macro DECLARE_CCTK_PARAMETERS. In Fortran, special care should be taken with string valued parameters. These parameters are passed as C pointers, and can not be treated as normal Fortran strings. To compare a string valued parameter and Fortran string, use the macro CCTK_EQUALS() or the function CCTK_Equals() (see the reference manual for a description of the CCTK_ functions). To print the value of a string valued parameter to screen, use the subroutine CCTK_PrintString(). A further function CCTK_FortranString provides a mechanism for converting a string parameter to a Fortran string. For example, if operator is a Cactus string parameter holding the name of a reduction operator whose handle you need to find, you cannot pass it directly into the subroutine CCTK_LocalArrayReductionHandle, which is expecting a Fortran string. Instead, the following is needed: character*200 fortran_operator CCTK_INT fortran_operator_len integer handle call CCTK_FortranString(fortran_operator_len,operator,fortran_operator) call CCTK_LocalArrayReductionHandle(handle,fortran_operator(1:fortran_operator_len))
![]() ![]() ![]() ![]() Next: Fortran Example Up: Fortran Routines Previous: Variables Contents |