Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add the ability for calculations to define additional Cactus schedule…

… groups
  • Loading branch information...
commit 68d93477c5dd0fb61b127e1c758630daf9c5227a 1 parent c6c6b5b
@ianhinder authored
View
13 Tools/CodeGen/Calculation.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[];
View
3  Tools/CodeGen/CalculationFunction.m
@@ -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];
View
2  Tools/CodeGen/Kranc.m
@@ -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};
View
7 Tools/CodeGen/Schedule.m
@@ -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]];
Please sign in to comment.
Something went wrong with that request. Please try again.