![]() ![]() ![]() ![]() Next: Memory Tracing Up: Include Files Previous: Include Files Contents ExampleAs an example of this in practice, for the case of Fortran code, consider a thorn A, which wants to gather terms for a calculation from any thorn that wishes to provide them. Thorn A could have the lines in its source code
c Get source code from other thorns allterms = 0d0 #include "AllSources.inc"and would then add to interface.ccl the line USES INCLUDE SOURCE: AllSources.inc If thorn B wants to add terms for the calculation, it would create a file, say Bterms.inc with the lines c Add this to AllSources.inc allterms = allterms + 1d0and would add to its own interface.ccl
INCLUDE SOURCE: Bterms.inc in AllSources.inc The final file for thorn A which is compiled, will contain the code c Get source code from other thorns allterms = 0d0 if (CCTK_IsThornActive("B").ne.0) then c Add this to AllSources.inc allterms = allterms + 1d0 end if Any Fortran thorn routines which include source code must include the declaration DECLARE_CCTK_FUNCTIONS.
|