diff options
author | allen <allen@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2001-04-15 07:49:44 +0000 |
---|---|---|
committer | allen <allen@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2001-04-15 07:49:44 +0000 |
commit | c811f681031e96271c6784ff68d56b0cc5429e81 (patch) | |
tree | aaaa22a1afa45c3be81dcf3b73cd362eea70a840 | |
parent | ff8d3df9f5ff40e43511143bda3c8fc8cac822ea (diff) |
Cactus/586
Added ValidateModifiers routine to check that while option in the
schedule file uses a CCTK_INT grid variable
git-svn-id: http://svn.cactuscode.org/flesh/trunk@2114 17b73243-c579-4c4c-a9d2-2d5706c11dac
-rw-r--r-- | src/main/ScheduleInterface.c | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/src/main/ScheduleInterface.c b/src/main/ScheduleInterface.c index 3112d20f..f5b526f7 100644 --- a/src/main/ScheduleInterface.c +++ b/src/main/ScheduleInterface.c @@ -24,6 +24,7 @@ #include "cctk_Comm.h" #include "cctk_Sync.h" +#include "cctk_Constants.h" #include "cctk_Groups.h" #include "cctk_GroupsOnGH.h" @@ -124,6 +125,9 @@ static t_sched_modifier *CreateModifiers(int n_before, int n_after, int n_while, va_list *ap); + +int ValidateModifiers(t_sched_modifier *modifier); + static int CreateGroupIndexList(int n_items, int *array, va_list *ap); static t_sched_modifier *CreateTypedModifier(t_sched_modifier *modifier, const char *type, @@ -441,6 +445,8 @@ int CCTKi_ScheduleFunction(void *function, va_end(ap); + ValidateModifiers(modifier); + if(attribute && (modifier || (n_before == 0 && n_after == 0 && n_while == 0))) { attribute->FunctionData.type = TranslateFunctionType(where); @@ -608,6 +614,8 @@ int CCTKi_ScheduleGroup(const char *name, va_end(ap); + ValidateModifiers(modifier); + if(attribute && (modifier || (n_before == 0 && n_after == 0 && n_while == 0))) { retcode = CCTKi_DoScheduleGroup(where, name, modifier, (void *)attribute); @@ -1403,6 +1411,56 @@ static t_sched_modifier *CreateModifiers(int n_before, } /*@@ + @routine ValidateModifier + @date Sat Apr 14 18:28:13 2001 + @author Gabrielle Allen + @desc + Validates a schedule modifier list. At the moment just check that + the while modifier uses a CCTK_INT grid variable. + @enddesc + @calls + @calledby + @history + + @endhistory + @var modifier + @vdesc + @vtype t_sched_modifier * + @vio in + @vcomment + + @endvar + + @returntype int + @returndesc + Negative if modifier not valid, zero if modifier is valid. + @endreturndesc +@@*/ +int ValidateModifiers(t_sched_modifier *modifier) +{ + int retval = 0; + int index; + int type; + + for (;modifier;modifier=modifier->next) + { + if (modifier->type == sched_while) + { + index = CCTK_VarIndex(modifier->argument); + type = CCTK_VarTypeI(index); + if (type != CCTK_VARIABLE_INT) + { + CCTK_VWarn(0,__LINE__,__FILE__,"Cactus", + "While qualifier %s is not a CCTK_INT grid variable", + modifier->argument); + retval = -1; + } + } + } + return retval; +} + +/*@@ @routine CreateGroupIndexList @date Fri Sep 17 21:51:51 1999 @author Tom Goodale |