[Developers] Re: [CactusMaint] fortran PROVIDES FUNCTION example?

Ian Hawke hawke at aei.mpg.de
Fri Jan 16 11:17:38 CST 2004

On Fri, 16 Jan 2004, Jonathan Thornburg wrote:

> > In trying to get my code ported to the latest-greatest development
> > version (I have not updated by development version of cactus
> > since sometime last fall), I find that thorn dependancies have been
> > tightened in some way.  If I have a fortran routine in thornA which
> > I try to call in thornB, I get an undefined reference at link time.
> > I assume that one has to use the PROVIDES FUNCTION capabilities?
> > Is this correct?  Is there any example in cactus-proper of providing
> > fortran functions?  I can't seem to find any.  Or is there some
> > other preferred mechanism/example of how one can provide fortran
> > functions between thorns?

> This isn't quite what you asked for, but AEIThorns/AHFinderDirect
> has some PROVIDES FUNCTION declarations in its interface.ccl.
> But it's in C (actually C++, but Cactus doesn't know that).
> The latest version of Michael Koppitz's AEIDevelopment/Dist uses
> these functions, but I don't know if he's committed that yet, nor does
> it necessarily work correctly yet. :)
> The syntax in the *.ccl files should be ok, though...

I do not know of a cactus-proper Fortran provided function, as nearly all
Cactus* arrangements are in C. Those that exist, such as DriftCorrect and
Dist are mostly restricted access.

However, the syntax at the .ccl level is identical independent of the
language. The only subtleties occur on the calling side where the method
was changed recently by Erik (largely to ensure that the return type
definition is automatically included somehow). Some of the recent changes
haven't propagated up to the users guide yet, largely because there is
still talk of introducing a "functions.ccl" when the syntax could change
again. Don't know what the movement on this is.

Cactus proper thorns that provide functions include CactusBase/Boundary
and CactusPUGH/PUGHSlab. The AEIThorns/ADM_BSSN and BSSN_MoL thorns have
aliased functions in. Some are used from Fortran. However, the provided
function is C. AEIThorns/BSSN_MoL/Boundaries.F is probably the canonical
example of using aliased functions from Fortran. Note that you need to
#include "cctk_Functions.h", that the routine needs the
DECLARE_CCTK_FUNCTIONS macro, and that from Fortran the checking function
CCTK_IsFunctionAliased is unfortunately a subroutine.

Hope this helps,


More information about the Developers mailing list