aboutsummaryrefslogtreecommitdiff
path: root/Tools/CodeGen
diff options
context:
space:
mode:
authorIan Hinder <ian.hinder@aei.mpg.de>2012-03-21 13:22:11 +0100
committerIan Hinder <ian.hinder@aei.mpg.de>2012-03-21 13:22:11 +0100
commitfd2fa1ee07c2dd3006af96f8368adf9b816d4fdb (patch)
tree4f9140150dbd3d076833b9232ffaea526762d1b0 /Tools/CodeGen
parent376ecd6f239e0fce431cd7a9fd487aa8a66bcf9c (diff)
CalculationFunction.m: Check that only recognized keys are used in calculations
Diffstat (limited to 'Tools/CodeGen')
-rw-r--r--Tools/CodeGen/CalculationFunction.m15
1 files changed, 14 insertions, 1 deletions
diff --git a/Tools/CodeGen/CalculationFunction.m b/Tools/CodeGen/CalculationFunction.m
index 395bbb2..77a0795 100644
--- a/Tools/CodeGen/CalculationFunction.m
+++ b/Tools/CodeGen/CalculationFunction.m
@@ -136,7 +136,20 @@ VerifyCalculation[calc_] :=
VerifyListContent[lookup[calc, Equations], Rule,
" while checking the equation" <> ToString[calcName]],
ThrowError["Invalid Calculation structure. Must contain Equations element: ",
- ToString[calc], " while checking the calculation called ", ToString[calcName]]]];
+ ToString[calc], " while checking the calculation called ", ToString[calcName]]];
+
+ allowedKeys = {BodyFunction, CallerFunction, ExecuteOn,
+ GFAccessFunction, Groups, Implementation, InitFDVariables,
+ LoopFunction, MacroPointer, Name, ODEGroups, Parameters,
+ PartialDerivatives, PreDefinitions, Schedule,Equations,
+ Shorthands, ConditionalOnKeyword, Before, After,
+ ConditionalOnTextuals, Where, ConditionalOnKeywords,
+ CollectList, AllowedSymbols, ApplyBCs};
+
+ usedKeys = Map[First, calc];
+ unknownKeys = Complement[usedKeys, allowedKeys];
+ If[unknownKeys =!= {},
+ ThrowError["Unrecognised key(s) in calculation: ", unknownKeys]]];
(* Remove equations in the calculation which assign to shorthands
which are never used. Do not modify the Shorthands entry. An unused