aboutsummaryrefslogtreecommitdiff
path: root/Tools/CodeGen/KrancThorn.m
diff options
context:
space:
mode:
authorIan Hinder <ian.hinder@aei.mpg.de>2010-03-02 14:23:11 -0600
committerIan Hinder <ian.hinder@aei.mpg.de>2010-03-02 14:23:11 -0600
commitbb44a273ccc5622ce671665a25486c79bb8f0242 (patch)
treef73cce5529198acbad629b78e572bc7f248301be /Tools/CodeGen/KrancThorn.m
parent108aa9e3d5680cf77c29d739acdccca871c56fca (diff)
Use Mathematica OptionValue mechanism to access options in CreateThorn
Diffstat (limited to 'Tools/CodeGen/KrancThorn.m')
-rw-r--r--Tools/CodeGen/KrancThorn.m48
1 files changed, 25 insertions, 23 deletions
diff --git a/Tools/CodeGen/KrancThorn.m b/Tools/CodeGen/KrancThorn.m
index f47fb49..26031b4 100644
--- a/Tools/CodeGen/KrancThorn.m
+++ b/Tools/CodeGen/KrancThorn.m
@@ -48,7 +48,8 @@ ThornOptions =
ZeroDimensions -> {},
UseLoopControl -> False,
UseCSE -> False,
- ProhibitAssignmentToGridFunctionsRead -> False};
+ ProhibitAssignmentToGridFunctionsRead -> False,
+ IncludeFiles -> {}};
{ConditionalOnKeyword, ConditionalOnKeywords, CollectList, Interior, InteriorNoSync, Boundary, BoundaryWithGhosts, Where, PreDefinitions, AllowedSymbols, UseLoopControl, Parameters};
@@ -134,30 +135,31 @@ CreateKrancThorn[groupsOrig_, parentDirectory_, thornName_, opts:OptionsPattern[
InfoMessage[Terse, "Processing arguments to CreateKrancThorn"];
cktCheckNamedArgs[{opts}];
- calcs = lookupDefault[{opts}, Calculations, {}];
- declaredGroups = lookupDefault[{opts}, DeclaredGroups, {}];
- implementation = lookupDefault[{opts}, Implementation, thornName];
- inheritedImplementations = lookupDefault[{opts},
- InheritedImplementations, {}];
- includeFiles = lookupDefault[{opts},
- includeFiles, {}];
- evolutionTimelevels = lookupDefault[{opts}, EvolutionTimelevels, 3];
+ calcs = OptionValue[Calculations];
+ declaredGroups = OptionValue[DeclaredGroups];
+ implementation =
+ If[OptionValue[Implementation] =!= None,
+ OptionValue[Implementation],
+ thornName];
+ inheritedImplementations = OptionValue[InheritedImplementations];
+ includeFiles = OptionValue[IncludeFiles];
+ evolutionTimelevels = OptionValue[EvolutionTimelevels]; (* Redundant *)
defaultEvolutionTimelevels = lookupDefault[{opts}, DefaultEvolutionTimelevels, evolutionTimelevels];
- realParams = lookupDefault[{opts}, RealParameters, {}];
- intParams = lookupDefault[{opts}, IntParameters, {}];
+ realParams = OptionValue[RealParameters];
+ intParams = OptionValue[IntParameters];
realParamDefs = makeFullParamDefs[realParams];
intParamDefs = makeFullParamDefs[intParams];
- keywordParams = lookupDefault[{opts}, KeywordParameters, {}];
- inheritedRealParams = lookupDefault[{opts}, InheritedRealParameters, {}];
- inheritedIntParams = lookupDefault[{opts}, InheritedIntParameters, {}];
- inheritedKeywordParams = lookupDefault[{opts}, InheritedKeywordParameters, {}];
- extendedRealParams = lookupDefault[{opts}, ExtendedRealParameters, {}];
- extendedIntParams = lookupDefault[{opts}, ExtendedIntParameters, {}];
- extendedKeywordParams = lookupDefault[{opts}, ExtendedKeywordParameters, {}];
- partialDerivs = lookupDefault[{opts}, PartialDerivatives, {}];
- reflectionSymmetries = lookupDefault[{opts}, ReflectionSymmetries, {}];
- useLoopControl = lookupDefault[{opts}, UseLoopControl, False];
- useCSE = lookupDefault[{opts}, UseCSE, False];
+ keywordParams = OptionValue[KeywordParameters];
+ inheritedRealParams = OptionValue[InheritedRealParameters];
+ inheritedIntParams = OptionValue[InheritedIntParameters];
+ inheritedKeywordParams = OptionValue[InheritedKeywordParameters];
+ extendedRealParams = OptionValue[ExtendedRealParameters];
+ extendedIntParams = OptionValue[ExtendedIntParameters];
+ extendedKeywordParams = OptionValue[ExtendedKeywordParameters];
+ partialDerivs = OptionValue[PartialDerivatives];
+ reflectionSymmetries = OptionValue[ReflectionSymmetries];
+ useLoopControl = OptionValue[UseLoopControl];
+ useCSE = OptionValue[UseCSE];
(* Print["partialDerivs == ", partialDerivs];*)
@@ -244,7 +246,7 @@ CreateKrancThorn[groupsOrig_, parentDirectory_, thornName_, opts:OptionsPattern[
(* Write the differencing header file *)
InfoMessage[Terse, "Creating differencing header file"];
- {pDefs, diffHeader} = CreateDifferencingHeader[partialDerivs, lookupDefault[{opts}, ZeroDimensions, {}]];
+ {pDefs, diffHeader} = CreateDifferencingHeader[partialDerivs, OptionValue[ZeroDimensions]];
(* Add the predefinitions into the calcs *)
calcs = Map[Join[#, {PreDefinitions -> pDefs}] &, calcs];