diff options
Diffstat (limited to 'Tools/CodeGen')
-rw-r--r-- | Tools/CodeGen/CalculationFunction.m | 6 | ||||
-rw-r--r-- | Tools/CodeGen/Kranc.m | 3 | ||||
-rw-r--r-- | Tools/CodeGen/Thorn.m | 11 |
3 files changed, 14 insertions, 6 deletions
diff --git a/Tools/CodeGen/CalculationFunction.m b/Tools/CodeGen/CalculationFunction.m index 8492389..be9ec84 100644 --- a/Tools/CodeGen/CalculationFunction.m +++ b/Tools/CodeGen/CalculationFunction.m @@ -491,11 +491,7 @@ DefFn[ InfoMessage[InfoFull,"Generating function"]; { - DefineFunction[bodyFunctionName, "static void", "cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const imin[3], int const imax[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]", - { - "DECLARE_CCTK_ARGUMENTS;\n", - "DECLARE_CCTK_PARAMETERS;\n\n", - + lookup[calcp,BodyFunction][{ (* OpenCL kernel prologue *) (* We could (or probably should) write this into a source file of its own *) If[OptionValue[UseOpenCL], diff --git a/Tools/CodeGen/Kranc.m b/Tools/CodeGen/Kranc.m index 8941eb2..5da3285 100644 --- a/Tools/CodeGen/Kranc.m +++ b/Tools/CodeGen/Kranc.m @@ -39,7 +39,8 @@ dummy; LoopPreIncludes, GroupImplementations, PartialDerivatives, NoSimplify, Boundary, Interior, InteriorNoSync, Where, AddToStencilWidth, Everywhere, normal1, normal2, normal3, INV, SQR, CUB, QAD, dot, pow, -exp, dt, dx, dy, dz, idx, idy, idz, t, MinMod, VanLeer} +exp, dt, dx, dy, dz, idx, idy, idz, t, MinMod, VanLeer, BodyFunction, +CallerFunction} {ConditionalOnKeyword, ConditionalOnKeywords, CollectList, Interior, InteriorNoSync, Boundary, BoundaryWithGhosts, Where, PreDefinitions, diff --git a/Tools/CodeGen/Thorn.m b/Tools/CodeGen/Thorn.m index 25d3d31..b2bb447 100644 --- a/Tools/CodeGen/Thorn.m +++ b/Tools/CodeGen/Thorn.m @@ -531,6 +531,17 @@ CreateSetterSource[calcs_, debug_, include_, CalculationBoundariesFunction[First[calcs]], + bodyFunction = DefineFunction[lookup[calc,Name]<>"_Body", "static void", "cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const imin[3], int const imax[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]", + { + "DECLARE_CCTK_ARGUMENTS;\n", + "DECLARE_CCTK_PARAMETERS;\n\n", + # + }] &; + + calc = Join[calc, {BodyFunction -> bodyFunction, + CallerFunction -> True, + LoopFunction -> (codeBlock[kernel<>"_Computations", #] &)}]; + CreateCalculationFunction[calc, opts]}]; |