summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorgoodale <goodale@17b73243-c579-4c4c-a9d2-2d5706c11dac>2000-01-28 02:47:03 +0000
committergoodale <goodale@17b73243-c579-4c4c-a9d2-2d5706c11dac>2000-01-28 02:47:03 +0000
commita6a1158bcd853931538dafd7bca42784f87c0527 (patch)
tree26d7aa7076a3d5c592f17d41d81dd3f1e9c32633 /src
parent29854817adc4f1d319917352fc327b5a706d9cf2 (diff)
Now, subject to review, you can put
OPTIONS:... in a schedule block to pass miscellaneous options to the schedular. Currently the only option is "Global" which sets a flag on the FunctionData structure passed to the call function. This option only makes sense for a scheduled function, not a schedule group, though this may change in the future. It is used to indicate to the calling function that this function should only be called once as it performs global operations. Tom git-svn-id: http://svn.cactuscode.org/flesh/trunk@1325 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'src')
-rw-r--r--src/include/cctk_Schedule.h4
-rw-r--r--src/include/cctki_ScheduleBindings.h5
-rw-r--r--src/main/ScheduleInterface.c108
3 files changed, 112 insertions, 5 deletions
diff --git a/src/include/cctk_Schedule.h b/src/include/cctk_Schedule.h
index 107e297f..d5fdc60c 100644
--- a/src/include/cctk_Schedule.h
+++ b/src/include/cctk_Schedule.h
@@ -27,6 +27,10 @@ typedef struct
int *SyncGroups;
+ /* Option Flags */
+
+ int global;
+
} cFunctionData;
#ifdef __cplusplus
diff --git a/src/include/cctki_ScheduleBindings.h b/src/include/cctki_ScheduleBindings.h
index 6316f346..faeabd0d 100644
--- a/src/include/cctki_ScheduleBindings.h
+++ b/src/include/cctki_ScheduleBindings.h
@@ -29,11 +29,11 @@ int CCTKi_ScheduleFunction(void *function,
int n_comm_groups,
int n_trigger_groups,
int n_sync_groups,
+ int n_options,
int n_before,
int n_after,
int n_while,
- ...
- );
+ ...);
int CCTKi_ScheduleGroup(const char *name,
const char *thorn,
@@ -44,6 +44,7 @@ int CCTKi_ScheduleGroup(const char *name,
int n_comm_groups,
int n_trigger_groups,
int n_sync_groups,
+ int n_options,
int n_before,
int n_after,
int n_while,
diff --git a/src/main/ScheduleInterface.c b/src/main/ScheduleInterface.c
index c29d22aa..6d655007 100644
--- a/src/main/ScheduleInterface.c
+++ b/src/main/ScheduleInterface.c
@@ -100,8 +100,19 @@ static t_attribute *CreateAttribute(const char *description,
int n_mem_groups,
int n_comm_groups,
int n_trigger_groups,
- int n_sync_groups,
+ int n_sync_groups,
+ int n_options,
va_list *ap);
+
+static int ParseOptionList(int n_items,
+ t_attribute *attribute,
+ va_list *ap);
+
+static int InitialiseOptionList(t_attribute *attribute);
+
+static int ParseOption(t_attribute *attribute,
+ const char *option);
+
static t_sched_modifier *CreateModifiers(int n_before,
int n_after,
int n_while,
@@ -240,6 +251,7 @@ int CCTKi_ScheduleFunction(void *function,
int n_comm_groups,
int n_trigger_groups,
int n_sync_groups,
+ int n_options,
int n_before,
int n_after,
int n_while,
@@ -255,7 +267,7 @@ int CCTKi_ScheduleFunction(void *function,
attribute = CreateAttribute(description, language, thorn, implementation,
n_mem_groups, n_comm_groups, n_trigger_groups,
- n_sync_groups, &ap);
+ n_sync_groups, n_options, &ap);
modifier = CreateModifiers(n_before, n_after, n_while, &ap);
va_end(ap);
@@ -303,6 +315,7 @@ int CCTKi_ScheduleGroup(const char *name,
int n_comm_groups,
int n_trigger_groups,
int n_sync_groups,
+ int n_options,
int n_before,
int n_after,
int n_while,
@@ -318,7 +331,7 @@ int CCTKi_ScheduleGroup(const char *name,
attribute = CreateAttribute(description, NULL, thorn, implementation,
n_mem_groups, n_comm_groups, n_trigger_groups,
- n_sync_groups, &ap);
+ n_sync_groups, n_options, &ap);
modifier = CreateModifiers(n_before, n_after, n_while, &ap);
va_end(ap);
@@ -665,6 +678,7 @@ static t_attribute *CreateAttribute(const char *description,
int n_comm_groups,
int n_trigger_groups,
int n_sync_groups,
+ int n_options,
va_list *ap)
{
t_attribute *this;
@@ -711,6 +725,11 @@ static t_attribute *CreateAttribute(const char *description,
CreateGroupIndexList(n_comm_groups, this->comm_groups, ap);
CreateGroupIndexList(n_trigger_groups, this->trigger_groups, ap);
CreateGroupIndexList(n_sync_groups, this->FunctionData.SyncGroups, ap);
+
+ /* Check the miscellaneous options */
+
+ InitialiseOptionList(this);
+ ParseOptionList(n_options, this, ap);
this->n_mem_groups = n_mem_groups;
this->n_comm_groups = n_comm_groups;
@@ -793,6 +812,89 @@ static int CreateGroupIndexList(int n_items, int *array, va_list *ap)
return 0;
}
+
+ /*@@
+ @routine ParseOptionList
+ @date Thu Jan 27 20:26:42 2000
+ @author Tom Goodale
+ @desc
+ Extracts the list of miscellaneous options in a schedule
+ group definition.
+ @enddesc
+ @calls
+ @calledby
+ @history
+
+ @endhistory
+
+@@*/
+static int ParseOptionList(int n_items,
+ t_attribute *attribute,
+ va_list *ap)
+{
+ int i;
+ const char *item;
+
+ for(i=0; i < n_items; i++)
+ {
+ item = va_arg(*ap, const char *);
+
+ ParseOption(attribute, item);
+ }
+
+ return 0;
+}
+
+ /*@@
+ @routine InitialiseOptionList
+ @date Thu Jan 27 20:36:54 2000
+ @author Tom Goodale
+ @desc
+ Initialises the miscellaneous option list for a schedule group.
+ @enddesc
+ @calls
+ @calledby
+ @history
+
+ @endhistory
+
+@@*/
+int InitialiseOptionList(t_attribute *attribute)
+{
+ attribute->FunctionData.global = 0;
+
+ return 0;
+}
+
+ /*@@
+ @routine ParseOption
+ @date Thu Jan 27 20:29:36 2000
+ @author Tom Goodale
+ @desc
+ Parses an individual option to a schedule group.
+ @enddesc
+ @calls
+ @calledby
+ @history
+
+ @endhistory
+
+@@*/
+static int ParseOption(t_attribute *attribute,
+ const char *option)
+{
+ if(CCTK_Equals(option, "GLOBAL"))
+ {
+ attribute->FunctionData.global = 1;
+ }
+ else
+ {
+ CCTK_WARN(1, "Unknown option for schedule group.\n");
+ }
+
+ return 0;
+}
+
/*@@
@routine CreateTypedModifier
@date Fri Sep 17 21:50:59 1999