Permalink
Browse files

Add the ability for calculations to define additional Cactus schedule…

… groups
  • Loading branch information...
1 parent c6c6b5b commit 68d93477c5dd0fb61b127e1c758630daf9c5227a @ianhinder committed Apr 23, 2012
Showing with 21 additions and 4 deletions.
  1. +13 −0 Tools/CodeGen/Calculation.m
  2. +2 −1 Tools/CodeGen/CalculationFunction.m
  3. +1 −1 Tools/CodeGen/Kranc.m
  4. +5 −2 Tools/CodeGen/Schedule.m
@@ -34,6 +34,7 @@
SeparateDerivatives;
AddCondition;
AddConditionSuffix;
+InNewScheduleGroup;
Begin["`Private`"];
@@ -233,6 +234,18 @@
AddConditionSuffix[calc_List, condition_] :=
mapReplaceAdd[calc, Schedule, Map[#<>" IF "<>condition &, lookup[calc,Schedule]]]];
+InNewScheduleGroup[groupName_String, calc_List] :=
+ Module[
+ {newGroup},
+ newGroup = {Name -> groupName,
+ Language -> "None", (* groups do not have a language *)
+ SchedulePoint -> lookup[calc,Schedule,Automatic],
+ Comment -> ""};
+ mapReplaceAdd[
+ mapReplaceAdd[
+ calc,
+ Schedule, {"in "<>groupName}],
+ ScheduleGroups, Append[lookup[calc, ScheduleGroups, {}],newGroup]]];
End[];
@@ -145,7 +145,8 @@ indentation after each line break (this will push the line length
Shorthands, ConditionalOnKeyword, Before, After,
ConditionalOnTextuals, Where, ConditionalOnKeywords,
CollectList, AllowedSymbols, ApplyBCs, Conditional, CachedVariables, SplitBy,
- SeparatedDerivatives, LocalGroups, NoSimplify, UseDGFE, SimpleCode, UseCaKernel};
+ SeparatedDerivatives, LocalGroups, NoSimplify, UseDGFE, SimpleCode, UseCaKernel,
+ ScheduleGroups};
usedKeys = Map[First, calc];
unknownKeys = Complement[usedKeys, allowedKeys];
@@ -114,7 +114,7 @@
Groups, Calculation, GridFunctions, Shorthands, Equations, Parameter,
Value, UsesFunctions, ArgString, Conditional, Conditionals, NewConditional, D1, D2, D3, D11, D22,
D33, D21, D31, D32, Textual, TriggerGroups, Include, RHSGroups, Tags,
-Steerable, Never, Always, Recover, Primitives, CaKernel};
+Steerable, Never, Always, Recover, Primitives, CaKernel, ScheduleGroups};
{ExcisionGFs};
@@ -223,7 +223,7 @@
Options[CreateKrancScheduleFile] = ThornOptions;
CreateKrancScheduleFile[calcs_, groups_, evolvedGroups_, rhsGroups_, nonevolvedGroups_, thornName_,
evolutionTimelevels_, opts:OptionsPattern[]] :=
- Module[{scheduledCalcs, scheduledStartup, scheduleMoLRegister, globalStorageGroups, scheduledFunctions, schedule, allParams},
+ Module[{scheduledCalcs, scheduledStartup, scheduleMoLRegister, globalStorageGroups, scheduledFunctions, schedule, allParams, calcGroups},
scheduledCalcs = Flatten[Map[scheduleCalc[#, groups, thornName, opts] &, calcs], 1];
scheduledStartup =
@@ -266,6 +266,9 @@
Map[rhsGroupStruct[#, evolutionTimelevels, evolutionTimelevels] &,
rhsGroups]];
+ (* Schedule groups defined in calculations *)
+ calcGroups = Union[Flatten[Map[lookup[#, ScheduleGroups, {}] &, calcs],1]];
+
scheduledFunctions =
Join[{scheduledStartup, scheduleRegisterSymmetries},
scheduledCalcs, CactusBoundary`GetScheduledFunctions[thornName, evolvedGroups],
@@ -276,7 +279,7 @@
allParams = Union@@((lookup[#,Parameters] &) /@ calcs);
schedule = CreateSchedule[globalStorageGroups,
- CactusBoundary`GetScheduledGroups[thornName], scheduledFunctions, allParams];
+ Join[CactusBoundary`GetScheduledGroups[thornName], calcGroups], scheduledFunctions, allParams];
Return[schedule]];

0 comments on commit 68d9347

Please sign in to comment.