diff options
author | Ian Hinder <ian.hinder@aei.mpg.de> | 2013-09-13 18:57:41 +0200 |
---|---|---|
committer | Ian Hinder <ian.hinder@aei.mpg.de> | 2013-09-13 18:57:41 +0200 |
commit | 508c5fdca83aff15eee3e4f811a478f52e8defd2 (patch) | |
tree | 8e04d3cfba488359975efe09408e336f44c4cdb3 /Tools | |
parent | b558b23da60f5a0ea65fe78b468a67f070b8c386 (diff) |
KrancThorn.m: Move option distribution code to its own function
Diffstat (limited to 'Tools')
-rw-r--r-- | Tools/CodeGen/KrancThorn.m | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/Tools/CodeGen/KrancThorn.m b/Tools/CodeGen/KrancThorn.m index 16f783f..4fde955 100644 --- a/Tools/CodeGen/KrancThorn.m +++ b/Tools/CodeGen/KrancThorn.m @@ -82,6 +82,21 @@ DefFn[ splitCalculationsProcessCode[cIn_Code, opts___] := ApplyToObjectField[cIn, "Calculations", SplitCalculations]]; +DefFn[ + distributeOptionsProcessCode[cIn_Code, opts___] := + Module[ + {c = cIn}, + c = SetObjectField[ + c, "Calculations", + Map[Join[#, {Groups -> GetObjectField[c, "Groups"]}] &, + GetObjectField[c, "Calculations"]]]; + + c = SetObjectField[ + c, "Calculations", + Map[Append[#, Parameters -> AllNumericParameters[GetObjectField[c, "Parameters"]]] &, + GetObjectField[c, "Calculations"]]]; + c]]; + (* -------------------------------------------------------------------------- Thorn generation (main entry point for non-tensorial thorns) -------------------------------------------------------------------------- *) @@ -225,17 +240,10 @@ CreateKrancThorn[groupsOrig_, parentDirectory_, thornName_, opts:OptionsPattern[ c = MoLProcessCode[c, opts]; (* ------------------------------------------------------------------------ - Add options to calculations + Add selected code options to calculations ------------------------------------------------------------------------ *) - c = SetObjectField[c, "Calculations", - Map[Join[#, {Groups -> GetObjectField[c, "Groups"]}] &, - GetObjectField[c, "Calculations"]]]; - - c = SetObjectField[ - c, "Calculations", - Map[Append[#, Parameters -> AllNumericParameters[GetObjectField[c, "Parameters"]]] &, - GetObjectField[c, "Calculations"]]]; + c = distributeOptionsProcessCode[c, opts]; (* ------------------------------------------------------------------------ Split calculations according to SplitVars option |