diff options
author | Ian Hinder <ian.hinder@aei.mpg.de> | 2013-09-12 18:57:09 +0200 |
---|---|---|
committer | Ian Hinder <ian.hinder@aei.mpg.de> | 2013-09-12 18:57:09 +0200 |
commit | 0b09169bacd7995d28b56a574bd060ebb243ca6f (patch) | |
tree | 6b4b50abc082c080478043d32176900f5e7f6dcd /Tools | |
parent | a07e177cbd2603aa9d7d0a072c36c4ed84e24bff (diff) |
Schedule.m: Implement new method for determining number of timelevels in schedule.ccl
Check against the old method and abort if there is a discrepancy (apart from ordering). Use the result from the new method in the generated thorn. Generally, this changes the ordering of storage statements in schedule.ccl.
Diffstat (limited to 'Tools')
-rw-r--r-- | Tools/CodeGen/Schedule.m | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/Tools/CodeGen/Schedule.m b/Tools/CodeGen/Schedule.m index 40ff318..9582908 100644 --- a/Tools/CodeGen/Schedule.m +++ b/Tools/CodeGen/Schedule.m @@ -236,7 +236,7 @@ scheduleCalc[calc_, groups_, thornName_, OptionsPattern[]] := Options[CreateKrancScheduleFile] = ThornOptions; CreateKrancScheduleFile[calcs_, groups_, declaredGroups_, evolvedGroups_, rhsGroups_, nonevolvedGroups_, thornName_, evolutionTimelevels_, opts:OptionsPattern[]] := - Module[{scheduledCalcs, scheduledStartup, scheduleMoLRegister, globalStorageGroups, scheduledFunctions, schedule, allParams, calcGroups}, + Module[{scheduledCalcs, scheduledStartup, scheduleMoLRegister, globalStorageGroups, scheduledFunctions, schedule, allParams, calcGroups, scheduleTimelevels}, scheduledCalcs = Flatten[Map[scheduleCalc[#, groups, thornName, opts] &, calcs], 1]; scheduledStartup = @@ -285,6 +285,27 @@ CreateKrancScheduleFile[calcs_, groups_, declaredGroups_, evolvedGroups_, rhsGro Map[storageStructure[#, "rhs_timelevels"] &, rhsGroups]]; + scheduleTimelevels[gn_] := + Module[ + {groupDef, extras}, + groupDef = groupFromName[gn, groups]; + extras = GroupExtras[groupDef]; + lookup[extras, ScheduleTimelevels, + (* Nonevolved groups do not have a ScheduleTimelevels + extra; we use this old code for now *) + (* Number of timelevels requested for this group, or 1 if no request made *) + If[NonevolvedTimelevels[groupDef]===1, + "other_timelevels", + "timelevels"]]]; + + globalStorageGroups2 = Map[storageStructure[#, scheduleTimelevels[#]] &, declaredGroups]; + + If[Union@globalStorageGroups2 =!= Union@globalStorageGroups, + Print["Global storage groups differ:"]; + Print["globalStorageGroups = ", Union@globalStorageGroups]; + Print["globalStorageGroups2 = ", Union@globalStorageGroups2]; + Quit[1]]; + (* Schedule groups defined in calculations *) calcGroups = Union[Flatten[Map[lookup[#, ScheduleGroups, {}] &, calcs],1]]; @@ -299,7 +320,7 @@ CreateKrancScheduleFile[calcs_, groups_, declaredGroups_, evolvedGroups_, rhsGro scheduledFunctions = Join[scheduledFunctions, CaKernelSchedule[thornName]]]; allParams = Union@@((lookup[#,Parameters] &) /@ calcs); - schedule = CreateSchedule[globalStorageGroups, + schedule = CreateSchedule[globalStorageGroups2, Join[CactusBoundary`GetScheduledGroups[thornName], calcGroups], scheduledFunctions, allParams]; Return[schedule]]; |