aboutsummaryrefslogtreecommitdiff
path: root/Tools/CodeGen/CalculationFunction.m
diff options
context:
space:
mode:
authorIan Hinder <ian.hinder@aei.mpg.de>2013-09-06 11:30:24 +0200
committerIan Hinder <ian.hinder@aei.mpg.de>2013-09-06 11:30:24 +0200
commit7e5fe18b4b0ffc18a17a2cd89f15c2f3afe82ff6 (patch)
tree4e97f39051467e93f414cbb10fd9ccc829e167a9 /Tools/CodeGen/CalculationFunction.m
parent3f377686702f42cd5058f3265fbeea9bb226cc15 (diff)
CalculationFunction.m: Remove unneeded temporary variable
Diffstat (limited to 'Tools/CodeGen/CalculationFunction.m')
-rw-r--r--Tools/CodeGen/CalculationFunction.m9
1 files changed, 4 insertions, 5 deletions
diff --git a/Tools/CodeGen/CalculationFunction.m b/Tools/CodeGen/CalculationFunction.m
index 6551fcf..3a51bba 100644
--- a/Tools/CodeGen/CalculationFunction.m
+++ b/Tools/CodeGen/CalculationFunction.m
@@ -884,21 +884,20 @@ DefFn[
(* Generate actual code strings. Try to declare variables as they are assigned, but
it is only possible to do this outside all if(){} statements. *)
generateEquationCode[{declare2_, eq2_}] :=
- Module[{ret, vars, preDeclare, cond, vectorize},
- vectorize = OptionValue[UseVectors];
+ Module[{ret, vars, preDeclare, cond},
InfoMessage[InfoFull, "Generating code for " <> ToString[eq2[[1]], InputForm]];
Which[
SameQ[Head[eq2[[2]]], IfThen],
ret = assignVariableFromExpression[eq2[[1]],
- eq2[[2]] /. IfThen[cond_, x__]:> IfThen[Scalar[cond], x], declare2, vectorize, noSimplify];,
+ eq2[[2]] /. IfThen[cond_, x__]:> IfThen[Scalar[cond], x], declare2, OptionValue[UseVectors], noSimplify];,
SameQ[Head[eq2], IfThenGroup],
vars = eq2[[2,All,1]];
cond = eq2[[1]];
preDeclare = Pick[vars, declare2];
ret = {Map[DeclareVariableNoInit[#, DataType[]] &, Complement[Union[preDeclare], localName/@gfsInRHS]], {"\n"},
Conditional[generateCodeFromExpression[Scalar[cond], False],
- Riffle[assignVariableFromExpression[#[[1]], #[[2]], False, vectorize, noSimplify]& /@ eq2[[2]], "\n"],
- Riffle[assignVariableFromExpression[#[[1]], #[[2]], False, vectorize, noSimplify]& /@ eq2[[3]], "\n"]]};,
+ Riffle[assignVariableFromExpression[#[[1]], #[[2]], False, OptionValue[UseVectors], noSimplify]& /@ eq2[[2]], "\n"],
+ Riffle[assignVariableFromExpression[#[[1]], #[[2]], False, OptionValue[UseVectors], noSimplify]& /@ eq2[[3]], "\n"]]};,
True,
ret = assignVariableFromExpression[eq2[[1]], eq2[[2]], declare2, OptionValue[UseVectors], noSimplify];
];