summaryrefslogtreecommitdiff
path: root/src/main/ScheduleInterface.c
diff options
context:
space:
mode:
authorgoodale <goodale@17b73243-c579-4c4c-a9d2-2d5706c11dac>2003-03-24 14:43:07 +0000
committergoodale <goodale@17b73243-c579-4c4c-a9d2-2d5706c11dac>2003-03-24 14:43:07 +0000
commit76d7ad0385f1c8441d897595067398593db91a0e (patch)
tree9235c343bd19db75f76d2a5b2cf0080ca1ef242d /src/main/ScheduleInterface.c
parent9bea9526e7cb8c3d1963caca2c577332b145bad8 (diff)
Allow routines scheduled within groups triggered in analysis to be run if the
enclosing group is triggered. The logic is now that if a group is triggered at analysis, all member routines or groups of that group will be automatically triggered unless they in turn have a trigger, in which case that overrides the trigger. E.g. schedule TestSchedule_CalcOne AT Analysis before TestSchedule_Analysis { storage: testschedule::one trigger: testschedule::one lang: C } "Calculate the value of one" schedule group TestSchedule_Analysis at ANALYSIS { trigger: testschedule::two testschedule::three } "TestSchedule top level analysis group" schedule TestSchedule_CalcTwo IN TestSchedule_Analysis { trigger: testschedule::two storage: testschedule::two lang: C } "Calculate the value of two" schedule GROUP TestSchedule_Analysis2 in TestSchedule_Analysis after TestSchedule_CalcTwo { trigger: testschedule::three } "TestSchedule second level analysis group" schedule TestSchedule_CalcThree IN TestSchedule_Analysis2 { trigger: testschedule::three storage: testschedule::three lang: C } "Calculate the value of three" will call the appropriate routines to calculate one, two or three if these are selected for output. As before, output is done on any trigger variable or variable group when a routine with the variable as a trigger exits. So in the above example "three" is output when CalcThree exits. If this is not desired, the trigger and storage for "three" could have been placed on the enclosing schedule group, and then the routine would have been called even if output was only requested for "two" and not for "three". This fixes PR 694, and helps with PR 844. Tom git-svn-id: http://svn.cactuscode.org/flesh/trunk@3188 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'src/main/ScheduleInterface.c')
-rw-r--r--src/main/ScheduleInterface.c29
1 files changed, 24 insertions, 5 deletions
diff --git a/src/main/ScheduleInterface.c b/src/main/ScheduleInterface.c
index 1f9ced64..a51388e6 100644
--- a/src/main/ScheduleInterface.c
+++ b/src/main/ScheduleInterface.c
@@ -84,6 +84,7 @@ typedef struct
cTimerData *total_time;
int print_headers;
int synchronised;
+ int trigger_level;
/* Stuff passed in in user calls */
@@ -1119,6 +1120,7 @@ static int ScheduleTraverse(const char *where,
data.CallFunction = CallFunction ? CallFunction : CCTK_CallFunction;
data.schedpoint = CCTK_Equals(where, "CCTK_ANALYSIS") ?
schedpoint_analysis : schedpoint_misc;
+ data.trigger_level = 0;
calling_function = CCTKi_ScheduleCallFunction;
CCTKi_DoScheduleTraverse(where,
@@ -2073,13 +2075,29 @@ static int CCTKi_ScheduleCallEntry(t_attribute *attribute,
if(data->schedpoint == schedpoint_analysis)
{
/* In analysis, so check triggers */
- for (i = 0; i < attribute->FunctionData.n_TriggerGroups ; i++)
+ if(data->trigger_level && attribute->FunctionData.n_TriggerGroups == 0)
+ {
+ /* Has already been triggered by a higher level group
+ * and there are no triggers on this group.
+ */
+ data->trigger_level++;
+ go = 1;
+ }
+ else
{
- indx = CCTK_FirstVarIndexI(attribute->FunctionData.TriggerGroups[i]);
- last = indx + CCTK_NumVarsInGroupI(attribute->FunctionData.TriggerGroups[i]) -1;
- for(; indx <= last ; indx++)
+ /* Check if it is now being triggered */
+ for (i = 0; i < attribute->FunctionData.n_TriggerGroups ; i++)
+ {
+ indx = CCTK_FirstVarIndexI(attribute->FunctionData.TriggerGroups[i]);
+ last = indx + CCTK_NumVarsInGroupI(attribute->FunctionData.TriggerGroups[i]) -1;
+ for(; indx <= last ; indx++)
+ {
+ go = go || CCTKi_TriggerSaysGo(data->GH, indx);
+ }
+ }
+ if(go)
{
- go = go || CCTKi_TriggerSaysGo(data->GH, indx);
+ data->trigger_level = 1;
}
}
}
@@ -2183,6 +2201,7 @@ static int CCTKi_ScheduleCallExit(t_attribute *attribute,
CCTKi_TriggerAction(data->GH, vindex);
}
}
+ data->trigger_level--;
}
/* Switch off communication if it was done in entry. */