Skip to content

Commit

Permalink
CalculationFunction.m: Check that only recognized keys are used in ca…
Browse files Browse the repository at this point in the history
…lculations
  • Loading branch information
ianhinder committed Mar 21, 2012
1 parent 376ecd6 commit fd2fa1e
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion Tools/CodeGen/CalculationFunction.m
Expand Up @@ -136,7 +136,20 @@ indentation after each line break (this will push the line length
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
Expand Down

0 comments on commit fd2fa1e

Please sign in to comment.