diff options
Diffstat (limited to 'Tools/CodeGen/Schedule.m')
-rw-r--r-- | Tools/CodeGen/Schedule.m | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/Tools/CodeGen/Schedule.m b/Tools/CodeGen/Schedule.m index e6e9621..87604b1 100644 --- a/Tools/CodeGen/Schedule.m +++ b/Tools/CodeGen/Schedule.m @@ -28,10 +28,11 @@ Begin["`Private`"]; Scheduling -------------------------------------------------------------------------- *) -simpleGroupStruct[groupName_, timelevels_] := +simpleGroupStruct[groupName_, timelevels_, maxtimelevels_] := { Group -> groupName, - Timelevels -> timelevels + Timelevels -> timelevels, + MaxTimelevels -> "other_timelevels" }; evolvedGroupStruct[groupName_, timelevels_, maxtimelevels_] := @@ -66,7 +67,7 @@ scheduleCalc[calc_, groups_] := Module[{points, conditional, conditionals, keywordConditional, keywordConditionals, triggered, keyword, value, keywordvaluepairs, groupsToSync, groupName, userSchedule, groupSched, fnSched, - selbcSched, appbcSched, bcGroupName, condParams, bcGroupSched}, + selbcSched, appbcSched, bcGroupName, condParams, bcGroupSched, before, after, relStr}, conditional = mapContains[calc, ConditionalOnKeyword]; conditionals = mapContains[calc, ConditionalOnKeywords]; triggered = mapContains[calc, TriggerGroups]; @@ -93,6 +94,12 @@ scheduleCalc[calc_, groups_] := groupsSetInCalc[calc, groups], {}]; + before = lookupDefault[calc, Before, None]; + after = lookupDefault[calc, After, None]; + + relStr = If[before =!= None, " before " <> before, ""] + <> If[after =!= None, " after " <> after, ""]; + applyBCs = lookupDefault[calc, ApplyBCs, False]; userSchedule = lookupDefault[calc, Schedule, Automatic]; @@ -101,11 +108,11 @@ scheduleCalc[calc_, groups_] := Join[ { Name -> lookup[calc, Name], - SchedulePoint -> #, + SchedulePoint -> # <> relStr, SynchronizedGroups -> If[StringMatchQ[#, "*MoL_CalcRHS*", IgnoreCase -> True] || StringMatchQ[#, "*MoL_RHSBoundaries*", IgnoreCase -> True], {}, groupsToSync], - Language -> CodeGen`SOURCELANGUAGE, + Language -> CodeGenC`SOURCELANGUAGE, Comment -> lookup[calc, Name] }, If[triggered, {TriggerGroups -> lookup[calc, TriggerGroups]}, @@ -133,7 +140,7 @@ scheduleCalc[calc_, groups_] := groupSched = { Name -> "group " <> groupName, - SchedulePoint -> If[applyBCs, First[userSchedule], "in MoL_PseudoEvolution"], + SchedulePoint -> If[applyBCs, First[userSchedule] <> relStr, "in MoL_PseudoEvolution" <> relStr], SynchronizedGroups -> {}, Language -> "None", Comment -> lookup[calc, Name] @@ -143,7 +150,7 @@ scheduleCalc[calc_, groups_] := fnSched = { Name -> lookup[calc, Name], SchedulePoint -> "in " <> groupName, - Language -> CodeGen`SOURCELANGUAGE, + Language -> CodeGenC`SOURCELANGUAGE, Comment -> lookup[calc, Name] }; @@ -161,7 +168,7 @@ scheduleCalc[calc_, groups_] := SchedulePoint -> "in " <> bcGroupName, SynchronizedGroups -> groupsToSync, Options -> "level", - Language -> CodeGen`SOURCELANGUAGE, + Language -> CodeGenC`SOURCELANGUAGE, Comment -> lookup[calc, Name] <> "_SelectBCs" }; @@ -175,8 +182,7 @@ scheduleCalc[calc_, groups_] := Return[{groupSched, fnSched} ~Join~ If[groupsToSync =!= {}, {selbcSched, appbcSched, bcGroupSched["in "<>groupName <> " after " <> lookup[calc, Name]], - bcGroupSched["at CCTK_POSTRESTRICT"], - bcGroupSched["at CCTK_POSTRESTRICTINITIAL"]},{}]]]]; + bcGroupSched["in MoL_PseudoEvolutionBoundaries after MoL_PostStep"]},{}]]]]; CreateKrancScheduleFile[calcs_, groups_, evolvedGroups_, rhsGroups_, nonevolvedGroups_, thornName_, evolutionTimelevels_] := @@ -212,8 +218,11 @@ CreateKrancScheduleFile[calcs_, groups_, evolvedGroups_, rhsGroups_, nonevolvedG globalStorageGroups = Join[ - Map[simpleGroupStruct[#, - NonevolvedTimelevels[groupFromName[#, groups]]] &, + Map[Module[{tl}, + tl = NonevolvedTimelevels[groupFromName[#, groups]]; + If[tl===1, + simpleGroupStruct[#, tl, evolutionTimelevels], + evolvedGroupStruct[#, evolutionTimelevels, evolutionTimelevels]]] &, nonevolvedGroups], Map[evolvedGroupStruct[#, evolutionTimelevels, evolutionTimelevels] &, evolvedGroups], |