From 20e7a8feb560e494efe6b00db07af8b350fc9783 Mon Sep 17 00:00:00 2001 From: Ian Hinder Date: Fri, 13 Sep 2013 19:05:30 +0200 Subject: KrancThorn.m: Move DeclaredGroups code processing to its own function --- Tools/CodeGen/KrancThorn.m | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/Tools/CodeGen/KrancThorn.m b/Tools/CodeGen/KrancThorn.m index 97cfc1f..3dd8482 100644 --- a/Tools/CodeGen/KrancThorn.m +++ b/Tools/CodeGen/KrancThorn.m @@ -107,6 +107,17 @@ DefFn[ GetObjectField[c, "Calculations"]]]; c]]; +DefFn[ + declaredGroupsProcessCode[cIn_Code, opts___] := + Module[ + {c = cIn}, + c = SetObjectField[ + c, "DeclaredGroups", + DeleteDuplicates[Join[GetObjectField[c, "DeclaredGroups"], + Flatten[Map[Map[groupName,lookup[#,LocalGroups,{}]] &, + GetObjectField[c, "Calculations"]],1]]]]; + c]]; + (* -------------------------------------------------------------------------- Thorn generation (main entry point for non-tensorial thorns) -------------------------------------------------------------------------- *) @@ -236,11 +247,11 @@ CreateKrancThorn[groupsOrig_, parentDirectory_, thornName_, opts:OptionsPattern[ c = ODEProcessCode[c, opts]; - c = SetObjectField[ - c, "DeclaredGroups", - DeleteDuplicates[Join[GetObjectField[c, "DeclaredGroups"], - Flatten[Map[Map[groupName,lookup[#,LocalGroups,{}]] &, - GetObjectField[c, "Calculations"]],1]]]]; + (* ------------------------------------------------------------------------ + Declared groups + ------------------------------------------------------------------------ *) + + c = declaredGroupsProcessCode[c, opts]; (* ------------------------------------------------------------------------ MoL -- cgit v1.2.3