aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Hinder <ian.hinder@aei.mpg.de>2013-09-12 15:59:28 +0200
committerIan Hinder <ian.hinder@aei.mpg.de>2013-09-12 15:59:28 +0200
commit5fe746013b88df716c1df5cc9d64892a2c09e664 (patch)
tree9863181b34033ed3b08a169243d2bdeca081aba9
parent5828f006046a5cccd12882352e0138da022a2613 (diff)
KrancThorn.m: Rearrange code and comments slightly
-rw-r--r--Tools/CodeGen/KrancThorn.m37
1 files changed, 22 insertions, 15 deletions
diff --git a/Tools/CodeGen/KrancThorn.m b/Tools/CodeGen/KrancThorn.m
index 68fc336..34b6e90 100644
--- a/Tools/CodeGen/KrancThorn.m
+++ b/Tools/CodeGen/KrancThorn.m
@@ -77,36 +77,45 @@ CreateKrancThorn[groupsOrig_, parentDirectory_, thornName_, opts:OptionsPattern[
InfoMessage[Terse, "Processing arguments to CreateKrancThorn"];
(* ------------------------------------------------------------------------
- Read named arguments
+ Read named arguments and apply nontrivial defaults
------------------------------------------------------------------------ *)
cktCheckNamedArgs[{opts}];
calcs = OptionValue[Calculations];
-
- calcs = Map[mapReplaceAdd[#, Shorthands, Join[lookup[#,Shorthands,{}],OptionValue[Shorthands]]] &, calcs];
-
declaredGroups = OptionValue[DeclaredGroups];
odeGroups = OptionValue[ODEGroups];
- implementation =
- If[OptionValue[Implementation] =!= None,
- OptionValue[Implementation],
- thornName];
-
- calcs = Map[Append[#, Implementation -> implementation] &, calcs];
-
+ implementation = If[OptionValue[Implementation] =!= None,
+ OptionValue[Implementation],
+ thornName];
inheritedImplementations = OptionValue[InheritedImplementations];
includeFiles = OptionValue[IncludeFiles];
evolutionTimelevels = OptionValue[EvolutionTimelevels]; (* Redundant *)
defaultEvolutionTimelevels = lookupDefault[{opts}, DefaultEvolutionTimelevels, evolutionTimelevels];
+ partialDerivs = OptionValue[PartialDerivatives];
- parameters = ParameterDatabase[opts];
+ (* ------------------------------------------------------------------------
+ Add conservation differencing operators to partialDerivs
+ ------------------------------------------------------------------------ *)
- partialDerivs = OptionValue[PartialDerivatives];
If[OptionValue[ConservationCalculations] =!= {},
partialDerivs = Join[partialDerivs, ConservationDifferencingOperators[]]];
(* ------------------------------------------------------------------------
+ Construct parameter database from named arguments
+ ------------------------------------------------------------------------ *)
+
+ parameters = ParameterDatabase[opts];
+
+ (* ------------------------------------------------------------------------
+ Add thorn-global options to calculations
+ ------------------------------------------------------------------------ *)
+
+ calcs = Map[mapReplaceAdd[#, Shorthands, Join[lookup[#,Shorthands,{}],OptionValue[Shorthands]]] &, calcs];
+ calcs = Map[Append[#, Implementation -> implementation] &, calcs];
+ calcs = Map[Append[#, PartialDerivatives -> partialDerivs] &, calcs];
+
+ (* ------------------------------------------------------------------------
CaKernel
------------------------------------------------------------------------ *)
@@ -118,8 +127,6 @@ CreateKrancThorn[groupsOrig_, parentDirectory_, thornName_, opts:OptionsPattern[
If[!And@@Map[ListQ, calcs], Print[Short[calcs//InputForm]]; ThrowError["Result of WithHostCalculations is not a list of lists"]];
- calcs = Map[Append[#, PartialDerivatives -> partialDerivs] &, calcs];
-
If[OptionValue[UseCaKernel],
includeFiles = Append[includeFiles, "CaCUDALib_driver_support.h"]];