next up previous contents
Next: Testing Aliased Functions Up: Function aliasing Previous: Conventions and Restrictions   Contents

Examples

  • A C function is provided to add together two real numbers. The interface.ccl should read
        CCTK_REAL FUNCTION SumStuff(CCTK_REAL IN x, CCTK_REAL IN y)
        PROVIDES FUNCTION SumStuff WITH AddItUp LANGUAGE C
        USES FUNCTION SumStuff
    

  • A Fortran function is provided to invert a real number. The interface.ccl should read
        SUBROUTINE Invert(CCTK_REAL INOUT x)
        PROVIDES FUNCTION Invert WITH FindInverse LANGUAGE Fortran
        USES FUNCTION Invert
    
    Note that SUBROUTINE has the same meaning as void FUNCTION.

  • A Fortran function is provided to integrate any function over an interval. The interface.ccl should read
        CCTK_REAL Integrate(CCTK_REAL CCTK_FPOINTER  func(CCTK_REAL IN x), \
                            CCTK_REAL IN xmin, CCTK_REAL IN xmax)
        PROVIDES FUNCTION Integrate WITH SimpsonsRule LANGUAGE Fortran
        USES FUNCTION Integrate