From 72837a1c287a2e31226db8cb2c59f053ab8c92f1 Mon Sep 17 00:00:00 2001 From: Ian Hinder Date: Thu, 12 Sep 2013 11:43:45 +0200 Subject: KrancThorn.m: Accumulate finite differencing header in sources variable --- Tools/CodeGen/KrancThorn.m | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/Tools/CodeGen/KrancThorn.m b/Tools/CodeGen/KrancThorn.m index 86018ac..1188c3f 100644 --- a/Tools/CodeGen/KrancThorn.m +++ b/Tools/CodeGen/KrancThorn.m @@ -331,21 +331,21 @@ CreateKrancThorn[groupsOrig_, parentDirectory_, thornName_, opts:OptionsPattern[ Create finite differencing header file ------------------------------------------------------------------------ *) - InfoMessage[Terse, "Creating differencing header file"]; - {pDefs, diffHeader} = CreateDifferencingHeader[partialDerivs, OptionValue[ZeroDimensions], OptionValue[UseVectors], OptionValue[IntParameters]]; - diffHeader = Join[ + Module[ + {diffHeader}, + InfoMessage[Terse, "Creating differencing header file"]; + {pDefs, diffHeader} = CreateDifferencingHeader[ + partialDerivs, OptionValue[ZeroDimensions], + OptionValue[UseVectors], OptionValue[IntParameters]]; + diffHeader = Join[ If[OptionValue[UseVectors] && ! OptionValue[UseOpenCL], {"#include \n", "#include \"vectors.h\"\n", "\n"}, {}], diffHeader]; - - (* ------------------------------------------------------------------------ - Process finite differencing header file for OpenCL - ------------------------------------------------------------------------ *) - - If[OptionValue[UseOpenCL], diffHeader = OpenCLProcessDifferencingHeader[diffHeader]]; + If[OptionValue[UseOpenCL], diffHeader = OpenCLProcessDifferencingHeader[diffHeader]]; + AppendTo[sources, {Filename -> "Differencing.h", Contents -> diffHeader}]]; (* ------------------------------------------------------------------------ Add predefinitions to calculations @@ -395,8 +395,7 @@ CreateKrancThorn[groupsOrig_, parentDirectory_, thornName_, opts:OptionsPattern[ Param -> param, CaKernel -> cakernel, Makefile -> make, - Sources -> Join[sources, { - {Filename -> "Differencing.h", Contents -> diffHeader}}, + Sources -> Join[sources, MapThread[{Filename -> #1, Contents -> #2} &, {calcFilenames, calcSources}], If[Length[OptionValue[ParameterConditions]] > 0, -- cgit v1.2.3