aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Hinder <ian.hinder@aei.mpg.de>2013-09-12 11:43:45 +0200
committerIan Hinder <ian.hinder@aei.mpg.de>2013-09-12 11:43:45 +0200
commit72837a1c287a2e31226db8cb2c59f053ab8c92f1 (patch)
tree21d68f97099b39be242ac8f49427ecab01ccac67
parent0b39a8d69637e13d81824f3dce4aa8d87f60218e (diff)
KrancThorn.m: Accumulate finite differencing header in sources variable
-rw-r--r--Tools/CodeGen/KrancThorn.m21
1 files 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 <assert.h>\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,