diff options
-rw-r--r-- | Tools/CodeGen/KrancThorn.m | 37 |
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"]]; |