aboutsummaryrefslogtreecommitdiff
path: root/Tools/CodeGen/CalculationFunction.m
diff options
context:
space:
mode:
authorIan Hinder <ian.hinder@aei.mpg.de>2011-09-18 20:34:16 +0200
committerIan Hinder <ian.hinder@aei.mpg.de>2011-09-18 20:43:11 +0200
commit9737d7a9f4e526f4aa14d9701c255ab06789f445 (patch)
treef0f3b9ef14e5cb32f1fad2e722da215e695410c8 /Tools/CodeGen/CalculationFunction.m
parent13dc2616b9714bddc37412bc6254fff9bc058216 (diff)
Enable selection of finite difference operators using run-time parameters
Partial derivative definitions can now depend on Mathematica variables corresponding to parameters defined in IntParameters. These parameters should be defined with an AllowedValues -> {1, 2, 3, …} entry. Derivative operators are created for all possible values of the parameter. At run-time, a switch statement in the grid function loop selects which set of operators are used. Only one parameter can currently be used.
Diffstat (limited to 'Tools/CodeGen/CalculationFunction.m')
-rw-r--r--Tools/CodeGen/CalculationFunction.m4
1 files changed, 2 insertions, 2 deletions
diff --git a/Tools/CodeGen/CalculationFunction.m b/Tools/CodeGen/CalculationFunction.m
index e9b6c13..35e9625 100644
--- a/Tools/CodeGen/CalculationFunction.m
+++ b/Tools/CodeGen/CalculationFunction.m
@@ -478,7 +478,7 @@ CreateCalculationFunction[calcp_, debug_, imp_, opts:OptionsPattern[]] :=
CheckGroupStorage[groupsInCalculation[cleancalc, imp], functionName],
"\n",
- CheckStencil[pddefs, eqs, functionName],
+ CheckStencil[pddefs, eqs, functionName, lookup[{opts}, IntParameters, {}]],
If[haveCondTextuals, Map[ConditionalOnParameterTextual["!(" <> # <> ")", "return;\n"] &,condTextuals], {}],
@@ -673,7 +673,7 @@ equationLoop[eqs_, cleancalc_, gfs_, shorts_, incs_, groups_, pddefs_,
Map[IncludeFile, incs]],
CommentedBlock["Precompute derivatives",
- PrecomputeDerivatives[defsWithoutShorts, eqsOrdered]],
+ PrecomputeDerivatives[defsWithoutShorts, eqsOrdered, lookup[{opts}, IntParameters, {}]]],
CommentedBlock["Calculate temporaries and grid functions", calcCode],